*: frr_elevate_privs whitespace fixes

(... and one superfluous variable removed)

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-08-13 19:52:57 +02:00 committed by Quentin Young
parent 8d2dcc85dd
commit 633fc9b133
9 changed files with 33 additions and 30 deletions

View File

@ -567,9 +567,11 @@ int bgp_connect(struct peer *peer)
#ifdef IPTOS_PREC_INTERNETCONTROL
frr_elevate_privs(&bgpd_privs) {
if (sockunion_family(&peer->su) == AF_INET)
setsockopt_ipv4_tos(peer->fd, IPTOS_PREC_INTERNETCONTROL);
setsockopt_ipv4_tos(peer->fd,
IPTOS_PREC_INTERNETCONTROL);
else if (sockunion_family(&peer->su) == AF_INET6)
setsockopt_ipv6_tclass(peer->fd, IPTOS_PREC_INTERNETCONTROL);
setsockopt_ipv6_tclass(peer->fd,
IPTOS_PREC_INTERNETCONTROL);
}
#endif
@ -644,7 +646,8 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
if (sa->sa_family == AF_INET)
setsockopt_ipv4_tos(sock, IPTOS_PREC_INTERNETCONTROL);
else if (sa->sa_family == AF_INET6)
setsockopt_ipv6_tclass(sock, IPTOS_PREC_INTERNETCONTROL);
setsockopt_ipv6_tclass(sock,
IPTOS_PREC_INTERNETCONTROL);
#endif
sockopt_v6only(sa->sa_family, sock);
@ -718,8 +721,9 @@ int bgp_socket(struct bgp *bgp, unsigned short port, const char *address)
sock = vrf_socket(ainfo->ai_family,
ainfo->ai_socktype,
ainfo->ai_protocol, bgp->vrf_id,
(bgp->inst_type == BGP_INSTANCE_TYPE_VRF ?
bgp->name : NULL));
(bgp->inst_type
== BGP_INSTANCE_TYPE_VRF
? bgp->name : NULL));
}
if (sock < 0) {
flog_err_sys(LIB_ERR_SOCKET, "socket: %s",

View File

@ -192,7 +192,8 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = open_bpf_dev(circuit);
if (retval != ISIS_OK) {
zlog_warn("%s: could not initialize the socket", __func__);
zlog_warn("%s: could not initialize the socket",
__func__);
break;
}
@ -204,8 +205,7 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = ISIS_WARNING;
break;
}
}
}
return retval;
}

View File

@ -473,7 +473,8 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = open_dlpi_dev(circuit);
if (retval != ISIS_OK) {
zlog_warn("%s: could not initialize the socket", __func__);
zlog_warn("%s: could not initialize the socket",
__func__);
break;
}
@ -485,8 +486,7 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = ISIS_WARNING;
break;
}
}
}
return retval;
}

View File

@ -190,7 +190,8 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = open_packet_socket(circuit);
if (retval != ISIS_OK) {
zlog_warn("%s: could not initialize the socket", __func__);
zlog_warn("%s: could not initialize the socket",
__func__);
break;
}
@ -206,8 +207,7 @@ int isis_sock_init(struct isis_circuit *circuit)
retval = ISIS_WARNING;
break;
}
}
}
return retval;
}

View File

@ -717,8 +717,8 @@ int pim_mroute_socket_enable(struct pim_instance *pim)
#ifdef SO_BINDTODEVICE
if (pim->vrf->vrf_id != VRF_DEFAULT
&& setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, pim->vrf->name,
strlen(pim->vrf->name))) {
&& setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
pim->vrf->name, strlen(pim->vrf->name))) {
zlog_warn("Could not setsockopt SO_BINDTODEVICE: %s",
safe_strerror(errno));
close(fd);

View File

@ -1359,20 +1359,16 @@ static int rip_create_socket(void)
frr_elevate_privs(&ripd_privs) {
setsockopt_so_recvbuf(sock, RIP_UDP_RCV_BUF);
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr))) < 0)
{
int save_errno = errno;
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)))
< 0) {
zlog_err("%s: Can't bind socket %d to %s port %d: %s",
__func__,
sock, inet_ntoa(addr.sin_addr),
(int)ntohs(addr.sin_port), safe_strerror(save_errno));
__func__, sock, inet_ntoa(addr.sin_addr),
(int)ntohs(addr.sin_port),
safe_strerror(errno));
close(sock);
return ret;
}
}
return sock;

View File

@ -126,10 +126,10 @@ static int ripng_make_socket(void)
ripaddr.sin6_port = htons(RIPNG_PORT_DEFAULT);
frr_elevate_privs(&ripngd_privs) {
ret = bind(sock, (struct sockaddr *)&ripaddr, sizeof(ripaddr));
if (ret < 0) {
zlog_err("Can't bind ripng socket: %s.", safe_strerror(errno));
zlog_err("Can't bind ripng socket: %s.",
safe_strerror(errno));
goto error;
}
}

View File

@ -386,7 +386,8 @@ static int get_iflink_speed(struct interface *interface)
return 0;
}
/* Get the current link state for the interface */
rc = vrf_ioctl(interface->vrf_id, sd, SIOCETHTOOL, (char *)&ifdata);
rc = vrf_ioctl(interface->vrf_id, sd, SIOCETHTOOL,
(char *)&ifdata);
}
if (rc < 0) {
if (IS_ZEBRA_DEBUG_KERNEL)

View File

@ -109,7 +109,8 @@ int ipforward_ipv6_on(void)
len = sizeof ip6forwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
zlog_warn("can't get ip6forwarding value");
return -1;
}
@ -124,7 +125,8 @@ int ipforward_ipv6_off(void)
len = sizeof ip6forwarding;
frr_elevate_privs(&zserv_privs) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len) < 0) {
if (sysctl(mib_ipv6, MIB_SIZ, NULL, NULL, &ip6forwarding, len)
< 0) {
zlog_warn("can't get ip6forwarding value");
return -1;
}