rta = (struct rtattr *) (((char *) n) + NLMSG_ALIGN (n->nlmsg_len));
rta->rta_type = type;
rta->rta_len = len;
- memcpy (RTA_DATA (rta), data, alen);
+
+ if (data)
+ memcpy (RTA_DATA (rta), data, alen);
+ else
+ assert (len == 0);
+
n->nlmsg_len = NLMSG_ALIGN (n->nlmsg_len) + RTA_ALIGN (len);
return 0;
subrta = (struct rtattr *) (((char *) rta) + RTA_ALIGN (rta->rta_len));
subrta->rta_type = type;
subrta->rta_len = len;
- memcpy (RTA_DATA (subrta), data, alen);
+
+ if (data)
+ memcpy (RTA_DATA (subrta), data, alen);
+ else
+ assert (len == 0);
+
rta->rta_len = NLMSG_ALIGN (rta->rta_len) + RTA_ALIGN (len);
return 0;
{
int have_netlink, have_protobuf;
- have_netlink = have_protobuf = 0;
-
#ifdef HAVE_NETLINK
have_netlink = 1;
+#else
+ have_netlink = 0;
#endif
#ifdef HAVE_PROTOBUF
have_protobuf = 1;
+#else
+ have_protobuf = 0;
#endif
zfpm_g->message_format = ZFPM_MSG_FORMAT_NONE;
* particularly in our communication with the FPM.
*/
if (cmd == RTM_DELROUTE && !rib)
- goto skip;
+ return 1;
- if (rib)
- ri->rtm_protocol = netlink_proto_from_route_type (rib->type);
+ if (!rib)
+ {
+ zfpm_debug ("%s: Expected non-NULL rib pointer", __PRETTY_FUNCTION__);
+ return 0;
+ }
+
+ ri->rtm_protocol = netlink_proto_from_route_type (rib->type);
if ((rib->flags & ZEBRA_FLAG_BLACKHOLE) || (rib->flags & ZEBRA_FLAG_REJECT))
discard = 1;
ri->metric = &rib->metric;
if (discard)
- {
- goto skip;
- }
+ return 1;
for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
{
return 0;
}
- skip:
return 1;
}
if (! table)
return;
+ memset (&nh_p, 0, sizeof (nh_p));
+
/* Lookup existing route */
rn = route_node_get (table, p);
RNODE_FOREACH_RIB (rn, rib)
mpls_label_t label[2];
};
+typedef enum {
+ STATIC_IFINDEX,
+ STATIC_IPV4_GATEWAY,
+ STATIC_BLACKHOLE,
+ STATIC_IPV6_GATEWAY,
+ STATIC_IPV6_GATEWAY_IFINDEX,
+} zebra_static_types;
+
/* Static route information. */
struct static_route
{
route_tag_t tag;
/* Flag for this static route's type. */
- u_char type;
-#define STATIC_IFINDEX 1
-#define STATIC_IPV4_GATEWAY 2
-#define STATIC_BLACKHOLE 3
-#define STATIC_IPV6_GATEWAY 4
-#define STATIC_IPV6_GATEWAY_IFINDEX 5
+ zebra_static_types type;
/*
* Nexthop value.
case STATIC_BLACKHOLE:
vty_out (vty, " Null0");
break;
+ case STATIC_IPV6_GATEWAY:
+ vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
+ break;
+ case STATIC_IPV6_GATEWAY_IFINDEX:
+ vty_out (vty, " %s %s",
+ inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
+ ifindex2ifname_vrf (si->ifindex, si->vrf_id));
+ break;
}
/* flags are incompatible with STATIC_BLACKHOLE */
switch (si->type)
{
+ case STATIC_IPV4_GATEWAY:
+ vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
+ break;
case STATIC_IPV6_GATEWAY:
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
break;
struct stream *s;
struct zapi_ipv6 api;
struct in6_addr nexthop;
- union g_addr *pnexthop;
+ union g_addr *pnexthop = NULL;
unsigned long ifindex;
struct prefix p;