summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/net/if_gif.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/net/if_gif.h')
-rw-r--r--freebsd/sys/net/if_gif.h82
1 files changed, 42 insertions, 40 deletions
diff --git a/freebsd/sys/net/if_gif.h b/freebsd/sys/net/if_gif.h
index a2f214c5..28da85bd 100644
--- a/freebsd/sys/net/if_gif.h
+++ b/freebsd/sys/net/if_gif.h
@@ -30,21 +30,17 @@
* SUCH DAMAGE.
*/
-/*
- * if_gif.h
- */
-
#ifndef _NET_IF_GIF_H_
#define _NET_IF_GIF_H_
-
#ifdef _KERNEL
#include <rtems/bsd/local/opt_inet.h>
#include <rtems/bsd/local/opt_inet6.h>
#include <netinet/in.h>
-/* xxx sigh, why route have struct route instead of pointer? */
+struct ip;
+struct ip6_hdr;
struct encaptab;
extern void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,
@@ -56,44 +52,44 @@ extern void (*ng_gif_attach_p)(struct ifnet *ifp);
extern void (*ng_gif_detach_p)(struct ifnet *ifp);
struct gif_softc {
- struct ifnet *gif_ifp;
- struct mtx gif_mtx;
- struct sockaddr *gif_psrc; /* Physical src addr */
- struct sockaddr *gif_pdst; /* Physical dst addr */
+ struct ifnet *gif_ifp;
+ struct rmlock gif_lock;
+ const struct encaptab *gif_ecookie;
+ int gif_family;
+ int gif_flags;
+ u_int gif_fibnum;
+ u_int gif_options;
+ void *gif_netgraph; /* netgraph node info */
union {
- struct route gifscr_ro; /* xxx */
+ void *hdr;
+ struct ip *iphdr;
#ifdef INET6
- struct route_in6 gifscr_ro6; /* xxx */
+ struct ip6_hdr *ip6hdr;
#endif
- } gifsc_gifscr;
- int gif_flags;
- u_int gif_fibnum;
- const struct encaptab *encap_cookie4;
- const struct encaptab *encap_cookie6;
- void *gif_netgraph; /* ng_gif(4) netgraph node info */
- u_int gif_options;
- LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */
+ } gif_uhdr;
+ LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */
};
#define GIF2IFP(sc) ((sc)->gif_ifp)
-#define GIF_LOCK_INIT(sc) mtx_init(&(sc)->gif_mtx, "gif softc", \
- NULL, MTX_DEF)
-#define GIF_LOCK_DESTROY(sc) mtx_destroy(&(sc)->gif_mtx)
-#define GIF_LOCK(sc) mtx_lock(&(sc)->gif_mtx)
-#define GIF_UNLOCK(sc) mtx_unlock(&(sc)->gif_mtx)
-#define GIF_LOCK_ASSERT(sc) mtx_assert(&(sc)->gif_mtx, MA_OWNED)
-
-#define gif_ro gifsc_gifscr.gifscr_ro
+#define GIF_LOCK_INIT(sc) rm_init(&(sc)->gif_lock, "gif softc")
+#define GIF_LOCK_DESTROY(sc) rm_destroy(&(sc)->gif_lock)
+#define GIF_RLOCK_TRACKER struct rm_priotracker gif_tracker
+#define GIF_RLOCK(sc) rm_rlock(&(sc)->gif_lock, &gif_tracker)
+#define GIF_RUNLOCK(sc) rm_runlock(&(sc)->gif_lock, &gif_tracker)
+#define GIF_RLOCK_ASSERT(sc) rm_assert(&(sc)->gif_lock, RA_RLOCKED)
+#define GIF_WLOCK(sc) rm_wlock(&(sc)->gif_lock)
+#define GIF_WUNLOCK(sc) rm_wunlock(&(sc)->gif_lock)
+#define GIF_WLOCK_ASSERT(sc) rm_assert(&(sc)->gif_lock, RA_WLOCKED)
+
+#define gif_iphdr gif_uhdr.iphdr
+#define gif_hdr gif_uhdr.hdr
#ifdef INET6
-#define gif_ro6 gifsc_gifscr.gifscr_ro6
+#define gif_ip6hdr gif_uhdr.ip6hdr
#endif
#define GIF_MTU (1280) /* Default MTU */
#define GIF_MTU_MIN (1280) /* Minimum MTU */
#define GIF_MTU_MAX (8192) /* Maximum MTU */
-#define MTAG_GIF 1080679712
-#define MTAG_GIF_CALLED 0
-
struct etherip_header {
#if BYTE_ORDER == LITTLE_ENDIAN
u_int eip_resvl:4, /* reserved */
@@ -111,20 +107,26 @@ struct etherip_header {
#define ETHERIP_ALIGN 2
/* Prototypes */
-void gif_input(struct mbuf *, int, struct ifnet *);
-int gif_output(struct ifnet *, struct mbuf *, struct sockaddr *,
+void gif_input(struct mbuf *, struct ifnet *, int, uint8_t);
+int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
struct route *);
-int gif_ioctl(struct ifnet *, u_long, caddr_t);
-int gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *);
-void gif_delete_tunnel(struct ifnet *);
int gif_encapcheck(const struct mbuf *, int, int, void *);
+#ifdef INET
+int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
+int in_gif_encapcheck(const struct mbuf *, int, int, void *);
+int in_gif_attach(struct gif_softc *);
+#endif
+#ifdef INET6
+int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
+int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
+int in6_gif_attach(struct gif_softc *);
+#endif
#endif /* _KERNEL */
#define GIFGOPTS _IOWR('i', 150, struct ifreq)
#define GIFSOPTS _IOW('i', 151, struct ifreq)
-#define GIF_ACCEPT_REVETHIP 0x0001
-#define GIF_SEND_REVETHIP 0x0010
-#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
+#define GIF_IGNORE_SOURCE 0x0002
+#define GIF_OPTMASK (GIF_IGNORE_SOURCE)
#endif /* _NET_IF_GIF_H_ */