1 typedef unsigned char __u8
;
2 typedef unsigned short __u16
;
3 typedef unsigned int __u32
;
4 typedef unsigned long __kernel_size_t
;
5 typedef __kernel_size_t
size_t;
10 struct iovec
* msg_iov
;
13 enum { IPPROTO_ICMP
= 1 };
15 static inline __attribute__((always_inline
)) struct dst_entry
*
16 skb_dst(const struct sk_buff
*skb
)
19 enum nf_inet_hooks
{ NF_INET_LOCAL_OUT
};
23 static inline __attribute__((always_inline
)) int
24 NF_HOOK_THRESH(uint8_t pf
, unsigned int hook
, struct sk_buff
*skb
,
25 struct net_device
*in
, struct net_device
*out
,
26 int (*okfn
)(struct sk_buff
*), int thresh
)
28 int ret
= nf_hook_thresh(pf
, hook
, skb
, in
, out
, okfn
, thresh
);
33 static inline __attribute__((always_inline
)) int
34 NF_HOOK(uint8_t pf
, unsigned int hook
, struct sk_buff
*skb
,
35 struct net_device
*in
, struct net_device
*out
,
36 int (*okfn
)(struct sk_buff
*))
38 return NF_HOOK_THRESH(pf
, hook
, skb
, in
, out
, okfn
, (-((int)(~0U>>1)) - 1));
41 struct net_device
*dev
;
42 int (*output
)(struct sk_buff
*);
44 static inline __attribute__((always_inline
)) int dst_output(struct sk_buff
*skb
) {
45 return skb_dst(skb
)->output(skb
);
52 __u8 recverr
: 1, hdrincl
: 1;
59 union { struct dst_entry dst
; } u
;
63 struct inet_sock
*inet_sk (struct sock
*);
64 struct net
*sock_net (struct sock
*);
65 void *skb_transport_header (struct sk_buff
*);
66 static int raw_send_hdrinc(struct sock
*sk
, void *from
, size_t length
,
67 struct rtable
*rt
, unsigned int flags
)
69 struct inet_sock
*inet
= inet_sk(sk
);
70 struct net
*net
= sock_net(sk
);
73 if (length
> rt
->u
.dst
.dev
->mtu
)
74 ip_local_error(sk
, 90, rt
->rt_dst
, inet
->inet_dport
, rt
->u
.dst
.dev
->mtu
);
77 if (iph
->protocol
== IPPROTO_ICMP
)
78 icmp_out_count(net
, ((struct icmphdr
*)skb_transport_header(skb
))->type
);
79 NF_HOOK(2, NF_INET_LOCAL_OUT
, skb
, ((void *)0), rt
->u
.dst
.dev
,
84 int raw_sendmsg(struct sock
*sk
, struct msghdr
*msg
, size_t len
)
86 raw_send_hdrinc(sk
, msg
->msg_iov
, len
, (void *)0, msg
->msg_flags
);