mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 11:25:41 +00:00
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:
parent
af9036b76d
commit
1f610a1fb3
@ -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);
|
memcpy(&p.u.prefix4, dest, 4);
|
||||||
p.prefixlen = rtm->rtm_dst_len;
|
p.prefixlen = rtm->rtm_dst_len;
|
||||||
|
|
||||||
src_p.prefixlen =
|
if (rtm->rtm_src_len != 0) {
|
||||||
0; // Forces debug below to not display anything
|
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) {
|
} else if (rtm->rtm_family == AF_INET6) {
|
||||||
p.family = AF_INET6;
|
p.family = AF_INET6;
|
||||||
memcpy(&p.u.prefix6, dest, 16);
|
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;
|
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:
|
* 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;
|
nh.vrf_id = nh_vrf_id;
|
||||||
|
|
||||||
rib_add(afi, SAFI_UNICAST, vrf_id, proto, 0, flags, &p,
|
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 {
|
} else {
|
||||||
/* This is a multipath route */
|
/* 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)
|
if (re->nexthop_num == 0)
|
||||||
XFREE(MTYPE_RE, re);
|
XFREE(MTYPE_RE, re);
|
||||||
else
|
else
|
||||||
rib_add_multipath(afi, SAFI_UNICAST, &p, NULL,
|
rib_add_multipath(afi, SAFI_UNICAST, &p,
|
||||||
re);
|
&src_p, re);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!tb[RTA_MULTIPATH]) {
|
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)
|
if (gate)
|
||||||
memcpy(&nh.gate, gate, sz);
|
memcpy(&nh.gate, gate, sz);
|
||||||
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
|
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
|
||||||
&p, NULL, &nh, table, metric, true);
|
&p, &src_p, &nh, table, metric, true);
|
||||||
} else {
|
} else {
|
||||||
/* XXX: need to compare the entire list of nexthops
|
/* XXX: need to compare the entire list of nexthops
|
||||||
* here for NLM_F_APPEND stupidity */
|
* here for NLM_F_APPEND stupidity */
|
||||||
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
|
rib_delete(afi, SAFI_UNICAST, vrf_id, proto, 0, flags,
|
||||||
&p, NULL, NULL, table, metric, true);
|
&p, &src_p, NULL, table, metric, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2331,7 +2331,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
if (!re)
|
if (!re)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
assert(!src_p || afi == AFI_IP6);
|
assert(!src_p || !src_p->prefixlen || afi == AFI_IP6);
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
table = zebra_vrf_table_with_table_id(afi, safi, re->vrf_id, re->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];
|
char buf2[INET6_ADDRSTRLEN];
|
||||||
rib_dest_t *dest;
|
rib_dest_t *dest;
|
||||||
|
|
||||||
assert(!src_p || afi == AFI_IP6);
|
assert(!src_p || !src_p->prefixlen || afi == AFI_IP6);
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
table = zebra_vrf_table_with_table_id(afi, safi, vrf_id, table_id);
|
table = zebra_vrf_table_with_table_id(afi, safi, vrf_id, table_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user