]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: static: rename IFINDEX -> IFNAME
authorDavid Lamparter <equinox@opensourcerouting.org>
Sun, 6 Aug 2017 02:32:55 +0000 (04:32 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sun, 6 Aug 2017 03:17:09 +0000 (05:17 +0200)
Static routes are really held by ifname, not ifindex.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra/zebra_static.c
zebra/zebra_static.h
zebra/zebra_vty.c

index 6cebae997c86f256d4dc59d7a5d83b685f289149..33ebb88e03fc92eb9683833192a0ba0e064ef5f0 100644 (file)
@@ -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;
        }
 
index 885774895fe9a4a70fcf3182ee2384a9f4b40ab2..520adb1e41dc3a2be02d96b2d15205e082a579fa 100644 (file)
@@ -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. */
index 13c4429d6a60733538aa2b976e62bb2acdab45a2..d167e7d271c4c8544605710f7c7a8dcc792d7676 100644 (file)
@@ -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,