Merge pull request #5404 from donaldsharp/bsd_null_routes

zebra: BSD null routes were not being installed
This commit is contained in:
Rafael Zalamena 2019-11-22 08:41:30 -03:00 committed by GitHub
commit ac7453a2c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,7 @@ static int kernel_rtm(int cmd, const struct prefix *p,
case NEXTHOP_TYPE_BLACKHOLE: case NEXTHOP_TYPE_BLACKHOLE:
bh_type = nexthop->bh_type; bh_type = nexthop->bh_type;
switch (p->family) { switch (p->family) {
case AFI_IP: { case AF_INET: {
struct in_addr loopback; struct in_addr loopback;
loopback.s_addr = htonl(INADDR_LOOPBACK); loopback.s_addr = htonl(INADDR_LOOPBACK);
sin_gate.sin.sin_addr = loopback; sin_gate.sin.sin_addr = loopback;
@ -189,7 +189,8 @@ static int kernel_rtm(int cmd, const struct prefix *p,
gate = true; gate = true;
} }
break; break;
case AFI_IP6: case AF_INET6:
zlog_warn("v6 blackhole routes have not been programmed yet");
break; break;
} }
} }
@ -230,13 +231,13 @@ static int kernel_rtm(int cmd, const struct prefix *p,
__func__, prefix_buf); __func__, prefix_buf);
} else { } else {
switch (p->family) { switch (p->family) {
case AFI_IP: case AF_INET:
inet_ntop(AF_INET, inet_ntop(AF_INET,
&sin_gate.sin.sin_addr, &sin_gate.sin.sin_addr,
gate_buf, sizeof(gate_buf)); gate_buf, sizeof(gate_buf));
break; break;
case AFI_IP6: case AF_INET6:
inet_ntop(AF_INET6, inet_ntop(AF_INET6,
&sin_gate.sin6.sin6_addr, &sin_gate.sin6.sin6_addr,
gate_buf, sizeof(gate_buf)); gate_buf, sizeof(gate_buf));