summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2023-07-12 16:10:46 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2023-07-12 16:10:46 +0000
commit7f882662d8503cd95ff3a812ab2c9a8515f9d1a1 (patch)
tree99c5c26f41dd34d0e1e4e2ccb40e74f9a71f07bc /sys/net
parent23541d4ff17dd58157aa7b86692d8029d6038e4c (diff)
Fix solock()/sounlock() usage.
This time solock() doesn't return value and sounlock() hasn't second parameter. Bi-directional Forwarding Detection is disabled by default, so it was forgotten when solock()/sounlock() were changed. Build test done with BFD option. ok phessler claudio
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bfd.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sys/net/bfd.c b/sys/net/bfd.c
index 95e73ca5989..4b105587276 100644
--- a/sys/net/bfd.c
+++ b/sys/net/bfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bfd.c,v 1.78 2021/09/14 09:15:55 mvs Exp $ */
+/* $OpenBSD: bfd.c,v 1.79 2023/07/12 16:10:45 mvs Exp $ */
/*
* Copyright (c) 2016-2018 Peter Hessler <phessler@openbsd.org>
@@ -436,7 +436,6 @@ bfd_listener(struct bfd_config *bfd, unsigned int port)
struct socket *so;
struct mbuf *m = NULL, *mopt = NULL;
int *ip, error;
- int s;
/* sa_family and sa_len must be equal */
if (src->sa_family != dst->sa_family || src->sa_len != dst->sa_len)
@@ -453,9 +452,9 @@ bfd_listener(struct bfd_config *bfd, unsigned int port)
mopt->m_len = sizeof(int);
ip = mtod(mopt, int *);
*ip = MAXTTL;
- s = solock(so);
+ solock(so);
error = sosetopt(so, IPPROTO_IP, IP_MINTTL, mopt);
- sounlock(so, s);
+ sounlock(so);
m_freem(mopt);
if (error) {
printf("%s: sosetopt error %d\n",
@@ -480,9 +479,9 @@ bfd_listener(struct bfd_config *bfd, unsigned int port)
break;
}
- s = solock(so);
+ solock(so);
error = sobind(so, m, p);
- sounlock(so, s);
+ sounlock(so);
if (error) {
printf("%s: sobind error %d\n",
__func__, error);
@@ -518,7 +517,6 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
int error, *ip;
- int s;
/* sa_family and sa_len must be equal */
if (src->sa_family != dst->sa_family || src->sa_len != dst->sa_len)
@@ -533,9 +531,9 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
mopt->m_len = sizeof(int);
ip = mtod(mopt, int *);
*ip = IP_PORTRANGE_HIGH;
- s = solock(so);
+ solock(so);
error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt);
- sounlock(so, s);
+ sounlock(so);
m_freem(mopt);
if (error) {
printf("%s: sosetopt error %d\n",
@@ -547,9 +545,9 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
mopt->m_len = sizeof(int);
ip = mtod(mopt, int *);
*ip = MAXTTL;
- s = solock(so);
+ solock(so);
error = sosetopt(so, IPPROTO_IP, IP_TTL, mopt);
- sounlock(so, s);
+ sounlock(so);
m_freem(mopt);
if (error) {
printf("%s: sosetopt error %d\n",
@@ -561,9 +559,9 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
mopt->m_len = sizeof(int);
ip = mtod(mopt, int *);
*ip = IPTOS_PREC_INTERNETCONTROL;
- s = solock(so);
+ solock(so);
error = sosetopt(so, IPPROTO_IP, IP_TOS, mopt);
- sounlock(so, s);
+ sounlock(so);
m_freem(mopt);
if (error) {
printf("%s: sosetopt error %d\n",
@@ -588,9 +586,9 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
break;
}
- s = solock(so);
+ solock(so);
error = sobind(so, m, p);
- sounlock(so, s);
+ sounlock(so);
if (error) {
printf("%s: sobind error %d\n",
__func__, error);
@@ -611,9 +609,9 @@ bfd_sender(struct bfd_config *bfd, unsigned int port)
break;
}
- s = solock(so);
+ solock(so);
error = soconnect(so, m);
- sounlock(so, s);
+ sounlock(so);
if (error && error != ECONNREFUSED) {
printf("%s: soconnect error %d\n",
__func__, error);