On 20/01/16 21:32, Simon Wunderlich wrote:
static void batadv_v_ogm_forward(struct batadv_priv *bat_priv, const struct batadv_ogm2_packet *ogm_received,
u32 throughput,
struct batadv_neigh_node *neigh_node, struct batadv_hard_iface *if_incoming, struct batadv_hard_iface *if_outgoing)
{
struct batadv_neigh_ifinfo *neigh_ifinfo = NULL;
struct batadv_orig_ifinfo *orig_ifinfo = NULL;
struct batadv_neigh_node *router = NULL; struct batadv_ogm2_packet *ogm_forward; unsigned char *skb_buff; struct sk_buff *skb; size_t packet_len; u16 tvlv_len;
/* only forward for specific interfaces, not for the default one. */
if (if_outgoing != BATADV_IF_DEFAULT)
goto out;
personally I'd prefer the forward function to do what it says: forward the OGM. The checks whether or not we should do this should stay in ogm_process_per_outif().
- orig_ifinfo = batadv_orig_ifinfo_new(orig_node, if_outgoing);
- if (!orig_ifinfo)
goto out;
- /* acquire possibly updated router */
- router = batadv_orig_router_get(orig_node, if_outgoing);
- /* strict rule: forward packets coming from the best next hop only */
- if (neigh_node != router)
goto out;
this is changing the behaviour. here now we get a router which potentially was elected during the previous update_route() call while processing this very OGM. We are still discussing if we want to do this or not, but this patch should be just a style change, while this is not.
This check should be performed against the router which was selected before performing any route update.
Cheers,