diff options
| author | Paul Mackerras <paulus@samba.org> | 2008-06-16 00:53:25 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2008-06-16 00:53:25 -0400 |
| commit | a9653cf540d407fb75deb3db65a1be6c81d53ee0 (patch) | |
| tree | 075fb79746f1d74443c9a9062e73c26a6266b05c /net | |
| parent | e80ac32767d0f781ac195c472d500a7451d3729a (diff) | |
| parent | 066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff) | |
Merge branch 'linux-2.6' into merge
Diffstat (limited to 'net')
33 files changed, 128 insertions, 184 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 6de4bd195d28..1e8be246ad15 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
| @@ -290,12 +290,12 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk, | |||
| 290 | 290 | ||
| 291 | while (1) { | 291 | while (1) { |
| 292 | const u8 len = dccp_ackvec_len(av, index); | 292 | const u8 len = dccp_ackvec_len(av, index); |
| 293 | const u8 state = dccp_ackvec_state(av, index); | 293 | const u8 av_state = dccp_ackvec_state(av, index); |
| 294 | /* | 294 | /* |
| 295 | * valid packets not yet in av_buf have a reserved | 295 | * valid packets not yet in av_buf have a reserved |
| 296 | * entry, with a len equal to 0. | 296 | * entry, with a len equal to 0. |
| 297 | */ | 297 | */ |
| 298 | if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && | 298 | if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED && |
| 299 | len == 0 && delta == 0) { /* Found our | 299 | len == 0 && delta == 0) { /* Found our |
| 300 | reserved seat! */ | 300 | reserved seat! */ |
| 301 | dccp_pr_debug("Found %llu reserved seat!\n", | 301 | dccp_pr_debug("Found %llu reserved seat!\n", |
| @@ -325,31 +325,6 @@ out_duplicate: | |||
| 325 | return -EILSEQ; | 325 | return -EILSEQ; |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | #ifdef CONFIG_IP_DCCP_DEBUG | ||
| 329 | void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len) | ||
| 330 | { | ||
| 331 | dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len, | ||
| 332 | (unsigned long long)ackno); | ||
| 333 | |||
| 334 | while (len--) { | ||
| 335 | const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6; | ||
| 336 | const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK; | ||
| 337 | |||
| 338 | dccp_pr_debug_cat("%d,%d|", state, rl); | ||
| 339 | ++vector; | ||
| 340 | } | ||
| 341 | |||
| 342 | dccp_pr_debug_cat("\n"); | ||
| 343 | } | ||
| 344 | |||
| 345 | void dccp_ackvec_print(const struct dccp_ackvec *av) | ||
| 346 | { | ||
| 347 | dccp_ackvector_print(av->av_buf_ackno, | ||
| 348 | av->av_buf + av->av_buf_head, | ||
| 349 | av->av_vec_len); | ||
| 350 | } | ||
| 351 | #endif | ||
| 352 | |||
| 353 | static void dccp_ackvec_throw_record(struct dccp_ackvec *av, | 328 | static void dccp_ackvec_throw_record(struct dccp_ackvec *av, |
| 354 | struct dccp_ackvec_record *avr) | 329 | struct dccp_ackvec_record *avr) |
| 355 | { | 330 | { |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index f813077234b7..a1929f33d703 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
| @@ -159,8 +159,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp) | |||
| 159 | } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) | 159 | } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) |
| 160 | - (s64)hctx->ccid3hctx_rtt >= 0) { | 160 | - (s64)hctx->ccid3hctx_rtt >= 0) { |
| 161 | 161 | ||
| 162 | hctx->ccid3hctx_x = | 162 | hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate); |
| 163 | max(min(2 * hctx->ccid3hctx_x, min_rate), | 163 | hctx->ccid3hctx_x = max(hctx->ccid3hctx_x, |
| 164 | scaled_div(((__u64)hctx->ccid3hctx_s) << 6, | 164 | scaled_div(((__u64)hctx->ccid3hctx_s) << 6, |
| 165 | hctx->ccid3hctx_rtt)); | 165 | hctx->ccid3hctx_rtt)); |
| 166 | hctx->ccid3hctx_t_ld = now; | 166 | hctx->ccid3hctx_t_ld = now; |
| @@ -329,8 +329,14 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) | |||
| 329 | hctx->ccid3hctx_x = rfc3390_initial_rate(sk); | 329 | hctx->ccid3hctx_x = rfc3390_initial_rate(sk); |
| 330 | hctx->ccid3hctx_t_ld = now; | 330 | hctx->ccid3hctx_t_ld = now; |
| 331 | } else { | 331 | } else { |
| 332 | /* Sender does not have RTT sample: X_pps = 1 pkt/sec */ | 332 | /* |
| 333 | hctx->ccid3hctx_x = hctx->ccid3hctx_s; | 333 | * Sender does not have RTT sample: |
| 334 | * - set fallback RTT (RFC 4340, 3.4) since a RTT value | ||
| 335 | * is needed in several parts (e.g. window counter); | ||
| 336 | * - set sending rate X_pps = 1pps as per RFC 3448, 4.2. | ||
| 337 | */ | ||
| 338 | hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT; | ||
| 339 | hctx->ccid3hctx_x = hctx->ccid3hctx_s; | ||
| 334 | hctx->ccid3hctx_x <<= 6; | 340 | hctx->ccid3hctx_x <<= 6; |
| 335 | } | 341 | } |
| 336 | ccid3_update_send_interval(hctx); | 342 | ccid3_update_send_interval(hctx); |
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c index d1dfbb8de64c..97ecec0a8e76 100644 --- a/net/dccp/ccids/lib/tfrc.c +++ b/net/dccp/ccids/lib/tfrc.c | |||
| @@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444); | |||
| 14 | MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); | 14 | MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | extern int tfrc_tx_packet_history_init(void); | ||
| 18 | extern void tfrc_tx_packet_history_exit(void); | ||
| 19 | extern int tfrc_rx_packet_history_init(void); | ||
| 20 | extern void tfrc_rx_packet_history_exit(void); | ||
| 21 | |||
| 22 | extern int tfrc_li_init(void); | ||
| 23 | extern void tfrc_li_exit(void); | ||
| 24 | |||
| 25 | static int __init tfrc_module_init(void) | 17 | static int __init tfrc_module_init(void) |
| 26 | { | 18 | { |
| 27 | int rc = tfrc_li_init(); | 19 | int rc = tfrc_li_init(); |
diff --git a/net/dccp/ccids/lib/tfrc.h b/net/dccp/ccids/lib/tfrc.h index 1fb1187bbf1c..ed9857527acf 100644 --- a/net/dccp/ccids/lib/tfrc.h +++ b/net/dccp/ccids/lib/tfrc.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | * (at your option) any later version. | 15 | * (at your option) any later version. |
| 16 | */ | 16 | */ |
| 17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 18 | #include <asm/div64.h> | 18 | #include <linux/math64.h> |
| 19 | #include "../../dccp.h" | 19 | #include "../../dccp.h" |
| 20 | /* internal includes that this module exports: */ | 20 | /* internal includes that this module exports: */ |
| 21 | #include "loss_interval.h" | 21 | #include "loss_interval.h" |
| @@ -29,21 +29,19 @@ extern int tfrc_debug; | |||
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | /* integer-arithmetic divisions of type (a * 1000000)/b */ | 31 | /* integer-arithmetic divisions of type (a * 1000000)/b */ |
| 32 | static inline u64 scaled_div(u64 a, u32 b) | 32 | static inline u64 scaled_div(u64 a, u64 b) |
| 33 | { | 33 | { |
| 34 | BUG_ON(b==0); | 34 | BUG_ON(b==0); |
| 35 | a *= 1000000; | 35 | return div64_u64(a * 1000000, b); |
| 36 | do_div(a, b); | ||
| 37 | return a; | ||
| 38 | } | 36 | } |
| 39 | 37 | ||
| 40 | static inline u32 scaled_div32(u64 a, u32 b) | 38 | static inline u32 scaled_div32(u64 a, u64 b) |
| 41 | { | 39 | { |
| 42 | u64 result = scaled_div(a, b); | 40 | u64 result = scaled_div(a, b); |
| 43 | 41 | ||
| 44 | if (result > UINT_MAX) { | 42 | if (result > UINT_MAX) { |
| 45 | DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U", | 43 | DCCP_CRIT("Overflow: %llu/%llu > UINT_MAX", |
| 46 | (unsigned long long)a, b); | 44 | (unsigned long long)a, (unsigned long long)b); |
| 47 | return UINT_MAX; | 45 | return UINT_MAX; |
| 48 | } | 46 | } |
| 49 | return result; | 47 | return result; |
| @@ -58,7 +56,14 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight) | |||
| 58 | return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval; | 56 | return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval; |
| 59 | } | 57 | } |
| 60 | 58 | ||
| 61 | extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); | 59 | extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); |
| 62 | extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); | 60 | extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); |
| 63 | 61 | ||
| 62 | extern int tfrc_tx_packet_history_init(void); | ||
| 63 | extern void tfrc_tx_packet_history_exit(void); | ||
| 64 | extern int tfrc_rx_packet_history_init(void); | ||
| 65 | extern void tfrc_rx_packet_history_exit(void); | ||
| 66 | |||
| 67 | extern int tfrc_li_init(void); | ||
| 68 | extern void tfrc_li_exit(void); | ||
| 64 | #endif /* _TFRC_H_ */ | 69 | #endif /* _TFRC_H_ */ |
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c index e4e64b76c10c..2f20a29cffe4 100644 --- a/net/dccp/ccids/lib/tfrc_equation.c +++ b/net/dccp/ccids/lib/tfrc_equation.c | |||
| @@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p) | |||
| 661 | 661 | ||
| 662 | EXPORT_SYMBOL_GPL(tfrc_calc_x); | 662 | EXPORT_SYMBOL_GPL(tfrc_calc_x); |
| 663 | 663 | ||
| 664 | /* | 664 | /** |
| 665 | * tfrc_calc_x_reverse_lookup - try to find p given f(p) | 665 | * tfrc_calc_x_reverse_lookup - try to find p given f(p) |
| 666 | * | 666 | * |
| 667 | * @fvalue: function value to match, scaled by 1000000 | 667 | * @fvalue: function value to match, scaled by 1000000 |
| @@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue) | |||
| 676 | 676 | ||
| 677 | /* Error cases. */ | 677 | /* Error cases. */ |
| 678 | if (fvalue < tfrc_calc_x_lookup[0][1]) { | 678 | if (fvalue < tfrc_calc_x_lookup[0][1]) { |
| 679 | DCCP_WARN("fvalue %d smaller than resolution\n", fvalue); | 679 | DCCP_WARN("fvalue %u smaller than resolution\n", fvalue); |
| 680 | return tfrc_calc_x_lookup[0][1]; | 680 | return TFRC_SMALLEST_P; |
| 681 | } | 681 | } |
| 682 | if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { | 682 | if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { |
| 683 | DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue); | 683 | DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue); |
| 684 | return 1000000; | 684 | return 1000000; |
| 685 | } | 685 | } |
| 686 | 686 | ||
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index c22a3780c14e..37d27bcb361f 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -589,7 +589,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 589 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) | 589 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) |
| 590 | goto drop; | 590 | goto drop; |
| 591 | 591 | ||
| 592 | req = reqsk_alloc(&dccp_request_sock_ops); | 592 | req = inet_reqsk_alloc(&dccp_request_sock_ops); |
| 593 | if (req == NULL) | 593 | if (req == NULL) |
| 594 | goto drop; | 594 | goto drop; |
| 595 | 595 | ||
| @@ -605,7 +605,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 605 | ireq = inet_rsk(req); | 605 | ireq = inet_rsk(req); |
| 606 | ireq->loc_addr = ip_hdr(skb)->daddr; | 606 | ireq->loc_addr = ip_hdr(skb)->daddr; |
| 607 | ireq->rmt_addr = ip_hdr(skb)->saddr; | 607 | ireq->rmt_addr = ip_hdr(skb)->saddr; |
| 608 | ireq->opt = NULL; | ||
| 609 | 608 | ||
| 610 | /* | 609 | /* |
| 611 | * Step 3: Process LISTEN state | 610 | * Step 3: Process LISTEN state |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 9b1129bb7ece..f7fe2a572d7b 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -421,7 +421,6 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 421 | ireq6 = inet6_rsk(req); | 421 | ireq6 = inet6_rsk(req); |
| 422 | ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr); | 422 | ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr); |
| 423 | ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr); | 423 | ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr); |
| 424 | ireq6->pktopts = NULL; | ||
| 425 | 424 | ||
| 426 | if (ipv6_opt_accepted(sk, skb) || | 425 | if (ipv6_opt_accepted(sk, skb) || |
| 427 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || | 426 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 33ad48321b08..66dca5bba858 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
| @@ -165,12 +165,12 @@ out_free: | |||
| 165 | /* See dccp_v4_conn_request */ | 165 | /* See dccp_v4_conn_request */ |
| 166 | newdmsk->dccpms_sequence_window = req->rcv_wnd; | 166 | newdmsk->dccpms_sequence_window = req->rcv_wnd; |
| 167 | 167 | ||
| 168 | newdp->dccps_gar = newdp->dccps_isr = dreq->dreq_isr; | 168 | newdp->dccps_gar = newdp->dccps_iss = dreq->dreq_iss; |
| 169 | dccp_update_gsr(newsk, dreq->dreq_isr); | ||
| 170 | |||
| 171 | newdp->dccps_iss = dreq->dreq_iss; | ||
| 172 | dccp_update_gss(newsk, dreq->dreq_iss); | 169 | dccp_update_gss(newsk, dreq->dreq_iss); |
| 173 | 170 | ||
| 171 | newdp->dccps_isr = dreq->dreq_isr; | ||
| 172 | dccp_update_gsr(newsk, dreq->dreq_isr); | ||
| 173 | |||
| 174 | /* | 174 | /* |
| 175 | * SWL and AWL are initially adjusted so that they are not less than | 175 | * SWL and AWL are initially adjusted so that they are not less than |
| 176 | * the initial Sequence Numbers received and sent, respectively: | 176 | * the initial Sequence Numbers received and sent, respectively: |
diff --git a/net/dccp/options.c b/net/dccp/options.c index d2a84a2fecee..43bc24e761d0 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
| @@ -107,9 +107,11 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | |||
| 107 | * | 107 | * |
| 108 | * CCID-specific options are ignored during connection setup, as | 108 | * CCID-specific options are ignored during connection setup, as |
| 109 | * negotiation may still be in progress (see RFC 4340, 10.3). | 109 | * negotiation may still be in progress (see RFC 4340, 10.3). |
| 110 | * The same applies to Ack Vectors, as these depend on the CCID. | ||
| 110 | * | 111 | * |
| 111 | */ | 112 | */ |
| 112 | if (dreq != NULL && opt >= 128) | 113 | if (dreq != NULL && (opt >= 128 || |
| 114 | opt == DCCPO_ACK_VECTOR_0 || opt == DCCPO_ACK_VECTOR_1)) | ||
| 113 | goto ignore_option; | 115 | goto ignore_option; |
| 114 | 116 | ||
| 115 | switch (opt) { | 117 | switch (opt) { |
diff --git a/net/dccp/output.c b/net/dccp/output.c index 1f8a9b64c083..fe20068c5d8e 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
| @@ -508,6 +508,7 @@ void dccp_send_ack(struct sock *sk) | |||
| 508 | 508 | ||
| 509 | EXPORT_SYMBOL_GPL(dccp_send_ack); | 509 | EXPORT_SYMBOL_GPL(dccp_send_ack); |
| 510 | 510 | ||
| 511 | #if 0 | ||
| 511 | /* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */ | 512 | /* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */ |
| 512 | void dccp_send_delayed_ack(struct sock *sk) | 513 | void dccp_send_delayed_ack(struct sock *sk) |
| 513 | { | 514 | { |
| @@ -538,6 +539,7 @@ void dccp_send_delayed_ack(struct sock *sk) | |||
| 538 | icsk->icsk_ack.timeout = timeout; | 539 | icsk->icsk_ack.timeout = timeout; |
| 539 | sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout); | 540 | sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout); |
| 540 | } | 541 | } |
| 542 | #endif | ||
| 541 | 543 | ||
| 542 | void dccp_send_sync(struct sock *sk, const u64 ackno, | 544 | void dccp_send_sync(struct sock *sk, const u64 ackno, |
| 543 | const enum dccp_pkt_type pkt_type) | 545 | const enum dccp_pkt_type pkt_type) |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 0bcdc9250279..81368a7f5379 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
| @@ -42,7 +42,7 @@ static int bufsize = 64 * 1024; | |||
| 42 | 42 | ||
| 43 | static const char procname[] = "dccpprobe"; | 43 | static const char procname[] = "dccpprobe"; |
| 44 | 44 | ||
| 45 | struct { | 45 | static struct { |
| 46 | struct kfifo *fifo; | 46 | struct kfifo *fifo; |
| 47 | spinlock_t lock; | 47 | spinlock_t lock; |
| 48 | wait_queue_head_t wait; | 48 | wait_queue_head_t wait; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 3b83c34019fc..0d4d72827e4b 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
| @@ -960,7 +960,10 @@ int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
| 960 | rtm->rtm_dst_len = dst_len; | 960 | rtm->rtm_dst_len = dst_len; |
| 961 | rtm->rtm_src_len = 0; | 961 | rtm->rtm_src_len = 0; |
| 962 | rtm->rtm_tos = tos; | 962 | rtm->rtm_tos = tos; |
| 963 | rtm->rtm_table = tb_id; | 963 | if (tb_id < 256) |
| 964 | rtm->rtm_table = tb_id; | ||
| 965 | else | ||
| 966 | rtm->rtm_table = RT_TABLE_COMPAT; | ||
| 964 | NLA_PUT_U32(skb, RTA_TABLE, tb_id); | 967 | NLA_PUT_U32(skb, RTA_TABLE, tb_id); |
| 965 | rtm->rtm_type = type; | 968 | rtm->rtm_type = type; |
| 966 | rtm->rtm_flags = fi->fib_flags; | 969 | rtm->rtm_flags = fi->fib_flags; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 828ea211ff21..045e799d3e1d 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -419,7 +419,8 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
| 419 | struct inet_connection_sock *icsk = inet_csk(parent); | 419 | struct inet_connection_sock *icsk = inet_csk(parent); |
| 420 | struct request_sock_queue *queue = &icsk->icsk_accept_queue; | 420 | struct request_sock_queue *queue = &icsk->icsk_accept_queue; |
| 421 | struct listen_sock *lopt = queue->listen_opt; | 421 | struct listen_sock *lopt = queue->listen_opt; |
| 422 | int thresh = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries; | 422 | int max_retries = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries; |
| 423 | int thresh = max_retries; | ||
| 423 | unsigned long now = jiffies; | 424 | unsigned long now = jiffies; |
| 424 | struct request_sock **reqp, *req; | 425 | struct request_sock **reqp, *req; |
| 425 | int i, budget; | 426 | int i, budget; |
| @@ -455,6 +456,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
| 455 | } | 456 | } |
| 456 | } | 457 | } |
| 457 | 458 | ||
| 459 | if (queue->rskq_defer_accept) | ||
| 460 | max_retries = queue->rskq_defer_accept; | ||
| 461 | |||
| 458 | budget = 2 * (lopt->nr_table_entries / (timeout / interval)); | 462 | budget = 2 * (lopt->nr_table_entries / (timeout / interval)); |
| 459 | i = lopt->clock_hand; | 463 | i = lopt->clock_hand; |
| 460 | 464 | ||
| @@ -462,8 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
| 462 | reqp=&lopt->syn_table[i]; | 466 | reqp=&lopt->syn_table[i]; |
| 463 | while ((req = *reqp) != NULL) { | 467 | while ((req = *reqp) != NULL) { |
| 464 | if (time_after_eq(now, req->expires)) { | 468 | if (time_after_eq(now, req->expires)) { |
| 465 | if (req->retrans < thresh && | 469 | if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) && |
| 466 | !req->rsk_ops->rtx_syn_ack(parent, req)) { | 470 | (inet_rsk(req)->acked || |
| 471 | !req->rsk_ops->rtx_syn_ack(parent, req))) { | ||
| 467 | unsigned long timeo; | 472 | unsigned long timeo; |
| 468 | 473 | ||
| 469 | if (req->retrans++ == 0) | 474 | if (req->retrans++ == 0) |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 73ba98921d64..d182a2a26291 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
| @@ -285,7 +285,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
| 285 | cookie_check_timestamp(&tcp_opt); | 285 | cookie_check_timestamp(&tcp_opt); |
| 286 | 286 | ||
| 287 | ret = NULL; | 287 | ret = NULL; |
| 288 | req = reqsk_alloc(&tcp_request_sock_ops); /* for safety */ | 288 | req = inet_reqsk_alloc(&tcp_request_sock_ops); /* for safety */ |
| 289 | if (!req) | 289 | if (!req) |
| 290 | goto out; | 290 | goto out; |
| 291 | 291 | ||
| @@ -301,7 +301,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | |||
| 301 | ireq->rmt_port = th->source; | 301 | ireq->rmt_port = th->source; |
| 302 | ireq->loc_addr = ip_hdr(skb)->daddr; | 302 | ireq->loc_addr = ip_hdr(skb)->daddr; |
| 303 | ireq->rmt_addr = ip_hdr(skb)->saddr; | 303 | ireq->rmt_addr = ip_hdr(skb)->saddr; |
| 304 | ireq->opt = NULL; | ||
| 305 | ireq->snd_wscale = tcp_opt.snd_wscale; | 304 | ireq->snd_wscale = tcp_opt.snd_wscale; |
| 306 | ireq->rcv_wscale = tcp_opt.rcv_wscale; | 305 | ireq->rcv_wscale = tcp_opt.rcv_wscale; |
| 307 | ireq->sack_ok = tcp_opt.sack_ok; | 306 | ireq->sack_ok = tcp_opt.sack_ok; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index ab66683b8043..fc54a48fde1e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -2112,12 +2112,15 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
| 2112 | break; | 2112 | break; |
| 2113 | 2113 | ||
| 2114 | case TCP_DEFER_ACCEPT: | 2114 | case TCP_DEFER_ACCEPT: |
| 2115 | if (val < 0) { | 2115 | icsk->icsk_accept_queue.rskq_defer_accept = 0; |
| 2116 | err = -EINVAL; | 2116 | if (val > 0) { |
| 2117 | } else { | 2117 | /* Translate value in seconds to number of |
| 2118 | if (val > MAX_TCP_ACCEPT_DEFERRED) | 2118 | * retransmits */ |
| 2119 | val = MAX_TCP_ACCEPT_DEFERRED; | 2119 | while (icsk->icsk_accept_queue.rskq_defer_accept < 32 && |
| 2120 | icsk->icsk_accept_queue.rskq_defer_accept = val; | 2120 | val > ((TCP_TIMEOUT_INIT / HZ) << |
| 2121 | icsk->icsk_accept_queue.rskq_defer_accept)) | ||
| 2122 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
| 2123 | icsk->icsk_accept_queue.rskq_defer_accept++; | ||
| 2121 | } | 2124 | } |
| 2122 | break; | 2125 | break; |
| 2123 | 2126 | ||
| @@ -2299,7 +2302,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level, | |||
| 2299 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; | 2302 | val = (val ? : sysctl_tcp_fin_timeout) / HZ; |
| 2300 | break; | 2303 | break; |
| 2301 | case TCP_DEFER_ACCEPT: | 2304 | case TCP_DEFER_ACCEPT: |
| 2302 | val = icsk->icsk_accept_queue.rskq_defer_accept; | 2305 | val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 : |
| 2306 | ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1)); | ||
| 2303 | break; | 2307 | break; |
| 2304 | case TCP_WINDOW_CLAMP: | 2308 | case TCP_WINDOW_CLAMP: |
| 2305 | val = tp->window_clamp; | 2309 | val = tp->window_clamp; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eba873e9b560..cad73b7dfef0 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -4541,49 +4541,6 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th) | |||
| 4541 | } | 4541 | } |
| 4542 | } | 4542 | } |
| 4543 | 4543 | ||
| 4544 | static int tcp_defer_accept_check(struct sock *sk) | ||
| 4545 | { | ||
| 4546 | struct tcp_sock *tp = tcp_sk(sk); | ||
| 4547 | |||
| 4548 | if (tp->defer_tcp_accept.request) { | ||
| 4549 | int queued_data = tp->rcv_nxt - tp->copied_seq; | ||
| 4550 | int hasfin = !skb_queue_empty(&sk->sk_receive_queue) ? | ||
| 4551 | tcp_hdr((struct sk_buff *) | ||
| 4552 | sk->sk_receive_queue.prev)->fin : 0; | ||
| 4553 | |||
| 4554 | if (queued_data && hasfin) | ||
| 4555 | queued_data--; | ||
| 4556 | |||
| 4557 | if (queued_data && | ||
| 4558 | tp->defer_tcp_accept.listen_sk->sk_state == TCP_LISTEN) { | ||
| 4559 | if (sock_flag(sk, SOCK_KEEPOPEN)) { | ||
| 4560 | inet_csk_reset_keepalive_timer(sk, | ||
| 4561 | keepalive_time_when(tp)); | ||
| 4562 | } else { | ||
| 4563 | inet_csk_delete_keepalive_timer(sk); | ||
| 4564 | } | ||
| 4565 | |||
| 4566 | inet_csk_reqsk_queue_add( | ||
| 4567 | tp->defer_tcp_accept.listen_sk, | ||
| 4568 | tp->defer_tcp_accept.request, | ||
| 4569 | sk); | ||
| 4570 | |||
| 4571 | tp->defer_tcp_accept.listen_sk->sk_data_ready( | ||
| 4572 | tp->defer_tcp_accept.listen_sk, 0); | ||
| 4573 | |||
| 4574 | sock_put(tp->defer_tcp_accept.listen_sk); | ||
| 4575 | sock_put(sk); | ||
| 4576 | tp->defer_tcp_accept.listen_sk = NULL; | ||
| 4577 | tp->defer_tcp_accept.request = NULL; | ||
| 4578 | } else if (hasfin || | ||
| 4579 | tp->defer_tcp_accept.listen_sk->sk_state != TCP_LISTEN) { | ||
| 4580 | tcp_reset(sk); | ||
| 4581 | return -1; | ||
| 4582 | } | ||
| 4583 | } | ||
| 4584 | return 0; | ||
| 4585 | } | ||
| 4586 | |||
| 4587 | static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen) | 4544 | static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen) |
| 4588 | { | 4545 | { |
| 4589 | struct tcp_sock *tp = tcp_sk(sk); | 4546 | struct tcp_sock *tp = tcp_sk(sk); |
| @@ -4944,8 +4901,6 @@ step5: | |||
| 4944 | 4901 | ||
| 4945 | tcp_data_snd_check(sk); | 4902 | tcp_data_snd_check(sk); |
| 4946 | tcp_ack_snd_check(sk); | 4903 | tcp_ack_snd_check(sk); |
| 4947 | |||
| 4948 | tcp_defer_accept_check(sk); | ||
| 4949 | return 0; | 4904 | return 0; |
| 4950 | 4905 | ||
| 4951 | csum_error: | 4906 | csum_error: |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index cd601a866c2f..97a230026e13 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1285,7 +1285,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1285 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) | 1285 | if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) |
| 1286 | goto drop; | 1286 | goto drop; |
| 1287 | 1287 | ||
| 1288 | req = reqsk_alloc(&tcp_request_sock_ops); | 1288 | req = inet_reqsk_alloc(&tcp_request_sock_ops); |
| 1289 | if (!req) | 1289 | if (!req) |
| 1290 | goto drop; | 1290 | goto drop; |
| 1291 | 1291 | ||
| @@ -1918,14 +1918,6 @@ int tcp_v4_destroy_sock(struct sock *sk) | |||
| 1918 | sk->sk_sndmsg_page = NULL; | 1918 | sk->sk_sndmsg_page = NULL; |
| 1919 | } | 1919 | } |
| 1920 | 1920 | ||
| 1921 | if (tp->defer_tcp_accept.request) { | ||
| 1922 | reqsk_free(tp->defer_tcp_accept.request); | ||
| 1923 | sock_put(tp->defer_tcp_accept.listen_sk); | ||
| 1924 | sock_put(sk); | ||
| 1925 | tp->defer_tcp_accept.listen_sk = NULL; | ||
| 1926 | tp->defer_tcp_accept.request = NULL; | ||
| 1927 | } | ||
| 1928 | |||
| 1929 | atomic_dec(&tcp_sockets_allocated); | 1921 | atomic_dec(&tcp_sockets_allocated); |
| 1930 | 1922 | ||
| 1931 | return 0; | 1923 | return 0; |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 019c8c16e5cc..8245247a6ceb 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
| @@ -571,8 +571,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
| 571 | does sequence test, SYN is truncated, and thus we consider | 571 | does sequence test, SYN is truncated, and thus we consider |
| 572 | it a bare ACK. | 572 | it a bare ACK. |
| 573 | 573 | ||
| 574 | Both ends (listening sockets) accept the new incoming | 574 | If icsk->icsk_accept_queue.rskq_defer_accept, we silently drop this |
| 575 | connection and try to talk to each other. 8-) | 575 | bare ACK. Otherwise, we create an established connection. Both |
| 576 | ends (listening sockets) accept the new incoming connection and try | ||
| 577 | to talk to each other. 8-) | ||
| 576 | 578 | ||
| 577 | Note: This case is both harmless, and rare. Possibility is about the | 579 | Note: This case is both harmless, and rare. Possibility is about the |
| 578 | same as us discovering intelligent life on another plant tomorrow. | 580 | same as us discovering intelligent life on another plant tomorrow. |
| @@ -640,6 +642,13 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
| 640 | if (!(flg & TCP_FLAG_ACK)) | 642 | if (!(flg & TCP_FLAG_ACK)) |
| 641 | return NULL; | 643 | return NULL; |
| 642 | 644 | ||
| 645 | /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */ | ||
| 646 | if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && | ||
| 647 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { | ||
| 648 | inet_rsk(req)->acked = 1; | ||
| 649 | return NULL; | ||
| 650 | } | ||
| 651 | |||
| 643 | /* OK, ACK is valid, create big socket and | 652 | /* OK, ACK is valid, create big socket and |
| 644 | * feed this segment to it. It will repeat all | 653 | * feed this segment to it. It will repeat all |
| 645 | * the tests. THIS SEGMENT MUST MOVE SOCKET TO | 654 | * the tests. THIS SEGMENT MUST MOVE SOCKET TO |
| @@ -678,24 +687,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
| 678 | inet_csk_reqsk_queue_unlink(sk, req, prev); | 687 | inet_csk_reqsk_queue_unlink(sk, req, prev); |
| 679 | inet_csk_reqsk_queue_removed(sk, req); | 688 | inet_csk_reqsk_queue_removed(sk, req); |
| 680 | 689 | ||
| 681 | if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && | 690 | inet_csk_reqsk_queue_add(sk, req, child); |
| 682 | TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) { | ||
| 683 | |||
| 684 | /* the accept queue handling is done is est recv slow | ||
| 685 | * path so lets make sure to start there | ||
| 686 | */ | ||
| 687 | tcp_sk(child)->pred_flags = 0; | ||
| 688 | sock_hold(sk); | ||
| 689 | sock_hold(child); | ||
| 690 | tcp_sk(child)->defer_tcp_accept.listen_sk = sk; | ||
| 691 | tcp_sk(child)->defer_tcp_accept.request = req; | ||
| 692 | |||
| 693 | inet_csk_reset_keepalive_timer(child, | ||
| 694 | inet_csk(sk)->icsk_accept_queue.rskq_defer_accept * HZ); | ||
| 695 | } else { | ||
| 696 | inet_csk_reqsk_queue_add(sk, req, child); | ||
| 697 | } | ||
| 698 | |||
| 699 | return child; | 691 | return child; |
| 700 | 692 | ||
| 701 | listen_overflow: | 693 | listen_overflow: |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 4de68cf5f2aa..63ed9d6830e7 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
| @@ -489,11 +489,6 @@ static void tcp_keepalive_timer (unsigned long data) | |||
| 489 | goto death; | 489 | goto death; |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | if (tp->defer_tcp_accept.request && sk->sk_state == TCP_ESTABLISHED) { | ||
| 493 | tcp_send_active_reset(sk, GFP_ATOMIC); | ||
| 494 | goto death; | ||
| 495 | } | ||
| 496 | |||
| 497 | if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE) | 492 | if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE) |
| 498 | goto out; | 493 | goto out; |
| 499 | 494 | ||
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 3c6aafb02183..e84b3fd17fb4 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
| @@ -191,7 +191,7 @@ lookup_protocol: | |||
| 191 | np->mcast_hops = -1; | 191 | np->mcast_hops = -1; |
| 192 | np->mc_loop = 1; | 192 | np->mc_loop = 1; |
| 193 | np->pmtudisc = IPV6_PMTUDISC_WANT; | 193 | np->pmtudisc = IPV6_PMTUDISC_WANT; |
| 194 | np->ipv6only = init_net.ipv6.sysctl.bindv6only; | 194 | np->ipv6only = net->ipv6.sysctl.bindv6only; |
| 195 | 195 | ||
| 196 | /* Init the ipv4 part of the socket since we can have sockets | 196 | /* Init the ipv4 part of the socket since we can have sockets |
| 197 | * using v6 API for ipv4. | 197 | * using v6 API for ipv4. |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index b9c2de84a8a2..0f0f94a40335 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
| @@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net, | |||
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | *hlimit = *(int *)CMSG_DATA(cmsg); | 707 | *hlimit = *(int *)CMSG_DATA(cmsg); |
| 708 | if (*hlimit < -1 || *hlimit > 0xff) { | ||
| 709 | err = -EINVAL; | ||
| 710 | goto exit_f; | ||
| 711 | } | ||
| 712 | |||
| 708 | break; | 713 | break; |
| 709 | 714 | ||
| 710 | case IPV6_TCLASS: | 715 | case IPV6_TCLASS: |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 26b83e512a09..c042ce19bd14 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -67,7 +67,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *)) | |||
| 67 | 67 | ||
| 68 | /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ | 68 | /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ |
| 69 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) | 69 | if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) |
| 70 | return -EINVAL; | 70 | return -ENOPROTOOPT; |
| 71 | 71 | ||
| 72 | new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; | 72 | new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; |
| 73 | 73 | ||
| @@ -446,7 +446,7 @@ done: | |||
| 446 | 446 | ||
| 447 | case IPV6_MULTICAST_HOPS: | 447 | case IPV6_MULTICAST_HOPS: |
| 448 | if (sk->sk_type == SOCK_STREAM) | 448 | if (sk->sk_type == SOCK_STREAM) |
| 449 | goto e_inval; | 449 | break; |
| 450 | if (optlen < sizeof(int)) | 450 | if (optlen < sizeof(int)) |
| 451 | goto e_inval; | 451 | goto e_inval; |
| 452 | if (val > 255 || val < -1) | 452 | if (val > 255 || val < -1) |
| @@ -458,13 +458,15 @@ done: | |||
| 458 | case IPV6_MULTICAST_LOOP: | 458 | case IPV6_MULTICAST_LOOP: |
| 459 | if (optlen < sizeof(int)) | 459 | if (optlen < sizeof(int)) |
| 460 | goto e_inval; | 460 | goto e_inval; |
| 461 | if (val != valbool) | ||
| 462 | goto e_inval; | ||
| 461 | np->mc_loop = valbool; | 463 | np->mc_loop = valbool; |
| 462 | retv = 0; | 464 | retv = 0; |
| 463 | break; | 465 | break; |
| 464 | 466 | ||
| 465 | case IPV6_MULTICAST_IF: | 467 | case IPV6_MULTICAST_IF: |
| 466 | if (sk->sk_type == SOCK_STREAM) | 468 | if (sk->sk_type == SOCK_STREAM) |
| 467 | goto e_inval; | 469 | break; |
| 468 | if (optlen < sizeof(int)) | 470 | if (optlen < sizeof(int)) |
| 469 | goto e_inval; | 471 | goto e_inval; |
| 470 | 472 | ||
| @@ -860,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
| 860 | if (sk->sk_protocol != IPPROTO_UDP && | 862 | if (sk->sk_protocol != IPPROTO_UDP && |
| 861 | sk->sk_protocol != IPPROTO_UDPLITE && | 863 | sk->sk_protocol != IPPROTO_UDPLITE && |
| 862 | sk->sk_protocol != IPPROTO_TCP) | 864 | sk->sk_protocol != IPPROTO_TCP) |
| 863 | return -EINVAL; | 865 | return -ENOPROTOOPT; |
| 864 | if (sk->sk_state != TCP_ESTABLISHED) | 866 | if (sk->sk_state != TCP_ESTABLISHED) |
| 865 | return -ENOTCONN; | 867 | return -ENOTCONN; |
| 866 | val = sk->sk_family; | 868 | val = sk->sk_family; |
| @@ -874,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
| 874 | return -EINVAL; | 876 | return -EINVAL; |
| 875 | if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) | 877 | if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) |
| 876 | return -EFAULT; | 878 | return -EFAULT; |
| 879 | if (gsf.gf_group.ss_family != AF_INET6) | ||
| 880 | return -EADDRNOTAVAIL; | ||
| 877 | lock_sock(sk); | 881 | lock_sock(sk); |
| 878 | err = ip6_mc_msfget(sk, &gsf, | 882 | err = ip6_mc_msfget(sk, &gsf, |
| 879 | (struct group_filter __user *)optval, optlen); | 883 | (struct group_filter __user *)optval, optlen); |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 8fee9a15b2d3..3aee12310d94 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -1169,7 +1169,8 @@ static int raw6_destroy(struct sock *sk) | |||
| 1169 | lock_sock(sk); | 1169 | lock_sock(sk); |
| 1170 | ip6_flush_pending_frames(sk); | 1170 | ip6_flush_pending_frames(sk); |
| 1171 | release_sock(sk); | 1171 | release_sock(sk); |
| 1172 | return 0; | 1172 | |
| 1173 | return inet6_destroy_sock(sk); | ||
| 1173 | } | 1174 | } |
| 1174 | 1175 | ||
| 1175 | static int rawv6_init_sk(struct sock *sk) | 1176 | static int rawv6_init_sk(struct sock *sk) |
| @@ -1200,7 +1201,6 @@ struct proto rawv6_prot = { | |||
| 1200 | .disconnect = udp_disconnect, | 1201 | .disconnect = udp_disconnect, |
| 1201 | .ioctl = rawv6_ioctl, | 1202 | .ioctl = rawv6_ioctl, |
| 1202 | .init = rawv6_init_sk, | 1203 | .init = rawv6_init_sk, |
| 1203 | .destroy = inet6_destroy_sock, | ||
| 1204 | .setsockopt = rawv6_setsockopt, | 1204 | .setsockopt = rawv6_setsockopt, |
| 1205 | .getsockopt = rawv6_getsockopt, | 1205 | .getsockopt = rawv6_getsockopt, |
| 1206 | .sendmsg = rawv6_sendmsg, | 1206 | .sendmsg = rawv6_sendmsg, |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 220cffe9e63b..d1f3e19b06c7 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -2196,8 +2196,12 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt, | |||
| 2196 | 2196 | ||
| 2197 | NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); | 2197 | NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); |
| 2198 | 2198 | ||
| 2199 | expires = (rt->rt6i_flags & RTF_EXPIRES) ? | 2199 | if (!(rt->rt6i_flags & RTF_EXPIRES)) |
| 2200 | rt->rt6i_expires - jiffies : 0; | 2200 | expires = 0; |
| 2201 | else if (rt->rt6i_expires - jiffies < INT_MAX) | ||
| 2202 | expires = rt->rt6i_expires - jiffies; | ||
| 2203 | else | ||
| 2204 | expires = INT_MAX; | ||
| 2201 | 2205 | ||
| 2202 | if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, | 2206 | if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, |
| 2203 | expires, rt->u.dst.error) < 0) | 2207 | expires, rt->u.dst.error) < 0) |
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c index 938ce4ecde55..3ecc1157994e 100644 --- a/net/ipv6/syncookies.c +++ b/net/ipv6/syncookies.c | |||
| @@ -198,7 +198,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) | |||
| 198 | ireq = inet_rsk(req); | 198 | ireq = inet_rsk(req); |
| 199 | ireq6 = inet6_rsk(req); | 199 | ireq6 = inet6_rsk(req); |
| 200 | treq = tcp_rsk(req); | 200 | treq = tcp_rsk(req); |
| 201 | ireq6->pktopts = NULL; | ||
| 202 | 201 | ||
| 203 | if (security_inet_conn_request(sk, skb, req)) { | 202 | if (security_inet_conn_request(sk, skb, req)) { |
| 204 | reqsk_free(req); | 203 | reqsk_free(req); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 715965f0fac0..cb46749d4c32 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1299,7 +1299,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1299 | treq = inet6_rsk(req); | 1299 | treq = inet6_rsk(req); |
| 1300 | ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); | 1300 | ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr); |
| 1301 | ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); | 1301 | ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr); |
| 1302 | treq->pktopts = NULL; | ||
| 1303 | if (!want_cookie) | 1302 | if (!want_cookie) |
| 1304 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1303 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
| 1305 | 1304 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index 9bba7ac5fee0..7470e367272b 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
| @@ -3030,6 +3030,9 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c) | |||
| 3030 | 3030 | ||
| 3031 | static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) | 3031 | static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) |
| 3032 | { | 3032 | { |
| 3033 | if (atomic_read(&pfkey_socks_nr) == 0) | ||
| 3034 | return 0; | ||
| 3035 | |||
| 3033 | switch (c->event) { | 3036 | switch (c->event) { |
| 3034 | case XFRM_MSG_EXPIRE: | 3037 | case XFRM_MSG_EXPIRE: |
| 3035 | return key_notify_sa_expire(x, c); | 3038 | return key_notify_sa_expire(x, c); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c7314bf4bec2..006486b26726 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -899,7 +899,7 @@ extern const struct iw_handler_def ieee80211_iw_handler_def; | |||
| 899 | 899 | ||
| 900 | 900 | ||
| 901 | /* ieee80211_ioctl.c */ | 901 | /* ieee80211_ioctl.c */ |
| 902 | int ieee80211_set_freq(struct ieee80211_local *local, int freq); | 902 | int ieee80211_set_freq(struct net_device *dev, int freq); |
| 903 | /* ieee80211_sta.c */ | 903 | /* ieee80211_sta.c */ |
| 904 | void ieee80211_sta_timer(unsigned long data); | 904 | void ieee80211_sta_timer(unsigned long data); |
| 905 | void ieee80211_sta_work(struct work_struct *work); | 905 | void ieee80211_sta_work(struct work_struct *work); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 5c876450b14c..98c0b5e56ecc 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
| @@ -511,6 +511,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
| 511 | case IEEE80211_IF_TYPE_STA: | 511 | case IEEE80211_IF_TYPE_STA: |
| 512 | case IEEE80211_IF_TYPE_IBSS: | 512 | case IEEE80211_IF_TYPE_IBSS: |
| 513 | sdata->u.sta.state = IEEE80211_DISABLED; | 513 | sdata->u.sta.state = IEEE80211_DISABLED; |
| 514 | memset(sdata->u.sta.bssid, 0, ETH_ALEN); | ||
| 514 | del_timer_sync(&sdata->u.sta.timer); | 515 | del_timer_sync(&sdata->u.sta.timer); |
| 515 | /* | 516 | /* |
| 516 | * When we get here, the interface is marked down. | 517 | * When we get here, the interface is marked down. |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 841278f1df8e..4d2b582dd055 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) | 44 | #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) |
| 45 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) | 45 | #define IEEE80211_SCAN_INTERVAL (2 * HZ) |
| 46 | #define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) | 46 | #define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) |
| 47 | #define IEEE80211_IBSS_JOIN_TIMEOUT (20 * HZ) | 47 | #define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ) |
| 48 | 48 | ||
| 49 | #define IEEE80211_PROBE_DELAY (HZ / 33) | 49 | #define IEEE80211_PROBE_DELAY (HZ / 33) |
| 50 | #define IEEE80211_CHANNEL_TIME (HZ / 33) | 50 | #define IEEE80211_CHANNEL_TIME (HZ / 33) |
| @@ -2336,6 +2336,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
| 2336 | u8 *pos; | 2336 | u8 *pos; |
| 2337 | struct ieee80211_sub_if_data *sdata; | 2337 | struct ieee80211_sub_if_data *sdata; |
| 2338 | struct ieee80211_supported_band *sband; | 2338 | struct ieee80211_supported_band *sband; |
| 2339 | union iwreq_data wrqu; | ||
| 2339 | 2340 | ||
| 2340 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 2341 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 2341 | 2342 | ||
| @@ -2358,13 +2359,10 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
| 2358 | sdata->drop_unencrypted = bss->capability & | 2359 | sdata->drop_unencrypted = bss->capability & |
| 2359 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; | 2360 | WLAN_CAPABILITY_PRIVACY ? 1 : 0; |
| 2360 | 2361 | ||
| 2361 | res = ieee80211_set_freq(local, bss->freq); | 2362 | res = ieee80211_set_freq(dev, bss->freq); |
| 2362 | 2363 | ||
| 2363 | if (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS) { | 2364 | if (res) |
| 2364 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | 2365 | return res; |
| 2365 | "%d MHz\n", dev->name, local->oper_channel->center_freq); | ||
| 2366 | return -1; | ||
| 2367 | } | ||
| 2368 | 2366 | ||
| 2369 | /* Set beacon template */ | 2367 | /* Set beacon template */ |
| 2370 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); | 2368 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400); |
| @@ -2479,6 +2477,10 @@ static int ieee80211_sta_join_ibss(struct net_device *dev, | |||
| 2479 | ifsta->state = IEEE80211_IBSS_JOINED; | 2477 | ifsta->state = IEEE80211_IBSS_JOINED; |
| 2480 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); | 2478 | mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL); |
| 2481 | 2479 | ||
| 2480 | memset(&wrqu, 0, sizeof(wrqu)); | ||
| 2481 | memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); | ||
| 2482 | wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); | ||
| 2483 | |||
| 2482 | return res; | 2484 | return res; |
| 2483 | } | 2485 | } |
| 2484 | 2486 | ||
| @@ -3486,7 +3488,7 @@ static int ieee80211_sta_config_auth(struct net_device *dev, | |||
| 3486 | spin_unlock_bh(&local->sta_bss_lock); | 3488 | spin_unlock_bh(&local->sta_bss_lock); |
| 3487 | 3489 | ||
| 3488 | if (selected) { | 3490 | if (selected) { |
| 3489 | ieee80211_set_freq(local, selected->freq); | 3491 | ieee80211_set_freq(dev, selected->freq); |
| 3490 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) | 3492 | if (!(ifsta->flags & IEEE80211_STA_SSID_SET)) |
| 3491 | ieee80211_sta_set_ssid(dev, selected->ssid, | 3493 | ieee80211_sta_set_ssid(dev, selected->ssid, |
| 3492 | selected->ssid_len); | 3494 | selected->ssid_len); |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 8311bb24f9f3..a8bb8e31b1ec 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
| @@ -290,14 +290,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
| 290 | return 0; | 290 | return 0; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) | 293 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) |
| 294 | { | 294 | { |
| 295 | int ret = -EINVAL; | 295 | int ret = -EINVAL; |
| 296 | struct ieee80211_channel *chan; | 296 | struct ieee80211_channel *chan; |
| 297 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
| 298 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 297 | 299 | ||
| 298 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | 300 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
| 299 | 301 | ||
| 300 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | 302 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
| 303 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
| 304 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
| 305 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
| 306 | "%d MHz\n", dev->name, chan->center_freq); | ||
| 307 | return ret; | ||
| 308 | } | ||
| 301 | local->oper_channel = chan; | 309 | local->oper_channel = chan; |
| 302 | 310 | ||
| 303 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 311 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
| @@ -315,7 +323,6 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
| 315 | struct iw_request_info *info, | 323 | struct iw_request_info *info, |
| 316 | struct iw_freq *freq, char *extra) | 324 | struct iw_freq *freq, char *extra) |
| 317 | { | 325 | { |
| 318 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
| 319 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 326 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 320 | 327 | ||
| 321 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 328 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
| @@ -329,14 +336,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev, | |||
| 329 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 336 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
| 330 | return 0; | 337 | return 0; |
| 331 | } else | 338 | } else |
| 332 | return ieee80211_set_freq(local, | 339 | return ieee80211_set_freq(dev, |
| 333 | ieee80211_channel_to_frequency(freq->m)); | 340 | ieee80211_channel_to_frequency(freq->m)); |
| 334 | } else { | 341 | } else { |
| 335 | int i, div = 1000000; | 342 | int i, div = 1000000; |
| 336 | for (i = 0; i < freq->e; i++) | 343 | for (i = 0; i < freq->e; i++) |
| 337 | div /= 10; | 344 | div /= 10; |
| 338 | if (div > 0) | 345 | if (div > 0) |
| 339 | return ieee80211_set_freq(local, freq->m / div); | 346 | return ieee80211_set_freq(dev, freq->m / div); |
| 340 | else | 347 | else |
| 341 | return -EINVAL; | 348 | return -EINVAL; |
| 342 | } | 349 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index c4b1799da5d7..662c1ccfee26 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -196,8 +196,6 @@ destroy_conntrack(struct nf_conntrack *nfct) | |||
| 196 | if (l4proto && l4proto->destroy) | 196 | if (l4proto && l4proto->destroy) |
| 197 | l4proto->destroy(ct); | 197 | l4proto->destroy(ct); |
| 198 | 198 | ||
| 199 | nf_ct_ext_destroy(ct); | ||
| 200 | |||
| 201 | rcu_read_unlock(); | 199 | rcu_read_unlock(); |
| 202 | 200 | ||
| 203 | spin_lock_bh(&nf_conntrack_lock); | 201 | spin_lock_bh(&nf_conntrack_lock); |
| @@ -520,6 +518,7 @@ static void nf_conntrack_free_rcu(struct rcu_head *head) | |||
| 520 | 518 | ||
| 521 | void nf_conntrack_free(struct nf_conn *ct) | 519 | void nf_conntrack_free(struct nf_conn *ct) |
| 522 | { | 520 | { |
| 521 | nf_ct_ext_destroy(ct); | ||
| 523 | call_rcu(&ct->rcu, nf_conntrack_free_rcu); | 522 | call_rcu(&ct->rcu, nf_conntrack_free_rcu); |
| 524 | } | 523 | } |
| 525 | EXPORT_SYMBOL_GPL(nf_conntrack_free); | 524 | EXPORT_SYMBOL_GPL(nf_conntrack_free); |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index bc11d7092032..9fda6ee95a31 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
| @@ -92,10 +92,6 @@ void nf_log_packet(int pf, | |||
| 92 | vsnprintf(prefix, sizeof(prefix), fmt, args); | 92 | vsnprintf(prefix, sizeof(prefix), fmt, args); |
| 93 | va_end(args); | 93 | va_end(args); |
| 94 | logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix); | 94 | logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix); |
| 95 | } else if (net_ratelimit()) { | ||
| 96 | printk(KERN_WARNING "nf_log_packet: can\'t log since " | ||
| 97 | "no backend logging module loaded in! Please either " | ||
| 98 | "load one, or disable logging explicitly\n"); | ||
| 99 | } | 95 | } |
| 100 | rcu_read_unlock(); | 96 | rcu_read_unlock(); |
| 101 | } | 97 | } |
