FreeBSD kernel IPv4 code
|
#include <sys/cdefs.h>
#include "opt_ipstealth.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/route.h>
#include <net/route/nhop.h>
#include <net/netisr.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_fib.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
#include <netinet/ip_icmp.h>
#include <machine/in_cksum.h>
#include <sys/socketvar.h>
Go to the source code of this file.
Macros | |
#define | V_ip_dosourceroute VNET(ip_dosourceroute) |
#define | V_ip_acceptsourceroute VNET(ip_acceptsourceroute) |
#define | INA struct in_ifaddr * |
#define | SA struct sockaddr * |
#define | OPTSIZ (sizeof(opts->ip_srcrt.nop) + sizeof(opts->ip_srcrt.srcopt)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
VNET_DEFINE_STATIC (int, ip_dosourceroute) | |
SYSCTL_INT (_net_inet_ip, IPCTL_SOURCEROUTE, sourceroute, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ip_dosourceroute), 0, "Enable forwarding source routed IP packets") | |
VNET_DEFINE_STATIC (int, ip_acceptsourceroute) | |
SYSCTL_INT (_net_inet_ip, IPCTL_ACCEPTSOURCEROUTE, accept_sourceroute, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ip_acceptsourceroute), 0, "Enable accepting source routed IP packets") | |
VNET_DEFINE (int, ip_doopts) | |
SYSCTL_INT (_net_inet_ip, OID_AUTO, process_options, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(ip_doopts), 0, "Enable IP options processing ([LS]SRR, RR, TS)") | |
static void | save_rte (struct mbuf *m, u_char *, struct in_addr) |
int | ip_dooptions (struct mbuf *m, int pass) |
struct mbuf * | ip_srcroute (struct mbuf *m0) |
void | ip_stripoptions (struct mbuf *m) |
struct mbuf * | ip_insertoptions (struct mbuf *m, struct mbuf *opt, int *phlen) |
int | ip_optcopy (struct ip *ip, struct ip *jp) |
int | ip_pcbopts (struct inpcb *inp, int optname, struct mbuf *m) |
int | ip_checkrouteralert (struct mbuf *m) |
#define INA struct in_ifaddr * |
#define OPTSIZ (sizeof(opts->ip_srcrt.nop) + sizeof(opts->ip_srcrt.srcopt)) |
#define SA struct sockaddr * |
#define V_ip_acceptsourceroute VNET(ip_acceptsourceroute) |
Definition at line 82 of file ip_options.c.
#define V_ip_dosourceroute VNET(ip_dosourceroute) |
Definition at line 76 of file ip_options.c.
__FBSDID | ( | "$FreeBSD$" | ) |
int ip_checkrouteralert | ( | struct mbuf * | m | ) |
Definition at line 718 of file ip_options.c.
References ip::ip_hl, IPOPT_EOL, IPOPT_NOP, IPOPT_OFFSET, IPOPT_OLEN, IPOPT_OPTVAL, and IPOPT_RA.
Referenced by igmp_input().
int ip_dooptions | ( | struct mbuf * | m, |
int | pass | ||
) |
Definition at line 103 of file ip_options.c.
References fib4_lookup(), IA_SIN, icmp_error(), ICMP_PARAMPROB, ICMP_UNREACH, ICMP_UNREACH_FILTER_PROHIB, ICMP_UNREACH_HOST, ICMP_UNREACH_SRCFAIL, INA, inet_ntoa_r(), ip::ip_dst, ip_forward(), ip::ip_hl, IPOPT_EOL, IPOPT_LSRR, IPOPT_MINOFF, IPOPT_NOP, IPOPT_OFFSET, IPOPT_OLEN, IPOPT_OPTVAL, IPOPT_RR, IPOPT_SSRR, IPOPT_TS, IPOPT_TS_PRESPEC, IPOPT_TS_TSANDADDR, IPOPT_TS_TSONLY, IPSTAT_INC, iptime(), in_addr::s_addr, SA, save_rte(), sockaddr_in::sin_addr, V_ip_acceptsourceroute, V_ip_doopts, V_ip_dosourceroute, and V_ipforwarding.
Referenced by ip_input().
struct mbuf * ip_insertoptions | ( | struct mbuf * | m, |
struct mbuf * | opt, | ||
int * | phlen | ||
) |
Definition at line 507 of file ip_options.c.
References ip::ip_dst, ip::ip_hl, ip::ip_len, IP_MAXPACKET, ip::ip_v, ipoption::ipopt_dst, ipoption::ipopt_list, IPVERSION, and in_addr::s_addr.
Referenced by ip_output().
Definition at line 557 of file ip_options.c.
References ip::ip_hl, IPOPT_COPIED, IPOPT_EOL, IPOPT_NOP, and IPOPT_OLEN.
Referenced by ip_fragment().
int ip_pcbopts | ( | struct inpcb * | inp, |
int | optname, | ||
struct mbuf * | m | ||
) |
Definition at line 601 of file ip_options.c.
References inpcb::inp_options, INP_WLOCK_ASSERT, IPOPT_EOL, IPOPT_LSRR, IPOPT_MINOFF, IPOPT_NOP, IPOPT_OFFSET, IPOPT_OLEN, IPOPT_OPTVAL, IPOPT_SSRR, and MAX_IPOPTLEN.
Referenced by ip_ctloutput().
struct mbuf * ip_srcroute | ( | struct mbuf * | m0 | ) |
Definition at line 426 of file ip_options.c.
References ipoptrt::dst, ipopt_tag::ip_nhops, ipopt_tag::ip_srcrt, IPOPT_MINOFF, IPOPT_NOP, IPOPT_OFFSET, ipoptrt::nop, OPTSIZ, ipoptrt::route, and ipoptrt::srcopt.
Referenced by ip_savecontrol(), syncache_add(), and syncache_socket().
void ip_stripoptions | ( | struct mbuf * | m | ) |
Definition at line 483 of file ip_options.c.
References ip::ip_hl, and ip::ip_len.
Referenced by tcp_input_with_port().
|
static |
Definition at line 399 of file ip_options.c.
References ipoptrt::dst, ipopt_tag::ip_nhops, ipopt_tag::ip_srcrt, IPOPT_OFFSET, IPOPT_OLEN, and ipoptrt::srcopt.
Referenced by ip_dooptions().
SYSCTL_INT | ( | _net_inet_ip | , |
IPCTL_ACCEPTSOURCEROUTE | , | ||
accept_sourceroute | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEip_acceptsourceroute, | ||
0 | , | ||
"Enable accepting source routed IP packets" | |||
) |
SYSCTL_INT | ( | _net_inet_ip | , |
IPCTL_SOURCEROUTE | , | ||
sourceroute | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEip_dosourceroute, | ||
0 | , | ||
"Enable forwarding source routed IP packets" | |||
) |
SYSCTL_INT | ( | _net_inet_ip | , |
OID_AUTO | , | ||
process_options | , | ||
CTLFLAG_VNET| | CTLFLAG_RW, | ||
& | VNET_NAMEip_doopts, | ||
0 | , | ||
"Enable IP options processing ([LS]SRR, RR, TS)" | |||
) |
VNET_DEFINE | ( | int | , |
ip_doopts | |||
) |
VNET_DEFINE_STATIC | ( | int | , |
ip_acceptsourceroute | |||
) |
VNET_DEFINE_STATIC | ( | int | , |
ip_dosourceroute | |||
) |