Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89814
b: refs/heads/master
c: 405666d
h: refs/heads/master
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Feb 29, 2008
1 parent 3b83215 commit 2906804
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 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: b7e729c4b4778aac4dbbec9dc070acde93071f4d
refs/heads/master: 405666db84b984b68fc75794069f424c02e5796c
19 changes: 10 additions & 9 deletions trunk/net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];
static DEFINE_PER_CPU(struct sock *, __icmp_sk) = NULL;
#define icmp_sk __get_cpu_var(__icmp_sk)

static inline int icmp_xmit_lock(void)
static inline int icmp_xmit_lock(struct sock *sk)
{
local_bh_disable();

if (unlikely(!spin_trylock(&icmp_sk->sk_lock.slock))) {
if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {
/* This can happen if the output path signals a
* dst_link_failure() for an outgoing ICMP packet.
*/
Expand All @@ -246,9 +246,9 @@ static inline int icmp_xmit_lock(void)
return 0;
}

static inline void icmp_xmit_unlock(void)
static inline void icmp_xmit_unlock(struct sock *sk)
{
spin_unlock_bh(&icmp_sk->sk_lock.slock);
spin_unlock_bh(&sk->sk_lock.slock);
}

/*
Expand Down Expand Up @@ -387,7 +387,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
if (ip_options_echo(&icmp_param->replyopts, skb))
return;

if (icmp_xmit_lock())
if (icmp_xmit_lock(sk))
return;

icmp_param->data.icmph.checksum = 0;
Expand Down Expand Up @@ -415,7 +415,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_push_reply(icmp_param, &ipc, rt);
ip_rt_put(rt);
out_unlock:
icmp_xmit_unlock();
icmp_xmit_unlock(sk);
}


Expand All @@ -440,6 +440,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
__be32 saddr;
u8 tos;
struct net *net;
struct sock *sk = icmp_sk;

if (!rt)
goto out;
Expand Down Expand Up @@ -507,7 +508,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
}
}

if (icmp_xmit_lock())
if (icmp_xmit_lock(sk))
return;

/*
Expand Down Expand Up @@ -546,7 +547,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
icmp_param.data.icmph.checksum = 0;
icmp_param.skb = skb_in;
icmp_param.offset = skb_network_offset(skb_in);
inet_sk(icmp_sk)->tos = tos;
inet_sk(sk)->tos = tos;
ipc.addr = iph->saddr;
ipc.opt = &icmp_param.replyopts;

Expand Down Expand Up @@ -654,7 +655,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
ende:
ip_rt_put(rt);
out_unlock:
icmp_xmit_unlock();
icmp_xmit_unlock(sk);
out:;
}

Expand Down
24 changes: 12 additions & 12 deletions trunk/net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ static struct inet6_protocol icmpv6_protocol = {
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};

static __inline__ int icmpv6_xmit_lock(void)
static __inline__ int icmpv6_xmit_lock(struct sock *sk)
{
local_bh_disable();

if (unlikely(!spin_trylock(&icmpv6_sk->sk_lock.slock))) {
if (unlikely(!spin_trylock(&sk->sk_lock.slock))) {
/* This can happen if the output path (f.e. SIT or
* ip6ip6 tunnel) signals dst_link_failure() for an
* outgoing ICMP6 packet.
Expand All @@ -105,9 +105,9 @@ static __inline__ int icmpv6_xmit_lock(void)
return 0;
}

static __inline__ void icmpv6_xmit_unlock(void)
static __inline__ void icmpv6_xmit_unlock(struct sock *sk)
{
spin_unlock_bh(&icmpv6_sk->sk_lock.slock);
spin_unlock_bh(&sk->sk_lock.slock);
}

/*
Expand Down Expand Up @@ -389,12 +389,12 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
fl.fl_icmp_code = code;
security_skb_classify_flow(skb, &fl);

if (icmpv6_xmit_lock())
return;

sk = icmpv6_sk;
np = inet6_sk(sk);

if (icmpv6_xmit_lock(sk))
return;

if (!icmpv6_xrlim_allow(sk, type, &fl))
goto out;

Expand Down Expand Up @@ -498,7 +498,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
out_dst_release:
dst_release(dst);
out:
icmpv6_xmit_unlock();
icmpv6_xmit_unlock(sk);
}

EXPORT_SYMBOL(icmpv6_send);
Expand Down Expand Up @@ -535,12 +535,12 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
fl.fl_icmp_type = ICMPV6_ECHO_REPLY;
security_skb_classify_flow(skb, &fl);

if (icmpv6_xmit_lock())
return;

sk = icmpv6_sk;
np = inet6_sk(sk);

if (icmpv6_xmit_lock(sk))
return;

if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
fl.oif = np->mcast_oif;

Expand Down Expand Up @@ -584,7 +584,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
in6_dev_put(idev);
dst_release(dst);
out:
icmpv6_xmit_unlock();
icmpv6_xmit_unlock(sk);
}

static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info)
Expand Down

0 comments on commit 2906804

Please sign in to comment.