2 * Copyright (c) 1998 The NetBSD Foundation, Inc.
3 * Copyright (c) 2014 Andrey V. Elsukov <ae@FreeBSD.org>
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Heiko W.Rupp <hwr@pilhuhn.de>
9 * IPv6-over-GRE contributed by Gert Doering <gert@greenie.muc.de>
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
32 * $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $
35 #include <sys/cdefs.h>
36 __FBSDID("$FreeBSD$");
39 #include "opt_inet6.h"
41 #include <sys/param.h>
43 #include <sys/kernel.h>
45 #include <sys/libkern.h>
46 #include <sys/malloc.h>
47 #include <sys/module.h>
51 #include <sys/protosw.h>
52 #include <sys/rmlock.h>
53 #include <sys/socket.h>
54 #include <sys/sockio.h>
56 #include <sys/sysctl.h>
57 #include <sys/syslog.h>
58 #include <sys/systm.h>
60 #include <net/ethernet.h>
62 #include <net/if_var.h>
63 #include <net/if_clone.h>
64 #include <net/if_types.h>
65 #include <net/netisr.h>
67 #include <net/route.h>
69 #include <netinet/in.h>
71 #include <netinet/in_systm.h>
72 #include <netinet/in_var.h>
73 #include <netinet/ip.h>
74 #include <netinet/ip_var.h>
78 #include <netinet/ip6.h>
79 #include <netinet6/in6_var.h>
80 #include <netinet6/ip6_var.h>
81 #include <netinet6/scope6_var.h>
84 #include <netinet/ip_encap.h>
86 #include <net/if_gre.h>
88 #include <machine/in_cksum.h>
89 #include <security/mac/mac_framework.h>
92 static const char grename[] = "gre";
93 static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation");
94 static VNET_DEFINE(struct mtx, gre_mtx);
95 #define V_gre_mtx VNET(gre_mtx)
96 #define GRE_LIST_LOCK_INIT(x) mtx_init(&V_gre_mtx, "gre_mtx", NULL, \
98 #define GRE_LIST_LOCK_DESTROY(x) mtx_destroy(&V_gre_mtx)
99 #define GRE_LIST_LOCK(x) mtx_lock(&V_gre_mtx)
100 #define GRE_LIST_UNLOCK(x) mtx_unlock(&V_gre_mtx)
102 static VNET_DEFINE(LIST_HEAD(, gre_softc), gre_softc_list);
103 #define V_gre_softc_list VNET(gre_softc_list)
104 static struct sx gre_ioctl_sx;
105 SX_SYSINIT(gre_ioctl_sx, &gre_ioctl_sx, "gre_ioctl");
107 static int gre_clone_create(struct if_clone *, int, caddr_t);
108 static void gre_clone_destroy(struct ifnet *);
109 static VNET_DEFINE(struct if_clone *, gre_cloner);
110 #define V_gre_cloner VNET(gre_cloner)
112 static void gre_qflush(struct ifnet *);
113 static int gre_transmit(struct ifnet *, struct mbuf *);
114 static int gre_ioctl(struct ifnet *, u_long, caddr_t);
115 static int gre_output(struct ifnet *, struct mbuf *,
116 const struct sockaddr *, struct route *);
118 static void gre_updatehdr(struct gre_softc *);
119 static int gre_set_tunnel(struct ifnet *, struct sockaddr *,
121 static void gre_delete_tunnel(struct ifnet *);
123 SYSCTL_DECL(_net_link);
124 static SYSCTL_NODE(_net_link, IFT_TUNNEL, gre, CTLFLAG_RW, 0,
125 "Generic Routing Encapsulation");
128 * This macro controls the default upper limitation on nesting of gre tunnels.
129 * Since, setting a large value to this macro with a careless configuration
130 * may introduce system crash, we don't allow any nestings by default.
131 * If you need to configure nested gre tunnels, you can define this macro
132 * in your kernel configuration file. However, if you do so, please be
133 * careful to configure the tunnels so that it won't make a loop.
135 #define MAX_GRE_NEST 1
138 static VNET_DEFINE(int, max_gre_nesting) = MAX_GRE_NEST;
139 #define V_max_gre_nesting VNET(max_gre_nesting)
140 SYSCTL_INT(_net_link_gre, OID_AUTO, max_nesting, CTLFLAG_RW | CTLFLAG_VNET,
141 &VNET_NAME(max_gre_nesting), 0, "Max nested tunnels");
144 vnet_gre_init(const void *unused __unused)
146 LIST_INIT(&V_gre_softc_list);
147 GRE_LIST_LOCK_INIT();
148 V_gre_cloner = if_clone_simple(grename, gre_clone_create,
149 gre_clone_destroy, 0);
151 VNET_SYSINIT(vnet_gre_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
152 vnet_gre_init, NULL);
155 vnet_gre_uninit(const void *unused __unused)
158 if_clone_detach(V_gre_cloner);
159 GRE_LIST_LOCK_DESTROY();
161 VNET_SYSUNINIT(vnet_gre_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
162 vnet_gre_uninit, NULL);
165 gre_clone_create(struct if_clone *ifc, int unit, caddr_t params)
167 struct gre_softc *sc;
169 sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO);
170 sc->gre_fibnum = curthread->td_proc->p_fibnum;
171 GRE2IFP(sc) = if_alloc(IFT_TUNNEL);
173 GRE2IFP(sc)->if_softc = sc;
174 if_initname(GRE2IFP(sc), grename, unit);
176 GRE2IFP(sc)->if_mtu = GREMTU;
177 GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
178 GRE2IFP(sc)->if_output = gre_output;
179 GRE2IFP(sc)->if_ioctl = gre_ioctl;
180 GRE2IFP(sc)->if_transmit = gre_transmit;
181 GRE2IFP(sc)->if_qflush = gre_qflush;
182 GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
183 GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
184 if_attach(GRE2IFP(sc));
185 bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t));
187 LIST_INSERT_HEAD(&V_gre_softc_list, sc, gre_list);
193 gre_clone_destroy(struct ifnet *ifp)
195 struct gre_softc *sc;
197 sx_xlock(&gre_ioctl_sx);
199 gre_delete_tunnel(ifp);
201 LIST_REMOVE(sc, gre_list);
205 ifp->if_softc = NULL;
206 sx_xunlock(&gre_ioctl_sx);
209 GRE_LOCK_DESTROY(sc);
214 gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
217 struct ifreq *ifr = (struct ifreq *)data;
218 struct sockaddr *src, *dst;
219 struct gre_softc *sc;
221 struct sockaddr_in *sin = NULL;
224 struct sockaddr_in6 *sin6 = NULL;
232 if (ifr->ifr_mtu < 576)
234 ifp->if_mtu = ifr->ifr_mtu;
237 ifp->if_flags |= IFF_UP;
251 sx_xlock(&gre_ioctl_sx);
261 case SIOCSIFPHYADDR_IN6:
267 src = (struct sockaddr *)
268 &(((struct in_aliasreq *)data)->ifra_addr);
269 dst = (struct sockaddr *)
270 &(((struct in_aliasreq *)data)->ifra_dstaddr);
274 case SIOCSIFPHYADDR_IN6:
275 src = (struct sockaddr *)
276 &(((struct in6_aliasreq *)data)->ifra_addr);
277 dst = (struct sockaddr *)
278 &(((struct in6_aliasreq *)data)->ifra_dstaddr);
282 error = EAFNOSUPPORT;
285 /* sa_family must be equal */
286 if (src->sa_family != dst->sa_family ||
287 src->sa_len != dst->sa_len)
290 /* validate sa_len */
291 switch (src->sa_family) {
294 if (src->sa_len != sizeof(struct sockaddr_in))
300 if (src->sa_len != sizeof(struct sockaddr_in6))
305 error = EAFNOSUPPORT;
308 /* check sa_family looks sane for the cmd */
309 error = EAFNOSUPPORT;
313 if (src->sa_family == AF_INET)
318 case SIOCSIFPHYADDR_IN6:
319 if (src->sa_family == AF_INET6)
324 error = EADDRNOTAVAIL;
325 switch (src->sa_family) {
328 if (satosin(src)->sin_addr.s_addr == INADDR_ANY ||
329 satosin(dst)->sin_addr.s_addr == INADDR_ANY)
335 if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr)
337 IN6_IS_ADDR_UNSPECIFIED(&satosin6(dst)->sin6_addr))
340 * Check validity of the scope zone ID of the
341 * addresses, and convert it into the kernel
342 * internal form if necessary.
344 error = sa6_embedscope(satosin6(src), 0);
347 error = sa6_embedscope(satosin6(dst), 0);
352 error = gre_set_tunnel(ifp, src, dst);
355 gre_delete_tunnel(ifp);
357 case SIOCGIFPSRCADDR:
358 case SIOCGIFPDSTADDR:
360 case SIOCGIFPSRCADDR_IN6:
361 case SIOCGIFPDSTADDR_IN6:
363 if (sc->gre_family == 0) {
364 error = EADDRNOTAVAIL;
370 case SIOCGIFPSRCADDR:
371 case SIOCGIFPDSTADDR:
372 if (sc->gre_family != AF_INET) {
373 error = EADDRNOTAVAIL;
376 sin = (struct sockaddr_in *)&ifr->ifr_addr;
377 memset(sin, 0, sizeof(*sin));
378 sin->sin_family = AF_INET;
379 sin->sin_len = sizeof(*sin);
383 case SIOCGIFPSRCADDR_IN6:
384 case SIOCGIFPDSTADDR_IN6:
385 if (sc->gre_family != AF_INET6) {
386 error = EADDRNOTAVAIL;
389 sin6 = (struct sockaddr_in6 *)
390 &(((struct in6_ifreq *)data)->ifr_addr);
391 memset(sin6, 0, sizeof(*sin6));
392 sin6->sin6_family = AF_INET6;
393 sin6->sin6_len = sizeof(*sin6);
400 case SIOCGIFPSRCADDR:
401 sin->sin_addr = sc->gre_oip.ip_src;
403 case SIOCGIFPDSTADDR:
404 sin->sin_addr = sc->gre_oip.ip_dst;
408 case SIOCGIFPSRCADDR_IN6:
409 sin6->sin6_addr = sc->gre_oip6.ip6_src;
411 case SIOCGIFPDSTADDR_IN6:
412 sin6->sin6_addr = sc->gre_oip6.ip6_dst;
422 case SIOCGIFPSRCADDR:
423 case SIOCGIFPDSTADDR:
424 error = prison_if(curthread->td_ucred,
425 (struct sockaddr *)sin);
427 memset(sin, 0, sizeof(*sin));
431 case SIOCGIFPSRCADDR_IN6:
432 case SIOCGIFPDSTADDR_IN6:
433 error = prison_if(curthread->td_ucred,
434 (struct sockaddr *)sin6);
436 error = sa6_recoverscope(sin6);
438 memset(sin6, 0, sizeof(*sin6));
443 ifr->ifr_fib = sc->gre_fibnum;
446 if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
448 if (ifr->ifr_fib >= rt_numfibs)
451 sc->gre_fibnum = ifr->ifr_fib;
454 if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
456 if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
458 if (sc->gre_key != opt) {
466 error = copyout(&sc->gre_key, ifr->ifr_data,
467 sizeof(sc->gre_key));
470 if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
472 if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
474 if (opt & ~GRE_OPTMASK)
477 if (sc->gre_options != opt) {
479 sc->gre_options = opt;
487 error = copyout(&sc->gre_options, ifr->ifr_data,
488 sizeof(sc->gre_options));
495 sx_xunlock(&gre_ioctl_sx);
500 gre_updatehdr(struct gre_softc *sc)
502 struct grehdr *gh = NULL;
506 GRE_WLOCK_ASSERT(sc);
507 switch (sc->gre_family) {
510 sc->gre_hlen = sizeof(struct greip);
511 sc->gre_oip.ip_v = IPPROTO_IPV4;
512 sc->gre_oip.ip_hl = sizeof(struct ip) >> 2;
513 sc->gre_oip.ip_p = IPPROTO_GRE;
514 gh = &sc->gre_gihdr->gi_gre;
519 sc->gre_hlen = sizeof(struct greip6);
520 sc->gre_oip6.ip6_vfc = IPV6_VERSION;
521 sc->gre_oip6.ip6_nxt = IPPROTO_GRE;
522 gh = &sc->gre_gi6hdr->gi6_gre;
530 if (sc->gre_options & GRE_ENABLE_CSUM) {
531 flags |= GRE_FLAGS_CP;
532 sc->gre_hlen += 2 * sizeof(uint16_t);
535 if (sc->gre_key != 0) {
536 flags |= GRE_FLAGS_KP;
537 sc->gre_hlen += sizeof(uint32_t);
538 *opts++ = htonl(sc->gre_key);
540 if (sc->gre_options & GRE_ENABLE_SEQ) {
541 flags |= GRE_FLAGS_SP;
542 sc->gre_hlen += sizeof(uint32_t);
546 gh->gre_flags = htons(flags);
550 gre_detach(struct gre_softc *sc)
553 sx_assert(&gre_ioctl_sx, SA_XLOCKED);
554 if (sc->gre_ecookie != NULL)
555 encap_detach(sc->gre_ecookie);
556 sc->gre_ecookie = NULL;
560 gre_set_tunnel(struct ifnet *ifp, struct sockaddr *src,
561 struct sockaddr *dst)
563 struct gre_softc *sc, *tsc;
573 sx_assert(&gre_ioctl_sx, SA_XLOCKED);
576 LIST_FOREACH(tsc, &V_gre_softc_list, gre_list) {
577 if (tsc == sc || tsc->gre_family != src->sa_family)
580 if (tsc->gre_family == AF_INET &&
581 tsc->gre_oip.ip_src.s_addr ==
582 satosin(src)->sin_addr.s_addr &&
583 tsc->gre_oip.ip_dst.s_addr ==
584 satosin(dst)->sin_addr.s_addr) {
586 return (EADDRNOTAVAIL);
590 if (tsc->gre_family == AF_INET6 &&
591 IN6_ARE_ADDR_EQUAL(&tsc->gre_oip6.ip6_src,
592 &satosin6(src)->sin6_addr) &&
593 IN6_ARE_ADDR_EQUAL(&tsc->gre_oip6.ip6_dst,
594 &satosin6(dst)->sin6_addr)) {
596 return (EADDRNOTAVAIL);
602 switch (src->sa_family) {
605 hdr = ip = malloc(sizeof(struct greip) +
606 3 * sizeof(uint32_t), M_GRE, M_WAITOK | M_ZERO);
607 ip->ip_src = satosin(src)->sin_addr;
608 ip->ip_dst = satosin(dst)->sin_addr;
613 hdr = ip6 = malloc(sizeof(struct greip6) +
614 3 * sizeof(uint32_t), M_GRE, M_WAITOK | M_ZERO);
615 ip6->ip6_src = satosin6(src)->sin6_addr;
616 ip6->ip6_dst = satosin6(dst)->sin6_addr;
620 return (EAFNOSUPPORT);
622 if (sc->gre_family != 0)
625 if (sc->gre_family != 0)
626 free(sc->gre_hdr, M_GRE);
627 sc->gre_family = src->sa_family;
630 sc->gre_iseq = UINT32_MAX;
635 switch (src->sa_family) {
638 error = in_gre_attach(sc);
643 error = in6_gre_attach(sc);
648 ifp->if_drv_flags |= IFF_DRV_RUNNING;
649 if_link_state_change(ifp, LINK_STATE_UP);
655 gre_delete_tunnel(struct ifnet *ifp)
657 struct gre_softc *sc = ifp->if_softc;
661 family = sc->gre_family;
666 free(sc->gre_hdr, M_GRE);
668 ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
669 if_link_state_change(ifp, LINK_STATE_DOWN);
673 gre_input(struct mbuf **mp, int *offp, int proto)
675 struct gre_softc *sc;
687 sc = encap_getarg(m);
688 KASSERT(sc != NULL, ("encap_getarg returned NULL"));
691 hlen = *offp + sizeof(struct grehdr) + 4 * sizeof(uint32_t);
692 if (m->m_pkthdr.len < hlen)
694 if (m->m_len < hlen) {
695 m = m_pullup(m, hlen);
699 gh = (struct grehdr *)mtodo(m, *offp);
700 flags = ntohs(gh->gre_flags);
701 if (flags & ~GRE_FLAGS_MASK)
704 hlen = 2 * sizeof(uint16_t);
705 if (flags & GRE_FLAGS_CP) {
706 /* reserved1 field must be zero */
707 if (((uint16_t *)opts)[1] != 0)
709 if (in_cksum_skip(m, m->m_pkthdr.len, *offp) != 0)
711 hlen += 2 * sizeof(uint16_t);
714 if (flags & GRE_FLAGS_KP) {
717 * XXX: The current implementation uses the key only for outgoing
718 * packets. But we can check the key value here, or even in the
719 * encapcheck function.
723 hlen += sizeof(uint32_t);
730 if (sc->gre_key != 0 && (key != sc->gre_key || key != 0))
733 if (flags & GRE_FLAGS_SP) {
737 hlen += sizeof(uint32_t);
739 switch (ntohs(gh->gre_proto)) {
742 * For WCCP skip an additional 4 bytes if after GRE header
743 * doesn't follow an IP header.
745 if (flags == 0 && (*(uint8_t *)gh->gre_opts & 0xF0) != 0x40)
746 hlen += sizeof(uint32_t);
759 m_adj(m, *offp + hlen);
761 m->m_pkthdr.rcvif = ifp;
762 M_SETFIB(m, ifp->if_fib);
764 mac_ifnet_create_mbuf(ifp, m);
766 BPF_MTAP2(ifp, &af, sizeof(af), m);
767 if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
768 if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
769 if ((ifp->if_flags & IFF_MONITOR) != 0)
772 netisr_dispatch(isr, m);
773 return (IPPROTO_DONE);
775 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
777 return (IPPROTO_DONE);
780 #define MTAG_GRE 1307983903
782 gre_check_nesting(struct ifnet *ifp, struct mbuf *m)
789 while ((mtag = m_tag_locate(m, MTAG_GRE, 0, mtag)) != NULL) {
790 if (*(struct ifnet **)(mtag + 1) == ifp) {
791 log(LOG_NOTICE, "%s: loop detected\n", ifp->if_xname);
796 if (count > V_max_gre_nesting) {
798 "%s: if_output recursively called too many times(%d)\n",
799 ifp->if_xname, count);
802 mtag = m_tag_alloc(MTAG_GRE, 0, sizeof(struct ifnet *), M_NOWAIT);
805 *(struct ifnet **)(mtag + 1) = ifp;
806 m_tag_prepend(m, mtag);
811 gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
818 error = mac_ifnet_check_transmit(ifp, m);
822 if ((ifp->if_flags & IFF_MONITOR) != 0 ||
823 (ifp->if_flags & IFF_UP) == 0) {
828 error = gre_check_nesting(ifp, m);
832 m->m_flags &= ~(M_BCAST|M_MCAST);
833 if (dst->sa_family == AF_UNSPEC)
834 bcopy(dst->sa_data, &af, sizeof(af));
837 BPF_MTAP2(ifp, &af, sizeof(af), m);
838 m->m_pkthdr.csum_data = af; /* save af for if_transmit */
839 return (ifp->if_transmit(ifp, m));
842 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
847 gre_setseqn(struct grehdr *gh, uint32_t seq)
853 flags = ntohs(gh->gre_flags);
854 KASSERT((flags & GRE_FLAGS_SP) != 0,
855 ("gre_setseqn called, but GRE_FLAGS_SP isn't set "));
856 if (flags & GRE_FLAGS_CP)
858 if (flags & GRE_FLAGS_KP)
864 gre_transmit(struct ifnet *ifp, struct mbuf *m)
867 struct gre_softc *sc;
869 uint32_t iaf, oaf, oseq;
870 int error, hlen, olen, plen;
871 int want_seq, want_csum;
881 if (sc->gre_family == 0) {
887 iaf = m->m_pkthdr.csum_data;
888 oaf = sc->gre_family;
890 want_seq = (sc->gre_options & GRE_ENABLE_SEQ) != 0;
892 oseq = sc->gre_oseq++; /* XXX */
894 oseq = 0; /* Make compiler happy. */
895 want_csum = (sc->gre_options & GRE_ENABLE_CSUM) != 0;
896 M_SETFIB(m, sc->gre_fibnum);
897 M_PREPEND(m, hlen, M_NOWAIT);
903 bcopy(sc->gre_hdr, mtod(m, void *), hlen);
908 olen = sizeof(struct ip);
913 olen = sizeof(struct ip6_hdr);
920 gh = (struct grehdr *)mtodo(m, olen);
924 gh->gre_proto = htons(ETHERTYPE_IP);
929 gh->gre_proto = htons(ETHERTYPE_IPV6);
937 gre_setseqn(gh, oseq);
939 *(uint16_t *)gh->gre_opts = in_cksum_skip(m,
940 m->m_pkthdr.len, olen);
942 plen = m->m_pkthdr.len - hlen;
946 error = in_gre_output(m, iaf, hlen);
951 error = in6_gre_output(m, iaf, hlen);
960 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
962 if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
963 if_inc_counter(ifp, IFCOUNTER_OBYTES, plen);
969 gre_qflush(struct ifnet *ifp __unused)
975 gremodevent(module_t mod, int type, void *data)
988 static moduledata_t gre_mod = {
994 DECLARE_MODULE(if_gre, gre_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
995 MODULE_VERSION(if_gre, 1);