Skip to content

Commit

Permalink
route-table: Store route priority.
Browse files Browse the repository at this point in the history
The route-table code is useful outside the scope of Open vSwitch.
In a subsequent patch we will expose the route-table data
structures to allow projects compiling against the private Open
vSwitch library to consume this data.

Store the route priority so that other consumers may read this
data if relevant to them.

Co-Authored-by: Felix Huettner <[email protected]>
Signed-off-by: Felix Huettner <[email protected]>
Signed-off-by: Frode Nordahl <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
2 people authored and ovsrobot committed Dec 6, 2024
1 parent 9b8298d commit eb6dc28
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/route-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct route_data {
char ifname[IFNAMSIZ]; /* Interface name. */
uint32_t mark;
uint32_t rta_table_id; /* 0 if missing. */
uint32_t rta_priority; /* 0 if missing. */
};

/* A digested version of a route message sent down by the kernel to indicate
Expand Down Expand Up @@ -235,6 +236,7 @@ route_table_parse(struct ofpbuf *buf, void *change_)
[RTA_MARK] = { .type = NL_A_U32, .optional = true },
[RTA_PREFSRC] = { .type = NL_A_U32, .optional = true },
[RTA_TABLE] = { .type = NL_A_U32, .optional = true },
[RTA_PRIORITY] = { .type = NL_A_U32, .optional = true },
};

static const struct nl_policy policy6[] = {
Expand All @@ -244,6 +246,7 @@ route_table_parse(struct ofpbuf *buf, void *change_)
[RTA_GATEWAY] = { .type = NL_A_IPV6, .optional = true },
[RTA_PREFSRC] = { .type = NL_A_IPV6, .optional = true },
[RTA_TABLE] = { .type = NL_A_U32, .optional = true },
[RTA_PRIORITY] = { .type = NL_A_U32, .optional = true },
};

struct nlattr *attrs[ARRAY_SIZE(policy)];
Expand Down Expand Up @@ -338,6 +341,9 @@ route_table_parse(struct ofpbuf *buf, void *change_)
if (attrs[RTA_MARK]) {
change->rd.mark = nl_attr_get_u32(attrs[RTA_MARK]);
}
if (attrs[RTA_PRIORITY]) {
change->rd.rta_priority = nl_attr_get_u32(attrs[RTA_PRIORITY]);
}
} else {
VLOG_DBG_RL(&rl, "received unparseable rtnetlink route message");
return 0;
Expand Down

0 comments on commit eb6dc28

Please sign in to comment.