char buf[4][SU_ADDRSTRLEN];
int state;
+ memset(&lladdr, 0, sizeof(lladdr));
ndm = znl_pull(zb, sizeof(*ndm));
if (!ndm)
return;
return;
debugf(NHRP_DEBUG_KERNEL,
- "Netlink: %s %s dev %s lladdr %s nud 0x%x "
- "cache used %u type %u",
+ "Netlink: %s %s dev %s lladdr %s nud 0x%x cache used %u type %u",
(msg->nlmsg_type == RTM_GETNEIGH)
? "who-has"
: (msg->nlmsg_type == RTM_NEWNEIGH) ? "new-neigh"
if (c->cur.type >= NHRP_CACHE_CACHED) {
nhrp_cache_set_used(c, 1);
debugf(NHRP_DEBUG_KERNEL,
- "Netlink: update binding for %s dev %s from c "
- "%s peer.vc.nbma %s to lladdr %s",
+ "Netlink: update binding for %s dev %s from c %s peer.vc.nbma %s to lladdr %s",
sockunion2str(&addr, buf[0], sizeof(buf[0])),
ifp->name,
sockunion2str(&c->cur.remote_nbma_natoa, buf[1],
* nbma.
*/
debugf(NHRP_DEBUG_COMMON,
- "cache (peer check ok, remote_nbma_natoa is set): "
- "Update binding for %s dev %s from (deleted) "
- "peer.vc.nbma %s to %s",
+ "cache (remote_nbma_natoa set): Update binding for %s dev %s from (deleted) peer.vc.nbma %s to %s",
sockunion2str(&c->remote_addr, buf[0],
sizeof(buf[0])),
p->ifp->name,
netlink_update_binding(p->ifp, &c->remote_addr,
&c->cur.remote_nbma_natoa);
} else {
- // update binding to peer->vc->remote->nbma
+ /* update binding to peer->vc->remote->nbma */
debugf(NHRP_DEBUG_COMMON,
- "cache (peer check ok, remote_nbma_natoa unspec): "
- "Update binding for %s dev %s from (deleted) "
- "to peer.vc.nbma %s",
+ "cache (remote_nbma_natoa unspec): Update binding for %s dev %s from (deleted) to peer.vc.nbma %s",
sockunion2str(&c->remote_addr, buf[0],
sizeof(buf[0])),
p->ifp->name,
c->route_installed = 1;
}
} else {
- // debug the reason for peer check fail
+ /* debug the reason for peer check fail */
if (p) {
nifp = p->ifp->info;
debugf(NHRP_DEBUG_COMMON,
- "cache (peer check failed: "
- "online?%d requested?%d ipsec?%d)",
+ "cache (peer check failed: online?%d requested?%d ipsec?%d)",
p->online, p->requested,
nifp->ipsec_profile ? 1 : 0);
} else
if (sockunion_family(&c->cur.remote_nbma_natoa) != AF_UNSPEC) {
debugf(NHRP_DEBUG_COMMON,
- "cache: update binding for %s dev %s from "
- "(deleted) peer.vc.nbma %s to %s",
+ "cache: update binding for %s dev %s from (deleted) peer.vc.nbma %s to %s",
sockunion2str(&c->remote_addr, buf[0],
- sizeof buf[0]),
+ sizeof(buf[0])),
c->ifp->name,
(c->cur.peer ? sockunion2str(
&c->cur.peer->vc->remote.nbma, buf[1],
- sizeof buf[1])
+ sizeof(buf[1]))
: "(no peer)"),
sockunion2str(&c->cur.remote_nbma_natoa, buf[2],
- sizeof buf[2]));
+ sizeof(buf[2])));
- netlink_update_binding(c->cur.peer->ifp,
- &c->remote_addr,
- &c->cur.remote_nbma_natoa);
+ if (c->cur.peer)
+ netlink_update_binding(
+ c->cur.peer->ifp, &c->remote_addr,
+ &c->cur.remote_nbma_natoa);
}
nhrp_cache_update_route(c);
uint32_t mtu, union sockunion *nbma_oa)
{
char buf[2][SU_ADDRSTRLEN];
+
if (c->cur.type > type || c->new.type > type) {
nhrp_peer_unref(p);
return 0;
nhrp_cache_reset_new(c);
if (c->cur.type == type && c->cur.peer == p && c->cur.mtu == mtu) {
debugf(NHRP_DEBUG_COMMON,
- "cache: same type %u, updating "
- "expiry and changing nbma addr from %s to %s",
+ "cache: same type %u, updating expiry and changing nbma addr from %s to %s",
type, buf[0], nbma_oa ? buf[1] : "(NULL)");
if (holding_time > 0)
c->cur.expires = monotime(NULL) + holding_time;
+
if (nbma_oa)
c->cur.remote_nbma_natoa = *nbma_oa;
else
memset(&c->cur.remote_nbma_natoa, 0,
sizeof(c->cur.remote_nbma_natoa));
+
nhrp_peer_unref(p);
} else {
debugf(NHRP_DEBUG_COMMON,
- "cache: new type %u/%u, or peer %s, "
- "or mtu %u/%u, nbma %s --> %s (map %d)",
+ "cache: new type %u/%u, or peer %s, or mtu %u/%u, nbma %s --> %s (map %d)",
c->cur.type, type, (c->cur.peer == p) ? "same" : "diff",
c->cur.mtu, mtu, buf[0], nbma_oa ? buf[1] : "(NULL)",
c->map);
!= NULL) {
prefix_len = cie->prefix_length;
debugf(NHRP_DEBUG_COMMON,
- "shortcut res_rep: parsing CIE with "
- "prefixlen=%u",
+ "shortcut res_rep: parsing CIE with prefixlen=%u",
prefix_len);
if (prefix_len == 0 || prefix_len >= hostprefix_len)
prefix_len = hostprefix_len;
holdtime = htons(cie->holding_time);
debugf(NHRP_DEBUG_COMMON,
- "shortcut res_rep: holdtime is %u "
- "(if 0, using %u)",
+ "shortcut res_rep: holdtime is %u (if 0, using %u)",
holdtime, pp->if_ad->holdtime);
if (!holdtime)
holdtime = pp->if_ad->holdtime;
c = nhrp_cache_get(ifp, proto_addr, 1);
if (!c) {
debugf(NHRP_DEBUG_COMMON,
- "shortcut res_rep: no cache "
- "found");
+ "shortcut res_rep: no cache found");
cie->code = NHRP_CODE_INSUFFICIENT_RESOURCES;
continue;
}
if (nbma_addr)
- sockunion2str(nbma_addr, buf, sizeof buf);
+ sockunion2str(nbma_addr, buf, sizeof(buf));
debugf(NHRP_DEBUG_COMMON,
- "shortcut res_rep: updating "
- "binding for nmba addr %s",
+ "shortcut res_rep: updating binding for nmba addr %s",
nbma_addr ? buf : "(NULL)");
if (!nhrp_cache_update_binding(c, NHRP_CACHE_DYNAMIC, holdtime,
nhrp_peer_ref(pp->peer),
case NOTIFY_CACHE_UP:
if (!s->route_installed) {
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: route install "
- "%s nh (unspec) dev %s",
+ "Shortcut: route install %s nh (unspec) dev %s",
prefix2str(s->p, buf, sizeof(buf)),
s->cache->ifp->name);
* change */
s->route_installed = 0;
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: forcing route install to "
- "announce prefix change for peer %s "
- "ht %u cur nbma %s dev %s",
+ "Shortcut: forcing renewal of zebra announce on prefix change peer %s ht %u cur nbma %s dev %s",
sockunion2str(&s->cache->remote_addr,
buf[0], sizeof(buf[0])),
holding_time,
}
if (!s->cache || !s->cache->route_installed) {
debugf(NHRP_DEBUG_ROUTE,
- "Shortcut: notify cache down "
- "because cache?%s or ri?%s",
+ "Shortcut: notify cache down because cache?%s or ri?%s",
s->cache ? "yes" : "no",
s->cache ? (s->cache->route_installed ? "yes"
: "no")
if (ps) {
ps->addr = s->addr;
debugf(NHRP_DEBUG_COMMON,
- "Shortcut: "
- "calling nhrp_shortcut_update_binding");
+ "Shortcut: calling update_binding");
nhrp_shortcut_update_binding(ps, NHRP_CACHE_DYNAMIC, c,
holding_time);
} else {
}
} else {
debugf(NHRP_DEBUG_COMMON,
- "NO Shortcut because c NULL?%s or "
- "same proto?%s",
+ "NO Shortcut because c NULL?%s or same proto?%s",
c ? "no" : "yes",
proto && pp && sockunion_same(proto, &pp->dst_proto)
? "yes"
cie->holding_time = htons(if_ad->holdtime);
cie->mtu = htons(if_ad->mtu);
debugf(NHRP_DEBUG_COMMON,
- "Shortcut res_req: set cie holdtime to %u "
- "and mtu to %u. shortcut's holdtime is %u.",
+ "Shortcut res_req: set cie ht to %u and mtu to %u. shortcut ht is %u",
ntohs(cie->holding_time), ntohs(cie->mtu), s->holding_time);
nhrp_ext_request(zb, hdr, ifp);