PERFORCE change 153665 for review

Marko Zec zec at FreeBSD.org
Thu Nov 27 05:15:09 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=153665

Change 153665 by zec at zec_tpx32 on 2008/11/27 13:15:02

	Bring in ip_output.c in sync with svn:head/sys/netinet/ip_output.c,
	not with //depot/vendor/freebsd/src/sys/netinet/ip_output.c
	which is broken!

Affected files ...

.. //depot/projects/vimage-commit/src/sys/netinet/ip_output.c#8 edit

Differences ...

==== //depot/projects/vimage-commit/src/sys/netinet/ip_output.c#8 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_output.c,v 1.285 2008/08/21 17:24:49 rwatson Exp $");
+__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 185348 2008-11-26 22:32:07Z zec $");
 
 #include "opt_ipfw.h"
 #include "opt_ipsec.h"
@@ -83,7 +83,9 @@
 				  (ntohl(a.s_addr)>>8)&0xFF,\
 				  (ntohl(a.s_addr))&0xFF, y);
 
+#ifdef VIMAGE_GLOBALS
 u_short ip_id;
+#endif
 
 #ifdef MBUF_STRESS_TEST
 int mbuf_frag_size = 0;
@@ -109,6 +111,8 @@
 ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
     struct ip_moptions *imo, struct inpcb *inp)
 {
+	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET(curvnet);
 	struct ip *ip;
 	struct ifnet *ifp = NULL;	/* keep compiler happy */
 	struct mbuf *m0;
@@ -130,8 +134,10 @@
 		bzero(ro, sizeof (*ro));
 	}
 
-	if (inp != NULL)
+	if (inp != NULL) {
+		M_SETFIB(m, inp->inp_inc.inc_fibnum);
 		INP_LOCK_ASSERT(inp);
+	}
 
 	if (opt) {
 		len = 0;
@@ -626,6 +632,7 @@
 ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
     u_long if_hwassist_flags, int sw_csum)
 {
+	INIT_VNET_INET(curvnet);
 	int error = 0;
 	int hlen = ip->ip_hl << 2;
 	int len = (mtu - hlen) & ~7;	/* size of payload in each fragment */
@@ -784,6 +791,7 @@
 void
 in_delayed_cksum(struct mbuf *m)
 {
+	INIT_VNET_INET(curvnet);
 	struct ip *ip;
 	u_short csum, offset;
 
@@ -819,6 +827,11 @@
 
 	error = optval = 0;
 	if (sopt->sopt_level != IPPROTO_IP) {
+		if ((sopt->sopt_level == SOL_SOCKET) &&
+		    (sopt->sopt_name == SO_SETFIB)) {
+			inp->inp_inc.inc_fibnum = so->so_fibnum;
+			return (0);
+		}
 		return (EINVAL);
 	}
 
@@ -1146,7 +1159,11 @@
 	register struct ip *ip;
 	struct mbuf *copym;
 
-	copym = m_copy(m, 0, M_COPYALL);
+	/*
+	 * Make a deep copy of the packet because we're going to
+	 * modify the pack in order to generate checksums.
+	 */
+	copym = m_dup(m, M_DONTWAIT);
 	if (copym != NULL && (copym->m_flags & M_EXT || copym->m_len < hlen))
 		copym = m_pullup(copym, hlen);
 	if (copym != NULL) {


More information about the p4-projects mailing list