addrlen = sockunion_get_addrlen(&p->vc->remote.nbma);
ret = os_sendmsg(zb->head, zbuf_used(zb), p->ifp->ifindex,
- sockunion_get_addr(&p->vc->remote.nbma),
- addrlen, addrlen == 4 ? 0x0800 : 0x86DD);
-
- debugf(NHRP_DEBUG_COMMON, "Multicast Packet: %s -> %s, ret = %d, size = %zu, addrlen = %zu",
- sockunion2str(&p->vc->local.nbma, buf[0], sizeof(buf[0])),
- sockunion2str(&p->vc->remote.nbma, buf[1], sizeof(buf[1])),
- ret, zbuf_used(zb), addrlen);
+ sockunion_get_addr(&p->vc->remote.nbma), addrlen,
+ addrlen == 4 ? 0x0800 : 0x86DD);
+
+ debugf(NHRP_DEBUG_COMMON,
+ "Multicast Packet: %s -> %s, ret = %d, size = %zu, addrlen = %zu",
+ sockunion2str(&p->vc->local.nbma, buf[0], sizeof(buf[0])),
+ sockunion2str(&p->vc->remote.nbma, buf[1], sizeof(buf[1])), ret,
+ zbuf_used(zb), addrlen);
}
-static void nhrp_multicast_forward_nbma(union sockunion *nbma_addr, struct interface *ifp, struct zbuf *pkt)
+static void nhrp_multicast_forward_nbma(union sockunion *nbma_addr,
+ struct interface *ifp, struct zbuf *pkt)
{
struct nhrp_peer *p = nhrp_peer_get(ifp, nbma_addr);
- if(p && p->online) {
+
+ if (p && p->online) {
/* Send packet */
nhrp_multicast_send(p, pkt);
}
struct mcast_ctx *ctx = (struct mcast_ctx *)pctx;
if (c->cur.type == NHRP_CACHE_DYNAMIC && c->cur.peer)
- nhrp_multicast_forward_nbma(&c->cur.peer->vc->remote.nbma, ctx->ifp, ctx->pkt);
+ nhrp_multicast_forward_nbma(&c->cur.peer->vc->remote.nbma,
+ ctx->ifp, ctx->pkt);
}
static void nhrp_multicast_forward(struct nhrp_multicast *mcast, void *pctx)
/* dynamic */
if (sockunion_family(&mcast->nbma_addr) == AF_UNSPEC) {
- nhrp_cache_foreach(ctx->ifp, nhrp_multicast_forward_cache, pctx);
+ nhrp_cache_foreach(ctx->ifp, nhrp_multicast_forward_cache,
+ pctx);
return;
}
afi_t afi;
struct mcast_ctx ctx;
- debugf(NHRP_DEBUG_COMMON,"Inside %s\n", __func__);
+ debugf(NHRP_DEBUG_COMMON, "Inside %s\n", __func__);
nf = znl_pull(zb, sizeof(*nf));
if (!nf)
/* NFULA_HWHDR exists and is supposed to contain source
* hardware address. However, for ip_gre it seems to be
* the nexthop destination address if the packet matches
- * route. */
+ * route.
+ */
}
}
if (!ifp)
return;
- debugf(NHRP_DEBUG_COMMON,"Outgoing interface = %s\n", ifp->name);
+ debugf(NHRP_DEBUG_COMMON, "Outgoing interface = %s\n", ifp->name);
- ctx = (struct mcast_ctx) {
- .ifp = ifp,
- .pkt = &pktpl,
+ ctx = (struct mcast_ctx){
+ .ifp = ifp, .pkt = &pktpl,
};
for (afi = 0; afi < AFI_MAX; afi++) {
- nhrp_multicast_foreach(ifp, afi, nhrp_multicast_forward, (void *)&ctx);
+ nhrp_multicast_foreach(ifp, afi, nhrp_multicast_forward,
+ (void *)&ctx);
}
}
zbuf_free(zb);
}
-static int nhrp_multicast_free(struct interface *ifp, struct nhrp_multicast *mcast)
+static int nhrp_multicast_free(struct interface *ifp,
+ struct nhrp_multicast *mcast)
{
list_del(&mcast->list_entry);
XFREE(MTYPE_NHRP_MULTICAST, mcast);
return;
netlink_mcast_log_register(netlink_mcast_log_fd, nlgroup);
- thread_add_read(master, netlink_mcast_log_recv, 0, netlink_mcast_log_fd,
+ thread_add_read(master, netlink_mcast_log_recv, 0,
+ netlink_mcast_log_fd,
&netlink_mcast_log_thread);
- debugf(NHRP_DEBUG_COMMON, "Register nflog group: %d", netlink_mcast_nflog_group);
+ debugf(NHRP_DEBUG_COMMON, "Register nflog group: %d",
+ netlink_mcast_nflog_group);
}
}
-int nhrp_multicast_add(struct interface *ifp, afi_t afi, union sockunion *nbma_addr)
+int nhrp_multicast_add(struct interface *ifp, afi_t afi,
+ union sockunion *nbma_addr)
{
struct nhrp_interface *nifp = ifp->info;
struct nhrp_multicast *mcast;
mcast = XMALLOC(MTYPE_NHRP_MULTICAST, sizeof(struct nhrp_multicast));
*mcast = (struct nhrp_multicast){
- .afi = afi,
- .ifp = ifp,
- .nbma_addr = *nbma_addr,
+ .afi = afi, .ifp = ifp, .nbma_addr = *nbma_addr,
};
list_add_tail(&mcast->list_entry, &nifp->afi[afi].mcastlist_head);
return NHRP_OK;
}
-int nhrp_multicast_del(struct interface *ifp, afi_t afi, union sockunion *nbma_addr)
+int nhrp_multicast_del(struct interface *ifp, afi_t afi,
+ union sockunion *nbma_addr)
{
struct nhrp_interface *nifp = ifp->info;
struct nhrp_multicast *mcast, *tmp;
afi_t afi;
for (afi = 0; afi < AFI_MAX; afi++) {
- debugf(NHRP_DEBUG_COMMON, "Cleaning up multicast entries (%d)", !list_empty(&nifp->afi[afi].mcastlist_head));
+ debugf(NHRP_DEBUG_COMMON,
+ "Cleaning up multicast entries (%d)",
+ !list_empty(&nifp->afi[afi].mcastlist_head));
list_for_each_entry_safe(
- mcast, tmp, &nifp->afi[afi].mcastlist_head,
- list_entry) {
+ mcast, tmp, &nifp->afi[afi].mcastlist_head, list_entry)
+ {
nhrp_multicast_free(ifp, mcast);
}
}
}
void nhrp_multicast_foreach(struct interface *ifp, afi_t afi,
- void (*cb)(struct nhrp_multicast *, void *),
- void *ctx)
+ void (*cb)(struct nhrp_multicast *, void *),
+ void *ctx)
{
struct nhrp_interface *nifp = ifp->info;
struct nhrp_multicast *mcast;
list_for_each_entry(mcast, &nifp->afi[afi].mcastlist_head, list_entry)
{
- cb (mcast, ctx);
+ cb(mcast, ctx);
}
}
ctx->count++;
if (reg && reg->peer)
- sockunion2str(®->peer->vc->remote.nbma,
- buf[0], sizeof(buf[0]));
+ sockunion2str(®->peer->vc->remote.nbma, buf[0],
+ sizeof(buf[0]));
else
snprintf(buf[0], sizeof(buf[0]), "-");
sockunion2str(reg ? ®->proto_addr : &n->proto_addr, buf[1],
const char *aficmd;
};
-static void interface_config_write_nhrp_map(struct nhrp_cache_config *c, void *data)
+static void interface_config_write_nhrp_map(struct nhrp_cache_config *c,
+ void *data)
{
struct write_map_ctx *ctx = data;
struct vty *vty = ctx->vty;
vty_out(vty, " %s nhrp map %s %s\n", ctx->aficmd,
sockunion2str(&c->remote_addr, buf[0], sizeof(buf[0])),
c->type == NHRP_CACHE_LOCAL
- ? "local" : sockunion2str(&c->nbma, buf[1], sizeof(buf[1])));
+ ? "local"
+ : sockunion2str(&c->nbma, buf[1], sizeof(buf[1])));
}
static int interface_config_write(struct vty *vty)
.family = afi2family(afi),
.aficmd = aficmd,
};
- nhrp_cache_config_foreach(ifp, interface_config_write_nhrp_map,
- &mapctx);
+ nhrp_cache_config_foreach(
+ ifp, interface_config_write_nhrp_map, &mapctx);
list_for_each_entry(nhs, &ad->nhslist_head,
nhslist_entry)
== AF_UNSPEC
? "dynamic"
: sockunion2str(
- &mcast->nbma_addr, buf,
- sizeof(buf)));
+ &mcast->nbma_addr,
+ buf, sizeof(buf)));
}
}