Netlink: Fix parsing of MPLS multipath routes
Add support for RTA_MULTIPATH attribute parsing for AF_MPLS routes. BIRD is capable of installing a multipath route into kernel on Linux, but it would not be seen because parsing fails. This made BIRD attempt to install the same route repeatedly. (The patch minorly updated by committer)
This commit is contained in:
parent
19f8f17320
commit
f1b5f179db
1 changed files with 17 additions and 0 deletions
|
@ -357,6 +357,11 @@ static struct nl_want_attrs nexthop_attr_want6[BIRD_RTA_MAX] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_MPLS_KERNEL
|
#ifdef HAVE_MPLS_KERNEL
|
||||||
|
static struct nl_want_attrs nexthop_attr_want_mpls[BIRD_RTA_MAX] = {
|
||||||
|
[RTA_VIA] = { 1, 0, 0 },
|
||||||
|
[RTA_NEWDST] = { 1, 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
static struct nl_want_attrs encap_mpls_want[BIRD_RTA_MAX] = {
|
static struct nl_want_attrs encap_mpls_want[BIRD_RTA_MAX] = {
|
||||||
[RTA_DST] = { 1, 0, 0 },
|
[RTA_DST] = { 1, 0, 0 },
|
||||||
};
|
};
|
||||||
|
@ -401,6 +406,7 @@ static struct nl_want_attrs rtm_attr_want_mpls[BIRD_RTA_MAX] = {
|
||||||
[RTA_OIF] = { 1, 1, sizeof(u32) },
|
[RTA_OIF] = { 1, 1, sizeof(u32) },
|
||||||
[RTA_PRIORITY] = { 1, 1, sizeof(u32) },
|
[RTA_PRIORITY] = { 1, 1, sizeof(u32) },
|
||||||
[RTA_METRICS] = { 1, 0, 0 },
|
[RTA_METRICS] = { 1, 0, 0 },
|
||||||
|
[RTA_MULTIPATH] = { 1, 0, 0 },
|
||||||
[RTA_FLOW] = { 1, 1, sizeof(u32) },
|
[RTA_FLOW] = { 1, 1, sizeof(u32) },
|
||||||
[RTA_TABLE] = { 1, 1, sizeof(u32) },
|
[RTA_TABLE] = { 1, 1, sizeof(u32) },
|
||||||
[RTA_VIA] = { 1, 0, 0 },
|
[RTA_VIA] = { 1, 0, 0 },
|
||||||
|
@ -703,6 +709,17 @@ nl_parse_multipath(struct nl_parse_state *s, struct krt_proto *p, struct rtattr
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef HAVE_MPLS_KERNEL
|
||||||
|
case AF_MPLS:
|
||||||
|
if (!nl_parse_attrs(RTNH_DATA(nh), nexthop_attr_want_mpls, a, sizeof(a)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (a[RTA_NEWDST])
|
||||||
|
rv->labels = rta_get_mpls(a[RTA_NEWDST], rv->label);
|
||||||
|
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue