summaryrefslogtreecommitdiffstats
path: root/ripd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-07-02 20:51:15 +0200
committerRenato Westphal <renato@opensourcerouting.org>2018-10-27 20:16:12 +0200
commit2e37ad7fd2f33261f413b76af598e4a3c59be90a (patch)
tree8940a7e235a6efe628ec8cacb4c91502ec17ded9 /ripd
parentripd: remove vty configuration lock (diff)
downloadfrr-2e37ad7fd2f33261f413b76af598e4a3c59be90a.tar.xz
frr-2e37ad7fd2f33261f413b76af598e4a3c59be90a.zip
ripd: reduce excessive indentation in a few places
Make the code a bit easier to read. No binary changes. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd')
-rw-r--r--ripd/rip_interface.c101
1 files changed, 47 insertions, 54 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index f0bc0cd9e..3d11ba146 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -158,34 +158,32 @@ static void rip_request_interface_send(struct interface *ifp, uint8_t version)
for (ALL_LIST_ELEMENTS(ifp->connected, cnode, cnnode,
connected)) {
- if (connected->address->family == AF_INET) {
- memset(&to, 0, sizeof(struct sockaddr_in));
- to.sin_port = htons(RIP_PORT_DEFAULT);
- if (connected->destination)
- /* use specified broadcast or peer
- * destination addr */
- to.sin_addr = connected->destination->u
- .prefix4;
- else if (connected->address->prefixlen
- < IPV4_MAX_PREFIXLEN)
- /* calculate the appropriate broadcast
- * address */
- to.sin_addr
- .s_addr = ipv4_broadcast_addr(
- connected->address->u.prefix4
- .s_addr,
- connected->address->prefixlen);
- else
- /* do not know where to send the packet
- */
- continue;
-
- if (IS_RIP_DEBUG_EVENT)
- zlog_debug("SEND request to %s",
- inet_ntoa(to.sin_addr));
-
- rip_request_send(&to, ifp, version, connected);
- }
+ if (connected->address->family != AF_INET)
+ continue;
+
+ memset(&to, 0, sizeof(struct sockaddr_in));
+ to.sin_port = htons(RIP_PORT_DEFAULT);
+ if (connected->destination)
+ /* use specified broadcast or peer
+ * destination addr */
+ to.sin_addr = connected->destination->u.prefix4;
+ else if (connected->address->prefixlen
+ < IPV4_MAX_PREFIXLEN)
+ /* calculate the appropriate broadcast
+ * address */
+ to.sin_addr.s_addr = ipv4_broadcast_addr(
+ connected->address->u.prefix4.s_addr,
+ connected->address->prefixlen);
+ else
+ /* do not know where to send the packet
+ */
+ continue;
+
+ if (IS_RIP_DEBUG_EVENT)
+ zlog_debug("SEND request to %s",
+ inet_ntoa(to.sin_addr));
+
+ rip_request_send(&to, ifp, version, connected);
}
}
}
@@ -194,6 +192,7 @@ static void rip_request_interface_send(struct interface *ifp, uint8_t version)
static void rip_request_interface(struct interface *ifp)
{
struct rip_interface *ri;
+ int vsend;
/* In default ripd doesn't send RIP_REQUEST to the loopback interface.
*/
@@ -209,14 +208,12 @@ static void rip_request_interface(struct interface *ifp)
/* If there is no version configuration in the interface,
use rip's version setting. */
- {
- int vsend = ((ri->ri_send == RI_RIP_UNSPEC) ? rip->version_send
- : ri->ri_send);
- if (vsend & RIPv1)
- rip_request_interface_send(ifp, RIPv1);
- if (vsend & RIPv2)
- rip_request_interface_send(ifp, RIPv2);
- }
+ vsend = ((ri->ri_send == RI_RIP_UNSPEC) ? rip->version_send
+ : ri->ri_send);
+ if (vsend & RIPv1)
+ rip_request_interface_send(ifp, RIPv1);
+ if (vsend & RIPv2)
+ rip_request_interface_send(ifp, RIPv2);
}
#if 0
@@ -957,25 +954,21 @@ void rip_enable_apply(struct interface *ifp)
/* Update running status of the interface. */
if (ri->enable_network || ri->enable_interface) {
- {
- if (IS_RIP_DEBUG_EVENT)
- zlog_debug("turn on %s", ifp->name);
-
- /* Add interface wake up thread. */
- thread_add_timer(master, rip_interface_wakeup, ifp, 1,
- &ri->t_wakeup);
- rip_connect_set(ifp, 1);
- }
- } else {
- if (ri->running) {
- /* Might as well clean up the route table as well
- * rip_if_down sets to 0 ri->running, and displays "turn
- *off %s"
- **/
- rip_if_down(ifp);
+ if (IS_RIP_DEBUG_EVENT)
+ zlog_debug("turn on %s", ifp->name);
+
+ /* Add interface wake up thread. */
+ thread_add_timer(master, rip_interface_wakeup, ifp, 1,
+ &ri->t_wakeup);
+ rip_connect_set(ifp, 1);
+ } else if (ri->running) {
+ /* Might as well clean up the route table as well
+ * rip_if_down sets to 0 ri->running, and displays "turn
+ *off %s"
+ **/
+ rip_if_down(ifp);
- rip_connect_set(ifp, 0);
- }
+ rip_connect_set(ifp, 0);
}
}