Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
ip.h File Reference
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <linux/skbuff.h>
#include <net/inet_sock.h>
#include <net/snmp.h>
#include <net/flow.h>

Go to the source code of this file.

Data Structures

struct  inet_skb_parm
 
struct  ipcm_cookie
 
struct  ip_ra_chain
 
struct  ip_reply_arg
 
struct  ipv4_config
 
struct  local_ports
 

Macros

#define IPSKB_FORWARDED   1
 
#define IPSKB_XFRM_TUNNEL_SIZE   2
 
#define IPSKB_XFRM_TRANSFORMED   4
 
#define IPSKB_FRAG_COMPLETE   8
 
#define IPSKB_REROUTED   16
 
#define IPCB(skb)   ((struct inet_skb_parm*)((skb)->cb))
 
#define IP_CE   0x8000 /* Flag: "Congestion" */
 
#define IP_DF   0x4000 /* Flag: "Don't Fragment" */
 
#define IP_MF   0x2000 /* Flag: "More Fragments" */
 
#define IP_OFFSET   0x1FFF /* "Fragment Offset" part */
 
#define IP_FRAG_TIME   (30 * HZ) /* fragment lifetime */
 
#define IP_REPLY_ARG_NOSRCCHECK   1
 
#define IP_INC_STATS(net, field)   SNMP_INC_STATS64((net)->mib.ip_statistics, field)
 
#define IP_INC_STATS_BH(net, field)   SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
 
#define IP_ADD_STATS(net, field, val)   SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
 
#define IP_ADD_STATS_BH(net, field, val)   SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)
 
#define IP_UPD_PO_STATS(net, field, val)   SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
 
#define IP_UPD_PO_STATS_BH(net, field, val)   SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val)
 
#define NET_INC_STATS(net, field)   SNMP_INC_STATS((net)->mib.net_statistics, field)
 
#define NET_INC_STATS_BH(net, field)   SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
 
#define NET_INC_STATS_USER(net, field)   SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
 
#define NET_ADD_STATS_BH(net, field, adnd)   SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
 
#define NET_ADD_STATS_USER(net, field, adnd)   SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
 

Enumerations

enum  ip_defrag_users {
  IP_DEFRAG_LOCAL_DELIVER, IP_DEFRAG_CALL_RA_CHAIN, IP_DEFRAG_CONNTRACK_IN, __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHRT_MAX,
  IP_DEFRAG_CONNTRACK_OUT, __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHRT_MAX, IP_DEFRAG_CONNTRACK_BRIDGE_IN, __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHRT_MAX,
  IP_DEFRAG_VS_IN, IP_DEFRAG_VS_OUT, IP_DEFRAG_VS_FWD, IP_DEFRAG_AF_PACKET,
  IP_DEFRAG_MACVLAN
}
 

Functions

int igmp_mc_proc_init (void)
 
int ip_build_and_send_pkt (struct sk_buff *skb, struct sock *sk, __be32 saddr, __be32 daddr, struct ip_options_rcu *opt)
 
int ip_rcv (struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
 
int ip_local_deliver (struct sk_buff *skb)
 
int ip_mr_input (struct sk_buff *skb)
 
int ip_output (struct sk_buff *skb)
 
int ip_mc_output (struct sk_buff *skb)
 
int ip_fragment (struct sk_buff *skb, int(*output)(struct sk_buff *))
 
int ip_do_nat (struct sk_buff *skb)
 
void ip_send_check (struct iphdr *ip)
 
int __ip_local_out (struct sk_buff *skb)
 
int ip_local_out (struct sk_buff *skb)
 
int ip_queue_xmit (struct sk_buff *skb, struct flowi *fl)
 
void ip_init (void)
 
int ip_append_data (struct sock *sk, struct flowi4 *fl4, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int len, int protolen, struct ipcm_cookie *ipc, struct rtable **rt, unsigned int flags)
 
int ip_generic_getfrag (void *from, char *to, int offset, int len, int odd, struct sk_buff *skb)
 
ssize_t ip_append_page (struct sock *sk, struct flowi4 *fl4, struct page *page, int offset, size_t size, int flags)
 
struct sk_buff__ip_make_skb (struct sock *sk, struct flowi4 *fl4, struct sk_buff_head *queue, struct inet_cork *cork)
 
int ip_send_skb (struct net *net, struct sk_buff *skb)
 
int ip_push_pending_frames (struct sock *sk, struct flowi4 *fl4)
 
void ip_flush_pending_frames (struct sock *sk)
 
struct sk_buffip_make_skb (struct sock *sk, struct flowi4 *fl4, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int length, int transhdrlen, struct ipcm_cookie *ipc, struct rtable **rtp, unsigned int flags)
 
int ip4_datagram_connect (struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
void ip_send_unicast_reply (struct net *net, struct sk_buff *skb, __be32 daddr, __be32 saddr, const struct ip_reply_arg *arg, unsigned int len)
 
unsigned long snmp_fold_field (void __percpu *mib[], int offt)
 
int snmp_mib_init (void __percpu *ptr[2], size_t mibsize, size_t align)
 
void snmp_mib_free (void __percpu *ptr[2])
 
void inet_get_local_port_range (int *low, int *high)
 
void ipfrag_init (void)
 
void ip_static_sysctl_init (void)
 
bool ip_call_ra_chain (struct sk_buff *skb)
 
int ip_defrag (struct sk_buff *skb, u32 user)
 
int ip_frag_mem (struct net *net)
 
int ip_frag_nqueues (struct net *net)
 
int ip_forward (struct sk_buff *skb)
 
void ip_options_build (struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag)
 
int ip_options_echo (struct ip_options *dopt, struct sk_buff *skb)
 
void ip_options_fragment (struct sk_buff *skb)
 
int ip_options_compile (struct net *net, struct ip_options *opt, struct sk_buff *skb)
 
int ip_options_get (struct net *net, struct ip_options_rcu **optp, unsigned char *data, int optlen)
 
int ip_options_get_from_user (struct net *net, struct ip_options_rcu **optp, unsigned char __user *data, int optlen)
 
void ip_options_undo (struct ip_options *opt)
 
void ip_forward_options (struct sk_buff *skb)
 
int ip_options_rcv_srr (struct sk_buff *skb)
 
void ipv4_pktinfo_prepare (struct sk_buff *skb)
 
void ip_cmsg_recv (struct msghdr *msg, struct sk_buff *skb)
 
int ip_cmsg_send (struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc)
 
int ip_setsockopt (struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen)
 
int ip_getsockopt (struct sock *sk, int level, int optname, char __user *optval, int __user *optlen)
 
int compat_ip_setsockopt (struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen)
 
int compat_ip_getsockopt (struct sock *sk, int level, int optname, char __user *optval, int __user *optlen)
 
int ip_ra_control (struct sock *sk, unsigned char on, void(*destructor)(struct sock *))
 
int ip_recv_error (struct sock *sk, struct msghdr *msg, int len)
 
void ip_icmp_error (struct sock *sk, struct sk_buff *skb, int err, __be16 port, u32 info, u8 *payload)
 
void ip_local_error (struct sock *sk, int err, __be32 daddr, __be16 dport, u32 info)
 

Variables

struct ip_ra_chain __rcuip_ra_chain
 
struct ipv4_config ipv4_config
 
struct local_ports sysctl_local_ports
 
unsigned longsysctl_local_reserved_ports
 
int sysctl_ip_nonlocal_bind
 
int inet_peer_threshold
 
int inet_peer_minttl
 
int inet_peer_maxttl
 
int sysctl_ip_early_demux
 
int sysctl_ip_dynaddr
 

Macro Definition Documentation

#define IP_ADD_STATS (   net,
  field,
  val 
)    SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)

Definition at line 175 of file ip.h.

#define IP_ADD_STATS_BH (   net,
  field,
  val 
)    SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)

Definition at line 176 of file ip.h.

#define IP_CE   0x8000 /* Flag: "Congestion" */

Definition at line 76 of file ip.h.

#define IP_DF   0x4000 /* Flag: "Don't Fragment" */

Definition at line 77 of file ip.h.

#define IP_FRAG_TIME   (30 * HZ) /* fragment lifetime */

Definition at line 81 of file ip.h.

#define IP_INC_STATS (   net,
  field 
)    SNMP_INC_STATS64((net)->mib.ip_statistics, field)

Definition at line 173 of file ip.h.

#define IP_INC_STATS_BH (   net,
  field 
)    SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)

Definition at line 174 of file ip.h.

#define IP_MF   0x2000 /* Flag: "More Fragments" */

Definition at line 78 of file ip.h.

#define IP_OFFSET   0x1FFF /* "Fragment Offset" part */

Definition at line 79 of file ip.h.

#define IP_REPLY_ARG_NOSRCCHECK   1

Definition at line 156 of file ip.h.

#define IP_UPD_PO_STATS (   net,
  field,
  val 
)    SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)

Definition at line 177 of file ip.h.

#define IP_UPD_PO_STATS_BH (   net,
  field,
  val 
)    SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val)

Definition at line 178 of file ip.h.

#define IPCB (   skb)    ((struct inet_skb_parm*)((skb)->cb))

Definition at line 61 of file ip.h.

#define IPSKB_FORWARDED   1

Definition at line 40 of file ip.h.

#define IPSKB_FRAG_COMPLETE   8

Definition at line 43 of file ip.h.

#define IPSKB_REROUTED   16

Definition at line 44 of file ip.h.

#define IPSKB_XFRM_TRANSFORMED   4

Definition at line 42 of file ip.h.

#define IPSKB_XFRM_TUNNEL_SIZE   2

Definition at line 41 of file ip.h.

#define NET_ADD_STATS_BH (   net,
  field,
  adnd 
)    SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)

Definition at line 182 of file ip.h.

#define NET_ADD_STATS_USER (   net,
  field,
  adnd 
)    SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)

Definition at line 183 of file ip.h.

#define NET_INC_STATS (   net,
  field 
)    SNMP_INC_STATS((net)->mib.net_statistics, field)

Definition at line 179 of file ip.h.

#define NET_INC_STATS_BH (   net,
  field 
)    SNMP_INC_STATS_BH((net)->mib.net_statistics, field)

Definition at line 180 of file ip.h.

#define NET_INC_STATS_USER (   net,
  field 
)    SNMP_INC_STATS_USER((net)->mib.net_statistics, field)

Definition at line 181 of file ip.h.

Enumeration Type Documentation

Enumerator:
IP_DEFRAG_LOCAL_DELIVER 
IP_DEFRAG_CALL_RA_CHAIN 
IP_DEFRAG_CONNTRACK_IN 
__IP_DEFRAG_CONNTRACK_IN_END 
IP_DEFRAG_CONNTRACK_OUT 
__IP_DEFRAG_CONNTRACK_OUT_END 
IP_DEFRAG_CONNTRACK_BRIDGE_IN 
__IP_DEFRAG_CONNTRACK_BRIDGE_IN 
IP_DEFRAG_VS_IN 
IP_DEFRAG_VS_OUT 
IP_DEFRAG_VS_FWD 
IP_DEFRAG_AF_PACKET 
IP_DEFRAG_MACVLAN 

Definition at line 383 of file ip.h.

Function Documentation

int __ip_local_out ( struct sk_buff skb)

Definition at line 94 of file ip_output.c.

struct sk_buff* __ip_make_skb ( struct sock sk,
struct flowi4 fl4,
struct sk_buff_head queue,
struct inet_cork cork 
)
read

Definition at line 1267 of file ip_output.c.

int compat_ip_getsockopt ( struct sock sk,
int  level,
int  optname,
char __user optval,
int __user optlen 
)
int compat_ip_setsockopt ( struct sock sk,
int  level,
int  optname,
char __user optval,
unsigned int  optlen 
)
int igmp_mc_proc_init ( void  )
void inet_get_local_port_range ( int low,
int high 
)

Definition at line 43 of file inet_connection_sock.c.

int ip4_datagram_connect ( struct sock sk,
struct sockaddr uaddr,
int  addr_len 
)

Definition at line 23 of file datagram.c.

int ip_append_data ( struct sock sk,
struct flowi4 fl4,
int   getfragvoid *from, char *to, int offset, int len, int odd, struct sk_buff *skb,
void from,
int  len,
int  protolen,
struct ipcm_cookie ipc,
struct rtable **  rt,
unsigned int  flags 
)

Definition at line 1083 of file ip_output.c.

ssize_t ip_append_page ( struct sock sk,
struct flowi4 fl4,
struct page page,
int  offset,
size_t  size,
int  flags 
)

Definition at line 1109 of file ip_output.c.

int ip_build_and_send_pkt ( struct sk_buff skb,
struct sock sk,
__be32  saddr,
__be32  daddr,
struct ip_options_rcu opt 
)

Definition at line 129 of file ip_output.c.

bool ip_call_ra_chain ( struct sk_buff skb)

Definition at line 152 of file ip_input.c.

void ip_cmsg_recv ( struct msghdr msg,
struct sk_buff skb 
)

Definition at line 148 of file ip_sockglue.c.

int ip_cmsg_send ( struct net net,
struct msghdr msg,
struct ipcm_cookie ipc 
)

Definition at line 190 of file ip_sockglue.c.

int ip_defrag ( struct sk_buff skb,
u32  user 
)

Definition at line 678 of file ip_fragment.c.

int ip_do_nat ( struct sk_buff skb)
void ip_flush_pending_frames ( struct sock sk)

Definition at line 1398 of file ip_output.c.

int ip_forward ( struct sk_buff skb)

Definition at line 55 of file ip_forward.c.

void ip_forward_options ( struct sk_buff skb)

Definition at line 561 of file ip_options.c.

int ip_frag_mem ( struct net net)

Definition at line 123 of file ip_fragment.c.

int ip_frag_nqueues ( struct net net)

Definition at line 118 of file ip_fragment.c.

int ip_fragment ( struct sk_buff skb,
int(*)(struct sk_buff *)  output 
)

Definition at line 450 of file ip_output.c.

int ip_generic_getfrag ( void from,
char to,
int  offset,
int  len,
int  odd,
struct sk_buff skb 
)

Definition at line 717 of file ip_output.c.

int ip_getsockopt ( struct sock sk,
int  level,
int  optname,
char __user optval,
int __user optlen 
)

Definition at line 1340 of file ip_sockglue.c.

void ip_icmp_error ( struct sock sk,
struct sk_buff skb,
int  err,
__be16  port,
u32  info,
u8 payload 
)

Definition at line 302 of file ip_sockglue.c.

void ip_init ( void  )

Definition at line 1536 of file ip_output.c.

int ip_local_deliver ( struct sk_buff skb)

Definition at line 252 of file ip_input.c.

void ip_local_error ( struct sock sk,
int  err,
__be32  daddr,
__be16  dport,
u32  info 
)

Definition at line 331 of file ip_sockglue.c.

int ip_local_out ( struct sk_buff skb)

Definition at line 104 of file ip_output.c.

struct sk_buff* ip_make_skb ( struct sock sk,
struct flowi4 fl4,
int   getfragvoid *from, char *to, int offset, int len, int odd, struct sk_buff *skb,
void from,
int  length,
int  transhdrlen,
struct ipcm_cookie ipc,
struct rtable **  rtp,
unsigned int  flags 
)
read

Definition at line 1403 of file ip_output.c.

int ip_mc_output ( struct sk_buff skb)

Definition at line 237 of file ip_output.c.

int ip_mr_input ( struct sk_buff skb)

Definition at line 1833 of file ipmr.c.

void ip_options_build ( struct sk_buff skb,
struct ip_options opt,
__be32  daddr,
struct rtable rt,
int  is_frag 
)

Definition at line 43 of file ip_options.c.

int ip_options_compile ( struct net net,
struct ip_options opt,
struct sk_buff skb 
)

Definition at line 259 of file ip_options.c.

int ip_options_echo ( struct ip_options dopt,
struct sk_buff skb 
)

Definition at line 90 of file ip_options.c.

void ip_options_fragment ( struct sk_buff skb)

Definition at line 213 of file ip_options.c.

int ip_options_get ( struct net net,
struct ip_options_rcu **  optp,
unsigned char data,
int  optlen 
)

Definition at line 549 of file ip_options.c.

int ip_options_get_from_user ( struct net net,
struct ip_options_rcu **  optp,
unsigned char __user data,
int  optlen 
)

Definition at line 535 of file ip_options.c.

int ip_options_rcv_srr ( struct sk_buff skb)

Definition at line 608 of file ip_options.c.

void ip_options_undo ( struct ip_options opt)

Definition at line 487 of file ip_options.c.

int ip_output ( struct sk_buff skb)

Definition at line 298 of file ip_output.c.

int ip_push_pending_frames ( struct sock sk,
struct flowi4 fl4 
)

Definition at line 1371 of file ip_output.c.

int ip_queue_xmit ( struct sk_buff skb,
struct flowi fl 
)

Definition at line 326 of file ip_output.c.

int ip_ra_control ( struct sock sk,
unsigned char  on,
void(*)(struct sock *)  destructor 
)

Definition at line 248 of file ip_sockglue.c.

int ip_rcv ( struct sk_buff skb,
struct net_device dev,
struct packet_type pt,
struct net_device orig_dev 
)

Definition at line 383 of file ip_input.c.

int ip_recv_error ( struct sock sk,
struct msghdr msg,
int  len 
)

Definition at line 371 of file ip_sockglue.c.

void ip_send_check ( struct iphdr ip)

Definition at line 87 of file ip_output.c.

int ip_send_skb ( struct net net,
struct sk_buff skb 
)

Definition at line 1356 of file ip_output.c.

void ip_send_unicast_reply ( struct net net,
struct sk_buff skb,
__be32  daddr,
__be32  saddr,
const struct ip_reply_arg arg,
unsigned int  len 
)

Definition at line 1470 of file ip_output.c.

int ip_setsockopt ( struct sock sk,
int  level,
int  optname,
char __user optval,
unsigned int  optlen 
)

Definition at line 1050 of file ip_sockglue.c.

void ip_static_sysctl_init ( void  )
void ipfrag_init ( void  )

Definition at line 881 of file ip_fragment.c.

void ipv4_pktinfo_prepare ( struct sk_buff skb)

ipv4_pktinfo_prepare - transfert some info from rtable to skb : socket : buffer

To support IP_CMSG_PKTINFO option, we store rt_iif and specific destination in skb->cb[] before dst drop. This way, receiver doesnt make cache line misses to read rtable.

Definition at line 1036 of file ip_sockglue.c.

unsigned long snmp_fold_field ( void __percpu mib[],
int  offt 
)

Definition at line 1480 of file af_inet.c.

void snmp_mib_free ( void __percpu ptr[2])
int snmp_mib_init ( void __percpu ptr[2],
size_t  mibsize,
size_t  align 
)

Definition at line 1520 of file af_inet.c.

Variable Documentation

int inet_peer_maxttl
int inet_peer_minttl
int inet_peer_threshold

Definition at line 236 of file ip_sockglue.c.

Definition at line 129 of file af_inet.c.

int sysctl_ip_dynaddr
int sysctl_ip_early_demux
int sysctl_ip_nonlocal_bind
struct local_ports sysctl_local_ports
unsigned long* sysctl_local_reserved_ports

Definition at line 40 of file inet_connection_sock.c.