summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-03-13 08:02:45 +0000
committerpst <pst@FreeBSD.org>1996-03-13 08:02:45 +0000
commit8c5e343745b777ff35be7f87474f61c336928c35 (patch)
tree316c93dde2aab80dc840a0fd7f9f45cf03b6b55c /sys/netinet/ip_output.c
parentbb7008423ce89079d136e937165d68311e31c3c5 (diff)
downloadFreeBSD-src-8c5e343745b777ff35be7f87474f61c336928c35.zip
FreeBSD-src-8c5e343745b777ff35be7f87474f61c336928c35.tar.gz
Fix ip option processing for raw IP sockets. This whole thing is a compromise
between ignoring options specified in the setsockopt call if IP_HDRINCL is set (the UCB choice when VJ's code was brought in) vs allowing them (what everyone else did, and what is assumed by programs everywhere...sigh). Also perform some checking of the passed down packet to avoid running off the end of a mbuf chain. Reviewed by: fenner
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 0bec023..fc2d43d 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
- * $Id: ip_output.c,v 1.30 1996/02/24 00:17:35 phk Exp $
+ * $Id: ip_output.c,v 1.31 1996/03/11 15:13:21 davidg Exp $
*/
#include <sys/param.h>
@@ -473,6 +473,8 @@ bad:
* Insert IP options into preformed packet.
* Adjust IP destination as required for IP source routing,
* as indicated by a non-zero in_addr at the start of the options.
+ *
+ * XXX This routine assumes that the packet has no options in place.
*/
static struct mbuf *
ip_insertoptions(m, opt, phlen)
@@ -511,6 +513,7 @@ ip_insertoptions(m, opt, phlen)
ip = mtod(m, struct ip *);
(void)memcpy(ip + 1, p->ipopt_list, (unsigned)optlen);
*phlen = sizeof(struct ip) + optlen;
+ ip->ip_hl = *phlen >> 2;
ip->ip_len += optlen;
return (m);
}
OpenPOWER on IntegriCloud