diff options
Diffstat (limited to 'babeld')
| -rw-r--r-- | babeld/babel_interface.c | 33 | 
1 files changed, 22 insertions, 11 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 2b5f9569..00d53bc6 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -288,7 +288,6 @@ babel_enable_if_delete (const char *ifname)      return 1;  } -  /* [Babel Command] Babel enable on specified interface or matched network. */  DEFUN (babel_network,         babel_network_cmd, @@ -344,6 +343,25 @@ DEFUN (no_babel_network,      return CMD_SUCCESS;  } +/* There are a number of interface parameters that must be changed when +   an interface becomes wired/wireless.  In Quagga, they cannot be +   configured separately. */ + +static void +babel_set_wired_internal(babel_interface_nfo *babel_ifp, int wired) +{ +    if(wired) { +        babel_ifp->flags |= BABEL_IF_WIRED; +        babel_ifp->cost = 96; +        babel_ifp->flags &= ~BABEL_IF_LQ; +    } else { +        babel_ifp->flags &= ~BABEL_IF_WIRED; +        babel_ifp->cost = 256; +        babel_ifp->flags |= BABEL_IF_LQ; +    } + +} +  /* [Interface Command] Tell the interface is wire. */  DEFUN (babel_set_wired,         babel_set_wired_cmd, @@ -358,7 +376,7 @@ DEFUN (babel_set_wired,      babel_ifp = babel_get_if_nfo(ifp);      assert (babel_ifp != NULL); -    babel_ifp->flags |= BABEL_IF_WIRED; +    babel_set_wired_internal(babel_ifp, 1);      return CMD_SUCCESS;  } @@ -376,7 +394,7 @@ DEFUN (babel_set_wireless,      babel_ifp = babel_get_if_nfo(ifp);      assert (babel_ifp != NULL); -    babel_ifp->flags &= ~BABEL_IF_WIRED; +    babel_set_wired_internal(babel_ifp, 0);      return CMD_SUCCESS;  } @@ -557,14 +575,6 @@ interface_recalculate(struct interface *ifp)      resize_receive_buffer(mtu); -    if(!(babel_ifp->flags & BABEL_IF_WIRED)) { /* if (wired) */ -        babel_ifp->cost = 96; -        babel_ifp->flags &= ~BABEL_IF_LQ; -    } else { -        babel_ifp->cost = 256; -        babel_ifp->flags |= BABEL_IF_LQ; -    } -      memset(&mreq, 0, sizeof(mreq));      memcpy(&mreq.ipv6mr_multiaddr, protocol_group, 16);      mreq.ipv6mr_interface = ifp->ifindex; @@ -1018,6 +1028,7 @@ babel_interface_allocate (void)      babel_ifp->hello_interval = BABEL_DEFAULT_HELLO_INTERVAL;      babel_ifp->update_interval = BABEL_DEFAULT_UPDATE_INTERVAL;      babel_ifp->channel = BABEL_IF_CHANNEL_INTERFERING; +    babel_set_wired_internal(babel_ifp, 0);      return babel_ifp;  }  | 
