Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352082
b: refs/heads/master
c: 547472b
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Feb 5, 2013
1 parent 0da7c20 commit 4a22b55
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d6ddb19905223828485d8c40deaec76e4dea3a5
refs/heads/master: 547472b8e1da72ae226430c0c4273e36fc8ca768
19 changes: 0 additions & 19 deletions trunk/net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,21 +263,6 @@ void build_ehash_secret(void)
}
EXPORT_SYMBOL(build_ehash_secret);

static inline int inet_netns_ok(struct net *net, __u8 protocol)
{
const struct net_protocol *ipprot;

if (net_eq(net, &init_net))
return 1;

ipprot = rcu_dereference(inet_protos[protocol]);
if (ipprot == NULL) {
/* raw IP is OK */
return 1;
}
return ipprot->netns_ok;
}

/*
* Create an inet socket.
*/
Expand Down Expand Up @@ -350,10 +335,6 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
!ns_capable(net->user_ns, CAP_NET_RAW))
goto out_rcu_unlock;

err = -EAFNOSUPPORT;
if (!inet_netns_ok(net, protocol))
goto out_rcu_unlock;

sock->ops = answer->ops;
answer_prot = answer->prot;
answer_no_check = answer->no_check;
Expand Down
7 changes: 0 additions & 7 deletions trunk/net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,6 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
if (ipprot != NULL) {
int ret;

if (!net_eq(net, &init_net) && !ipprot->netns_ok) {
net_info_ratelimited("%s: proto %d isn't netns-ready\n",
__func__, protocol);
kfree_skb(skb);
goto out;
}

if (!ipprot->no_policy) {
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
kfree_skb(skb);
Expand Down
6 changes: 6 additions & 0 deletions trunk/net/ipv4/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;

int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
{
if (!prot->netns_ok) {
pr_err("Protocol %u is not namespace aware, cannot register.\n",
protocol);
return -EINVAL;
}

return !cmpxchg((const struct net_protocol **)&inet_protos[protocol],
NULL, prot) ? 0 : -1;
}
Expand Down

0 comments on commit 4a22b55

Please sign in to comment.