/* Install static route into rib. */
static void
-static_install_ipv4 (struct prefix *p, struct static_ipv4 *si)
+static_install_ipv4 (struct prefix *p, struct static_route *si)
{
struct rib *rib;
struct route_node *rn;
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
- nexthop_ipv4_add (rib, &si->gate.ipv4, NULL);
+ nexthop_ipv4_add (rib, &si->addr.ipv4, NULL);
nh_p.family = AF_INET;
nh_p.prefixlen = IPV4_MAX_BITLEN;
- nh_p.u.prefix4 = si->gate.ipv4;
+ nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(&nh_p, rn);
break;
case STATIC_IPV4_IFNAME:
- nexthop_ifname_add (rib, si->gate.ifname);
+ nexthop_ifname_add (rib, si->ifname);
break;
case STATIC_IPV4_BLACKHOLE:
nexthop_blackhole_add (rib);
switch (si->type)
{
case STATIC_IPV4_GATEWAY:
- nexthop_ipv4_add (rib, &si->gate.ipv4, NULL);
+ nexthop_ipv4_add (rib, &si->addr.ipv4, NULL);
nh_p.family = AF_INET;
nh_p.prefixlen = IPV4_MAX_BITLEN;
- nh_p.u.prefix4 = si->gate.ipv4;
+ nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(&nh_p, rn);
break;
case STATIC_IPV4_IFNAME:
- nexthop_ifname_add (rib, si->gate.ifname);
+ nexthop_ifname_add (rib, si->ifname);
break;
case STATIC_IPV4_BLACKHOLE:
nexthop_blackhole_add (rib);
}
static int
-static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_ipv4 *si)
+static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_route *si)
{
if (nexthop->type == NEXTHOP_TYPE_IPV4
&& si->type == STATIC_IPV4_GATEWAY
- && IPV4_ADDR_SAME (&nexthop->gate.ipv4, &si->gate.ipv4))
+ && IPV4_ADDR_SAME (&nexthop->gate.ipv4, &si->addr.ipv4))
return 1;
if (nexthop->type == NEXTHOP_TYPE_IFNAME
&& si->type == STATIC_IPV4_IFNAME
- && strcmp (nexthop->ifname, si->gate.ifname) == 0)
+ && strcmp (nexthop->ifname, si->ifname) == 0)
return 1;
if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE
&& si->type == STATIC_IPV4_BLACKHOLE)
/* Uninstall static route from RIB. */
static void
-static_uninstall_ipv4 (struct prefix *p, struct static_ipv4 *si)
+static_uninstall_ipv4 (struct prefix *p, struct static_route *si)
{
struct route_node *rn;
struct rib *rib;
{
u_char type = 0;
struct route_node *rn;
- struct static_ipv4 *si;
- struct static_ipv4 *pp;
- struct static_ipv4 *cp;
- struct static_ipv4 *update = NULL;
+ struct static_route *si;
+ struct static_route *pp;
+ struct static_route *cp;
+ struct static_route *update = NULL;
struct route_table *stable;
/* Lookup table. */
for (si = rn->info; si; si = si->next)
{
if (type == si->type
- && (! gate || IPV4_ADDR_SAME (gate, &si->gate.ipv4))
- && (! ifname || strcmp (ifname, si->gate.ifname) == 0))
+ && (! gate || IPV4_ADDR_SAME (gate, &si->addr.ipv4))
+ && (! ifname || strcmp (ifname, si->ifname) == 0))
{
if ((distance == si->distance) && (tag == si->tag))
{
static_delete_ipv4 (p, gate, ifname, update->tag, update->distance, vrf_id);
/* Make new static route structure. */
- si = XCALLOC (MTYPE_STATIC_IPV4, sizeof (struct static_ipv4));
+ si = XCALLOC (MTYPE_STATIC_ROUTE, sizeof (struct static_route));
si->type = type;
si->distance = distance;
si->tag = tag;
if (gate)
- si->gate.ipv4 = *gate;
+ si->addr.ipv4 = *gate;
if (ifname)
- si->gate.ifname = XSTRDUP (0, ifname);
+ si->ifname = XSTRDUP (0, ifname);
/* Add new static route information to the tree with sort by
distance value and gateway address. */
continue;
if (si->type == STATIC_IPV4_GATEWAY && cp->type == STATIC_IPV4_GATEWAY)
{
- if (ntohl (si->gate.ipv4.s_addr) < ntohl (cp->gate.ipv4.s_addr))
+ if (ntohl (si->addr.ipv4.s_addr) < ntohl (cp->addr.ipv4.s_addr))
break;
- if (ntohl (si->gate.ipv4.s_addr) > ntohl (cp->gate.ipv4.s_addr))
+ if (ntohl (si->addr.ipv4.s_addr) > ntohl (cp->addr.ipv4.s_addr))
continue;
}
}
{
u_char type = 0;
struct route_node *rn;
- struct static_ipv4 *si;
+ struct static_route *si;
struct route_table *stable;
/* Lookup table. */
/* Find same static route is the tree */
for (si = rn->info; si; si = si->next)
if (type == si->type
- && (! gate || IPV4_ADDR_SAME (gate, &si->gate.ipv4))
- && (! ifname || strcmp (ifname, si->gate.ifname) == 0)
+ && (! gate || IPV4_ADDR_SAME (gate, &si->addr.ipv4))
+ && (! ifname || strcmp (ifname, si->ifname) == 0)
&& (! tag || (tag == si->tag)))
break;
/* Free static route configuration. */
if (ifname)
- XFREE (0, si->gate.ifname);
- XFREE (MTYPE_STATIC_IPV4, si);
+ XFREE (0, si->ifname);
+ XFREE (MTYPE_STATIC_ROUTE, si);
route_unlock_node (rn);
/* Install static route into rib. */
static void
-static_install_ipv6 (struct prefix *p, struct static_ipv6 *si)
+static_install_ipv6 (struct prefix *p, struct static_route *si)
{
struct rib *rib;
struct route_table *table;
switch (si->type)
{
case STATIC_IPV6_GATEWAY:
- nexthop_ipv6_add (rib, &si->ipv6);
+ nexthop_ipv6_add (rib, &si->addr.ipv6);
nh_p.family = AF_INET6;
nh_p.prefixlen = IPV6_MAX_BITLEN;
- nh_p.u.prefix6 = si->ipv6;
+ nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(&nh_p, rn);
break;
case STATIC_IPV6_IFNAME:
nexthop_ifname_add (rib, si->ifname);
break;
case STATIC_IPV6_GATEWAY_IFNAME:
- nexthop_ipv6_ifname_add (rib, &si->ipv6, si->ifname);
+ nexthop_ipv6_ifname_add (rib, &si->addr.ipv6, si->ifname);
break;
}
rib_queue_add (&zebrad, rn);
switch (si->type)
{
case STATIC_IPV6_GATEWAY:
- nexthop_ipv6_add (rib, &si->ipv6);
+ nexthop_ipv6_add (rib, &si->addr.ipv6);
nh_p.family = AF_INET6;
nh_p.prefixlen = IPV6_MAX_BITLEN;
- nh_p.u.prefix6 = si->ipv6;
+ nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(&nh_p, rn);
break;
case STATIC_IPV6_IFNAME:
nexthop_ifname_add (rib, si->ifname);
break;
case STATIC_IPV6_GATEWAY_IFNAME:
- nexthop_ipv6_ifname_add (rib, &si->ipv6, si->ifname);
+ nexthop_ipv6_ifname_add (rib, &si->addr.ipv6, si->ifname);
break;
}
}
static int
-static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_ipv6 *si)
+static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_route *si)
{
if (nexthop->type == NEXTHOP_TYPE_IPV6
&& si->type == STATIC_IPV6_GATEWAY
- && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->ipv6))
+ && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
return 1;
if (nexthop->type == NEXTHOP_TYPE_IFNAME
&& si->type == STATIC_IPV6_IFNAME
return 1;
if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME
&& si->type == STATIC_IPV6_GATEWAY_IFNAME
- && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->ipv6)
+ && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6)
&& strcmp (nexthop->ifname, si->ifname) == 0)
return 1;
return 0;
}
static void
-static_uninstall_ipv6 (struct prefix *p, struct static_ipv6 *si)
+static_uninstall_ipv6 (struct prefix *p, struct static_route *si)
{
struct route_table *table;
struct route_node *rn;
u_char distance, u_int32_t vrf_id)
{
struct route_node *rn;
- struct static_ipv6 *si;
- struct static_ipv6 *pp;
- struct static_ipv6 *cp;
+ struct static_route *si;
+ struct static_route *pp;
+ struct static_route *cp;
struct route_table *stable;
+
/* Lookup table. */
stable = vrf_static_table (AFI_IP6, SAFI_UNICAST, vrf_id);
if (! stable)
if (distance == si->distance
&& type == si->type
&& tag == si->tag
- && (! gate || IPV6_ADDR_SAME (gate, &si->ipv6))
+ && (! gate || IPV6_ADDR_SAME (gate, &si->addr.ipv6))
&& (! ifname || strcmp (ifname, si->ifname) == 0))
{
route_unlock_node (rn);
}
/* Make new static route structure. */
- si = XCALLOC (MTYPE_STATIC_IPV6, sizeof (struct static_ipv6));
+ si = XCALLOC (MTYPE_STATIC_ROUTE, sizeof (struct static_route));
si->type = type;
si->distance = distance;
switch (type)
{
case STATIC_IPV6_GATEWAY:
- si->ipv6 = *gate;
+ si->addr.ipv6 = *gate;
break;
case STATIC_IPV6_IFNAME:
si->ifname = XSTRDUP (0, ifname);
break;
case STATIC_IPV6_GATEWAY_IFNAME:
- si->ipv6 = *gate;
+ si->addr.ipv6 = *gate;
si->ifname = XSTRDUP (0, ifname);
break;
}
u_int32_t vrf_id)
{
struct route_node *rn;
- struct static_ipv6 *si;
+ struct static_route *si;
struct route_table *stable;
/* Lookup table. */
for (si = rn->info; si; si = si->next)
if (distance == si->distance
&& type == si->type
- && (! gate || IPV6_ADDR_SAME (gate, &si->ipv6))
+ && (! gate || IPV6_ADDR_SAME (gate, &si->addr.ipv6))
&& (! ifname || strcmp (ifname, si->ifname) == 0)
&& (! tag || (tag == si->tag)))
break;
/* Free static route configuration. */
if (ifname)
XFREE (0, si->ifname);
- XFREE (MTYPE_STATIC_IPV6, si);
+ XFREE (MTYPE_STATIC_ROUTE, si);
return 1;
}