mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
netgraph: prevent panic during attach to-non ethernet devices
PR: https://forum.opnsense.org/index.php?topic=2385 (cherry picked from commit56b3d8393e) (cherry picked from commit6edfc6fe9d) (cherry picked from commit9b57a37488)
This commit is contained in:
parent
b8ff7a2767
commit
02adfc59c1
1 changed files with 10 additions and 4 deletions
|
|
@ -66,6 +66,7 @@
|
|||
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/if_var.h>
|
||||
|
||||
#include <net/netisr.h>
|
||||
|
|
@ -2923,10 +2924,15 @@ ng_generic_msg(node_p here, item_p item, hook_p lasthook)
|
|||
|
||||
case NGM_ETHER_ATTACH:
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
ifp = ifunit((char *)msg->data);
|
||||
if (ifp && ng_ether_attach_p != NULL) {
|
||||
ng_ether_attach_p(ifp);
|
||||
struct ifnet *ifp = ifunit((char *)msg->data);
|
||||
|
||||
if (ng_ether_attach_p) {
|
||||
if (ifp && (ifp->if_type == IFT_ETHER ||
|
||||
ifp->if_type == IFT_L2VLAN)) {
|
||||
ng_ether_attach_p(ifp);
|
||||
} else {
|
||||
error = ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue