aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-11-10 18:32:51 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-10 18:32:51 -0500
commitd4185bbf62a5d8d777ee445db1581beb17882a07 (patch)
tree024b0badbd7c970b1983be6d8c345cc4a290cb31 /net/ipv4
parentc075b13098b399dc565b4d53f42047a8d40ed3ba (diff)
parenta375413311b39005ef281bfd71ae8f4e3df22e97 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c Minor conflict between the BCM_CNIC define removal in net-next and a bug fix added to net. Based upon a conflict resolution patch posted by Stephen Rothwell. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/inet_diag.c5
-rw-r--r--net/ipv4/netfilter/iptable_nat.c4
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_illinois.c8
-rw-r--r--net/ipv4/tcp_input.c16
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv4/tcp_metrics.c2
-rw-r--r--net/ipv4/tcp_minisocks.c1
-rw-r--r--net/ipv4/tcp_timer.c4
9 files changed, 33 insertions, 10 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index b5e781b529aa..cb98cbed1973 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -895,13 +895,16 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
895 struct inet_diag_req_v2 *r, struct nlattr *bc) 895 struct inet_diag_req_v2 *r, struct nlattr *bc)
896{ 896{
897 const struct inet_diag_handler *handler; 897 const struct inet_diag_handler *handler;
898 int err = 0;
898 899
899 handler = inet_diag_lock_handler(r->sdiag_protocol); 900 handler = inet_diag_lock_handler(r->sdiag_protocol);
900 if (!IS_ERR(handler)) 901 if (!IS_ERR(handler))
901 handler->dump(skb, cb, r, bc); 902 handler->dump(skb, cb, r, bc);
903 else
904 err = PTR_ERR(handler);
902 inet_diag_unlock_handler(handler); 905 inet_diag_unlock_handler(handler);
903 906
904 return skb->len; 907 return err ? : skb->len;
905} 908}
906 909
907static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) 910static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index 9e0ffaf1d942..a82047282dbb 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -184,7 +184,8 @@ nf_nat_ipv4_out(unsigned int hooknum,
184 184
185 if ((ct->tuplehash[dir].tuple.src.u3.ip != 185 if ((ct->tuplehash[dir].tuple.src.u3.ip !=
186 ct->tuplehash[!dir].tuple.dst.u3.ip) || 186 ct->tuplehash[!dir].tuple.dst.u3.ip) ||
187 (ct->tuplehash[dir].tuple.src.u.all != 187 (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
188 ct->tuplehash[dir].tuple.src.u.all !=
188 ct->tuplehash[!dir].tuple.dst.u.all)) 189 ct->tuplehash[!dir].tuple.dst.u.all))
189 if (nf_xfrm_me_harder(skb, AF_INET) < 0) 190 if (nf_xfrm_me_harder(skb, AF_INET) < 0)
190 ret = NF_DROP; 191 ret = NF_DROP;
@@ -221,6 +222,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
221 } 222 }
222#ifdef CONFIG_XFRM 223#ifdef CONFIG_XFRM
223 else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && 224 else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
225 ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
224 ct->tuplehash[dir].tuple.dst.u.all != 226 ct->tuplehash[dir].tuple.dst.u.all !=
225 ct->tuplehash[!dir].tuple.src.u.all) 227 ct->tuplehash[!dir].tuple.src.u.all)
226 if (nf_xfrm_me_harder(skb, AF_INET) < 0) 228 if (nf_xfrm_me_harder(skb, AF_INET) < 0)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index eace049da052..733f48593ec3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2765,6 +2765,8 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info)
2765 info->tcpi_options |= TCPI_OPT_ECN; 2765 info->tcpi_options |= TCPI_OPT_ECN;
2766 if (tp->ecn_flags & TCP_ECN_SEEN) 2766 if (tp->ecn_flags & TCP_ECN_SEEN)
2767 info->tcpi_options |= TCPI_OPT_ECN_SEEN; 2767 info->tcpi_options |= TCPI_OPT_ECN_SEEN;
2768 if (tp->syn_data_acked)
2769 info->tcpi_options |= TCPI_OPT_SYN_DATA;
2768 2770
2769 info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto); 2771 info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto);
2770 info->tcpi_ato = jiffies_to_usecs(icsk->icsk_ack.ato); 2772 info->tcpi_ato = jiffies_to_usecs(icsk->icsk_ack.ato);
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 813b43a76fec..834857f3c871 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct sock *sk, u32 ext,
313 .tcpv_rttcnt = ca->cnt_rtt, 313 .tcpv_rttcnt = ca->cnt_rtt,
314 .tcpv_minrtt = ca->base_rtt, 314 .tcpv_minrtt = ca->base_rtt,
315 }; 315 };
316 u64 t = ca->sum_rtt;
317 316
318 do_div(t, ca->cnt_rtt); 317 if (info.tcpv_rttcnt > 0) {
319 info.tcpv_rtt = t; 318 u64 t = ca->sum_rtt;
320 319
320 do_div(t, info.tcpv_rttcnt);
321 info.tcpv_rtt = t;
322 }
321 nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); 323 nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
322 } 324 }
323} 325}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e95b4e508afe..7839d51fb65b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4553,6 +4553,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
4553 struct tcphdr *th; 4553 struct tcphdr *th;
4554 bool fragstolen; 4554 bool fragstolen;
4555 4555
4556 if (size == 0)
4557 return 0;
4558
4556 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); 4559 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
4557 if (!skb) 4560 if (!skb)
4558 goto err; 4561 goto err;
@@ -5653,6 +5656,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
5653 tcp_rearm_rto(sk); 5656 tcp_rearm_rto(sk);
5654 return true; 5657 return true;
5655 } 5658 }
5659 tp->syn_data_acked = tp->syn_data;
5656 return false; 5660 return false;
5657} 5661}
5658 5662
@@ -5970,7 +5974,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5970 5974
5971 req = tp->fastopen_rsk; 5975 req = tp->fastopen_rsk;
5972 if (req != NULL) { 5976 if (req != NULL) {
5973 BUG_ON(sk->sk_state != TCP_SYN_RECV && 5977 WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
5974 sk->sk_state != TCP_FIN_WAIT1); 5978 sk->sk_state != TCP_FIN_WAIT1);
5975 5979
5976 if (tcp_check_req(sk, skb, req, NULL, true) == NULL) 5980 if (tcp_check_req(sk, skb, req, NULL, true) == NULL)
@@ -6059,7 +6063,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6059 * ACK we have received, this would have acknowledged 6063 * ACK we have received, this would have acknowledged
6060 * our SYNACK so stop the SYNACK timer. 6064 * our SYNACK so stop the SYNACK timer.
6061 */ 6065 */
6062 if (acceptable && req != NULL) { 6066 if (req != NULL) {
6067 /* Return RST if ack_seq is invalid.
6068 * Note that RFC793 only says to generate a
6069 * DUPACK for it but for TCP Fast Open it seems
6070 * better to treat this case like TCP_SYN_RECV
6071 * above.
6072 */
6073 if (!acceptable)
6074 return 1;
6063 /* We no longer need the request sock. */ 6075 /* We no longer need the request sock. */
6064 reqsk_fastopen_remove(sk, req, false); 6076 reqsk_fastopen_remove(sk, req, false);
6065 tcp_rearm_rto(sk); 6077 tcp_rearm_rto(sk);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e3607669064e..9dd5b34eb112 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1465,6 +1465,7 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk,
1465 skb_set_owner_r(skb, child); 1465 skb_set_owner_r(skb, child);
1466 __skb_queue_tail(&child->sk_receive_queue, skb); 1466 __skb_queue_tail(&child->sk_receive_queue, skb);
1467 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; 1467 tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
1468 tp->syn_data_acked = 1;
1468 } 1469 }
1469 sk->sk_data_ready(sk, 0); 1470 sk->sk_data_ready(sk, 0);
1470 bh_unlock_sock(child); 1471 bh_unlock_sock(child);
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 4c752a6e0bcd..53bc5847bfa8 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -864,7 +864,7 @@ static int parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
864 } 864 }
865 a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6]; 865 a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6];
866 if (a) { 866 if (a) {
867 if (nla_len(a) != sizeof(sizeof(struct in6_addr))) 867 if (nla_len(a) != sizeof(struct in6_addr))
868 return -EINVAL; 868 return -EINVAL;
869 addr->family = AF_INET6; 869 addr->family = AF_INET6;
870 memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); 870 memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6));
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 0404b3f4c959..f35f2dfb6401 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -510,6 +510,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
510 newtp->rx_opt.mss_clamp = req->mss; 510 newtp->rx_opt.mss_clamp = req->mss;
511 TCP_ECN_openreq_child(newtp, req); 511 TCP_ECN_openreq_child(newtp, req);
512 newtp->fastopen_rsk = NULL; 512 newtp->fastopen_rsk = NULL;
513 newtp->syn_data_acked = 0;
513 514
514 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS); 515 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS);
515 } 516 }
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 62c69ab19fdf..b78aac30c498 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -347,8 +347,8 @@ void tcp_retransmit_timer(struct sock *sk)
347 return; 347 return;
348 } 348 }
349 if (tp->fastopen_rsk) { 349 if (tp->fastopen_rsk) {
350 BUG_ON(sk->sk_state != TCP_SYN_RECV && 350 WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
351 sk->sk_state != TCP_FIN_WAIT1); 351 sk->sk_state != TCP_FIN_WAIT1);
352 tcp_fastopen_synack_timer(sk); 352 tcp_fastopen_synack_timer(sk);
353 /* Before we receive ACK to our SYN-ACK don't retransmit 353 /* Before we receive ACK to our SYN-ACK don't retransmit
354 * anything else (e.g., data or FIN segments). 354 * anything else (e.g., data or FIN segments).