FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/jail.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
#include <netinet/in_var.h>
#include <netinet/ip_encap.h>
#include <netinet/ip_ecn.h>
#include <netinet/in_fib.h>
#include <net/if_gif.h>
Go to the source code of this file.
Macros | |
#define | GIF_TTL 30 |
#define | V_ip_gif_ttl VNET(ip_gif_ttl) |
#define | V_ipv4_hashtbl VNET(ipv4_hashtbl) |
#define | V_ipv4_srchashtbl VNET(ipv4_srchashtbl) |
#define | V_ipv4_list VNET(ipv4_list) |
#define | GIF_HASH(src, dst) |
#define | GIF_SRCHASH(src) |
#define | GIF_HASH_SC(sc) |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE_STATIC (int, ip_gif_ttl) | |
SYSCTL_INT (_net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ip_gif_ttl), 0, "Default TTL value for encapsulated packets") | |
VNET_DEFINE_STATIC (struct gif_list *, ipv4_hashtbl) | |
VNET_DEFINE_STATIC (struct gif_list *, ipv4_srchashtbl) | |
VNET_DEFINE_STATIC (struct gif_list, ipv4_list) | |
static uint32_t | in_gif_hashval (in_addr_t src, in_addr_t dst) |
static int | in_gif_checkdup (const struct gif_softc *sc, in_addr_t src, in_addr_t dst) |
static void | in_gif_set_running (struct gif_softc *sc) |
static void | in_gif_srcaddr (void *arg __unused, const struct sockaddr *sa, int event __unused) |
static void | in_gif_attach (struct gif_softc *sc) |
int | in_gif_setopts (struct gif_softc *sc, u_int options) |
int | in_gif_ioctl (struct gif_softc *sc, u_long cmd, caddr_t data) |
int | in_gif_output (struct ifnet *ifp, struct mbuf *m, int proto, uint8_t ecn) |
static int | in_gif_input (struct mbuf *m, int off, int proto, void *arg) |
static int | in_gif_lookup (const struct mbuf *m, int off, int proto, void **arg) |
void | in_gif_init (void) |
void | in_gif_uninit (void) |
Variables | |
static const struct srcaddrtab * | ipv4_srcaddrtab |
struct { | |
const struct encap_config encap | |
const struct encaptab * cookie | |
} | ipv4_encap_cfg [] |
#define GIF_HASH | ( | src, | |
dst | |||
) |
#define GIF_HASH_SC | ( | sc | ) |
#define GIF_SRCHASH | ( | src | ) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 165 of file in_gif.c.
References GIF_HASH_SC, GIF_SRCHASH, and V_ipv4_list.
Referenced by in_gif_ioctl(), and in_gif_setopts().
Definition at line 107 of file in_gif.c.
References GIF_HASH.
Referenced by in_gif_ioctl().
void in_gif_init | ( | void | ) |
Definition at line 433 of file in_gif.c.
References cookie, encap, in_gif_srcaddr(), ip_encap_attach(), ip_encap_register_srcaddr(), ipv4_encap_cfg, and ipv4_srcaddrtab.
|
static |
Definition at line 313 of file in_gif.c.
References ip::ip_tos, and KMOD_IPSTAT_INC.
int in_gif_ioctl | ( | struct gif_softc * | sc, |
u_long | cmd, | ||
caddr_t | data | ||
) |
Definition at line 196 of file in_gif.c.
References in_gif_attach(), in_gif_checkdup(), in_gif_set_running(), INADDR_ANY, ip::ip_dst, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_len, V_ipv4_hashtbl, and V_ipv4_srchashtbl.
|
static |
Definition at line 340 of file in_gif.c.
References ENCAP_DRV_LOOKUP, fib4_check_urpf(), GIF_HASH, ip::ip_dst, in_addr::s_addr, V_ipv4_hashtbl, and V_ipv4_list.
int in_gif_output | ( | struct ifnet * | ifp, |
struct mbuf * | m, | ||
int | proto, | ||
uint8_t | ecn | ||
) |
Definition at line 274 of file in_gif.c.
References ip::ip_len, ip_output(), ip::ip_p, ip::ip_tos, ip::ip_ttl, and V_ip_gif_ttl.
|
static |
Definition at line 130 of file in_gif.c.
References in_localip().
Referenced by in_gif_ioctl(), and in_gif_srcaddr().
int in_gif_setopts | ( | struct gif_softc * | sc, |
u_int | options | ||
) |
Definition at line 178 of file in_gif.c.
References in_gif_attach().
|
static |
Definition at line 145 of file in_gif.c.
References GIF_SRCHASH, in_gif_set_running(), in_addr::s_addr, sockaddr_in::sin_addr, and V_ipv4_hashtbl.
Referenced by in_gif_init().
void in_gif_uninit | ( | void | ) |
Definition at line 448 of file in_gif.c.
References cookie, ip_encap_detach(), ip_encap_unregister_srcaddr(), ipv4_encap_cfg, ipv4_srcaddrtab, V_ipv4_hashtbl, and V_ipv4_srchashtbl.
SYSCTL_INT | ( | _net_inet_ip | , |
IPCTL_GIF_TTL | , | ||
gifttl | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEip_gif_ttl, | ||
0 | , | ||
"Default TTL value for encapsulated packets" | |||
) |
VNET_DEFINE_STATIC | ( | int | , |
ip_gif_ttl | |||
) |
VNET_DEFINE_STATIC | ( | struct gif_list * | , |
ipv4_hashtbl | |||
) |
VNET_DEFINE_STATIC | ( | struct gif_list * | , |
ipv4_srchashtbl | |||
) |
VNET_DEFINE_STATIC | ( | struct gif_list | , |
ipv4_list | |||
) |
const struct encaptab* cookie |
Definition at line 396 of file in_gif.c.
Referenced by encap_detach(), encap_unregister_srcaddr(), in_gif_init(), in_gif_uninit(), process_chunk_drop(), sctp_cookie_timer(), sctp_handle_cookie_echo(), sctp_med_chunk_output(), sctp_process_cookie_existing(), sctp_process_cookie_new(), sctp_send_cookie_echo(), syncookie_generate(), syncookie_lookup(), tcp_fastopen_ccache_create(), tcp_fastopen_check_cookie(), tcp_fastopen_make_psk_cookie(), and tcp_fastopen_update_cache().
const struct encap_config encap |
Definition at line 395 of file in_gif.c.
Referenced by in_gif_init().
struct { ... } ipv4_encap_cfg[] |
Referenced by in_gif_init(), and in_gif_uninit().
|
static |
Definition at line 393 of file in_gif.c.
Referenced by in_gif_init(), in_gif_uninit(), and srcaddr_change_event().