Module Name:    src
Committed By:   ozaki-r
Date:           Mon Jul 21 12:03:38 UTC 2014

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

Log Message:
Don't assume if_init is always set

if_init may be NULL, e.g., if_vlan.

PR kern/48997


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/net/link_proto.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/link_proto.c
diff -u src/sys/net/link_proto.c:1.16 src/sys/net/link_proto.c:1.17
--- src/sys/net/link_proto.c:1.16	Tue Jul 15 20:17:53 2014
+++ src/sys/net/link_proto.c	Mon Jul 21 12:03:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: link_proto.c,v 1.16 2014/07/15 20:17:53 joerg Exp $	*/
+/*	$NetBSD: link_proto.c,v 1.17 2014/07/21 12:03:38 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.16 2014/07/15 20:17:53 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.17 2014/07/21 12:03:38 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -213,7 +213,8 @@ link_control(struct socket *so, unsigned
 		splx(s);
 		if (error != ENETRESET)
 			return error;
-		else if ((ifp->if_flags & IFF_RUNNING) != 0)
+		else if ((ifp->if_flags & IFF_RUNNING) != 0 &&
+		         ifp->if_init != NULL)
 			return (*ifp->if_init)(ifp);
 		else
 			return 0;

Reply via email to