On Tue, Oct 21, 2014 at 3:27 PM, Thomas Graf <[email protected]> wrote: > On 10/16/14 at 11:38am, Pravin B Shelar wrote: >> Routing table will be used by ovs userspace tunneling, it need to >> know gw address, following commit extract gw information from >> netlink message so that ovs can populate it in ovs route table. >> >> Signed-off-by: Pravin B Shelar <[email protected]> >> --- >> lib/route-table.c | 9 ++++++++- >> 1 files changed, 8 insertions(+), 1 deletions(-) >> >> diff --git a/lib/route-table.c b/lib/route-table.c >> index cb8f0f7..b168315 100644 >> --- a/lib/route-table.c >> +++ b/lib/route-table.c >> @@ -41,6 +41,7 @@ struct route_data { >> >> /* Extracted from Netlink attributes. */ >> ovs_be32 rta_dst; /* 0 if missing. */ >> + ovs_be32 rta_gw; >> char ifname[IFNAMSIZ]; /* Interface name. */ >> }; >> >> @@ -205,6 +206,7 @@ route_table_parse(struct ofpbuf *buf, struct >> route_table_msg *change) >> static const struct nl_policy policy[] = { >> [RTA_DST] = { .type = NL_A_U32, .optional = true }, >> [RTA_OIF] = { .type = NL_A_U32, .optional = false }, >> + [RTA_GATEWAY] = { .type = NL_A_U32, .optional = true }, >> }; >> >> struct nlattr *attrs[ARRAY_SIZE(policy)]; >> @@ -251,6 +253,10 @@ route_table_parse(struct ofpbuf *buf, struct >> route_table_msg *change) >> if (attrs[RTA_DST]) { >> change->rd.rta_dst = nl_attr_get_be32(attrs[RTA_DST]); >> } >> + if (attrs[RTA_GATEWAY]) { >> + change->rd.rta_gw = nl_attr_get_be32(attrs[RTA_GATEWAY]); >> + } > > Note that this only works for single nexthop routes. Probably good > enough for now but we should eventually convert this to use the > fib lookup Netlink API to correctly work with multipath routes. > yep, we can add multipath support later.
> Acked-by: Thomas Graf <[email protected]> _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
