mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
netfilter: Pass socket pointer down through okfn().
On the output paths in particular, we have to sometimes deal with two socket contexts. First, and usually skb->sk, is the local socket that generated the frame. And second, is potentially the socket used to control a tunneling socket, such as one the encapsulates using UDP. We do not want to disassociate skb->sk when encapsulating in order to fix this, because that would break socket memory accounting. The most extreme case where this can cause huge problems is an AF_PACKET socket transmitting over a vxlan device. We hit code paths doing checks that assume they are dealing with an ipv4 socket, but are actually operating upon the AF_PACKET one. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1c984f8a5d
commit
7026b1ddb6
@@ -2165,8 +2165,12 @@ int dev_open(struct net_device *dev);
|
||||
int dev_close(struct net_device *dev);
|
||||
int dev_close_many(struct list_head *head, bool unlink);
|
||||
void dev_disable_lro(struct net_device *dev);
|
||||
int dev_loopback_xmit(struct sk_buff *newskb);
|
||||
int dev_queue_xmit(struct sk_buff *skb);
|
||||
int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
|
||||
int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
|
||||
static inline int dev_queue_xmit(struct sk_buff *skb)
|
||||
{
|
||||
return dev_queue_xmit_sk(skb->sk, skb);
|
||||
}
|
||||
int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
|
||||
int register_netdevice(struct net_device *dev);
|
||||
void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
|
||||
@@ -2927,7 +2931,11 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
|
||||
|
||||
int netif_rx(struct sk_buff *skb);
|
||||
int netif_rx_ni(struct sk_buff *skb);
|
||||
int netif_receive_skb(struct sk_buff *skb);
|
||||
int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
|
||||
static inline int netif_receive_skb(struct sk_buff *skb)
|
||||
{
|
||||
return netif_receive_skb_sk(skb->sk, skb);
|
||||
}
|
||||
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
|
||||
void napi_gro_flush(struct napi_struct *napi, bool flush_old);
|
||||
struct sk_buff *napi_get_frags(struct napi_struct *napi);
|
||||
|
||||
@@ -54,7 +54,7 @@ struct nf_hook_state {
|
||||
struct net_device *in;
|
||||
struct net_device *out;
|
||||
struct sock *sk;
|
||||
int (*okfn)(struct sk_buff *);
|
||||
int (*okfn)(struct sock *, struct sk_buff *);
|
||||
};
|
||||
|
||||
static inline void nf_hook_state_init(struct nf_hook_state *p,
|
||||
@@ -63,7 +63,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p,
|
||||
struct net_device *indev,
|
||||
struct net_device *outdev,
|
||||
struct sock *sk,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
int (*okfn)(struct sock *, struct sk_buff *))
|
||||
{
|
||||
p->hook = hook;
|
||||
p->thresh = thresh;
|
||||
@@ -156,26 +156,29 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state);
|
||||
* value indicates the packet has been consumed by the hook.
|
||||
*/
|
||||
static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
|
||||
struct sock *sk,
|
||||
struct sk_buff *skb,
|
||||
struct net_device *indev,
|
||||
struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *), int thresh)
|
||||
int (*okfn)(struct sock *, struct sk_buff *),
|
||||
int thresh)
|
||||
{
|
||||
if (nf_hooks_active(pf, hook)) {
|
||||
struct nf_hook_state state;
|
||||
|
||||
nf_hook_state_init(&state, hook, thresh, pf,
|
||||
indev, outdev, NULL, okfn);
|
||||
indev, outdev, sk, okfn);
|
||||
return nf_hook_slow(skb, &state);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *indev, struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
|
||||
struct sk_buff *skb, struct net_device *indev,
|
||||
struct net_device *outdev,
|
||||
int (*okfn)(struct sock *, struct sk_buff *))
|
||||
{
|
||||
return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN);
|
||||
return nf_hook_thresh(pf, hook, sk, skb, indev, outdev, okfn, INT_MIN);
|
||||
}
|
||||
|
||||
/* Activate hook; either okfn or kfree_skb called, unless a hook
|
||||
@@ -196,35 +199,36 @@ static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
*/
|
||||
|
||||
static inline int
|
||||
NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *in, struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *), int thresh)
|
||||
NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct sock *sk,
|
||||
struct sk_buff *skb, struct net_device *in,
|
||||
struct net_device *out,
|
||||
int (*okfn)(struct sock *, struct sk_buff *), int thresh)
|
||||
{
|
||||
int ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, thresh);
|
||||
int ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, thresh);
|
||||
if (ret == 1)
|
||||
ret = okfn(skb);
|
||||
ret = okfn(sk, skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *in, struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *), bool cond)
|
||||
NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sock *sk,
|
||||
struct sk_buff *skb, struct net_device *in, struct net_device *out,
|
||||
int (*okfn)(struct sock *, struct sk_buff *), bool cond)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!cond ||
|
||||
((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1))
|
||||
ret = okfn(skb);
|
||||
((ret = nf_hook_thresh(pf, hook, sk, skb, in, out, okfn, INT_MIN)) == 1))
|
||||
ret = okfn(sk, skb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int
|
||||
NF_HOOK(uint8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
NF_HOOK(uint8_t pf, unsigned int hook, struct sock *sk, struct sk_buff *skb,
|
||||
struct net_device *in, struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
int (*okfn)(struct sock *, struct sk_buff *))
|
||||
{
|
||||
return NF_HOOK_THRESH(pf, hook, skb, in, out, okfn, INT_MIN);
|
||||
return NF_HOOK_THRESH(pf, hook, sk, skb, in, out, okfn, INT_MIN);
|
||||
}
|
||||
|
||||
/* Call setsockopt() */
|
||||
@@ -324,19 +328,21 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
|
||||
}
|
||||
|
||||
#else /* !CONFIG_NETFILTER */
|
||||
#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
|
||||
#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
|
||||
#define NF_HOOK(pf, hook, sk, skb, indev, outdev, okfn) (okfn)(sk, skb)
|
||||
#define NF_HOOK_COND(pf, hook, sk, skb, indev, outdev, okfn, cond) (okfn)(sk, skb)
|
||||
static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
|
||||
struct sock *sk,
|
||||
struct sk_buff *skb,
|
||||
struct net_device *indev,
|
||||
struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *), int thresh)
|
||||
int (*okfn)(struct sock *sk, struct sk_buff *), int thresh)
|
||||
{
|
||||
return okfn(skb);
|
||||
return okfn(sk, skb);
|
||||
}
|
||||
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
|
||||
struct net_device *indev, struct net_device *outdev,
|
||||
int (*okfn)(struct sk_buff *))
|
||||
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sock *sk,
|
||||
struct sk_buff *skb, struct net_device *indev,
|
||||
struct net_device *outdev,
|
||||
int (*okfn)(struct sock *, struct sk_buff *))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int br_handle_frame_finish(struct sk_buff *skb);
|
||||
int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
|
||||
|
||||
static inline void br_drop_fake_rtable(struct sk_buff *skb)
|
||||
{
|
||||
|
||||
@@ -18,11 +18,11 @@ struct dn_neigh {
|
||||
|
||||
void dn_neigh_init(void);
|
||||
void dn_neigh_cleanup(void);
|
||||
int dn_neigh_router_hello(struct sk_buff *skb);
|
||||
int dn_neigh_endnode_hello(struct sk_buff *skb);
|
||||
int dn_neigh_router_hello(struct sock *sk, struct sk_buff *skb);
|
||||
int dn_neigh_endnode_hello(struct sock *sk, struct sk_buff *skb);
|
||||
void dn_neigh_pointopoint_hello(struct sk_buff *skb);
|
||||
int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
|
||||
int dn_to_neigh_output(struct sk_buff *skb);
|
||||
int dn_to_neigh_output(struct sock *sk, struct sk_buff *skb);
|
||||
|
||||
extern struct neigh_table dn_neigh_table;
|
||||
|
||||
|
||||
@@ -108,7 +108,8 @@ int ip_local_deliver(struct sk_buff *skb);
|
||||
int ip_mr_input(struct sk_buff *skb);
|
||||
int ip_output(struct sock *sk, struct sk_buff *skb);
|
||||
int ip_mc_output(struct sock *sk, struct sk_buff *skb);
|
||||
int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
|
||||
int ip_fragment(struct sock *sk, struct sk_buff *skb,
|
||||
int (*output)(struct sock *, 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);
|
||||
|
||||
@@ -170,7 +170,8 @@ static inline bool ipv6_anycast_destination(const struct sk_buff *skb)
|
||||
return rt->rt6i_flags & RTF_ANYCAST;
|
||||
}
|
||||
|
||||
int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
|
||||
int ip6_fragment(struct sock *sk, struct sk_buff *skb,
|
||||
int (*output)(struct sock *, struct sk_buff *));
|
||||
|
||||
static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
|
||||
{
|
||||
|
||||
@@ -769,7 +769,7 @@ static inline u8 ip6_tclass(__be32 flowinfo)
|
||||
int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type *pt, struct net_device *orig_dev);
|
||||
|
||||
int ip6_rcv_finish(struct sk_buff *skb);
|
||||
int ip6_rcv_finish(struct sock *sk, struct sk_buff *skb);
|
||||
|
||||
/*
|
||||
* upper-layer output functions
|
||||
|
||||
@@ -332,7 +332,7 @@ struct xfrm_state_afinfo {
|
||||
int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
|
||||
int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
|
||||
int (*output)(struct sock *sk, struct sk_buff *skb);
|
||||
int (*output_finish)(struct sk_buff *skb);
|
||||
int (*output_finish)(struct sock *sk, struct sk_buff *skb);
|
||||
int (*extract_input)(struct xfrm_state *x,
|
||||
struct sk_buff *skb);
|
||||
int (*extract_output)(struct xfrm_state *x,
|
||||
@@ -1503,7 +1503,7 @@ int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
|
||||
int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
|
||||
int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
|
||||
int xfrm_output_resume(struct sk_buff *skb, int err);
|
||||
int xfrm_output(struct sk_buff *skb);
|
||||
int xfrm_output(struct sock *sk, struct sk_buff *skb);
|
||||
int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
|
||||
void xfrm_local_error(struct sk_buff *skb, int mtu);
|
||||
int xfrm4_extract_header(struct sk_buff *skb);
|
||||
@@ -1524,7 +1524,7 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
|
||||
int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
|
||||
int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
|
||||
int xfrm4_output(struct sock *sk, struct sk_buff *skb);
|
||||
int xfrm4_output_finish(struct sk_buff *skb);
|
||||
int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb);
|
||||
int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
|
||||
int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
|
||||
int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
|
||||
@@ -1549,7 +1549,7 @@ __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
|
||||
int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
|
||||
int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
|
||||
int xfrm6_output(struct sock *sk, struct sk_buff *skb);
|
||||
int xfrm6_output_finish(struct sk_buff *skb);
|
||||
int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb);
|
||||
int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
|
||||
u8 **prevhdr);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ static inline int should_deliver(const struct net_bridge_port *p,
|
||||
p->state == BR_STATE_FORWARDING;
|
||||
}
|
||||
|
||||
int br_dev_queue_push_xmit(struct sk_buff *skb)
|
||||
int br_dev_queue_push_xmit(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
if (!is_skb_forwardable(skb->dev, skb)) {
|
||||
kfree_skb(skb);
|
||||
@@ -49,9 +49,10 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(br_dev_queue_push_xmit);
|
||||
|
||||
int br_forward_finish(struct sk_buff *skb)
|
||||
int br_forward_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev,
|
||||
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_POST_ROUTING, sk, skb,
|
||||
NULL, skb->dev,
|
||||
br_dev_queue_push_xmit);
|
||||
|
||||
}
|
||||
@@ -75,7 +76,8 @@ static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
|
||||
return;
|
||||
}
|
||||
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, NULL, skb,
|
||||
NULL, skb->dev,
|
||||
br_forward_finish);
|
||||
}
|
||||
|
||||
@@ -96,7 +98,8 @@ static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
|
||||
skb->dev = to->dev;
|
||||
skb_forward_csum(skb);
|
||||
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev,
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_FORWARD, NULL, skb,
|
||||
indev, skb->dev,
|
||||
br_forward_finish);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,9 @@ static int br_pass_frame_up(struct sk_buff *skb)
|
||||
if (!skb)
|
||||
return NET_RX_DROP;
|
||||
|
||||
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL,
|
||||
netif_receive_skb);
|
||||
return NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, NULL, skb,
|
||||
indev, NULL,
|
||||
netif_receive_skb_sk);
|
||||
}
|
||||
|
||||
static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
@@ -119,7 +120,7 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br,
|
||||
}
|
||||
|
||||
/* note: already called with rcu_read_lock */
|
||||
int br_handle_frame_finish(struct sk_buff *skb)
|
||||
int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
const unsigned char *dest = eth_hdr(skb)->h_dest;
|
||||
struct net_bridge_port *p = br_port_get_rcu(skb->dev);
|
||||
@@ -207,7 +208,7 @@ drop:
|
||||
EXPORT_SYMBOL_GPL(br_handle_frame_finish);
|
||||
|
||||
/* note: already called with rcu_read_lock */
|
||||
static int br_handle_local_finish(struct sk_buff *skb)
|
||||
static int br_handle_local_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct net_bridge_port *p = br_port_get_rcu(skb->dev);
|
||||
u16 vid = 0;
|
||||
@@ -277,8 +278,8 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
|
||||
}
|
||||
|
||||
/* Deliver packet to local host only */
|
||||
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
|
||||
NULL, br_handle_local_finish)) {
|
||||
if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, NULL, skb,
|
||||
skb->dev, NULL, br_handle_local_finish)) {
|
||||
return RX_HANDLER_CONSUMED; /* consumed by filter */
|
||||
} else {
|
||||
*pskb = skb;
|
||||
@@ -302,7 +303,8 @@ forward:
|
||||
if (ether_addr_equal(p->br->dev->dev_addr, dest))
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, NULL, skb,
|
||||
skb->dev, NULL,
|
||||
br_handle_frame_finish);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -814,7 +814,8 @@ static void __br_multicast_send_query(struct net_bridge *br,
|
||||
|
||||
if (port) {
|
||||
skb->dev = port->dev;
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, NULL, skb,
|
||||
NULL, skb->dev,
|
||||
br_dev_queue_push_xmit);
|
||||
} else {
|
||||
br_multicast_select_own_querier(br, ip, skb);
|
||||
|
||||
@@ -261,7 +261,7 @@ static void nf_bridge_update_protocol(struct sk_buff *skb)
|
||||
/* PF_BRIDGE/PRE_ROUTING *********************************************/
|
||||
/* Undo the changes made for ip6tables PREROUTING and continue the
|
||||
* bridge PRE_ROUTING hook. */
|
||||
static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
|
||||
static int br_nf_pre_routing_finish_ipv6(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct nf_bridge_info *nf_bridge = skb->nf_bridge;
|
||||
struct rtable *rt;
|
||||
@@ -282,7 +282,8 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
|
||||
skb->dev = nf_bridge->physindev;
|
||||
nf_bridge_update_protocol(skb);
|
||||
nf_bridge_push_encap_header(skb);
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, sk, skb,
|
||||
skb->dev, NULL,
|
||||
br_handle_frame_finish, 1);
|
||||
|
||||
return 0;
|
||||
@@ -293,7 +294,7 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
|
||||
* don't, we use the neighbour framework to find out. In both cases, we make
|
||||
* sure that br_handle_frame_finish() is called afterwards.
|
||||
*/
|
||||
static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
|
||||
static int br_nf_pre_routing_finish_bridge(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct nf_bridge_info *nf_bridge = skb->nf_bridge;
|
||||
struct neighbour *neigh;
|
||||
@@ -310,7 +311,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
|
||||
if (neigh->hh.hh_len) {
|
||||
neigh_hh_bridge(&neigh->hh, skb);
|
||||
skb->dev = nf_bridge->physindev;
|
||||
ret = br_handle_frame_finish(skb);
|
||||
ret = br_handle_frame_finish(sk, skb);
|
||||
} else {
|
||||
/* the neighbour function below overwrites the complete
|
||||
* MAC header, so we save the Ethernet source address and
|
||||
@@ -387,7 +388,7 @@ static bool dnat_took_place(const struct sk_buff *skb)
|
||||
* device, we proceed as if ip_route_input() succeeded. If it differs from the
|
||||
* logical bridge port or if ip_route_output_key() fails we drop the packet.
|
||||
*/
|
||||
static int br_nf_pre_routing_finish(struct sk_buff *skb)
|
||||
static int br_nf_pre_routing_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = skb->dev;
|
||||
struct iphdr *iph = ip_hdr(skb);
|
||||
@@ -440,7 +441,7 @@ bridged_dnat:
|
||||
nf_bridge_push_encap_header(skb);
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE,
|
||||
NF_BR_PRE_ROUTING,
|
||||
skb, skb->dev, NULL,
|
||||
sk, skb, skb->dev, NULL,
|
||||
br_nf_pre_routing_finish_bridge,
|
||||
1);
|
||||
return 0;
|
||||
@@ -460,7 +461,8 @@ bridged_dnat:
|
||||
skb->dev = nf_bridge->physindev;
|
||||
nf_bridge_update_protocol(skb);
|
||||
nf_bridge_push_encap_header(skb);
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_PRE_ROUTING, sk, skb,
|
||||
skb->dev, NULL,
|
||||
br_handle_frame_finish, 1);
|
||||
|
||||
return 0;
|
||||
@@ -596,7 +598,8 @@ static unsigned int br_nf_pre_routing_ipv6(const struct nf_hook_ops *ops,
|
||||
return NF_DROP;
|
||||
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
NF_HOOK(NFPROTO_IPV6, NF_INET_PRE_ROUTING, state->sk, skb,
|
||||
skb->dev, NULL,
|
||||
br_nf_pre_routing_finish_ipv6);
|
||||
|
||||
return NF_STOLEN;
|
||||
@@ -651,7 +654,8 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops,
|
||||
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
|
||||
NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb,
|
||||
skb->dev, NULL,
|
||||
br_nf_pre_routing_finish);
|
||||
|
||||
return NF_STOLEN;
|
||||
@@ -674,7 +678,7 @@ static unsigned int br_nf_local_in(const struct nf_hook_ops *ops,
|
||||
}
|
||||
|
||||
/* PF_BRIDGE/FORWARD *************************************************/
|
||||
static int br_nf_forward_finish(struct sk_buff *skb)
|
||||
static int br_nf_forward_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct nf_bridge_info *nf_bridge = skb->nf_bridge;
|
||||
struct net_device *in;
|
||||
@@ -691,8 +695,8 @@ static int br_nf_forward_finish(struct sk_buff *skb)
|
||||
}
|
||||
nf_bridge_push_encap_header(skb);
|
||||
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_FORWARD, skb, in,
|
||||
skb->dev, br_forward_finish, 1);
|
||||
NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_FORWARD, sk, skb,
|
||||
in, skb->dev, br_forward_finish, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -746,7 +750,8 @@ static unsigned int br_nf_forward_ip(const struct nf_hook_ops *ops,
|
||||
else
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
|
||||
NF_HOOK(pf, NF_INET_FORWARD, skb, brnf_get_logical_dev(skb, state->in),
|
||||
NF_HOOK(pf, NF_INET_FORWARD, NULL, skb,
|
||||
brnf_get_logical_dev(skb, state->in),
|
||||
parent, br_nf_forward_finish);
|
||||
|
||||
return NF_STOLEN;
|
||||
@@ -780,8 +785,8 @@ static unsigned int br_nf_forward_arp(const struct nf_hook_ops *ops,
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
*d = state->in;
|
||||
NF_HOOK(NFPROTO_ARP, NF_ARP_FORWARD, skb, state->in,
|
||||
state->out, br_nf_forward_finish);
|
||||
NF_HOOK(NFPROTO_ARP, NF_ARP_FORWARD, state->sk, skb,
|
||||
state->in, state->out, br_nf_forward_finish);
|
||||
|
||||
return NF_STOLEN;
|
||||
}
|
||||
@@ -804,24 +809,24 @@ static bool nf_bridge_copy_header(struct sk_buff *skb)
|
||||
return true;
|
||||
}
|
||||
|
||||
static int br_nf_push_frag_xmit(struct sk_buff *skb)
|
||||
static int br_nf_push_frag_xmit(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
if (!nf_bridge_copy_header(skb)) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return br_dev_queue_push_xmit(skb);
|
||||
return br_dev_queue_push_xmit(sk, skb);
|
||||
}
|
||||
|
||||
static int br_nf_dev_queue_xmit(struct sk_buff *skb)
|
||||
static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
int ret;
|
||||
int frag_max_size;
|
||||
unsigned int mtu_reserved;
|
||||
|
||||
if (skb_is_gso(skb) || skb->protocol != htons(ETH_P_IP))
|
||||
return br_dev_queue_push_xmit(skb);
|
||||
return br_dev_queue_push_xmit(sk, skb);
|
||||
|
||||
mtu_reserved = nf_bridge_mtu_reduction(skb);
|
||||
/* This is wrong! We should preserve the original fragment
|
||||
@@ -833,16 +838,16 @@ static int br_nf_dev_queue_xmit(struct sk_buff *skb)
|
||||
/* Drop invalid packet */
|
||||
return NF_DROP;
|
||||
IPCB(skb)->frag_max_size = frag_max_size;
|
||||
ret = ip_fragment(skb, br_nf_push_frag_xmit);
|
||||
ret = ip_fragment(sk, skb, br_nf_push_frag_xmit);
|
||||
} else
|
||||
ret = br_dev_queue_push_xmit(skb);
|
||||
ret = br_dev_queue_push_xmit(sk, skb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
static int br_nf_dev_queue_xmit(struct sk_buff *skb)
|
||||
static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
return br_dev_queue_push_xmit(skb);
|
||||
return br_dev_queue_push_xmit(sk, skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -887,7 +892,8 @@ static unsigned int br_nf_post_routing(const struct nf_hook_ops *ops,
|
||||
else
|
||||
skb->protocol = htons(ETH_P_IPV6);
|
||||
|
||||
NF_HOOK(pf, NF_INET_POST_ROUTING, skb, NULL, realoutdev,
|
||||
NF_HOOK(pf, NF_INET_POST_ROUTING, state->sk, skb,
|
||||
NULL, realoutdev,
|
||||
br_nf_dev_queue_xmit);
|
||||
|
||||
return NF_STOLEN;
|
||||
@@ -927,7 +933,7 @@ static void br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
|
||||
skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
|
||||
skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
|
||||
skb->dev = nf_bridge->physindev;
|
||||
br_handle_frame_finish(skb);
|
||||
br_handle_frame_finish(NULL, skb);
|
||||
}
|
||||
|
||||
static int br_nf_dev_xmit(struct sk_buff *skb)
|
||||
|
||||
@@ -410,10 +410,10 @@ int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p,
|
||||
|
||||
/* br_forward.c */
|
||||
void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb);
|
||||
int br_dev_queue_push_xmit(struct sk_buff *skb);
|
||||
int br_dev_queue_push_xmit(struct sock *sk, struct sk_buff *skb);
|
||||
void br_forward(const struct net_bridge_port *to,
|
||||
struct sk_buff *skb, struct sk_buff *skb0);
|
||||
int br_forward_finish(struct sk_buff *skb);
|
||||
int br_forward_finish(struct sock *sk, struct sk_buff *skb);
|
||||
void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, bool unicast);
|
||||
void br_flood_forward(struct net_bridge *br, struct sk_buff *skb,
|
||||
struct sk_buff *skb2, bool unicast);
|
||||
@@ -431,7 +431,7 @@ void br_port_flags_change(struct net_bridge_port *port, unsigned long mask);
|
||||
void br_manage_promisc(struct net_bridge *br);
|
||||
|
||||
/* br_input.c */
|
||||
int br_handle_frame_finish(struct sk_buff *skb);
|
||||
int br_handle_frame_finish(struct sock *sk, struct sk_buff *skb);
|
||||
rx_handler_result_t br_handle_frame(struct sk_buff **pskb);
|
||||
|
||||
static inline bool br_rx_handler_check_rcu(const struct net_device *dev)
|
||||
|
||||
@@ -54,8 +54,9 @@ static void br_send_bpdu(struct net_bridge_port *p,
|
||||
|
||||
skb_reset_mac_header(skb);
|
||||
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
|
||||
dev_queue_xmit);
|
||||
NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, NULL, skb,
|
||||
NULL, skb->dev,
|
||||
dev_queue_xmit_sk);
|
||||
}
|
||||
|
||||
static inline void br_set_ticks(unsigned char *dest, int j)
|
||||
|
||||
@@ -2879,7 +2879,7 @@ EXPORT_SYMBOL(xmit_recursion);
|
||||
* dev_loopback_xmit - loop back @skb
|
||||
* @skb: buffer to transmit
|
||||
*/
|
||||
int dev_loopback_xmit(struct sk_buff *skb)
|
||||
int dev_loopback_xmit(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
skb_reset_mac_header(skb);
|
||||
__skb_pull(skb, skb_network_offset(skb));
|
||||
@@ -3017,11 +3017,11 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int dev_queue_xmit(struct sk_buff *skb)
|
||||
int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
return __dev_queue_xmit(skb, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(dev_queue_xmit);
|
||||
EXPORT_SYMBOL(dev_queue_xmit_sk);
|
||||
|
||||
int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv)
|
||||
{
|
||||
@@ -3853,13 +3853,13 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
|
||||
* NET_RX_SUCCESS: no congestion
|
||||
* NET_RX_DROP: packet was dropped
|
||||
*/
|
||||
int netif_receive_skb(struct sk_buff *skb)
|
||||
int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
trace_netif_receive_skb_entry(skb);
|
||||
|
||||
return netif_receive_skb_internal(skb);
|
||||
}
|
||||
EXPORT_SYMBOL(netif_receive_skb);
|
||||
EXPORT_SYMBOL(netif_receive_skb_sk);
|
||||
|
||||
/* Network device is going away, flush any packets still pending
|
||||
* Called with irqs disabled.
|
||||
|
||||
@@ -194,7 +194,7 @@ static int dn_neigh_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int dn_neigh_output_packet(struct sk_buff *skb)
|
||||
static int dn_neigh_output_packet(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dst_entry *dst = skb_dst(skb);
|
||||
struct dn_route *rt = (struct dn_route *)dst;
|
||||
@@ -206,7 +206,8 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
|
||||
/*
|
||||
* For talking to broadcast devices: Ethernet & PPP
|
||||
*/
|
||||
static int dn_long_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
static int dn_long_output(struct neighbour *neigh, struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = neigh->dev;
|
||||
int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3;
|
||||
@@ -245,14 +246,15 @@ static int dn_long_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, skb, NULL,
|
||||
neigh->dev, dn_neigh_output_packet);
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, sk, skb,
|
||||
NULL, neigh->dev, dn_neigh_output_packet);
|
||||
}
|
||||
|
||||
/*
|
||||
* For talking to pointopoint and multidrop devices: DDCMP and X.25
|
||||
*/
|
||||
static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
static int dn_short_output(struct neighbour *neigh, struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = neigh->dev;
|
||||
int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
|
||||
@@ -284,8 +286,8 @@ static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, skb, NULL,
|
||||
neigh->dev, dn_neigh_output_packet);
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, sk, skb,
|
||||
NULL, neigh->dev, dn_neigh_output_packet);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -293,7 +295,8 @@ static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
* Phase 3 output is the same as short output, execpt that
|
||||
* it clears the area bits before transmission.
|
||||
*/
|
||||
static int dn_phase3_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
static int dn_phase3_output(struct neighbour *neigh, struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = neigh->dev;
|
||||
int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
|
||||
@@ -324,11 +327,11 @@ static int dn_phase3_output(struct neighbour *neigh, struct sk_buff *skb)
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, skb, NULL,
|
||||
neigh->dev, dn_neigh_output_packet);
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_POST_ROUTING, sk, skb,
|
||||
NULL, neigh->dev, dn_neigh_output_packet);
|
||||
}
|
||||
|
||||
int dn_to_neigh_output(struct sk_buff *skb)
|
||||
int dn_to_neigh_output(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dst_entry *dst = skb_dst(skb);
|
||||
struct dn_route *rt = (struct dn_route *) dst;
|
||||
@@ -347,11 +350,11 @@ int dn_to_neigh_output(struct sk_buff *skb)
|
||||
rcu_read_unlock();
|
||||
|
||||
if (dn->flags & DN_NDFLAG_P3)
|
||||
return dn_phase3_output(neigh, skb);
|
||||
return dn_phase3_output(neigh, sk, skb);
|
||||
if (use_long)
|
||||
return dn_long_output(neigh, skb);
|
||||
return dn_long_output(neigh, sk, skb);
|
||||
else
|
||||
return dn_short_output(neigh, skb);
|
||||
return dn_short_output(neigh, sk, skb);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -372,7 +375,7 @@ void dn_neigh_pointopoint_hello(struct sk_buff *skb)
|
||||
/*
|
||||
* Ethernet router hello message received
|
||||
*/
|
||||
int dn_neigh_router_hello(struct sk_buff *skb)
|
||||
int dn_neigh_router_hello(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct rtnode_hello_message *msg = (struct rtnode_hello_message *)skb->data;
|
||||
|
||||
@@ -434,7 +437,7 @@ int dn_neigh_router_hello(struct sk_buff *skb)
|
||||
/*
|
||||
* Endnode hello message received
|
||||
*/
|
||||
int dn_neigh_endnode_hello(struct sk_buff *skb)
|
||||
int dn_neigh_endnode_hello(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct endnode_hello_message *msg = (struct endnode_hello_message *)skb->data;
|
||||
struct neighbour *neigh;
|
||||
|
||||
@@ -714,7 +714,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dn_nsp_rx_packet(struct sk_buff *skb)
|
||||
static int dn_nsp_rx_packet(struct sock *sk2, struct sk_buff *skb)
|
||||
{
|
||||
struct dn_skb_cb *cb = DN_SKB_CB(skb);
|
||||
struct sock *sk = NULL;
|
||||
@@ -814,7 +814,8 @@ free_out:
|
||||
|
||||
int dn_nsp_rx(struct sk_buff *skb)
|
||||
{
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_IN, skb, skb->dev, NULL,
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_IN, NULL, skb,
|
||||
skb->dev, NULL,
|
||||
dn_nsp_rx_packet);
|
||||
}
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ static int dn_return_long(struct sk_buff *skb)
|
||||
*
|
||||
* Returns: result of input function if route is found, error code otherwise
|
||||
*/
|
||||
static int dn_route_rx_packet(struct sk_buff *skb)
|
||||
static int dn_route_rx_packet(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct dn_skb_cb *cb;
|
||||
int err;
|
||||
@@ -573,7 +573,8 @@ static int dn_route_rx_long(struct sk_buff *skb)
|
||||
ptr++;
|
||||
cb->hops = *ptr++; /* Visit Count */
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, NULL, skb,
|
||||
skb->dev, NULL,
|
||||
dn_route_rx_packet);
|
||||
|
||||
drop_it:
|
||||
@@ -600,7 +601,8 @@ static int dn_route_rx_short(struct sk_buff *skb)
|
||||
ptr += 2;
|
||||
cb->hops = *ptr & 0x3f;
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, skb, skb->dev, NULL,
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_PRE_ROUTING, NULL, skb,
|
||||
skb->dev, NULL,
|
||||
dn_route_rx_packet);
|
||||
|
||||
drop_it:
|
||||
@@ -608,7 +610,7 @@ drop_it:
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
|
||||
static int dn_route_discard(struct sk_buff *skb)
|
||||
static int dn_route_discard(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
/*
|
||||
* I know we drop the packet here, but thats considered success in
|
||||
@@ -618,7 +620,7 @@ static int dn_route_discard(struct sk_buff *skb)
|
||||
return NET_RX_SUCCESS;
|
||||
}
|
||||
|
||||
static int dn_route_ptp_hello(struct sk_buff *skb)
|
||||
static int dn_route_ptp_hello(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
dn_dev_hello(skb);
|
||||
dn_neigh_pointopoint_hello(skb);
|
||||
@@ -704,22 +706,22 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
|
||||
switch (flags & DN_RT_CNTL_MSK) {
|
||||
case DN_RT_PKT_HELO:
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
|
||||
skb, skb->dev, NULL,
|
||||
NULL, skb, skb->dev, NULL,
|
||||
dn_route_ptp_hello);
|
||||
|
||||
case DN_RT_PKT_L1RT:
|
||||
case DN_RT_PKT_L2RT:
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_ROUTE,
|
||||
skb, skb->dev, NULL,
|
||||
NULL, skb, skb->dev, NULL,
|
||||
dn_route_discard);
|
||||
case DN_RT_PKT_ERTH:
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
|
||||
skb, skb->dev, NULL,
|
||||
NULL, skb, skb->dev, NULL,
|
||||
dn_neigh_router_hello);
|
||||
|
||||
case DN_RT_PKT_EEDH:
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_HELLO,
|
||||
skb, skb->dev, NULL,
|
||||
NULL, skb, skb->dev, NULL,
|
||||
dn_neigh_endnode_hello);
|
||||
}
|
||||
} else {
|
||||
@@ -768,7 +770,8 @@ static int dn_output(struct sock *sk, struct sk_buff *skb)
|
||||
cb->rt_flags |= DN_RT_F_IE;
|
||||
cb->hops = 0;
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, skb, NULL, dev,
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_LOCAL_OUT, sk, skb,
|
||||
NULL, dev,
|
||||
dn_to_neigh_output);
|
||||
|
||||
error:
|
||||
@@ -816,7 +819,8 @@ static int dn_forward(struct sk_buff *skb)
|
||||
if (rt->rt_flags & RTCF_DOREDIRECT)
|
||||
cb->rt_flags |= DN_RT_F_IE;
|
||||
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, skb, dev, skb->dev,
|
||||
return NF_HOOK(NFPROTO_DECNET, NF_DN_FORWARD, NULL, skb,
|
||||
dev, skb->dev,
|
||||
dn_to_neigh_output);
|
||||
|
||||
drop:
|
||||
|
||||
@@ -591,7 +591,8 @@ EXPORT_SYMBOL(arp_create);
|
||||
void arp_xmit(struct sk_buff *skb)
|
||||
{
|
||||
/* Send it off, maybe filter it using firewalling first. */
|
||||
NF_HOOK(NFPROTO_ARP, NF_ARP_OUT, skb, NULL, skb->dev, dev_queue_xmit);
|
||||
NF_HOOK(NFPROTO_ARP, NF_ARP_OUT, NULL, skb,
|
||||
NULL, skb->dev, dev_queue_xmit_sk);
|
||||
}
|
||||
EXPORT_SYMBOL(arp_xmit);
|
||||
|
||||
@@ -625,7 +626,7 @@ EXPORT_SYMBOL(arp_send);
|
||||
* Process an arp request.
|
||||
*/
|
||||
|
||||
static int arp_process(struct sk_buff *skb)
|
||||
static int arp_process(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = skb->dev;
|
||||
struct in_device *in_dev = __in_dev_get_rcu(dev);
|
||||
@@ -846,7 +847,7 @@ out:
|
||||
|
||||
static void parp_redo(struct sk_buff *skb)
|
||||
{
|
||||
arp_process(skb);
|
||||
arp_process(NULL, skb);
|
||||
}
|
||||
|
||||
|
||||
@@ -879,7 +880,8 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb));
|
||||
|
||||
return NF_HOOK(NFPROTO_ARP, NF_ARP_IN, skb, dev, NULL, arp_process);
|
||||
return NF_HOOK(NFPROTO_ARP, NF_ARP_IN, NULL, skb,
|
||||
dev, NULL, arp_process);
|
||||
|
||||
consumeskb:
|
||||
consume_skb(skb);
|
||||
|
||||
@@ -57,7 +57,7 @@ static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
|
||||
}
|
||||
|
||||
|
||||
static int ip_forward_finish(struct sk_buff *skb)
|
||||
static int ip_forward_finish(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
struct ip_options *opt = &(IPCB(skb)->opt);
|
||||
|
||||
@@ -68,7 +68,7 @@ static int ip_forward_finish(struct sk_buff *skb)
|
||||
ip_forward_options(skb);
|
||||
|
||||
skb_sender_cpu_clear(skb);
|
||||
return dst_output(skb);
|
||||
return dst_output_sk(sk, skb);
|
||||
}
|
||||
|
||||
int ip_forward(struct sk_buff *skb)
|
||||
@@ -136,8 +136,8 @@ int ip_forward(struct sk_buff *skb)
|
||||
|
||||
skb->priority = rt_tos2priority(iph->tos);
|
||||
|
||||
return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, skb, skb->dev,
|
||||
rt->dst.dev, ip_forward_finish);
|
||||
return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD, NULL, skb,
|
||||
skb->dev, rt->dst.dev, ip_forward_finish);
|
||||
|
||||
sr_failed:
|
||||
/*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user