From: mvs Date: Wed, 12 Jul 2023 16:10:45 +0000 (+0000) Subject: Fix solock()/sounlock() usage. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7266eec8276b191cc99d578332b93ff49b3e87fc;p=openbsd 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 --- 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 @@ -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);