IPV6_ADDR_COPY(&p.u.prefix, address);
p.prefixlen = IPV6_MAX_PREFIXLEN;
- if (!(ifc = listnode_head(ifp->nbr_connected))) {
+ ifc = listnode_head(ifp->nbr_connected);
+ if (!ifc) {
/* new addition */
ifc = nbr_connected_new();
ifc->address = prefix_new();
if (IS_ZEBRA_DEBUG_SEND) {
char buf_prefix[PREFIX_STRLEN];
+
prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s",
stream_putc(s, re->distance);
stream_putl(s, re->metric);
num = 0;
- nump = stream_get_endp(
- s); /* remember position for nexthop_num */
- stream_putc(s, 0); /* reserve room for nexthop_num */
- /* Only non-recursive routes are elegible to resolve the nexthop
- * we
- * are looking up. Therefore, we will just iterate over the top
- * chain of nexthops. */
+ /* remember position for nexthop_num */
+ nump = stream_get_endp(s);
+ /* reserve room for nexthop_num */
+ stream_putc(s, 0);
+ /*
+ * Only non-recursive routes are elegible to resolve the
+ * nexthop we are looking up. Therefore, we will just iterate
+ * over the top chain of nexthops.
+ */
for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next)
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
num += zserv_encode_nexthop(s, nexthop);
- stream_putc_at(s, nump, num); /* store nexthop_num */
+ /* store nexthop_num */
+ stream_putc_at(s, nump, num);
} else {
stream_putc(s, 0); /* distance */
stream_putl(s, 0); /* metric */
s = msg;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
- return; // unexpected
+ return;
/*
* The minimum amount of data that can be sent for one fec
s = msg;
zvrf = vrf_info_lookup(VRF_DEFAULT);
if (!zvrf)
- return; // unexpected
+ return;
/*
* The minimum amount of data that can be sent for one
{
if (nexthop_num > multipath_num) {
char buff[PREFIX2STR_BUFFER];
+
prefix2str(p, buff, sizeof(buff));
zlog_warn(
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
if (IS_ZEBRA_DEBUG_RECV) {
char buf_prefix[PREFIX_STRLEN];
+
prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
zlog_debug("%s: p=%s, ZAPI_MESSAGE_LABEL: %sset, flags=0x%x",
__func__, buf_prefix,
* api_nh->vrf_id instead of re->vrf_id ? I only changed
* for cases NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.
*/
- if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) {
+ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP))
for (i = 0; i < api.nexthop_num; i++) {
api_nh = &api.nexthops[i];
ifindex_t ifindex = 0;
- if (IS_ZEBRA_DEBUG_RECV) {
+ if (IS_ZEBRA_DEBUG_RECV)
zlog_debug("nh type %d", api_nh->type);
- }
switch (api_nh->type) {
case NEXTHOP_TYPE_IFINDEX:
case NEXTHOP_TYPE_IPV4:
if (IS_ZEBRA_DEBUG_RECV) {
char nhbuf[INET6_ADDRSTRLEN] = {0};
+
inet_ntop(AF_INET, &api_nh->gate.ipv4,
nhbuf, INET6_ADDRSTRLEN);
zlog_debug("%s: nh=%s, vrf_id=%d",
if (IS_ZEBRA_DEBUG_RECV) {
char nhbuf[INET6_ADDRSTRLEN] = {0};
+
inet_ntop(AF_INET, &api_nh->gate.ipv4,
nhbuf, INET6_ADDRSTRLEN);
zlog_debug(
&api_nh->labels[0]);
}
}
- }
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_DISTANCE))
re->distance = api.distance;
IPV4_MAX_BYTELEN);
nexthop = route_entry_nexthop_ipv4_add(
re, &nhop_addr, NULL, re->vrf_id);
- /* For labeled-unicast, each nexthop is followed
- * by label. */
+ /*
+ * For labeled-unicast, each nexthop is followed
+ * by the label.
+ */
if (CHECK_FLAG(message, ZAPI_MESSAGE_LABEL)) {
STREAM_GETL(s, label);
nexthop_add_labels(nexthop, label_type,
nexthops_free(re->ng.nexthop);
XFREE(MTYPE_RE, re);
return;
- break;
case NEXTHOP_TYPE_BLACKHOLE:
route_entry_nexthop_blackhole_add(re, bh_type);
break;
/* VRF ID */
re->vrf_id = zvrf_id(zvrf);
- /* We need to give nh-addr, nh-ifindex with the same next-hop object
+ /*
+ * We need to give nh-addr, nh-ifindex with the same next-hop object
* to the re to ensure that IPv6 multipathing works; need to coalesce
* these. Clients should send the same number of paired set of
- * next-hop-addr/next-hop-ifindices. */
+ * next-hop-addr/next-hop-ifindices.
+ */
if (CHECK_FLAG(message, ZAPI_MESSAGE_NEXTHOP)) {
unsigned int nh_count = 0;
unsigned int if_count = 0;
case NEXTHOP_TYPE_IPV6:
STREAM_GET(&nhop_addr, s, 16);
if (nh_count < MULTIPATH_NUM) {
- /* For labeled-unicast, each nexthop is
- * followed by label. */
+ /*
+ * For labeled-unicast, each nexthop is
+ * followed by the label.
+ */
if (CHECK_FLAG(message,
ZAPI_MESSAGE_LABEL)) {
STREAM_GETL(s, label);
}
break;
case NEXTHOP_TYPE_IFINDEX:
- if (if_count < multipath_num) {
+ if (if_count < multipath_num)
STREAM_GETL(s, ifindices[if_count++]);
- }
break;
case NEXTHOP_TYPE_BLACKHOLE:
route_entry_nexthop_blackhole_add(re, bh_type);
/* VRF ID */
re->vrf_id = zvrf_id(zvrf);
- /* We need to give nh-addr, nh-ifindex with the same next-hop object
+ /*
+ * We need to give nh-addr, nh-ifindex with the same next-hop object
* to the re to ensure that IPv6 multipathing works; need to coalesce
* these. Clients should send the same number of paired set of
- * next-hop-addr/next-hop-ifindices. */
+ * next-hop-addr/next-hop-ifindices.
+ */
if (CHECK_FLAG(message, ZAPI_MESSAGE_NEXTHOP)) {
unsigned int nh_count = 0;
unsigned int if_count = 0;
case NEXTHOP_TYPE_IPV6:
STREAM_GET(&nhop_addr, s, 16);
if (nh_count < MULTIPATH_NUM) {
- /* For labeled-unicast, each nexthop is
- * followed by label. */
+ /*
+ * For labeled-unicast, each nexthop is
+ * followed by label.
+ */
if (CHECK_FLAG(message,
ZAPI_MESSAGE_LABEL)) {
STREAM_GETL(s, label);
re, &nhop_addr, ifindex, re->vrf_id);
break;
case NEXTHOP_TYPE_IFINDEX:
- if (if_count < multipath_num) {
+ if (if_count < multipath_num)
STREAM_GETL(s, ifindices[if_count++]);
- }
break;
case NEXTHOP_TYPE_BLACKHOLE:
route_entry_nexthop_blackhole_add(re, bh_type);
extern void zserv_handle_commands(struct zserv *client, struct zmsghdr *hdr,
struct stream *msg, struct zebra_vrf *zvrf);
-extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *);
-extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *);
-extern int zsend_interface_add(struct zserv *, struct interface *);
-extern int zsend_interface_delete(struct zserv *, struct interface *);
-extern int zsend_interface_addresses(struct zserv *, struct interface *);
-extern int zsend_interface_address(int, struct zserv *, struct interface *,
- struct connected *);
-extern void nbr_connected_add_ipv6(struct interface *, struct in6_addr *);
-extern void nbr_connected_delete_ipv6(struct interface *, struct in6_addr *);
-extern int zsend_interface_update(int, struct zserv *, struct interface *);
-extern int zsend_redistribute_route(int, struct zserv *, struct prefix *,
- struct prefix *, struct route_entry *);
-extern int zsend_router_id_update(struct zserv *, struct prefix *, vrf_id_t);
-extern int zsend_interface_vrf_update(struct zserv *, struct interface *,
- vrf_id_t);
-extern int zsend_interface_link_params(struct zserv *, struct interface *);
-extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
+extern int zsend_vrf_add(struct zserv *zclient, struct zebra_vrf *zvrf);
+extern int zsend_vrf_delete(struct zserv *zclient, struct zebra_vrf *zvrf);
+extern int zsend_interface_add(struct zserv *zclient, struct interface *ifp);
+extern int zsend_interface_delete(struct zserv *zclient, struct interface *ifp);
+extern int zsend_interface_addresses(struct zserv *zclient,
+ struct interface *ifp);
+extern int zsend_interface_address(int cmd, struct zserv *zclient,
+ struct interface *ifp,
+ struct connected *ifc);
+extern void nbr_connected_add_ipv6(struct interface *ifp,
+ struct in6_addr *address);
+extern void nbr_connected_delete_ipv6(struct interface *ifp,
+ struct in6_addr *address);
+extern int zsend_interface_update(int cmd, struct zserv *client,
+ struct interface *ifp);
+extern int zsend_redistribute_route(int cmd, struct zserv *zclient,
+ struct prefix *p, struct prefix *src_p,
+ struct route_entry *re);
+extern int zsend_router_id_update(struct zserv *zclient, struct prefix *p,
+ vrf_id_t vrf_id);
+extern int zsend_interface_vrf_update(struct zserv *zclient,
+ struct interface *ifp, vrf_id_t vrf_id);
+extern int zsend_interface_link_params(struct zserv *zclient,
+ struct interface *ifp);
+extern int zsend_pw_update(struct zserv *client, struct zebra_pw *pw);
extern int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
enum zapi_route_notify_owner note);
enum zapi_ipset_entry_notify_owner note);
extern void zsend_iptable_notify_owner(struct zebra_pbr_iptable *iptable,
enum zapi_iptable_notify_owner note);
-extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
- const unsigned int);
+extern void zserv_nexthop_num_warn(const char *caller, const struct prefix *p,
+ const unsigned int nexthop_num);