|
@@ -56,7 +56,7 @@ struct nf_hook_state {
|
|
struct sock *sk;
|
|
struct sock *sk;
|
|
struct net *net;
|
|
struct net *net;
|
|
struct list_head *hook_list;
|
|
struct list_head *hook_list;
|
|
- int (*okfn)(struct sock *, struct sk_buff *);
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *);
|
|
};
|
|
};
|
|
|
|
|
|
static inline void nf_hook_state_init(struct nf_hook_state *p,
|
|
static inline void nf_hook_state_init(struct nf_hook_state *p,
|
|
@@ -67,7 +67,7 @@ static inline void nf_hook_state_init(struct nf_hook_state *p,
|
|
struct net_device *outdev,
|
|
struct net_device *outdev,
|
|
struct sock *sk,
|
|
struct sock *sk,
|
|
struct net *net,
|
|
struct net *net,
|
|
- int (*okfn)(struct sock *, struct sk_buff *))
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *))
|
|
{
|
|
{
|
|
p->hook = hook;
|
|
p->hook = hook;
|
|
p->thresh = thresh;
|
|
p->thresh = thresh;
|
|
@@ -175,7 +175,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
|
|
struct sk_buff *skb,
|
|
struct sk_buff *skb,
|
|
struct net_device *indev,
|
|
struct net_device *indev,
|
|
struct net_device *outdev,
|
|
struct net_device *outdev,
|
|
- int (*okfn)(struct sock *, struct sk_buff *),
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *),
|
|
int thresh)
|
|
int thresh)
|
|
{
|
|
{
|
|
struct list_head *hook_list = &net->nf.hooks[pf][hook];
|
|
struct list_head *hook_list = &net->nf.hooks[pf][hook];
|
|
@@ -193,7 +193,7 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
|
|
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
|
|
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
|
|
struct sock *sk, struct sk_buff *skb,
|
|
struct sock *sk, struct sk_buff *skb,
|
|
struct net_device *indev, struct net_device *outdev,
|
|
struct net_device *indev, struct net_device *outdev,
|
|
- int (*okfn)(struct sock *, struct sk_buff *))
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *))
|
|
{
|
|
{
|
|
return nf_hook_thresh(pf, hook, net, sk, skb, indev, outdev, okfn, INT_MIN);
|
|
return nf_hook_thresh(pf, hook, net, sk, skb, indev, outdev, okfn, INT_MIN);
|
|
}
|
|
}
|
|
@@ -219,31 +219,33 @@ static inline int
|
|
NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
|
|
NF_HOOK_THRESH(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
|
|
struct sk_buff *skb, struct net_device *in,
|
|
struct sk_buff *skb, struct net_device *in,
|
|
struct net_device *out,
|
|
struct net_device *out,
|
|
- int (*okfn)(struct sock *, struct sk_buff *), int thresh)
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *),
|
|
|
|
+ int thresh)
|
|
{
|
|
{
|
|
int ret = nf_hook_thresh(pf, hook, net, sk, skb, in, out, okfn, thresh);
|
|
int ret = nf_hook_thresh(pf, hook, net, sk, skb, in, out, okfn, thresh);
|
|
if (ret == 1)
|
|
if (ret == 1)
|
|
- ret = okfn(sk, skb);
|
|
|
|
|
|
+ ret = okfn(net, sk, skb);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static inline int
|
|
static inline int
|
|
NF_HOOK_COND(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
|
|
NF_HOOK_COND(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk,
|
|
struct sk_buff *skb, struct net_device *in, struct net_device *out,
|
|
struct sk_buff *skb, struct net_device *in, struct net_device *out,
|
|
- int (*okfn)(struct sock *, struct sk_buff *), bool cond)
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *),
|
|
|
|
+ bool cond)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (!cond ||
|
|
if (!cond ||
|
|
((ret = nf_hook_thresh(pf, hook, net, sk, skb, in, out, okfn, INT_MIN)) == 1))
|
|
((ret = nf_hook_thresh(pf, hook, net, sk, skb, in, out, okfn, INT_MIN)) == 1))
|
|
- ret = okfn(sk, skb);
|
|
|
|
|
|
+ ret = okfn(net, sk, skb);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static inline int
|
|
static inline int
|
|
NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb,
|
|
NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb,
|
|
struct net_device *in, struct net_device *out,
|
|
struct net_device *in, struct net_device *out,
|
|
- int (*okfn)(struct sock *, struct sk_buff *))
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *))
|
|
{
|
|
{
|
|
return NF_HOOK_THRESH(pf, hook, net, sk, skb, in, out, okfn, INT_MIN);
|
|
return NF_HOOK_THRESH(pf, hook, net, sk, skb, in, out, okfn, INT_MIN);
|
|
}
|
|
}
|
|
@@ -345,12 +347,12 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
|
|
}
|
|
}
|
|
|
|
|
|
#else /* !CONFIG_NETFILTER */
|
|
#else /* !CONFIG_NETFILTER */
|
|
-#define NF_HOOK(pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(sk, skb)
|
|
|
|
-#define NF_HOOK_COND(pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(sk, skb)
|
|
|
|
|
|
+#define NF_HOOK(pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(net, sk, skb)
|
|
|
|
+#define NF_HOOK_COND(pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(net, sk, skb)
|
|
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
|
|
static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net,
|
|
struct sock *sk, struct sk_buff *skb,
|
|
struct sock *sk, struct sk_buff *skb,
|
|
struct net_device *indev, struct net_device *outdev,
|
|
struct net_device *indev, struct net_device *outdev,
|
|
- int (*okfn)(struct sock *, struct sk_buff *))
|
|
|
|
|
|
+ int (*okfn)(struct net *, struct sock *, struct sk_buff *))
|
|
{
|
|
{
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|