Skip to content

Commit

Permalink
net: Fix for dst_negative_advice
Browse files Browse the repository at this point in the history
dst_negative_advice() should check for changed dst and reset
sk_tx_queue_mapping accordingly. Pass sock to the callers of
dst_negative_advice.

(sk_reset_txq is defined just for use by dst_negative_advice. The
only way I could find to get around this is to move dst_negative_()
from dst.h to dst.c, include sock.h in dst.c, etc)

Signed-off-by: Krishna Kumar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
krkumar authored and davem330 committed Oct 21, 2009
1 parent f04c827 commit ea94ff3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
12 changes: 10 additions & 2 deletions include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,19 @@ static inline void dst_confirm(struct dst_entry *dst)
neigh_confirm(dst->neighbour);
}

static inline void dst_negative_advice(struct dst_entry **dst_p)
static inline void dst_negative_advice(struct dst_entry **dst_p,
struct sock *sk)
{
struct dst_entry * dst = *dst_p;
if (dst && dst->ops->negative_advice)
if (dst && dst->ops->negative_advice) {
*dst_p = dst->ops->negative_advice(dst);

if (dst != *dst_p) {
extern void sk_reset_txq(struct sock *sk);

sk_reset_txq(sk);
}
}
}

static inline void dst_link_failure(struct sk_buff *skb)
Expand Down
6 changes: 6 additions & 0 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested)
}
EXPORT_SYMBOL(sk_receive_skb);

void sk_reset_txq(struct sock *sk)
{
sk_tx_queue_clear(sk);
}
EXPORT_SYMBOL(sk_reset_txq);

struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie)
{
struct dst_entry *dst = sk->sk_dst_cache;
Expand Down
4 changes: 2 additions & 2 deletions net/dccp/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static int dccp_write_timeout(struct sock *sk)

if (sk->sk_state == DCCP_REQUESTING || sk->sk_state == DCCP_PARTOPEN) {
if (icsk->icsk_retransmits != 0)
dst_negative_advice(&sk->sk_dst_cache);
dst_negative_advice(&sk->sk_dst_cache, sk);
retry_until = icsk->icsk_syn_retries ?
: sysctl_dccp_request_retries;
} else {
Expand All @@ -63,7 +63,7 @@ static int dccp_write_timeout(struct sock *sk)
Golden words :-).
*/

dst_negative_advice(&sk->sk_dst_cache);
dst_negative_advice(&sk->sk_dst_cache, sk);
}

retry_until = sysctl_dccp_retries2;
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/af_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ static int dn_sendmsg(struct kiocb *iocb, struct socket *sock,
}

if ((flags & MSG_TRYHARD) && sk->sk_dst_cache)
dst_negative_advice(&sk->sk_dst_cache);
dst_negative_advice(&sk->sk_dst_cache, sk);

mss = scp->segsize_rem;
fctype = scp->services_rem & NSP_FC_MASK;
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/tcp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ static int tcp_write_timeout(struct sock *sk)

if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
if (icsk->icsk_retransmits)
dst_negative_advice(&sk->sk_dst_cache);
dst_negative_advice(&sk->sk_dst_cache, sk);
retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries;
} else {
if (retransmits_timed_out(sk, sysctl_tcp_retries1)) {
/* Black hole detection */
tcp_mtu_probing(icsk, sk);

dst_negative_advice(&sk->sk_dst_cache);
dst_negative_advice(&sk->sk_dst_cache, sk);
}

retry_until = sysctl_tcp_retries2;
Expand Down

0 comments on commit ea94ff3

Please sign in to comment.