summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babel_interface.c38
-rw-r--r--babeld/babel_interface.h2
-rw-r--r--babeld/babel_zebra.c16
-rw-r--r--babeld/babeld.c2
4 files changed, 31 insertions, 27 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 58da9e96d..ceff472c2 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -49,7 +49,7 @@ static vector babel_enable_if; /* enable interfaces (by cmd). */
int babel_ifp_up(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface up'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface up'");
interface_recalculate(ifp);
return 0;
@@ -58,7 +58,7 @@ int babel_ifp_up(struct interface *ifp)
int
babel_ifp_down(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface down'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface down'");
if (ifp == NULL) {
return 0;
@@ -70,7 +70,7 @@ babel_ifp_down(struct interface *ifp)
int babel_ifp_create (struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface add'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface add'");
interface_recalculate(ifp);
@@ -80,7 +80,7 @@ int babel_ifp_create (struct interface *ifp)
int
babel_ifp_destroy(struct interface *ifp)
{
- debugf(BABEL_DEBUG_IF, "receive a 'interface delete'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface delete'");
if (IS_ENABLE(ifp))
interface_reset(ifp);
@@ -95,7 +95,7 @@ babel_interface_address_add (ZAPI_CALLBACK_ARGS)
struct connected *ifc;
struct prefix *prefix;
- debugf(BABEL_DEBUG_IF, "receive a 'interface address add'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface address add'");
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD,
zclient->ibuf, vrf_id);
@@ -131,7 +131,7 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS)
struct connected *ifc;
struct prefix *prefix;
- debugf(BABEL_DEBUG_IF, "receive a 'interface address delete'");
+ debugf(BABEL_DEBUG_IF, "receive an 'interface address delete'");
ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE,
zclient->ibuf, vrf_id);
@@ -278,17 +278,18 @@ static void
babel_set_wired_internal(babel_interface_nfo *babel_ifp, int wired)
{
if(wired) {
- babel_ifp->flags |= BABEL_IF_WIRED;
- babel_ifp->flags |= BABEL_IF_SPLIT_HORIZON;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_WIRED);
+ SET_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON);
babel_ifp->cost = BABEL_DEFAULT_RXCOST_WIRED;
babel_ifp->channel = BABEL_IF_CHANNEL_NONINTERFERING;
- babel_ifp->flags &= ~BABEL_IF_LQ;
- } else {
- babel_ifp->flags &= ~BABEL_IF_WIRED;
- babel_ifp->flags &= ~BABEL_IF_SPLIT_HORIZON;
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_LQ);
+ }
+ else {
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_WIRED);
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_SPLIT_HORIZON);
babel_ifp->cost = BABEL_DEFAULT_RXCOST_WIRELESS;
babel_ifp->channel = BABEL_IF_CHANNEL_INTERFERING;
- babel_ifp->flags |= BABEL_IF_LQ;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_LQ);
}
}
@@ -578,7 +579,7 @@ interface_recalculate(struct interface *ifp)
return -1;
}
- babel_ifp->flags |= BABEL_IF_IS_UP;
+ SET_FLAG(babel_ifp->flags, BABEL_IF_IS_UP);
mtu = MIN(ifp->mtu, ifp->mtu6);
@@ -636,7 +637,7 @@ interface_recalculate(struct interface *ifp)
debugf(BABEL_DEBUG_COMMON,
"Upped interface %s (%s, cost=%d, channel=%d%s).",
ifp->name,
- (babel_ifp->flags & BABEL_IF_WIRED) ? "wired" : "wireless",
+ CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless",
babel_ifp->cost,
babel_ifp->channel,
babel_ifp->ipv4 ? ", IPv4" : "");
@@ -656,11 +657,12 @@ interface_reset(struct interface *ifp)
struct ipv6_mreq mreq;
babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp);
- if (!(babel_ifp->flags & BABEL_IF_IS_UP))
+ if (!CHECK_FLAG(babel_ifp->flags, BABEL_IF_IS_UP))
return 0;
debugf(BABEL_DEBUG_IF, "interface reset: %s", ifp->name);
- babel_ifp->flags &= ~BABEL_IF_IS_UP;
+
+ UNSET_FLAG(babel_ifp->flags, BABEL_IF_IS_UP);
flush_interface_routes(ifp, 0);
babel_ifp->buffered = 0;
@@ -689,7 +691,7 @@ interface_reset(struct interface *ifp)
debugf(BABEL_DEBUG_COMMON,"Upped network %s (%s, cost=%d%s).",
ifp->name,
- (babel_ifp->flags & BABEL_IF_WIRED) ? "wired" : "wireless",
+ CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? "wired" : "wireless",
babel_ifp->cost,
babel_ifp->ipv4 ? ", IPv4" : "");
diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h
index 08d51557e..12fa6e2ba 100644
--- a/babeld/babel_interface.h
+++ b/babeld/babel_interface.h
@@ -83,7 +83,7 @@ if_up(struct interface *ifp)
{
return (if_is_operative(ifp) &&
ifp->connected != NULL &&
- (babel_get_if_nfo(ifp)->flags & BABEL_IF_IS_UP));
+ CHECK_FLAG(babel_get_if_nfo(ifp)->flags, BABEL_IF_IS_UP));
}
struct buffered_update {
diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c
index 456c300a4..bead9f27e 100644
--- a/babeld/babel_zebra.c
+++ b/babeld/babel_zebra.c
@@ -122,7 +122,7 @@ DEFUN (debug_babel,
for(i = 0; debug_type[i].str != NULL; i++) {
if (strncmp (debug_type[i].str, argv[2]->arg,
debug_type[i].str_min_len) == 0) {
- debug |= debug_type[i].type;
+ SET_FLAG(debug, debug_type[i].type);
return CMD_SUCCESS;
}
}
@@ -152,7 +152,7 @@ DEFUN (no_debug_babel,
for (i = 0; debug_type[i].str; i++) {
if (strncmp(debug_type[i].str, argv[3]->arg,
debug_type[i].str_min_len) == 0) {
- debug &= ~debug_type[i].type;
+ UNSET_FLAG(debug, debug_type[i].type);
return CMD_SUCCESS;
}
}
@@ -178,16 +178,18 @@ debug_babel_config_write (struct vty * vty)
lines++;
}
else
+ {
for (i = 0; debug_type[i].str != NULL; i++)
- if
- (
- debug_type[i].type != BABEL_DEBUG_ALL
- && CHECK_FLAG (debug, debug_type[i].type)
- )
+ {
+ if (debug_type[i].type != BABEL_DEBUG_ALL
+ && CHECK_FLAG (debug, debug_type[i].type))
{
vty_out (vty, "debug babel %s\n", debug_type[i].str);
lines++;
}
+ }
+ }
+
if (lines)
{
vty_out (vty, "!\n");
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 3de33fd0b..510415593 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -260,7 +260,7 @@ babel_get_myid(void)
exit(1);
}
/* Clear group and global bits */
- myid[0] &= ~3;
+ UNSET_FLAG (myid[0], 3);
}
/* Make some noise so that others notice us, and send retractions in