Skip to content

Commit

Permalink
netgraph: prevent panic during attach to-non ethernet devices
Browse files Browse the repository at this point in the history
This code will be purged with 16.7, but for now we tighten the
it to prevent panics that surfaced after cleaning up defunct
code paths in the legacy VPN area of the GUI.  Userland must
not be able to produce panics...

PR: https://forum.opnsense.org/index.php?topic=2385
  • Loading branch information
fichtner committed Mar 22, 2016
1 parent 4206b8b commit 56b3d83
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sys/netgraph/ng_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2923,10 +2923,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;
Expand Down

0 comments on commit 56b3d83

Please sign in to comment.