diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-08-03 09:49:10 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-08-03 09:49:10 +0000 |
commit | c71db6270b45ca1226999a5f490bf7f109c0cc7d (patch) | |
tree | af9c2a5eb745ca76c23639c7c3655a1d5f81a92a /sys/net/bfd.c | |
parent | 01be0bc8a680ff07a797697c253fae4917858062 (diff) |
Move solock() down to sosetopt(). A part of standalone sblock() work.
This movement required because buffers related SO_SND* and SO_RCV*
socket options should be protected with sblock(). However, standalone
sblock() has different lock order with solock() and `so_snd' and
`so_rcv' buffers. At least sblock() for `so_snd' buffer will always be
taken before solock() in the sosend() path.
The (*pr_ctloutput)() call was removed from the SOL_SOCKET level 'else'
branch. Except the SO_RTABLE case where it handled in the special way,
this is null op call.
For SO_SND* and SO_RCV* cases solock() will be replaced by sblock() in
the future.
Feedback from bluhm
Tested by bluhm naddy
ok bluhm
Diffstat (limited to 'sys/net/bfd.c')
-rw-r--r-- | sys/net/bfd.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/sys/net/bfd.c b/sys/net/bfd.c index 4b105587276..9592c1b0aea 100644 --- a/sys/net/bfd.c +++ b/sys/net/bfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bfd.c,v 1.79 2023/07/12 16:10:45 mvs Exp $ */ +/* $OpenBSD: bfd.c,v 1.80 2023/08/03 09:49:08 mvs Exp $ */ /* * Copyright (c) 2016-2018 Peter Hessler <phessler@openbsd.org> @@ -452,9 +452,7 @@ bfd_listener(struct bfd_config *bfd, unsigned int port) mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = MAXTTL; - solock(so); error = sosetopt(so, IPPROTO_IP, IP_MINTTL, mopt); - sounlock(so); m_freem(mopt); if (error) { printf("%s: sosetopt error %d\n", @@ -531,9 +529,7 @@ bfd_sender(struct bfd_config *bfd, unsigned int port) mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = IP_PORTRANGE_HIGH; - solock(so); error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt); - sounlock(so); m_freem(mopt); if (error) { printf("%s: sosetopt error %d\n", @@ -545,9 +541,7 @@ bfd_sender(struct bfd_config *bfd, unsigned int port) mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = MAXTTL; - solock(so); error = sosetopt(so, IPPROTO_IP, IP_TTL, mopt); - sounlock(so); m_freem(mopt); if (error) { printf("%s: sosetopt error %d\n", @@ -559,9 +553,7 @@ bfd_sender(struct bfd_config *bfd, unsigned int port) mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = IPTOS_PREC_INTERNETCONTROL; - solock(so); error = sosetopt(so, IPPROTO_IP, IP_TOS, mopt); - sounlock(so); m_freem(mopt); if (error) { printf("%s: sosetopt error %d\n", |