FreeBSD kernel IPv4 code
|
#include <sys/queue.h>
#include <sys/fnv_hash.h>
#include <sys/tree.h>
#include <netinet6/in6_var.h>
Go to the source code of this file.
Data Structures | |
struct | in_aliasreq |
struct | in_ifinfo |
struct | in_ifaddr |
struct | router_info |
struct | ip_msource |
struct | ip_msource::ims_st |
struct | in_msource |
struct | in_mfilter |
struct | in_multi |
struct | in_multi::inm_st |
Macros | |
#define | ifra_dstaddr ifra_broadaddr |
#define | ia_ifp ia_ifa.ifa_ifp |
#define | ia_flags ia_ifa.ifa_flags |
#define | ia_broadaddr ia_dstaddr |
#define | IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) |
#define | IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) |
#define | IA_MASKSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_sockmask)) |
#define | IN_LNAOF(in, ifa) ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) |
#define | LLTABLE(ifp) ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt |
#define | V_in_ifaddrhashtbl VNET(in_ifaddrhashtbl) |
#define | V_in_ifaddrhead VNET(in_ifaddrhead) |
#define | V_in_ifaddrhmask VNET(in_ifaddrhmask) |
#define | INADDR_NHASH_LOG2 9 |
#define | INADDR_NHASH (1 << INADDR_NHASH_LOG2) |
#define | INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) |
#define | INADDR_HASH(x) (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) |
#define | INADDR_TO_IFADDR(addr, ia) |
#define | INADDR_TO_IFP(addr, ifp) |
#define | IFP_TO_IA(ifp, ia) |
#define | IP_MFILTER_FOREACH(imf, head) STAILQ_FOREACH(imf, head, imf_entry) |
#define | IN_MULTI_LIST_LOCK() mtx_lock(&in_multi_list_mtx) |
#define | IN_MULTI_LIST_UNLOCK() mtx_unlock(&in_multi_list_mtx) |
#define | IN_MULTI_LIST_LOCK_ASSERT() mtx_assert(&in_multi_list_mtx, MA_OWNED) |
#define | IN_MULTI_LIST_UNLOCK_ASSERT() mtx_assert(&in_multi_list_mtx, MA_NOTOWNED) |
#define | IN_MULTI_LOCK() sx_xlock(&in_multi_sx) |
#define | IN_MULTI_UNLOCK() sx_xunlock(&in_multi_sx) |
#define | IN_MULTI_LOCK_ASSERT() sx_assert(&in_multi_sx, SA_XLOCKED) |
#define | IN_MULTI_UNLOCK_ASSERT() sx_assert(&in_multi_sx, SA_XUNLOCKED) |
#define | MCAST_PASS 0 /* Pass */ |
#define | MCAST_NOTGMEMBER 1 /* This host not a member of group */ |
#define | MCAST_NOTSMEMBER 2 /* This host excluded source */ |
#define | MCAST_MUTED 3 /* [deprecated] */ |
Functions | |
SLIST_HEAD (in_multi_head, in_multi) | |
CK_STAILQ_HEAD (in_ifaddrhead, in_ifaddr) | |
CK_LIST_HEAD (in_ifaddrhashhead, in_ifaddr) | |
VNET_DECLARE (struct in_ifaddrhashhead *, in_ifaddrhashtbl) | |
VNET_DECLARE (struct in_ifaddrhead, in_ifaddrhead) | |
VNET_DECLARE (u_long, in_ifaddrhmask) | |
RB_HEAD (ip_msource_tree, ip_msource) | |
static __inline int | ip_msource_cmp (const struct ip_msource *a, const struct ip_msource *b) |
RB_PROTOTYPE (ip_msource_tree, ip_msource, ims_link, ip_msource_cmp) | |
STAILQ_HEAD (ip_mfilter_head, in_mfilter) | |
struct in_mfilter * | ip_mfilter_alloc (int mflags, int st0, int st1) |
void | ip_mfilter_free (struct in_mfilter *) |
static void | ip_mfilter_init (struct ip_mfilter_head *head) |
static struct in_mfilter * | ip_mfilter_first (const struct ip_mfilter_head *head) |
static void | ip_mfilter_insert (struct ip_mfilter_head *head, struct in_mfilter *imf) |
static void | ip_mfilter_remove (struct ip_mfilter_head *head, struct in_mfilter *imf) |
static size_t | ip_mfilter_count (struct ip_mfilter_head *head) |
static __inline uint8_t | ims_get_mode (const struct in_multi *inm, const struct ip_msource *ims, uint8_t t) |
void | inm_disconnect (struct in_multi *inm) |
static __inline void | inm_acquire_locked (struct in_multi *inm) |
static __inline void | inm_acquire (struct in_multi *inm) |
static __inline void | inm_rele_locked (struct in_multi_head *inmh, struct in_multi *inm) |
struct in_multi * | inm_lookup_locked (struct ifnet *, const struct in_addr) |
struct in_multi * | inm_lookup (struct ifnet *, const struct in_addr) |
int | imo_multi_filter (const struct ip_moptions *, const struct ifnet *, const struct sockaddr *, const struct sockaddr *) |
void | inm_commit (struct in_multi *) |
void | inm_clear_recorded (struct in_multi *) |
void | inm_print (const struct in_multi *) |
int | inm_record_source (struct in_multi *inm, const in_addr_t) |
void | inm_release_deferred (struct in_multi *) |
void | inm_release_list_deferred (struct in_multi_head *) |
void | inm_release_wait (void *) |
int | in_joingroup (struct ifnet *, const struct in_addr *, struct in_mfilter *, struct in_multi **) |
int | in_joingroup_locked (struct ifnet *, const struct in_addr *, struct in_mfilter *, struct in_multi **) |
int | in_leavegroup (struct in_multi *, struct in_mfilter *) |
int | in_leavegroup_locked (struct in_multi *, struct in_mfilter *) |
int | in_control (struct socket *, u_long, caddr_t, struct ifnet *, struct thread *) |
int | in_addprefix (struct in_ifaddr *) |
int | in_scrubprefix (struct in_ifaddr *, u_int) |
void | in_ifscrub_all (void) |
int | in_handle_ifaddr_route (int, struct in_ifaddr *) |
void | ip_input (struct mbuf *) |
void | ip_direct_input (struct mbuf *) |
void | in_ifadown (struct ifaddr *ifa, int) |
struct mbuf * | ip_tryforward (struct mbuf *) |
void * | in_domifattach (struct ifnet *) |
void | in_domifdetach (struct ifnet *, void *) |
struct rib_head * | in_inithead (uint32_t fibnum) |
Variables | |
u_char | inetctlerrmap [] |
struct mtx | in_multi_list_mtx |
struct sx | in_multi_sx |
int | ifma_restart |
#define IA_DSTSIN | ( | ia | ) | (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) |
#define IA_MASKSIN | ( | ia | ) | (&(((struct in_ifaddr *)(ia))->ia_sockmask)) |
#define IA_SIN | ( | ia | ) | (&(((struct in_ifaddr *)(ia))->ia_addr)) |
#define IFP_TO_IA | ( | ifp, | |
ia | |||
) |
#define IN_MULTI_LIST_LOCK | ( | ) | mtx_lock(&in_multi_list_mtx) |
#define IN_MULTI_LIST_LOCK_ASSERT | ( | ) | mtx_assert(&in_multi_list_mtx, MA_OWNED) |
#define IN_MULTI_LIST_UNLOCK | ( | ) | mtx_unlock(&in_multi_list_mtx) |
#define IN_MULTI_LIST_UNLOCK_ASSERT | ( | ) | mtx_assert(&in_multi_list_mtx, MA_NOTOWNED) |
#define IN_MULTI_LOCK | ( | ) | sx_xlock(&in_multi_sx) |
#define IN_MULTI_LOCK_ASSERT | ( | ) | sx_assert(&in_multi_sx, SA_XLOCKED) |
#define IN_MULTI_UNLOCK | ( | ) | sx_xunlock(&in_multi_sx) |
#define IN_MULTI_UNLOCK_ASSERT | ( | ) | sx_assert(&in_multi_sx, SA_XUNLOCKED) |
#define INADDR_HASH | ( | x | ) | (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) |
#define INADDR_HASHVAL | ( | x | ) | fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT) |
#define INADDR_NHASH (1 << INADDR_NHASH_LOG2) |
#define INADDR_TO_IFADDR | ( | addr, | |
ia | |||
) |
#define INADDR_TO_IFP | ( | addr, | |
ifp | |||
) |
#define IP_MFILTER_FOREACH | ( | imf, | |
head | |||
) | STAILQ_FOREACH(imf, head, imf_entry) |
#define LLTABLE | ( | ifp | ) | ((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt |
#define MCAST_NOTGMEMBER 1 /* This host not a member of group */ |
CK_LIST_HEAD | ( | in_ifaddrhashhead | , |
in_ifaddr | |||
) |
CK_STAILQ_HEAD | ( | in_ifaddrhead | , |
in_ifaddr | |||
) |
int imo_multi_filter | ( | const struct ip_moptions * | imo, |
const struct ifnet * | ifp, | ||
const struct sockaddr * | group, | ||
const struct sockaddr * | src | ||
) |
Definition at line 462 of file in_mcast.c.
References in_mfilter::imf_st, imo_match_group(), imo_match_source(), in_msource::imsl_st, MCAST_NOTGMEMBER, MCAST_NOTSMEMBER, and MCAST_PASS.
|
static |
Definition at line 346 of file in_var.h.
References ip_msource::ims_st::ex, ip_msource::ims_st, ip_msource::ims_st::in, in_multi::inm_st, and in_multi::inm_st::iss_ex.
Referenced by igmp_v3_enqueue_filter_change(), igmp_v3_enqueue_group_record(), and sysctl_ip_mcast_filters().
int in_addprefix | ( | struct in_ifaddr * | target | ) |
Definition at line 992 of file in.c.
References in_ifaddr::ia_ifa, in_handle_ifaddr_route(), in_hasrtprefix(), and V_nosameprefix.
Referenced by carp_ifa_addroute(), and in_aifaddr_ioctl().
int in_control | ( | struct socket * | so, |
u_long | cmd, | ||
caddr_t | data, | ||
struct ifnet * | ifp, | ||
struct thread * | td | ||
) |
Definition at line 281 of file in.c.
References in_aifaddr_ioctl(), in_control_sx, in_difaddr_ioctl(), in_gifaddr_ioctl(), INADDR_ANY, prison_check_ip4(), in_addr::s_addr, and sockaddr_in::sin_addr.
Referenced by in_ifscrub_all().
void * in_domifattach | ( | struct ifnet * | ifp | ) |
Definition at line 1719 of file in.c.
References igmp_domifattach(), in_ifinfo::ii_igmp, in_ifinfo::ii_llt, and in_lltattach().
void in_domifdetach | ( | struct ifnet * | ifp, |
void * | aux | ||
) |
Definition at line 1732 of file in.c.
References igmp_domifdetach(), and in_ifinfo::ii_llt.
int in_handle_ifaddr_route | ( | int | cmd, |
struct in_ifaddr * | ia | ||
) |
Definition at line 912 of file in.c.
References ia_getrtprefix(), in_ifaddr::ia_ifa, in_handle_prefix_route(), INADDR_BROADCAST, in_addr::s_addr, s_addr, sockaddr_in::sin_addr, and sockaddr_in::sin_family.
Referenced by in_addprefix(), and in_scrubprefix().
void in_ifadown | ( | struct ifaddr * | ifa, |
int | delete | ||
) |
Definition at line 171 of file in_rmx.c.
References in_ifadown_arg::del, in_ifadown_arg::ifa, and in_ifadownkill().
Referenced by in_difaddr_ioctl().
void in_ifscrub_all | ( | void | ) |
Definition at line 1158 of file in.c.
References igmp_domifdetach(), in_control(), and in_purgemaddrs().
struct rib_head * in_inithead | ( | uint32_t | fibnum | ) |
Definition at line 119 of file in_rmx.c.
References rib4_preadd().
int in_joingroup | ( | struct ifnet * | ifp, |
const struct in_addr * | gina, | ||
struct in_mfilter * | imf, | ||
struct in_multi ** | pinm | ||
) |
Definition at line 1201 of file in_mcast.c.
References in_joingroup_locked(), IN_MULTI_LOCK, and IN_MULTI_UNLOCK.
Referenced by carp_multicast_setup(), and in_aifaddr_ioctl().
int in_joingroup_locked | ( | struct ifnet * | ifp, |
const struct in_addr * | gina, | ||
struct in_mfilter * | imf, | ||
struct in_multi ** | pinm | ||
) |
Definition at line 1223 of file in_mcast.c.
References igmp_change_state(), imf_init(), in_getmulti(), IN_MULTI_LIST_LOCK, IN_MULTI_LIST_UNLOCK, IN_MULTI_LIST_UNLOCK_ASSERT, IN_MULTI_LOCK_ASSERT, inm_merge(), inm_release_deferred(), KTR_IGMPV3, and in_addr::s_addr.
Referenced by in_joingroup(), and inp_join_group().
int in_leavegroup | ( | struct in_multi * | inm, |
struct in_mfilter * | imf | ||
) |
Definition at line 1286 of file in_mcast.c.
References in_leavegroup_locked(), IN_MULTI_LOCK, and IN_MULTI_UNLOCK.
Referenced by carp_multicast_cleanup(), in_difaddr_ioctl(), and inp_freemoptions().
int in_leavegroup_locked | ( | struct in_multi * | inm, |
struct in_mfilter * | imf | ||
) |
Definition at line 1311 of file in_mcast.c.
References igmp_change_state(), imf_init(), IN_MULTI_LIST_LOCK, IN_MULTI_LIST_UNLOCK, IN_MULTI_LIST_UNLOCK_ASSERT, IN_MULTI_LOCK_ASSERT, in_multi::inm_addr, in_multi::inm_ifp, inm_merge(), inm_release_deferred(), KTR_IGMPV3, and in_addr::s_addr.
Referenced by in_leavegroup(), and inp_leave_group().
int in_scrubprefix | ( | struct in_ifaddr * | target, |
u_int | flags | ||
) |
Definition at line 1060 of file in.c.
References in_ifaddr::ia_addr, ia_getrtprefix(), in_ifaddr::ia_ifa, ia_need_loopback_route(), in_handle_ifaddr_route(), in_localip_more(), in_scrubprefixlle(), in_addr::s_addr, and V_in_ifaddrhead.
Referenced by carp_ifa_delroute(), in_aifaddr_ioctl(), and in_difaddr_ioctl().
|
static |
Definition at line 397 of file in_var.h.
References IN_MULTI_LIST_LOCK, IN_MULTI_LIST_UNLOCK, and inm_acquire_locked().
|
static |
Definition at line 389 of file in_var.h.
References IN_MULTI_LIST_LOCK_ASSERT, and in_multi::inm_refcount.
Referenced by igmp_final_leave(), in_getmulti(), and inm_acquire().
void inm_clear_recorded | ( | struct in_multi * | inm | ) |
Definition at line 653 of file in_mcast.c.
References ip_msource::ims_stp, IN_MULTI_LIST_LOCK_ASSERT, in_multi::inm_srcs, in_multi::inm_st, and in_multi::inm_st::iss_rec.
Referenced by igmp_ifdetach(), igmp_input_v3_group_query(), igmp_v3_cancel_link_timers(), igmp_v3_process_group_timers(), and igmp_v3_suppress_group_record().
void inm_commit | ( | struct in_multi * | inm | ) |
Definition at line 1143 of file in_mcast.c.
References ip_msource::ims_st, inm_print(), in_multi::inm_srcs, in_multi::inm_st, and KTR_IGMPV3.
Referenced by igmp_final_leave(), igmp_handle_state_change(), igmp_initial_join(), and igmp_v3_process_group_timers().
void inm_disconnect | ( | struct in_multi * | inm | ) |
Definition at line 258 of file in_mcast.c.
References ifma_restart, in_multi::inm_ifma, and in_multi::inm_ifp.
Referenced by inm_rele_locked(), and inm_release_deferred().
Definition at line 390 of file in_mcast.c.
References IN_MULTI_LIST_LOCK_ASSERT, and inm_lookup_locked().
Referenced by igmp_input_v1_report(), igmp_input_v2_query(), igmp_input_v2_report(), igmp_input_v3_query(), and in_getmulti().
Definition at line 364 of file in_mcast.c.
References IN_MULTI_LIST_LOCK_ASSERT, in_multi::inm_addr, and in_addr::s_addr.
Referenced by inm_lookup().
void inm_print | ( | const struct in_multi * | inm | ) |
Definition at line 3033 of file in_mcast.c.
Referenced by inm_commit(), and inm_merge().
int inm_record_source | ( | struct in_multi * | inm, |
const | in_addr_t | ||
) |
Definition at line 692 of file in_mcast.c.
References ip_msource::ims_haddr, ip_msource::ims_stp, in_mcast_maxgrpsrc, IN_MULTI_LIST_LOCK_ASSERT, in_multi::inm_nsrc, in_multi::inm_srcs, in_multi::inm_st, and in_multi::inm_st::iss_rec.
Referenced by igmp_input_v3_group_query().
|
static |
Definition at line 405 of file in_var.h.
References IN_MULTI_LIST_LOCK_ASSERT, inm_disconnect(), in_multi::inm_ifma, and in_multi::inm_refcount.
Referenced by igmp_ifdetach(), igmp_initial_join(), igmp_v3_cancel_link_timers(), igmp_v3_process_group_timers(), and in_purgemaddrs().
void inm_release_deferred | ( | struct in_multi * | inm | ) |
Definition at line 291 of file in_mcast.c.
References IN_MULTI_LIST_LOCK_ASSERT, inm_disconnect(), in_multi::inm_ifma, in_multi::inm_refcount, and inm_release_list_deferred().
Referenced by in_joingroup_locked(), in_leavegroup_locked(), and inp_join_group().
void inm_release_list_deferred | ( | struct in_multi_head * | inmh | ) |
Definition at line 246 of file in_mcast.c.
References in_multi_free_mtx, inm_free_list, and inm_free_task.
Referenced by igmp_fasttimo_vnet(), igmp_ifdetach(), igmp_v3_cancel_link_timers(), in_purgemaddrs(), and inm_release_deferred().
void inm_release_wait | ( | void * | ) |
void ip_direct_input | ( | struct mbuf * | ) |
void ip_input | ( | struct mbuf * | m | ) |
Definition at line 448 of file ip_input.c.
References in_ifaddr::ia_ifa, IA_SIN, ifatoia, in_cksum_hdr(), in_localip_fib(), INADDR_ANY, INADDR_BROADCAST, INADDR_HASH, inetsw, ip_dooptions(), ip::ip_dst, ip_forward(), ip::ip_hl, ip_len, ip::ip_len, IP_MF, ip_mforward, ip::ip_off, IP_OFFMASK, ip::ip_p, IP_PROBE, ip_protox, ip_reass(), ip_tryforward(), ip::ip_v, IPSTAT_INC, IPVERSION, in_addr::s_addr, satosin, V_in_ifaddrhead, V_inet_pfil_head, V_ip_mrouter, V_ip_sav, V_ip_strong_es, V_ipforwarding, and V_rsvp_on.
struct in_mfilter * ip_mfilter_alloc | ( | int | mflags, |
int | st0, | ||
int | st1 | ||
) |
Definition at line 339 of file in_mcast.c.
References imf_init().
Referenced by carp_multicast_setup(), and inp_join_group().
|
inlinestatic |
Definition at line 267 of file in_var.h.
Referenced by inp_join_group().
|
inlinestatic |
Definition at line 243 of file in_var.h.
Referenced by carp_multicast_cleanup(), carp_multicast_setup(), and inp_freemoptions().
void ip_mfilter_free | ( | struct in_mfilter * | imf | ) |
Definition at line 351 of file in_mcast.c.
References imf_purge().
Referenced by carp_multicast_cleanup(), carp_multicast_setup(), inp_freemoptions(), inp_join_group(), and inp_leave_group().
|
inlinestatic |
Definition at line 236 of file in_var.h.
Referenced by carp_multicast_setup().
|
inlinestatic |
Definition at line 250 of file in_var.h.
Referenced by carp_multicast_setup(), and inp_join_group().
|
inlinestatic |
Definition at line 257 of file in_var.h.
Referenced by carp_multicast_cleanup(), inp_freemoptions(), and inp_leave_group().
|
static |
Definition at line 205 of file in_var.h.
References ip_msource::ims_haddr.
struct mbuf * ip_tryforward | ( | struct mbuf * | m | ) |
Definition at line 233 of file ip_fastfwd.c.
References icmp_error(), ICMP_REDIRECT, ICMP_REDIRECT_HOST, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, ICMP_UNREACH, ICMP_UNREACH_FILTER_PROHIB, ICMP_UNREACH_NEEDFRAG, in_localip(), INADDR_ANY, INADDR_BROADCAST, IP_DF, ip::ip_dst, ip_findroute(), ip_fragment(), ip::ip_hl, ip_len, ip::ip_len, ip_off, ip::ip_off, IP_PROBE, ip_redir_alloc(), ip::ip_sum, ip::ip_ttl, IPSTAT_INC, IPTTLDEC, in_addr::s_addr, sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_len, V_inet_pfil_head, V_ip_doopts, and V_ipsendredirects.
Referenced by ip_input().
RB_HEAD | ( | ip_msource_tree | , |
ip_msource | |||
) |
RB_PROTOTYPE | ( | ip_msource_tree | , |
ip_msource | , | ||
ims_link | , | ||
ip_msource_cmp | |||
) |
SLIST_HEAD | ( | in_multi_head | , |
in_multi | |||
) |
STAILQ_HEAD | ( | ip_mfilter_head | , |
in_mfilter | |||
) |
VNET_DECLARE | ( | struct in_ifaddrhashhead * | , |
in_ifaddrhashtbl | |||
) |
VNET_DECLARE | ( | struct in_ifaddrhead | , |
in_ifaddrhead | |||
) |
VNET_DECLARE | ( | u_long | , |
in_ifaddrhmask | |||
) |
|
extern |
Definition at line 116 of file in_mcast.c.
Referenced by igmp_fasttimo_vnet(), igmp_ifdetach(), in_purgemaddrs(), and inm_disconnect().
|
extern |
Definition at line 107 of file in_mcast.c.
|
extern |
Definition at line 113 of file in_mcast.c.
|
extern |
Definition at line 935 of file ip_input.c.