mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 15:27:59 +00:00
*: frr_elevate_privs whitespace fixes
(... and one superfluous variable removed) Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
8d2dcc85dd
commit
633fc9b133
@ -567,9 +567,11 @@ int bgp_connect(struct peer *peer)
|
|||||||
#ifdef IPTOS_PREC_INTERNETCONTROL
|
#ifdef IPTOS_PREC_INTERNETCONTROL
|
||||||
frr_elevate_privs(&bgpd_privs) {
|
frr_elevate_privs(&bgpd_privs) {
|
||||||
if (sockunion_family(&peer->su) == AF_INET)
|
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)
|
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
|
#endif
|
||||||
|
|
||||||
@ -644,7 +646,8 @@ static int bgp_listener(int sock, struct sockaddr *sa, socklen_t salen,
|
|||||||
if (sa->sa_family == AF_INET)
|
if (sa->sa_family == AF_INET)
|
||||||
setsockopt_ipv4_tos(sock, IPTOS_PREC_INTERNETCONTROL);
|
setsockopt_ipv4_tos(sock, IPTOS_PREC_INTERNETCONTROL);
|
||||||
else if (sa->sa_family == AF_INET6)
|
else if (sa->sa_family == AF_INET6)
|
||||||
setsockopt_ipv6_tclass(sock, IPTOS_PREC_INTERNETCONTROL);
|
setsockopt_ipv6_tclass(sock,
|
||||||
|
IPTOS_PREC_INTERNETCONTROL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sockopt_v6only(sa->sa_family, sock);
|
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,
|
sock = vrf_socket(ainfo->ai_family,
|
||||||
ainfo->ai_socktype,
|
ainfo->ai_socktype,
|
||||||
ainfo->ai_protocol, bgp->vrf_id,
|
ainfo->ai_protocol, bgp->vrf_id,
|
||||||
(bgp->inst_type == BGP_INSTANCE_TYPE_VRF ?
|
(bgp->inst_type
|
||||||
bgp->name : NULL));
|
== BGP_INSTANCE_TYPE_VRF
|
||||||
|
? bgp->name : NULL));
|
||||||
}
|
}
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
|
flog_err_sys(LIB_ERR_SOCKET, "socket: %s",
|
||||||
|
@ -192,7 +192,8 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = open_bpf_dev(circuit);
|
retval = open_bpf_dev(circuit);
|
||||||
|
|
||||||
if (retval != ISIS_OK) {
|
if (retval != ISIS_OK) {
|
||||||
zlog_warn("%s: could not initialize the socket", __func__);
|
zlog_warn("%s: could not initialize the socket",
|
||||||
|
__func__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,8 +205,7 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = ISIS_WARNING;
|
retval = ISIS_WARNING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,8 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = open_dlpi_dev(circuit);
|
retval = open_dlpi_dev(circuit);
|
||||||
|
|
||||||
if (retval != ISIS_OK) {
|
if (retval != ISIS_OK) {
|
||||||
zlog_warn("%s: could not initialize the socket", __func__);
|
zlog_warn("%s: could not initialize the socket",
|
||||||
|
__func__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,8 +486,7 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = ISIS_WARNING;
|
retval = ISIS_WARNING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,8 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = open_packet_socket(circuit);
|
retval = open_packet_socket(circuit);
|
||||||
|
|
||||||
if (retval != ISIS_OK) {
|
if (retval != ISIS_OK) {
|
||||||
zlog_warn("%s: could not initialize the socket", __func__);
|
zlog_warn("%s: could not initialize the socket",
|
||||||
|
__func__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +207,7 @@ int isis_sock_init(struct isis_circuit *circuit)
|
|||||||
retval = ISIS_WARNING;
|
retval = ISIS_WARNING;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -717,8 +717,8 @@ int pim_mroute_socket_enable(struct pim_instance *pim)
|
|||||||
|
|
||||||
#ifdef SO_BINDTODEVICE
|
#ifdef SO_BINDTODEVICE
|
||||||
if (pim->vrf->vrf_id != VRF_DEFAULT
|
if (pim->vrf->vrf_id != VRF_DEFAULT
|
||||||
&& setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, pim->vrf->name,
|
&& setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
|
||||||
strlen(pim->vrf->name))) {
|
pim->vrf->name, strlen(pim->vrf->name))) {
|
||||||
zlog_warn("Could not setsockopt SO_BINDTODEVICE: %s",
|
zlog_warn("Could not setsockopt SO_BINDTODEVICE: %s",
|
||||||
safe_strerror(errno));
|
safe_strerror(errno));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
14
ripd/ripd.c
14
ripd/ripd.c
@ -1359,20 +1359,16 @@ static int rip_create_socket(void)
|
|||||||
|
|
||||||
frr_elevate_privs(&ripd_privs) {
|
frr_elevate_privs(&ripd_privs) {
|
||||||
setsockopt_so_recvbuf(sock, RIP_UDP_RCV_BUF);
|
setsockopt_so_recvbuf(sock, RIP_UDP_RCV_BUF);
|
||||||
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr))) < 0)
|
if ((ret = bind(sock, (struct sockaddr *)&addr, sizeof(addr)))
|
||||||
|
< 0) {
|
||||||
{
|
|
||||||
int save_errno = errno;
|
|
||||||
|
|
||||||
zlog_err("%s: Can't bind socket %d to %s port %d: %s",
|
zlog_err("%s: Can't bind socket %d to %s port %d: %s",
|
||||||
__func__,
|
__func__, sock, inet_ntoa(addr.sin_addr),
|
||||||
sock, inet_ntoa(addr.sin_addr),
|
(int)ntohs(addr.sin_port),
|
||||||
(int)ntohs(addr.sin_port), safe_strerror(save_errno));
|
safe_strerror(errno));
|
||||||
|
|
||||||
close(sock);
|
close(sock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sock;
|
return sock;
|
||||||
|
@ -126,10 +126,10 @@ static int ripng_make_socket(void)
|
|||||||
ripaddr.sin6_port = htons(RIPNG_PORT_DEFAULT);
|
ripaddr.sin6_port = htons(RIPNG_PORT_DEFAULT);
|
||||||
|
|
||||||
frr_elevate_privs(&ripngd_privs) {
|
frr_elevate_privs(&ripngd_privs) {
|
||||||
|
|
||||||
ret = bind(sock, (struct sockaddr *)&ripaddr, sizeof(ripaddr));
|
ret = bind(sock, (struct sockaddr *)&ripaddr, sizeof(ripaddr));
|
||||||
if (ret < 0) {
|
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;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,8 @@ static int get_iflink_speed(struct interface *interface)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Get the current link state for the interface */
|
/* 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 (rc < 0) {
|
||||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
|
@ -109,7 +109,8 @@ int ipforward_ipv6_on(void)
|
|||||||
|
|
||||||
len = sizeof ip6forwarding;
|
len = sizeof ip6forwarding;
|
||||||
frr_elevate_privs(&zserv_privs) {
|
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");
|
zlog_warn("can't get ip6forwarding value");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -124,7 +125,8 @@ int ipforward_ipv6_off(void)
|
|||||||
|
|
||||||
len = sizeof ip6forwarding;
|
len = sizeof ip6forwarding;
|
||||||
frr_elevate_privs(&zserv_privs) {
|
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");
|
zlog_warn("can't get ip6forwarding value");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user