diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-08 20:44:58 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-04-08 20:44:58 +0200 |
commit | f9e5c9ca061ae9d8693a766bff99b4ec63b6f5f9 (patch) | |
tree | 2d02c2e44cf49608e89749ecebf9569defc599f8 /eigrpd/eigrp_network.c | |
parent | eigrpd: Only install up to eigrp->max_paths into rib. (diff) | |
download | frr-f9e5c9ca061ae9d8693a766bff99b4ec63b6f5f9.tar.xz frr-f9e5c9ca061ae9d8693a766bff99b4ec63b6f5f9.zip |
eigrpd: Cleanup tab/spacing of the *.c files
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_network.c')
-rw-r--r-- | eigrpd/eigrp_network.c | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index fba7717b9..9898d1692 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -63,7 +63,7 @@ eigrp_sock_init(void) if (eigrpd_privs.change(ZPRIVS_RAISE)) zlog_err("eigrp_sock_init: could not raise privs, %s", - safe_strerror(errno)); + safe_strerror(errno)); eigrp_sock = socket(AF_INET, SOCK_RAW, IPPROTO_EIGRPIGP); if (eigrp_sock < 0) @@ -71,7 +71,7 @@ eigrp_sock_init(void) int save_errno = errno; if (eigrpd_privs.change(ZPRIVS_LOWER)) zlog_err("eigrp_sock_init: could not lower privs, %s", - safe_strerror(errno)); + safe_strerror(errno)); zlog_err("eigrp_read_sock_init: socket: %s", safe_strerror(save_errno)); exit(1); } @@ -84,9 +84,9 @@ eigrp_sock_init(void) int save_errno = errno; if (eigrpd_privs.change(ZPRIVS_LOWER)) zlog_err("eigrp_sock_init: could not lower privs, %s", - safe_strerror(errno)); + safe_strerror(errno)); zlog_warn("Can't set IP_HDRINCL option for fd %d: %s", eigrp_sock, - safe_strerror(save_errno)); + safe_strerror(save_errno)); } #elif defined (IPTOS_PREC_INTERNETCONTROL) @@ -97,10 +97,10 @@ eigrp_sock_init(void) { int save_errno = errno; if ( eigrpd_privs.change (ZPRIVS_LOWER) ) - zlog_err ("eigrpd_sock_init: could not lower privs, %s", - safe_strerror (errno) ); + zlog_err ("eigrpd_sock_init: could not lower privs, %s", + safe_strerror (errno) ); zlog_warn ("can't set sockopt IP_TOS %d to socket %d: %s", - tos, eigrp_sock, safe_strerror (save_errno)); + tos, eigrp_sock, safe_strerror (save_errno)); close (eigrp_sock); /* Prevent sd leak. */ return ret; } @@ -117,7 +117,7 @@ eigrp_sock_init(void) if (eigrpd_privs.change(ZPRIVS_LOWER)) { zlog_err("eigrp_sock_init: could not lower privs, %s", - safe_strerror(errno)); + safe_strerror(errno)); } return eigrp_sock; @@ -132,6 +132,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen) return; if (eigrpd_privs.change(ZPRIVS_RAISE)) zlog_err("%s: could not raise privs, %s", __func__, safe_strerror(errno)); + /* Now we try to set SO_SNDBUF to what our caller has requested * (the MTU of a newly added interface). However, if the OS has * truncated the actual buffer size to somewhat less size, try @@ -143,7 +144,7 @@ eigrp_adjust_sndbuflen(struct eigrp * eigrp, unsigned int buflen) newbuflen = getsockopt_so_sendbuf(eigrp->fd); if (newbuflen < 0 || newbuflen < (int) buflen) zlog_warn("%s: tried to set SO_SNDBUF to %u, but got %d", __func__, buflen, - newbuflen); + newbuflen); if (newbuflen >= 0) eigrp->maxsndbuflen = (unsigned int) newbuflen; else @@ -172,13 +173,13 @@ eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex) ret = setsockopt(top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *) &val, len); if (ret < 0) zlog_warn("can't setsockopt IP_MULTICAST_TTL (1) for fd %d: %s", top->fd, - safe_strerror(errno)); + safe_strerror(errno)); ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex); if (ret < 0) zlog_warn("can't setsockopt IP_MULTICAST_IF (fd %d, addr %s, " - "ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + "ifindex %u): %s", top->fd, inet_ntoa(p->u.prefix4), ifindex, + safe_strerror(errno)); return ret; } @@ -186,7 +187,7 @@ eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, unsigned int ifindex) /* Join to the EIGRP multicast group. */ int eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p, - unsigned int ifindex) + unsigned int ifindex) { int ret; @@ -194,19 +195,19 @@ eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p, htonl(EIGRP_MULTICAST_ADDRESS), ifindex); if (ret < 0) zlog_warn("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " - "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " - "on # of multicast group memberships has been exceeded?", top->fd, - inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); + "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " + "on # of multicast group memberships has been exceeded?", top->fd, + inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); else zlog_debug("interface %s [%u] join EIGRP Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + inet_ntoa(p->u.prefix4), ifindex); return ret; } int eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p, - unsigned int ifindex) + unsigned int ifindex) { int ret; @@ -214,11 +215,11 @@ eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p, htonl(EIGRP_MULTICAST_ADDRESS), ifindex); if (ret < 0) zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, " - "ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4), - ifindex, safe_strerror(errno)); + "ifindex %u, AllSPFRouters): %s", top->fd, inet_ntoa(p->u.prefix4), + ifindex, safe_strerror(errno)); else zlog_debug("interface %s [%u] leave EIGRP Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + inet_ntoa(p->u.prefix4), ifindex); return ret; } @@ -230,7 +231,6 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p) struct interface *ifp; struct listnode *node; - zlog_debug ("A"); rn = route_node_get(eigrp->networks, (struct prefix *) p); if (rn->info) { @@ -243,10 +243,9 @@ eigrp_network_set(struct eigrp *eigrp, struct prefix_ipv4 *p) PREFIX_COPY_IPV4(pref,p); rn->info = (void *) pref; - zlog_debug ("B"); /* Schedule Router ID Update. */ -// if (eigrp->router_id == 0) -// eigrp_router_id_update(eigrp); + // if (eigrp->router_id == 0) + // eigrp_router_id_update(eigrp); /* Run network config now. */ /* Get target interface. */ for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) @@ -269,13 +268,13 @@ eigrp_network_match_iface(const struct connected *co, const struct prefix *net) static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p, - struct interface *ifp) + struct interface *ifp) { struct listnode *cnode; struct connected *co; /* if interface prefix is match specified prefix, - then create socket and join multicast group. */ + then create socket and join multicast group. */ for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, co)) { @@ -298,7 +297,7 @@ eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p, /* update network type as interface flag */ /* If network type is specified previously, - skip network type setting. */ + skip network type setting. */ ei->type = IF_DEF_PARAMS (ifp)->type; /* if router_id is not configured, dont bring up @@ -354,7 +353,7 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p) route_unlock_node (rn); if (!IPV4_ADDR_SAME (&pref->u.prefix4, &p->prefix)) - return 0; + return 0; prefix_ipv4_free(rn->info); rn->info = NULL; @@ -373,7 +372,6 @@ eigrp_network_unset(struct eigrp *eigrp, struct prefix_ipv4 *p) if (eigrp_network_match_iface(co, &rn->p)) { - zlog_debug("eigrp_network_unset()2"); found = 1; route_unlock_node(rn); break; @@ -404,7 +402,7 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric) temp_metric += (eigrp->k_values[0] * metric->bandwith); if (eigrp->k_values[1]) temp_metric += ((eigrp->k_values[1] * metric->bandwith) - / (256 - metric->load)); + / (256 - metric->load)); if (eigrp->k_values[2]) temp_metric += (eigrp->k_values[2] * metric->delay); if (eigrp->k_values[3] && !eigrp->k_values[4]) @@ -413,7 +411,7 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric) temp_metric *= (eigrp->k_values[4] / metric->reliability); if (eigrp->k_values[3] && eigrp->k_values[4]) temp_metric *= ((eigrp->k_values[4] / metric->reliability) - + eigrp->k_values[3]); + + eigrp->k_values[3]); if (temp_metric <= EIGRP_MAX_METRIC) return (u_int32_t) temp_metric; @@ -423,24 +421,24 @@ eigrp_calculate_metrics(struct eigrp *eigrp, struct eigrp_metrics *metric) u_int32_t eigrp_calculate_total_metrics(struct eigrp *eigrp, - struct eigrp_neighbor_entry *entry) + struct eigrp_neighbor_entry *entry) { entry->total_metric = entry->reported_metric; u_int64_t temp_delay = (u_int64_t) entry->total_metric.delay - + (u_int64_t) EIGRP_IF_PARAM (entry->ei, delay); + + (u_int64_t) EIGRP_IF_PARAM (entry->ei, delay); entry->total_metric.delay = - temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC : (u_int32_t) temp_delay; + temp_delay > EIGRP_MAX_METRIC ? EIGRP_MAX_METRIC : (u_int32_t) temp_delay; u_int32_t bw = EIGRP_IF_PARAM (entry->ei,bandwidth); entry->total_metric.bandwith = - entry->total_metric.bandwith > bw ? bw : entry->total_metric.bandwith; + entry->total_metric.bandwith > bw ? bw : entry->total_metric.bandwith; return eigrp_calculate_metrics(eigrp, &entry->total_metric); } u_char eigrp_metrics_is_same(struct eigrp_metrics *metric1, - struct eigrp_metrics *metric2) + struct eigrp_metrics *metric2) { if ((metric1->bandwith == metric2->bandwith) && (metric1->delay == metric2->delay) @@ -452,12 +450,12 @@ eigrp_metrics_is_same(struct eigrp_metrics *metric1, && (metric1->mtu[2] == metric2->mtu[2])) return 1; - return 0; // if different + return 0; // if different } + void eigrp_external_routes_refresh (struct eigrp *eigrp, int type) { - } |