From 23443030d3a45a4c765cbde5ee68d09ecbc68043 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 6 Aug 2017 04:32:55 +0200 Subject: [PATCH] zebra: static: rename IFINDEX -> IFNAME Static routes are really held by ifname, not ifindex. Signed-off-by: David Lamparter --- zebra/zebra_static.c | 34 +++++++++++++++++----------------- zebra/zebra_static.h | 6 +++--- zebra/zebra_vty.c | 12 ++++++------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c index 6cebae997c..33ebb88e03 100644 --- a/zebra/zebra_static.c +++ b/zebra/zebra_static.c @@ -81,11 +81,11 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, nh_p.u.prefix4 = si->addr.ipv4; zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn); break; - case STATIC_IPV4_GATEWAY_IFINDEX: + case STATIC_IPV4_GATEWAY_IFNAME: nexthop = route_entry_nexthop_ipv4_ifindex_add( re, &si->addr.ipv4, NULL, si->ifindex); break; - case STATIC_IFINDEX: + case STATIC_IFNAME: nexthop = route_entry_nexthop_ifindex_add(re, si->ifindex); break; @@ -100,7 +100,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, nh_p.u.prefix6 = si->addr.ipv6; zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn); break; - case STATIC_IPV6_GATEWAY_IFINDEX: + case STATIC_IPV6_GATEWAY_IFNAME: nexthop = route_entry_nexthop_ipv6_ifindex_add( re, &si->addr.ipv6, si->ifindex); break; @@ -156,11 +156,11 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, nh_p.u.prefix4 = si->addr.ipv4; zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn); break; - case STATIC_IPV4_GATEWAY_IFINDEX: + case STATIC_IPV4_GATEWAY_IFNAME: nexthop = route_entry_nexthop_ipv4_ifindex_add( re, &si->addr.ipv4, NULL, si->ifindex); break; - case STATIC_IFINDEX: + case STATIC_IFNAME: nexthop = route_entry_nexthop_ifindex_add(re, si->ifindex); break; @@ -175,7 +175,7 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, nh_p.u.prefix6 = si->addr.ipv6; zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn); break; - case STATIC_IPV6_GATEWAY_IFINDEX: + case STATIC_IPV6_GATEWAY_IFNAME: nexthop = route_entry_nexthop_ipv6_ifindex_add( re, &si->addr.ipv6, si->ifindex); break; @@ -225,12 +225,12 @@ static int static_nexthop_same(struct nexthop *nexthop, struct static_route *si) && IPV4_ADDR_SAME(&nexthop->gate.ipv4, &si->addr.ipv4)) return 1; else if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX - && si->type == STATIC_IPV4_GATEWAY_IFINDEX + && si->type == STATIC_IPV4_GATEWAY_IFNAME && IPV4_ADDR_SAME(&nexthop->gate.ipv4, &si->addr.ipv4) && nexthop->ifindex == si->ifindex) return 1; else if (nexthop->type == NEXTHOP_TYPE_IFINDEX - && si->type == STATIC_IFINDEX + && si->type == STATIC_IFNAME && nexthop->ifindex == si->ifindex) return 1; else if (nexthop->type == NEXTHOP_TYPE_IPV6 @@ -238,7 +238,7 @@ static int static_nexthop_same(struct nexthop *nexthop, struct static_route *si) && IPV6_ADDR_SAME(&nexthop->gate.ipv6, &si->addr.ipv6)) return 1; else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX - && si->type == STATIC_IPV6_GATEWAY_IFINDEX + && si->type == STATIC_IPV6_GATEWAY_IFNAME && IPV6_ADDR_SAME(&nexthop->gate.ipv6, &si->addr.ipv6) && nexthop->ifindex == si->ifindex) return 1; @@ -376,15 +376,15 @@ int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p, if (!gate && (type == STATIC_IPV4_GATEWAY - || type == STATIC_IPV4_GATEWAY_IFINDEX + || type == STATIC_IPV4_GATEWAY_IFNAME || type == STATIC_IPV6_GATEWAY - || type == STATIC_IPV6_GATEWAY_IFINDEX)) + || type == STATIC_IPV6_GATEWAY_IFNAME)) return -1; if (!ifindex - && (type == STATIC_IFINDEX - || type == STATIC_IPV4_GATEWAY_IFINDEX - || type == STATIC_IPV6_GATEWAY_IFINDEX)) + && (type == STATIC_IFNAME + || type == STATIC_IPV4_GATEWAY_IFNAME + || type == STATIC_IPV6_GATEWAY_IFNAME)) return -1; /* Lookup static route prefix. */ @@ -429,14 +429,14 @@ int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p, switch (type) { case STATIC_IPV4_GATEWAY: - case STATIC_IPV4_GATEWAY_IFINDEX: + case STATIC_IPV4_GATEWAY_IFNAME: si->addr.ipv4 = gate->ipv4; break; case STATIC_IPV6_GATEWAY: - case STATIC_IPV6_GATEWAY_IFINDEX: + case STATIC_IPV6_GATEWAY_IFNAME: si->addr.ipv6 = gate->ipv6; break; - case STATIC_IFINDEX: + case STATIC_IFNAME: break; } diff --git a/zebra/zebra_static.h b/zebra/zebra_static.h index 885774895f..520adb1e41 100644 --- a/zebra/zebra_static.h +++ b/zebra/zebra_static.h @@ -30,12 +30,12 @@ struct static_nh_label { }; typedef enum { - STATIC_IFINDEX, + STATIC_IFNAME, STATIC_IPV4_GATEWAY, - STATIC_IPV4_GATEWAY_IFINDEX, + STATIC_IPV4_GATEWAY_IFNAME, STATIC_BLACKHOLE, STATIC_IPV6_GATEWAY, - STATIC_IPV6_GATEWAY_IFINDEX, + STATIC_IPV6_GATEWAY_IFNAME, } zebra_static_types; /* Static route information. */ diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 13c4429d6a..d167e7d271 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -222,11 +222,11 @@ static int zebra_static_route(struct vty *vty, afi_t afi, safi_t safi, type = STATIC_BLACKHOLE; else if (gate_str && ifname) { if (afi == AFI_IP) - type = STATIC_IPV4_GATEWAY_IFINDEX; + type = STATIC_IPV4_GATEWAY_IFNAME; else - type = STATIC_IPV6_GATEWAY_IFINDEX; + type = STATIC_IPV6_GATEWAY_IFNAME; } else if (ifname) - type = STATIC_IFINDEX; + type = STATIC_IFNAME; else { if (afi == AFI_IP) type = STATIC_IPV4_GATEWAY; @@ -1705,7 +1705,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi, &si->addr.ipv6, buf, sizeof buf)); break; - case STATIC_IFINDEX: + case STATIC_IFNAME: vty_out(vty, " %s", si->ifname); break; /* blackhole and Null0 mean the same thing */ @@ -1715,7 +1715,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi, else vty_out(vty, " Null0"); break; - case STATIC_IPV4_GATEWAY_IFINDEX: + case STATIC_IPV4_GATEWAY_IFNAME: vty_out(vty, " %s %s", inet_ntop(AF_INET, &si->addr.ipv4, buf, @@ -1723,7 +1723,7 @@ static int static_config(struct vty *vty, afi_t afi, safi_t safi, ifindex2ifname(si->ifindex, si->vrf_id)); break; - case STATIC_IPV6_GATEWAY_IFINDEX: + case STATIC_IPV6_GATEWAY_IFNAME: vty_out(vty, " %s %s", inet_ntop(AF_INET6, &si->addr.ipv6, buf, -- 2.39.5