diff options
author | wollman <wollman@FreeBSD.org> | 1995-09-21 19:59:43 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-09-21 19:59:43 +0000 |
commit | 1dee1ca9d463e73e44f7b0b7fa26c2d61872f68c (patch) | |
tree | c613b8f4a6a4babf96a7f37a52589bcdc50ab2c6 /sys/netinet | |
parent | 9be1703f8870fe73b6c3e6a72799911526aec88d (diff) | |
download | FreeBSD-src-1dee1ca9d463e73e44f7b0b7fa26c2d61872f68c.zip FreeBSD-src-1dee1ca9d463e73e44f7b0b7fa26c2d61872f68c.tar.gz |
Merge with 4.4-Lite-2: fix bug that caused getsockopt of IP_HDRINCL
to fail.
Obtained from: 4.4BSD-Lite-2
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/raw_ip.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index b163941..d73c45c 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -30,8 +30,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)raw_ip.c 8.2 (Berkeley) 1/4/94 - * $Id: raw_ip.c,v 1.20 1995/06/13 17:51:16 wollman Exp $ + * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 + * $Id: raw_ip.c,v 1.21 1995/07/24 16:33:51 wollman Exp $ */ #include <sys/param.h> @@ -200,22 +200,22 @@ rip_ctloutput(op, so, level, optname, m) switch (optname) { case IP_HDRINCL: - if (op == PRCO_SETOPT || op == PRCO_GETOPT) { + error = 0; + if (op == PRCO_SETOPT) { if (m == 0 || *m == 0 || (*m)->m_len < sizeof (int)) - return (EINVAL); - if (op == PRCO_SETOPT) { - if (*mtod(*m, int *)) - inp->inp_flags |= INP_HDRINCL; - else - inp->inp_flags &= ~INP_HDRINCL; + error = EINVAL; + else if (*mtod(*m, int *)) + inp->inp_flags |= INP_HDRINCL; + else + inp->inp_flags &= ~INP_HDRINCL; + if (*m) (void)m_free(*m); - } else { - (*m)->m_len = sizeof (int); - *mtod(*m, int *) = inp->inp_flags & INP_HDRINCL; - } - return (0); + } else { + *m = m_get(M_WAIT, MT_SOOPTS); + (*m)->m_len = sizeof (int); + *mtod(*m, int *) = inp->inp_flags & INP_HDRINCL; } - break; + return (error); case IP_FW_ADD: case IP_FW_DEL: |