ipv4.c (967535223f9a8d95c187a8728480b569164cd4f4) | ipv4.c (c92e8c02fe664155ac4234516e32544bec0f113d) |
---|---|
1/* 2 * net/dccp/ipv4.c 3 * 4 * An implementation of the DCCP protocol 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 400 unchanged lines hidden (view full) --- 409 if (newsk == NULL) 410 goto exit_nonewsk; 411 412 newinet = inet_sk(newsk); 413 ireq = inet_rsk(req); 414 sk_daddr_set(newsk, ireq->ir_rmt_addr); 415 sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); 416 newinet->inet_saddr = ireq->ir_loc_addr; | 1/* 2 * net/dccp/ipv4.c 3 * 4 * An implementation of the DCCP protocol 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License --- 400 unchanged lines hidden (view full) --- 409 if (newsk == NULL) 410 goto exit_nonewsk; 411 412 newinet = inet_sk(newsk); 413 ireq = inet_rsk(req); 414 sk_daddr_set(newsk, ireq->ir_rmt_addr); 415 sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); 416 newinet->inet_saddr = ireq->ir_loc_addr; |
417 newinet->inet_opt = ireq->opt; 418 ireq->opt = NULL; | 417 RCU_INIT_POINTER(newinet->inet_opt, rcu_dereference(ireq->ireq_opt)); |
419 newinet->mc_index = inet_iif(skb); 420 newinet->mc_ttl = ip_hdr(skb)->ttl; 421 newinet->inet_id = jiffies; 422 423 if (dst == NULL && (dst = inet_csk_route_child_sock(sk, newsk, req)) == NULL) 424 goto put_and_exit; 425 426 sk_setup_caps(newsk, dst); 427 428 dccp_sync_mss(newsk, dst_mtu(dst)); 429 430 if (__inet_inherit_port(sk, newsk) < 0) 431 goto put_and_exit; 432 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); | 418 newinet->mc_index = inet_iif(skb); 419 newinet->mc_ttl = ip_hdr(skb)->ttl; 420 newinet->inet_id = jiffies; 421 422 if (dst == NULL && (dst = inet_csk_route_child_sock(sk, newsk, req)) == NULL) 423 goto put_and_exit; 424 425 sk_setup_caps(newsk, dst); 426 427 dccp_sync_mss(newsk, dst_mtu(dst)); 428 429 if (__inet_inherit_port(sk, newsk) < 0) 430 goto put_and_exit; 431 *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); |
433 | 432 if (*own_req) 433 ireq->ireq_opt = NULL; 434 else 435 newinet->inet_opt = NULL; |
434 return newsk; 435 436exit_overflow: 437 __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); 438exit_nonewsk: 439 dst_release(dst); 440exit: 441 __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS); 442 return NULL; 443put_and_exit: | 436 return newsk; 437 438exit_overflow: 439 __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); 440exit_nonewsk: 441 dst_release(dst); 442exit: 443 __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS); 444 return NULL; 445put_and_exit: |
446 newinet->inet_opt = NULL; |
|
444 inet_csk_prepare_forced_close(newsk); 445 dccp_done(newsk); 446 goto exit; 447} 448EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock); 449 450static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, 451 struct sk_buff *skb) --- 35 unchanged lines hidden (view full) --- 487 if (skb != NULL) { 488 const struct inet_request_sock *ireq = inet_rsk(req); 489 struct dccp_hdr *dh = dccp_hdr(skb); 490 491 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr, 492 ireq->ir_rmt_addr); 493 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, 494 ireq->ir_rmt_addr, | 447 inet_csk_prepare_forced_close(newsk); 448 dccp_done(newsk); 449 goto exit; 450} 451EXPORT_SYMBOL_GPL(dccp_v4_request_recv_sock); 452 453static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, 454 struct sk_buff *skb) --- 35 unchanged lines hidden (view full) --- 490 if (skb != NULL) { 491 const struct inet_request_sock *ireq = inet_rsk(req); 492 struct dccp_hdr *dh = dccp_hdr(skb); 493 494 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr, 495 ireq->ir_rmt_addr); 496 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, 497 ireq->ir_rmt_addr, |
495 ireq->opt); | 498 rcu_dereference(ireq->ireq_opt)); |
496 err = net_xmit_eval(err); 497 } 498 499out: 500 dst_release(dst); 501 return err; 502} 503 --- 39 unchanged lines hidden (view full) --- 543 local_bh_enable(); 544out: 545 dst_release(dst); 546} 547 548static void dccp_v4_reqsk_destructor(struct request_sock *req) 549{ 550 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); | 499 err = net_xmit_eval(err); 500 } 501 502out: 503 dst_release(dst); 504 return err; 505} 506 --- 39 unchanged lines hidden (view full) --- 546 local_bh_enable(); 547out: 548 dst_release(dst); 549} 550 551static void dccp_v4_reqsk_destructor(struct request_sock *req) 552{ 553 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); |
551 kfree(inet_rsk(req)->opt); | 554 kfree(rcu_dereference_protected(inet_rsk(req)->ireq_opt, 1)); |
552} 553 554void dccp_syn_ack_timeout(const struct request_sock *req) 555{ 556} 557EXPORT_SYMBOL(dccp_syn_ack_timeout); 558 559static struct request_sock_ops dccp_request_sock_ops __read_mostly = { --- 521 unchanged lines hidden --- | 555} 556 557void dccp_syn_ack_timeout(const struct request_sock *req) 558{ 559} 560EXPORT_SYMBOL(dccp_syn_ack_timeout); 561 562static struct request_sock_ops dccp_request_sock_ops __read_mostly = { --- 521 unchanged lines hidden --- |