zebra: do not ignore ipv6 srcdest routes

Commit a2ca67d1d2 consolidated IPv4 and IPv6 handling. It also applied
our ignorance for IPv4 srcdest routes onto IPv6.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
Christian Franke 2018-07-23 03:40:42 +02:00
parent af9036b76d
commit 1f610a1fb3
2 changed files with 16 additions and 17 deletions

View File

@ -387,8 +387,15 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
memcpy(&p.u.prefix4, dest, 4);
p.prefixlen = rtm->rtm_dst_len;
src_p.prefixlen =
0; // Forces debug below to not display anything
if (rtm->rtm_src_len != 0) {
char buf[PREFIX_STRLEN];
zlog_warn("unsupported IPv4 sourcedest route (dest %s vrf %u)",
prefix2str(&p, buf, sizeof(buf)), vrf_id);
return 0;
}
/* Force debug below to not display anything for source */
src_p.prefixlen = 0;
} else if (rtm->rtm_family == AF_INET6) {
p.family = AF_INET6;
memcpy(&p.u.prefix6, dest, 16);
@ -399,14 +406,6 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
src_p.prefixlen = rtm->rtm_src_len;
}
if (rtm->rtm_src_len != 0) {
char buf[PREFIX_STRLEN];
zlog_warn(
"unsupported IPv[4|6] sourcedest route (dest %s vrf %u)",
prefix2str(&p, buf, sizeof(buf)), vrf_id);
return 0;
}
/*
* For ZEBRA_ROUTE_KERNEL types:
*
@ -492,7 +491,7 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
nh.vrf_id = nh_vrf_id;
rib_add(afi, SAFI_UNICAST, vrf_id, proto, 0, flags, &p,
NULL, &nh, table, metric, mtu, distance, tag);
&src_p, &nh, table, metric, mtu, distance, tag);
} else {
/* This is a multipath route */
@ -591,8 +590,8 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
if (re->nexthop_num == 0)
XFREE(MTYPE_RE, re);
else
rib_add_multipath(afi, SAFI_UNICAST, &p, NULL,
re);
rib_add_multipath(afi, SAFI_UNICAST, &p,
&src_p, re);
}
} else {
if (!tb[RTA_MULTIPATH]) {
@ -624,12 +623,12 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
if (gate)
memcpy(&nh.gate, gate, sz);
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
&p, NULL, &nh, table, metric, true);
&p, &src_p, &nh, table, metric, true);
} else {
/* XXX: need to compare the entire list of nexthops
* here for NLM_F_APPEND stupidity */
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
&p, NULL, NULL, table, metric, true);
&p, &src_p, NULL, table, metric, true);
}
}

View File

@ -2331,7 +2331,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
if (!re)
return 0;
assert(!src_p || afi == AFI_IP6);
assert(!src_p || !src_p->prefixlen || afi == AFI_IP6);
/* Lookup table. */
table = zebra_vrf_table_with_table_id(afi, safi, re->vrf_id, re->table);
@ -2421,7 +2421,7 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
char buf2[INET6_ADDRSTRLEN];
rib_dest_t *dest;
assert(!src_p || afi == AFI_IP6);
assert(!src_p || !src_p->prefixlen || afi == AFI_IP6);
/* Lookup table. */
table = zebra_vrf_table_with_table_id(afi, safi, vrf_id, table_id);