Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Don't call if_attach, do if_initialize+if_register, ...



details:   https://anonhg.NetBSD.org/src/rev/a71e634b597b
branches:  trunk
changeset: 829339:a71e634b597b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Jan 26 11:06:32 2018 +0000

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

diffstat:

 sys/net/if_etherip.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 6a00b611ef2f -r a71e634b597b sys/net/if_etherip.c
--- a/sys/net/if_etherip.c      Fri Jan 26 09:38:26 2018 +0000
+++ b/sys/net/if_etherip.c      Fri Jan 26 11:06:32 2018 +0000
@@ -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 <rosenfeld%grumpf.hope-2000.org@localhost>
@@ -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 @@
         * 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.



Home | Main Index | Thread Index | Old Index