ip.h (6ea24cf79e055f0a62a64baa8587e2254a493c7b) ip.h (fedbb6b4ff341c1e2120f4ffbf367fd78ac3e8f3)
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the IP module.
7 *
8 * Version: @(#)ip.h 1.0.2 05/07/93

--- 22 unchanged lines hidden (view full) ---

31#include <net/route.h>
32#include <net/snmp.h>
33#include <net/flow.h>
34#include <net/flow_dissector.h>
35
36struct sock;
37
38struct inet_skb_parm {
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the IP module.
7 *
8 * Version: @(#)ip.h 1.0.2 05/07/93

--- 22 unchanged lines hidden (view full) ---

31#include <net/route.h>
32#include <net/snmp.h>
33#include <net/flow.h>
34#include <net/flow_dissector.h>
35
36struct sock;
37
38struct inet_skb_parm {
39 int iif;
39 struct ip_options opt; /* Compiled IP options */
40 unsigned char flags;
41
42#define IPSKB_FORWARDED BIT(0)
43#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
44#define IPSKB_XFRM_TRANSFORMED BIT(2)
45#define IPSKB_FRAG_COMPLETE BIT(3)
46#define IPSKB_REROUTED BIT(4)

--- 4 unchanged lines hidden (view full) ---

51};
52
53static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
54{
55 return ip_hdr(skb)->ihl * 4;
56}
57
58struct ipcm_cookie {
40 struct ip_options opt; /* Compiled IP options */
41 unsigned char flags;
42
43#define IPSKB_FORWARDED BIT(0)
44#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
45#define IPSKB_XFRM_TRANSFORMED BIT(2)
46#define IPSKB_FRAG_COMPLETE BIT(3)
47#define IPSKB_REROUTED BIT(4)

--- 4 unchanged lines hidden (view full) ---

52};
53
54static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
55{
56 return ip_hdr(skb)->ihl * 4;
57}
58
59struct ipcm_cookie {
60 struct sockcm_cookie sockc;
59 __be32 addr;
60 int oif;
61 struct ip_options_rcu *opt;
62 __u8 tx_flags;
63 __u8 ttl;
64 __s16 tos;
65 char priority;
66};

--- 114 unchanged lines hidden (view full) ---

181
182void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
183 const struct ip_options *sopt,
184 __be32 daddr, __be32 saddr,
185 const struct ip_reply_arg *arg,
186 unsigned int len);
187
188#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
61 __be32 addr;
62 int oif;
63 struct ip_options_rcu *opt;
64 __u8 tx_flags;
65 __u8 ttl;
66 __s16 tos;
67 char priority;
68};

--- 114 unchanged lines hidden (view full) ---

183
184void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
185 const struct ip_options *sopt,
186 __be32 daddr, __be32 saddr,
187 const struct ip_reply_arg *arg,
188 unsigned int len);
189
190#define IP_INC_STATS(net, field) SNMP_INC_STATS64((net)->mib.ip_statistics, field)
189#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS64_BH((net)->mib.ip_statistics, field)
191#define __IP_INC_STATS(net, field) __SNMP_INC_STATS64((net)->mib.ip_statistics, field)
190#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
192#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
191#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS64_BH((net)->mib.ip_statistics, field, val)
193#define __IP_ADD_STATS(net, field, val) __SNMP_ADD_STATS64((net)->mib.ip_statistics, field, val)
192#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
194#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
193#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS64_BH((net)->mib.ip_statistics, field, val)
195#define __IP_UPD_PO_STATS(net, field, val) __SNMP_UPD_PO_STATS64((net)->mib.ip_statistics, field, val)
194#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
196#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
195#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
196#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
197#define __NET_INC_STATS(net, field) __SNMP_INC_STATS((net)->mib.net_statistics, field)
197#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
198#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
198#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
199#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
199#define __NET_ADD_STATS(net, field, adnd) __SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
200
201u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offct);
202unsigned long snmp_fold_field(void __percpu *mib, int offt);
203#if BITS_PER_LONG==32
204u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
205 size_t syncp_offset);
206u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
207#else

--- 100 unchanged lines hidden (view full) ---

308 if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
309 dst_metric_locked(dst, RTAX_MTU) ||
310 !forwarding)
311 return dst_mtu(dst);
312
313 return min(dst->dev->mtu, IP_MAX_MTU);
314}
315
200
201u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offct);
202unsigned long snmp_fold_field(void __percpu *mib, int offt);
203#if BITS_PER_LONG==32
204u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
205 size_t syncp_offset);
206u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
207#else

--- 100 unchanged lines hidden (view full) ---

308 if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
309 dst_metric_locked(dst, RTAX_MTU) ||
310 !forwarding)
311 return dst_mtu(dst);
312
313 return min(dst->dev->mtu, IP_MAX_MTU);
314}
315
316static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
316static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
317 const struct sk_buff *skb)
317{
318{
318 struct sock *sk = skb->sk;
319
320 if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
321 bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
322
323 return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
324 }
325
326 return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
327}

--- 217 unchanged lines hidden (view full) ---

545int ip_options_rcv_srr(struct sk_buff *skb);
546
547/*
548 * Functions provided by ip_sockglue.c
549 */
550
551void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
552void ip_cmsg_recv_offset(struct msghdr *msg, struct sk_buff *skb, int offset);
319 if (!sk || !sk_fullsock(sk) || ip_sk_use_pmtu(sk)) {
320 bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
321
322 return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
323 }
324
325 return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
326}

--- 217 unchanged lines hidden (view full) ---

544int ip_options_rcv_srr(struct sk_buff *skb);
545
546/*
547 * Functions provided by ip_sockglue.c
548 */
549
550void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
551void ip_cmsg_recv_offset(struct msghdr *msg, struct sk_buff *skb, int offset);
553int ip_cmsg_send(struct net *net, struct msghdr *msg,
552int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
554 struct ipcm_cookie *ipc, bool allow_ipv6);
555int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
556 unsigned int optlen);
557int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
558 int __user *optlen);
559int compat_ip_setsockopt(struct sock *sk, int level, int optname,
560 char __user *optval, unsigned int optlen);
561int compat_ip_getsockopt(struct sock *sk, int level, int optname,

--- 24 unchanged lines hidden ---
553 struct ipcm_cookie *ipc, bool allow_ipv6);
554int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
555 unsigned int optlen);
556int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
557 int __user *optlen);
558int compat_ip_setsockopt(struct sock *sk, int level, int optname,
559 char __user *optval, unsigned int optlen);
560int compat_ip_getsockopt(struct sock *sk, int level, int optname,

--- 24 unchanged lines hidden ---