61 |
61 |
62 #define for_nexthops(fi) { int nhsel; const struct fib_nh * nh; \ |
62 #define for_nexthops(fi) { int nhsel; const struct fib_nh * nh; \ |
63 for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) |
63 for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++) |
64 |
64 |
65 #define change_nexthops(fi) { int nhsel; struct fib_nh * nh; \ |
65 #define change_nexthops(fi) { int nhsel; struct fib_nh * nh; \ |
66 for (nhsel=0, nh = (struct fib_nh*)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++) |
66 for (nhsel=0, nh = (struct fib_nh *)((fi)->fib_nh); nhsel < (fi)->fib_nhs; nh++, nhsel++) |
67 |
67 |
68 #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
68 #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
69 |
69 |
70 /* Hope, that gcc will optimize it to get rid of dummy loop */ |
70 /* Hope, that gcc will optimize it to get rid of dummy loop */ |
71 |
71 |
72 #define for_nexthops(fi) { int nhsel=0; const struct fib_nh * nh = (fi)->fib_nh; \ |
72 #define for_nexthops(fi) { int nhsel = 0; const struct fib_nh * nh = (fi)->fib_nh; \ |
73 for (nhsel=0; nhsel < 1; nhsel++) |
73 for (nhsel=0; nhsel < 1; nhsel++) |
74 |
74 |
75 #define change_nexthops(fi) { int nhsel=0; struct fib_nh * nh = (struct fib_nh*)((fi)->fib_nh); \ |
75 #define change_nexthops(fi) { int nhsel = 0; struct fib_nh * nh = (struct fib_nh *)((fi)->fib_nh); \ |
76 for (nhsel=0; nhsel < 1; nhsel++) |
76 for (nhsel=0; nhsel < 1; nhsel++) |
77 |
77 |
78 #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
78 #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
79 |
79 |
80 #define endfor_nexthops(fi) } |
80 #define endfor_nexthops(fi) } |
356 n = neigh_lookup(&arp_tbl, &fi->fib_nh[0].nh_gw, fi->fib_dev); |
356 n = neigh_lookup(&arp_tbl, &fi->fib_nh[0].nh_gw, fi->fib_dev); |
357 if (n) { |
357 if (n) { |
358 state = n->nud_state; |
358 state = n->nud_state; |
359 neigh_release(n); |
359 neigh_release(n); |
360 } |
360 } |
361 if (state==NUD_REACHABLE) |
361 if (state == NUD_REACHABLE) |
362 return 0; |
362 return 0; |
363 if ((state&NUD_VALID) && order != dflt) |
363 if ((state&NUD_VALID) && order != dflt) |
364 return 0; |
364 return 0; |
365 if ((state&NUD_VALID) || |
365 if ((state&NUD_VALID) || |
366 (*last_idx<0 && order > dflt)) { |
366 (*last_idx<0 && order > dflt)) { |