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

Pravin B Shelar pshelar at ovn.org
Wed Jan 25 05:57:09 UTC 2017


Keep track of skb-mark of given RTNL routing notification.
This will be used by next commit.

Signed-off-by: Pravin B Shelar <pshelar at ovn.org>
Acked-by: Jarno Rajahalme <jarno at 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



More information about the dev mailing list