mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-30 03:08:59 +00:00
zebra: static: rename IFINDEX -> IFNAME
Static routes are really held by ifname, not ifindex. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
78986c05cd
commit
7569827e30
@ -83,7 +83,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
nh_p.u.prefix4 = si->addr.ipv4;
|
nh_p.u.prefix4 = si->addr.ipv4;
|
||||||
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
||||||
break;
|
break;
|
||||||
case STATIC_IFINDEX:
|
case STATIC_IFNAME:
|
||||||
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
|
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
|
||||||
break;
|
break;
|
||||||
case STATIC_BLACKHOLE:
|
case STATIC_BLACKHOLE:
|
||||||
@ -96,7 +96,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
nh_p.u.prefix6 = si->addr.ipv6;
|
nh_p.u.prefix6 = si->addr.ipv6;
|
||||||
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY_IFINDEX:
|
case STATIC_IPV6_GATEWAY_IFNAME:
|
||||||
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
|
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
|
||||||
si->ifindex);
|
si->ifindex);
|
||||||
break;
|
break;
|
||||||
@ -147,7 +147,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
nh_p.u.prefix4 = si->addr.ipv4;
|
nh_p.u.prefix4 = si->addr.ipv4;
|
||||||
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
||||||
break;
|
break;
|
||||||
case STATIC_IFINDEX:
|
case STATIC_IFNAME:
|
||||||
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
|
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
|
||||||
break;
|
break;
|
||||||
case STATIC_BLACKHOLE:
|
case STATIC_BLACKHOLE:
|
||||||
@ -160,7 +160,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
|
|||||||
nh_p.u.prefix6 = si->addr.ipv6;
|
nh_p.u.prefix6 = si->addr.ipv6;
|
||||||
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY_IFINDEX:
|
case STATIC_IPV6_GATEWAY_IFNAME:
|
||||||
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
|
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
|
||||||
si->ifindex);
|
si->ifindex);
|
||||||
break;
|
break;
|
||||||
@ -209,7 +209,7 @@ static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
|
|||||||
&& IPV4_ADDR_SAME (&nexthop->gate.ipv4, &si->addr.ipv4))
|
&& IPV4_ADDR_SAME (&nexthop->gate.ipv4, &si->addr.ipv4))
|
||||||
return 1;
|
return 1;
|
||||||
else if (nexthop->type == NEXTHOP_TYPE_IFINDEX
|
else if (nexthop->type == NEXTHOP_TYPE_IFINDEX
|
||||||
&& si->type == STATIC_IFINDEX
|
&& si->type == STATIC_IFNAME
|
||||||
&& nexthop->ifindex == si->ifindex)
|
&& nexthop->ifindex == si->ifindex)
|
||||||
return 1;
|
return 1;
|
||||||
else if (nexthop->type == NEXTHOP_TYPE_IPV6
|
else if (nexthop->type == NEXTHOP_TYPE_IPV6
|
||||||
@ -217,7 +217,7 @@ static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
|
|||||||
&& IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
|
&& IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
|
||||||
return 1;
|
return 1;
|
||||||
else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
|
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)
|
&& IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6)
|
||||||
&& nexthop->ifindex == si->ifindex)
|
&& nexthop->ifindex == si->ifindex)
|
||||||
return 1;
|
return 1;
|
||||||
@ -359,12 +359,12 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
|
|||||||
if (!gate &&
|
if (!gate &&
|
||||||
(type == STATIC_IPV4_GATEWAY ||
|
(type == STATIC_IPV4_GATEWAY ||
|
||||||
type == STATIC_IPV6_GATEWAY ||
|
type == STATIC_IPV6_GATEWAY ||
|
||||||
type == STATIC_IPV6_GATEWAY_IFINDEX))
|
type == STATIC_IPV6_GATEWAY_IFNAME))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!ifindex &&
|
if (!ifindex &&
|
||||||
(type == STATIC_IFINDEX ||
|
(type == STATIC_IFNAME ||
|
||||||
type == STATIC_IPV6_GATEWAY_IFINDEX))
|
type == STATIC_IPV6_GATEWAY_IFNAME))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Lookup static route prefix. */
|
/* Lookup static route prefix. */
|
||||||
@ -416,10 +416,10 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
|
|||||||
case STATIC_IPV6_GATEWAY:
|
case STATIC_IPV6_GATEWAY:
|
||||||
si->addr.ipv6 = gate->ipv6;
|
si->addr.ipv6 = gate->ipv6;
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY_IFINDEX:
|
case STATIC_IPV6_GATEWAY_IFNAME:
|
||||||
si->addr.ipv6 = gate->ipv6;
|
si->addr.ipv6 = gate->ipv6;
|
||||||
break;
|
break;
|
||||||
case STATIC_IFINDEX:
|
case STATIC_IFNAME:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ struct static_nh_label
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STATIC_IFINDEX,
|
STATIC_IFNAME,
|
||||||
STATIC_IPV4_GATEWAY,
|
STATIC_IPV4_GATEWAY,
|
||||||
STATIC_BLACKHOLE,
|
STATIC_BLACKHOLE,
|
||||||
STATIC_IPV6_GATEWAY,
|
STATIC_IPV6_GATEWAY,
|
||||||
STATIC_IPV6_GATEWAY_IFINDEX,
|
STATIC_IPV6_GATEWAY_IFNAME,
|
||||||
} zebra_static_types;
|
} zebra_static_types;
|
||||||
|
|
||||||
/* Static route information. */
|
/* Static route information. */
|
||||||
@ -64,7 +64,7 @@ struct static_route
|
|||||||
* Under IPv4 addr and ifindex are
|
* Under IPv4 addr and ifindex are
|
||||||
* used independentyly.
|
* used independentyly.
|
||||||
* STATIC_IPV4_GATEWAY uses addr
|
* STATIC_IPV4_GATEWAY uses addr
|
||||||
* STATIC_IFINDEX uses ifindex
|
* STATIC_IFNAME uses ifindex
|
||||||
*/
|
*/
|
||||||
union g_addr addr;
|
union g_addr addr;
|
||||||
ifindex_t ifindex;
|
ifindex_t ifindex;
|
||||||
|
@ -193,7 +193,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
|
|||||||
else
|
else
|
||||||
ifindex = ifp->ifindex;
|
ifindex = ifp->ifindex;
|
||||||
ifname = gate_str;
|
ifname = gate_str;
|
||||||
type = STATIC_IFINDEX;
|
type = STATIC_IFNAME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
type = STATIC_IPV4_GATEWAY;
|
type = STATIC_IPV4_GATEWAY;
|
||||||
@ -2280,7 +2280,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
|||||||
case STATIC_IPV4_GATEWAY:
|
case STATIC_IPV4_GATEWAY:
|
||||||
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
|
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
|
||||||
break;
|
break;
|
||||||
case STATIC_IFINDEX:
|
case STATIC_IFNAME:
|
||||||
vty_out (vty, " %s", si->ifname);
|
vty_out (vty, " %s", si->ifname);
|
||||||
break;
|
break;
|
||||||
case STATIC_BLACKHOLE:
|
case STATIC_BLACKHOLE:
|
||||||
@ -2289,7 +2289,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
|
|||||||
case STATIC_IPV6_GATEWAY:
|
case STATIC_IPV6_GATEWAY:
|
||||||
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
|
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY_IFINDEX:
|
case STATIC_IPV6_GATEWAY_IFNAME:
|
||||||
vty_out (vty, " %s %s",
|
vty_out (vty, " %s %s",
|
||||||
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
|
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
|
||||||
ifindex2ifname (si->ifindex, si->vrf_id));
|
ifindex2ifname (si->ifindex, si->vrf_id));
|
||||||
@ -2457,7 +2457,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
|
|||||||
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
|
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
type = STATIC_IPV6_GATEWAY_IFINDEX;
|
type = STATIC_IPV6_GATEWAY_IFNAME;
|
||||||
gate = &gate_addr;
|
gate = &gate_addr;
|
||||||
ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
|
ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
@ -2476,7 +2476,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = STATIC_IFINDEX;
|
type = STATIC_IFNAME;
|
||||||
ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
|
ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
{
|
{
|
||||||
@ -3773,13 +3773,13 @@ static_config_ipv6 (struct vty *vty)
|
|||||||
case STATIC_IPV6_GATEWAY:
|
case STATIC_IPV6_GATEWAY:
|
||||||
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
|
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
|
||||||
break;
|
break;
|
||||||
case STATIC_IFINDEX:
|
case STATIC_IFNAME:
|
||||||
vty_out (vty, " %s", si->ifname);
|
vty_out (vty, " %s", si->ifname);
|
||||||
break;
|
break;
|
||||||
case STATIC_BLACKHOLE:
|
case STATIC_BLACKHOLE:
|
||||||
vty_out (vty, " Null0" );
|
vty_out (vty, " Null0" );
|
||||||
break;
|
break;
|
||||||
case STATIC_IPV6_GATEWAY_IFINDEX:
|
case STATIC_IPV6_GATEWAY_IFNAME:
|
||||||
vty_out (vty, " %s %s",
|
vty_out (vty, " %s %s",
|
||||||
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
|
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
|
||||||
ifindex2ifname (si->ifindex, si->vrf_id));
|
ifindex2ifname (si->ifindex, si->vrf_id));
|
||||||
|
Loading…
Reference in New Issue
Block a user