Module Name:    src
Committed By:   maxv
Date:           Fri Jan 26 11:06:32 UTC 2018

Modified Files:
        src/sys/net: if_etherip.c

Log Message:
Don't call if_attach, do if_initialize+if_register, otherwise when an
EtherIP packet is received the first KASSERT in if_input() fires.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/if_etherip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_etherip.c
diff -u src/sys/net/if_etherip.c:1.40 src/sys/net/if_etherip.c:1.41
--- src/sys/net/if_etherip.c:1.40	Wed Dec  6 07:40:16 2017
+++ src/sys/net/if_etherip.c	Fri Jan 26 11:06:32 2018
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_etherip.c,v 1.40 2017/12/06 07:40:16 ozaki-r Exp $        */
+/*      $NetBSD: if_etherip.c,v 1.41 2018/01/26 11:06:32 maxv Exp $        */
 
 /*
  *  Copyright (c) 2006, Hans Rosenfeld <rosenf...@grumpf.hope-2000.org>
@@ -86,7 +86,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_etherip.c,v 1.40 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_etherip.c,v 1.41 2018/01/26 11:06:32 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -266,14 +266,15 @@ etherip_attach(device_t parent, device_t
 	 * Those steps are mandatory for an Ethernet driver, the first call
 	 * being common to all network interface drivers.
 	 */
-	error = if_attach(ifp);
+	error = if_initialize(ifp);
 	if (error != 0) {
-		aprint_error_dev(self, "if_attach failed(%d)\n", error);
+		aprint_error_dev(self, "if_initialize failed(%d)\n", error);
 		ifmedia_delete_instance(&sc->sc_im, IFM_INST_ANY);
 		pmf_device_deregister(self);
 		return;
 	}
 	ether_ifattach(ifp, enaddr);
+	if_register(ifp);
 
 	/*
 	 * Add a sysctl node for that interface.

Reply via email to