specify gateway (=destination) in routes to direct neighbours, to fix problems with...
authorMarkus Kittenberger <Markus.Kittenberger@gmx.at>
Sat, 21 May 2011 11:50:38 +0000 (13:50 +0200)
committerMarkus Kittenberger <Markus.Kittenberger@gmx.at>
Sat, 21 May 2011 11:50:38 +0000 (13:50 +0200)
src/linux/kernel_routes_nl.c

index f6d36eb..2807e6d 100644 (file)
@@ -423,6 +423,10 @@ static int olsr_new_netlink_route(int family, int rttable, int if_index, int met
     /* add gateway */
     olsr_netlink_addreq(&req.n, sizeof(req), RTA_GATEWAY, gw, family_size);
   }
+  else {
+    /* use destination as gateway, to 'force' linux kernel to do proper source address selection */
+    olsr_netlink_addreq(&req.n, sizeof(req), RTA_GATEWAY, &dst->prefix, family_size);
+  }
 
   /* add destination */
   olsr_netlink_addreq(&req.n, sizeof(req), RTA_DST, &dst->prefix, family_size);