summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2001-09-26 23:50:17 +0000
committerbrooks <brooks@FreeBSD.org>2001-09-26 23:50:17 +0000
commit375454f578bc844afecdc4726c1c0e71b42666b9 (patch)
tree88725114e0a34bf834a02b17a64b75614573d795 /sys/net
parente8d737fac928d0d8d0832ffaa84c7e3fc8264d8a (diff)
downloadFreeBSD-src-375454f578bc844afecdc4726c1c0e71b42666b9.zip
FreeBSD-src-375454f578bc844afecdc4726c1c0e71b42666b9.tar.gz
/home/brooks/ng_gif.message
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gif.c20
-rw-r--r--sys/net/if_gif.h9
2 files changed, 28 insertions, 1 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index c993e83..22ebf8f 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -87,6 +87,11 @@ static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
static struct rman gifunits[1];
LIST_HEAD(, gif_softc) gif_softc_list;
+void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af);
+void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
+void (*ng_gif_attach_p)(struct ifnet *ifp);
+void (*ng_gif_detach_p)(struct ifnet *ifp);
+
int gif_clone_create __P((struct if_clone *, int *));
void gif_clone_destroy __P((struct ifnet *));
@@ -199,6 +204,8 @@ gif_clone_create(ifc, unit)
sc->gif_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
if_attach(&sc->gif_if);
bpfattach(&sc->gif_if, DLT_NULL, sizeof(u_int));
+ if (ng_gif_attach_p != NULL)
+ (*ng_gif_attach_p)(&sc->gif_if);
LIST_INSERT_HEAD(&gif_softc_list, sc, gif_link);
return (0);
}
@@ -221,6 +228,8 @@ gif_clone_destroy(ifp)
KASSERT(err == 0, ("Unexpected error detaching encap_cookie6"));
}
+ if (ng_gif_detach_p != NULL)
+ (*ng_gif_detach_p)(ifp);
bpfdetach(ifp);
if_detach(ifp);
@@ -462,6 +471,12 @@ gif_input(m, af, gifp)
bpf_mtap(gifp, &m0);
}
+ if (ng_gif_input_p != NULL) {
+ (*ng_gif_input_p)(gifp, &m, af);
+ if (m == NULL)
+ return;
+ }
+
/*
* Put the packet to the network layer input queue according to the
* specified address family.
@@ -488,7 +503,10 @@ gif_input(m, af, gifp)
break;
#endif
default:
- m_freem(m);
+ if (ng_gif_input_orphan_p != NULL)
+ (*ng_gif_input_orphan_p)(gifp, m, af);
+ else
+ m_freem(m);
return;
}
diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h
index 40626e2..fffad5f 100644
--- a/sys/net/if_gif.h
+++ b/sys/net/if_gif.h
@@ -47,6 +47,14 @@
struct encaptab;
+extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,
+ int af);
+extern void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m,
+ int af);
+extern int (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp);
+extern void (*ng_gif_attach_p)(struct ifnet *ifp);
+extern void (*ng_gif_detach_p)(struct ifnet *ifp);
+
struct gif_softc {
struct ifnet gif_if; /* common area - must be at the top */
struct sockaddr *gif_psrc; /* Physical src addr */
@@ -61,6 +69,7 @@ struct gif_softc {
const struct encaptab *encap_cookie4;
const struct encaptab *encap_cookie6;
struct resource *r_unit; /* resource allocated for this unit */
+ void *gif_netgraph; /* ng_gif(4) netgraph node info */
LIST_ENTRY(gif_softc) gif_link; /* all gif's are linked */
};
OpenPOWER on IntegriCloud