diff mbox

[ovs-dev,2/3] routing-table: parse skb-mark from RTNETLINK msg

Message ID 1482918254-3915-3-git-send-email-pshelar@ovn.org
State Superseded
Headers show

Commit Message

Pravin Shelar Dec. 28, 2016, 9:44 a.m. UTC
Keep track of skb-mark of given RTNL routing notification.
This will be used by next commit.

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
---
 lib/route-table.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jarno Rajahalme Jan. 23, 2017, 5:04 p.m. UTC | #1
Acked-by: Jarno Rajahalme <jarno@ovn.org>

> On Dec 28, 2016, at 1:44 AM, Pravin B Shelar <pshelar@ovn.org> wrote:
> 
> Keep track of skb-mark of given RTNL routing notification.
> This will be used by next commit.
> 
> Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
> ---
> lib/route-table.c | 6 ++++++
> 1 file changed, 6 insertions(+)
> 
> diff --git a/lib/route-table.c b/lib/route-table.c
> index 00f95e3..61c8cd8 100644
> --- a/lib/route-table.c
> +++ b/lib/route-table.c
> @@ -45,6 +45,7 @@ struct route_data {
>     struct in6_addr rta_dst; /* 0 if missing. */
>     struct in6_addr rta_gw;
>     char ifname[IFNAMSIZ]; /* Interface name. */
> +    uint32_t mark;
> };
> 
> /* A digested version of a route message sent down by the kernel to indicate
> @@ -190,11 +191,13 @@ route_table_parse(struct ofpbuf *buf, struct route_table_msg *change)
>         [RTA_DST] = { .type = NL_A_U32, .optional = true  },
>         [RTA_OIF] = { .type = NL_A_U32, .optional = true },
>         [RTA_GATEWAY] = { .type = NL_A_U32, .optional = true },
> +        [RTA_MARK] = { .type = NL_A_U32, .optional = true },
>     };
> 
>     static const struct nl_policy policy6[] = {
>         [RTA_DST] = { .type = NL_A_IPV6, .optional = true },
>         [RTA_OIF] = { .type = NL_A_U32, .optional = true },
> +        [RTA_MARK] = { .type = NL_A_U32, .optional = true },
>         [RTA_GATEWAY] = { .type = NL_A_IPV6, .optional = true },
>     };
> 
> @@ -270,6 +273,9 @@ route_table_parse(struct ofpbuf *buf, struct route_table_msg *change)
>                 change->rd.rta_gw = nl_attr_get_in6_addr(attrs[RTA_GATEWAY]);
>             }
>         }
> +        if (attrs[RTA_MARK]) {
> +            change->rd.mark = nl_attr_get_u32(attrs[RTA_MARK]);
> +        }
>     } else {
>         VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message");
>         return 0;
> -- 
> 2.9.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox

Patch

diff --git a/lib/route-table.c b/lib/route-table.c
index 00f95e3..61c8cd8 100644
--- a/lib/route-table.c
+++ b/lib/route-table.c
@@ -45,6 +45,7 @@  struct route_data {
     struct in6_addr rta_dst; /* 0 if missing. */
     struct in6_addr rta_gw;
     char ifname[IFNAMSIZ]; /* Interface name. */
+    uint32_t mark;
 };
 
 /* A digested version of a route message sent down by the kernel to indicate
@@ -190,11 +191,13 @@  route_table_parse(struct ofpbuf *buf, struct route_table_msg *change)
         [RTA_DST] = { .type = NL_A_U32, .optional = true  },
         [RTA_OIF] = { .type = NL_A_U32, .optional = true },
         [RTA_GATEWAY] = { .type = NL_A_U32, .optional = true },
+        [RTA_MARK] = { .type = NL_A_U32, .optional = true },
     };
 
     static const struct nl_policy policy6[] = {
         [RTA_DST] = { .type = NL_A_IPV6, .optional = true },
         [RTA_OIF] = { .type = NL_A_U32, .optional = true },
+        [RTA_MARK] = { .type = NL_A_U32, .optional = true },
         [RTA_GATEWAY] = { .type = NL_A_IPV6, .optional = true },
     };
 
@@ -270,6 +273,9 @@  route_table_parse(struct ofpbuf *buf, struct route_table_msg *change)
                 change->rd.rta_gw = nl_attr_get_in6_addr(attrs[RTA_GATEWAY]);
             }
         }
+        if (attrs[RTA_MARK]) {
+            change->rd.mark = nl_attr_get_u32(attrs[RTA_MARK]);
+        }
     } else {
         VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message");
         return 0;