Bug 34590

Summary: Better patch
Product: Base System Reporter: Archie Cobbs <archie>
Component: kernAssignee: GNATS administrator <gnats-admin>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description Archie Cobbs 2002-02-03 19:20:00 UTC
 Oops, the previous patch was completely bogus. Try this
 one instead. Note: this is a patch against -current; the
 -stable patch is similar.

[********** this was supposed to be for kern/31586 ************]
[********** this was supposed to be for kern/31586 ************]

	http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/31586

[********** this was supposed to be for kern/31586 ************]
[********** this was supposed to be for kern/31586 ************]
 
 -Archie
 
 __________________________________________________________________________
 Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com
 
 Index: sys/netgraph/ng_ether.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/netgraph/ng_ether.c,v
 retrieving revision 1.21
 diff -u -r1.21 ng_ether.c
 --- sys/netgraph/ng_ether.c	10 Dec 2001 08:09:47 -0000	1.21
 +++ sys/netgraph/ng_ether.c	3 Feb 2002 19:00:48 -0000
 @@ -75,6 +75,7 @@
  	u_char		lowerOrphan;	/* whether lower is lower or orphan */
  	u_char		autoSrcAddr;	/* always overwrite source address */
  	u_char		promisc;	/* promiscuous mode enabled */
 +	u_long		hwassist;	/* hardware checksum capabilities */
  	u_int		flags;		/* flags e.g. really die */
  };
  typedef struct private *priv_p;
 @@ -317,6 +318,7 @@
  	priv->ifp = ifp;
  	IFP2NG(ifp) = node;
  	priv->autoSrcAddr = 1;
 +	priv->hwassist = ifp->if_hwassist;
  
  	/* Try to give the node the same name as the interface */
  	if (ng_name_node(node, name) != 0) {
 @@ -468,6 +470,10 @@
  	if (*hookptr != NULL)
  		return (EISCONN);
  
 +	/* Disable hardware checksums while 'upper' hook is connected */
 +	if (hookptr == &priv->upper)
 +		priv->ifp->if_hwassist = 0;
 +
  	/* OK */
  	*hookptr = hook;
  	priv->lowerOrphan = orphan;
 @@ -715,9 +721,10 @@
  {
  	const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
  
 -	if (hook == priv->upper)
 +	if (hook == priv->upper) {
  		priv->upper = NULL;
 -	else if (hook == priv->lower) {
 +		priv->ifp->if_hwassist = priv->hwassist;  /* restore h/w csum */
 +	} else if (hook == priv->lower) {
  		priv->lower = NULL;
  		priv->lowerOrphan = 0;
  	} else
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2002-02-04 22:13:14 UTC
State Changed
From-To: open->closed

Misfiled PR.  This seems to be a followup to an existing PR, but I 
can't find which PR that could be.  Can you please post again, paying 
attention to add to the beginning of your "Subject:" header a 
reference to the PR you'r replying to?  Examples of valid references 
could be: 

Re: kern/23456: My subject goes here 
Re: docs/19359: Here is the fix.