mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Babel: Log the reason when refusing to run on an interface
The babel protocol code checks whether iface supports multicast, and whether it has a link-local address assigned. However, it doesn not give any feedback if any of those checks fail, it just silently ignores the interface. Fix this by explicitly logging when multicast check fails. Based on patch from Toke Høiland-Jørgensen, thanks!
This commit is contained in:
parent
b17adf0735
commit
c1511b92cc
@ -1639,6 +1639,20 @@ babel_remove_iface(struct babel_proto *p, struct babel_iface *ifa)
|
|||||||
rfree(ifa->pool); /* contains ifa itself, locks, socket, etc */
|
rfree(ifa->pool); /* contains ifa itself, locks, socket, etc */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
iface_is_valid(struct babel_proto *p, struct iface *iface)
|
||||||
|
{
|
||||||
|
if (!(iface->flags & IF_MULTICAST))
|
||||||
|
{
|
||||||
|
log(L_ERR "%s: Interface %s does not support multicast",
|
||||||
|
p->p.name, iface->name);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
babel_if_notify(struct proto *P, unsigned flags, struct iface *iface)
|
babel_if_notify(struct proto *P, unsigned flags, struct iface *iface)
|
||||||
{
|
{
|
||||||
@ -1658,16 +1672,13 @@ babel_if_notify(struct proto *P, unsigned flags, struct iface *iface)
|
|||||||
if (!(iface->flags & IF_UP))
|
if (!(iface->flags & IF_UP))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We only speak multicast */
|
|
||||||
if (!(iface->flags & IF_MULTICAST))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Ignore ifaces without link-local address */
|
/* Ignore ifaces without link-local address */
|
||||||
if (!iface->llv6)
|
if (!iface->llv6)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
struct babel_iface_config *ic = (void *) iface_patt_find(&cf->iface_list, iface, NULL);
|
struct babel_iface_config *ic = (void *) iface_patt_find(&cf->iface_list, iface, NULL);
|
||||||
if (ic)
|
|
||||||
|
if (ic && iface_is_valid(p, iface))
|
||||||
babel_add_iface(p, iface, ic);
|
babel_add_iface(p, iface, ic);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -1736,10 +1747,6 @@ babel_reconfigure_ifaces(struct babel_proto *p, struct babel_config *cf)
|
|||||||
if (!(iface->flags & IF_UP))
|
if (!(iface->flags & IF_UP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Ignore non-multicast ifaces */
|
|
||||||
if (!(iface->flags & IF_MULTICAST))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Ignore ifaces without link-local address */
|
/* Ignore ifaces without link-local address */
|
||||||
if (!iface->llv6)
|
if (!iface->llv6)
|
||||||
continue;
|
continue;
|
||||||
@ -1747,6 +1754,9 @@ babel_reconfigure_ifaces(struct babel_proto *p, struct babel_config *cf)
|
|||||||
struct babel_iface *ifa = babel_find_iface(p, iface);
|
struct babel_iface *ifa = babel_find_iface(p, iface);
|
||||||
struct babel_iface_config *ic = (void *) iface_patt_find(&cf->iface_list, iface, NULL);
|
struct babel_iface_config *ic = (void *) iface_patt_find(&cf->iface_list, iface, NULL);
|
||||||
|
|
||||||
|
if (ic && iface_is_valid(p, iface))
|
||||||
|
ic = NULL;
|
||||||
|
|
||||||
if (ifa && ic)
|
if (ifa && ic)
|
||||||
{
|
{
|
||||||
if (babel_reconfigure_iface(p, ifa, ic))
|
if (babel_reconfigure_iface(p, ifa, ic))
|
||||||
|
Loading…
Reference in New Issue
Block a user