Skip to content

Commit

Permalink
route-table: Store route priority.
Browse files Browse the repository at this point in the history
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]>
Acked-by: Eelco Chaudron <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
2 people authored and ovsrobot committed Jan 13, 2025
1 parent a6f1174 commit f207567
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 f207567

Please sign in to comment.