diff options
| -rw-r--r-- | ldpd/neighbor.c | 10 | ||||
| -rw-r--r-- | tests/topotests/ldp-topo1/r3/how_mpls_table.ref | 10 | ||||
| -rw-r--r-- | tests/topotests/ldp-topo1/r4/how_mpls_table.ref | 9 | ||||
| -rw-r--r-- | zebra/rt_netlink.c | 20 |
4 files changed, 24 insertions, 25 deletions
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index ae51490c07..1aa53151e6 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -619,6 +619,16 @@ nbr_establish_connection(struct nbr *nbr) #endif } + if (nbr->af == AF_INET) { + if (sock_set_ipv4_tos(nbr->fd, IPTOS_PREC_INTERNETCONTROL) == -1) + log_warn("%s: lsr-id %s, sock_set_ipv4_tos error", + __func__, inet_ntoa(nbr->id)); + } else if (nbr->af == AF_INET6) { + if (sock_set_ipv6_dscp(nbr->fd, IPTOS_PREC_INTERNETCONTROL) == -1) + log_warn("%s: lsr-id %s, sock_set_ipv6_dscp error", + __func__, inet_ntoa(nbr->id)); + } + addr2sa(nbr->af, &nbr->laddr, 0, &local_su); addr2sa(nbr->af, &nbr->raddr, LDP_PORT, &remote_su); if (nbr->af == AF_INET6 && nbr->raddr_scope) diff --git a/tests/topotests/ldp-topo1/r3/how_mpls_table.ref b/tests/topotests/ldp-topo1/r3/how_mpls_table.ref deleted file mode 100644 index 18f7df0ee4..0000000000 --- a/tests/topotests/ldp-topo1/r3/how_mpls_table.ref +++ /dev/null @@ -1,10 +0,0 @@ - Inbound Outbound - Label Type Nexthop Label --------- ------- --------------- -------- - 16 LDP 10.0.2.2 3 - 16 LDP 10.0.3.2 3 - 17 LDP 10.0.2.2 3 - 17 LDP 10.0.3.2 3 - 18 LDP 10.0.2.2 17 - 18 LDP 10.0.3.2 17 - 19 LDP 10.0.2.4 3 diff --git a/tests/topotests/ldp-topo1/r4/how_mpls_table.ref b/tests/topotests/ldp-topo1/r4/how_mpls_table.ref deleted file mode 100644 index 40efab8b5b..0000000000 --- a/tests/topotests/ldp-topo1/r4/how_mpls_table.ref +++ /dev/null @@ -1,9 +0,0 @@ - Inbound Outbound - Label Type Nexthop Label --------- ------- --------------- -------- - 16 LDP 10.0.2.2 17 - 17 LDP 10.0.2.2 3 - 18 LDP 10.0.2.3 3 - 19 LDP 10.0.2.2 3 - 20 LDP 10.0.2.3 3 - 20 LDP 10.0.2.2 3 diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 882babec81..466e985494 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -90,6 +90,18 @@ struct gw_family_t { static const char ipv4_ll_buf[16] = "169.254.0.1"; static struct in_addr ipv4_ll; +/* Is this a ipv4 over ipv6 route? */ +static bool is_route_v4_over_v6(unsigned char rtm_family, + enum nexthop_types_t nexthop_type) +{ + if (rtm_family == AF_INET + && (nexthop_type == NEXTHOP_TYPE_IPV6 + || nexthop_type == NEXTHOP_TYPE_IPV6_IFINDEX)) + return true; + + return false; +} + /* Helper to control use of kernel-level nexthop ids */ static bool kernel_nexthops_supported(void) { @@ -1165,9 +1177,7 @@ static void _netlink_route_build_singlepath(const struct prefix *p, if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK)) rtmsg->rtm_flags |= RTNH_F_ONLINK; - if (rtmsg->rtm_family == AF_INET - && (nexthop->type == NEXTHOP_TYPE_IPV6 - || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) { + if (is_route_v4_over_v6(rtmsg->rtm_family, nexthop->type)) { rtmsg->rtm_flags |= RTNH_F_ONLINK; addattr_l(nlmsg, req_size, RTA_GATEWAY, &ipv4_ll, 4); addattr32(nlmsg, req_size, RTA_OIF, nexthop->ifindex); @@ -1342,9 +1352,7 @@ _netlink_route_build_multipath(const struct prefix *p, const char *routedesc, if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK)) rtnh->rtnh_flags |= RTNH_F_ONLINK; - if (rtmsg->rtm_family == AF_INET - && (nexthop->type == NEXTHOP_TYPE_IPV6 - || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX)) { + if (is_route_v4_over_v6(rtmsg->rtm_family, nexthop->type)) { bytelen = 4; rtnh->rtnh_flags |= RTNH_F_ONLINK; rta_addattr_l(rta, NL_PKT_BUF_SIZE, RTA_GATEWAY, &ipv4_ll, |
