Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'tcp-follow-up-for-dccp-removal'

Kuniyuki Iwashima says:

====================
tcp: Follow up for DCCP removal.

As I mentioned in [0], TCP still has code for DCCP.

This series cleans up such leftovers.

[0]: https://patch.msgid.link/20250410023921.11307-3-kuniyu@amazon.com

v1: https://lore.kernel.org/20250821061540.2876953-1-kuniyu@google.com
====================

Link: https://patch.msgid.link/20250822190803.540788-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+549 -644
+4 -5
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
··· 498 498 depth += sizeof(struct iphdr); 499 499 th = (void *)iph + sizeof(struct iphdr); 500 500 501 - sk = inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 502 - iph->saddr, th->source, iph->daddr, 503 - th->dest, netdev->ifindex); 501 + sk = inet_lookup_established(net, iph->saddr, th->source, 502 + iph->daddr, th->dest, 503 + netdev->ifindex); 504 504 #if IS_ENABLED(CONFIG_IPV6) 505 505 } else { 506 506 struct ipv6hdr *ipv6h = (struct ipv6hdr *)iph; ··· 508 508 depth += sizeof(struct ipv6hdr); 509 509 th = (void *)ipv6h + sizeof(struct ipv6hdr); 510 510 511 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 512 - &ipv6h->saddr, th->source, 511 + sk = __inet6_lookup_established(net, &ipv6h->saddr, th->source, 513 512 &ipv6h->daddr, ntohs(th->dest), 514 513 netdev->ifindex, 0); 515 514 #endif
+4 -5
drivers/net/ethernet/netronome/nfp/crypto/tls.c
··· 495 495 496 496 switch (ipv6h->version) { 497 497 case 4: 498 - sk = inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 499 - iph->saddr, th->source, iph->daddr, 500 - th->dest, netdev->ifindex); 498 + sk = inet_lookup_established(net, iph->saddr, th->source, 499 + iph->daddr, th->dest, 500 + netdev->ifindex); 501 501 break; 502 502 #if IS_ENABLED(CONFIG_IPV6) 503 503 case 6: 504 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 505 - &ipv6h->saddr, th->source, 504 + sk = __inet6_lookup_established(net, &ipv6h->saddr, th->source, 506 505 &ipv6h->daddr, ntohs(th->dest), 507 506 netdev->ifindex, 0); 508 507 break;
-13
include/linux/inet_diag.h
··· 24 24 bool net_admin, 25 25 struct sk_buff *skb); 26 26 27 - size_t (*idiag_get_aux_size)(struct sock *sk, 28 - bool net_admin); 29 - 30 27 int (*destroy)(struct sk_buff *in_skb, 31 28 const struct inet_diag_req_v2 *req); 32 29 ··· 45 48 struct sk_buff *skb, struct netlink_callback *cb, 46 49 const struct inet_diag_req_v2 *req, 47 50 u16 nlmsg_flags, bool net_admin); 48 - void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 49 - struct netlink_callback *cb, 50 - const struct inet_diag_req_v2 *r); 51 - int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 52 - struct netlink_callback *cb, 53 - const struct inet_diag_req_v2 *req); 54 - 55 - struct sock *inet_diag_find_one_icsk(struct net *net, 56 - struct inet_hashinfo *hashinfo, 57 - const struct inet_diag_req_v2 *req); 58 51 59 52 int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 60 53
+6 -12
include/net/inet6_hashtables.h
··· 41 41 * The sockhash lock must be held as a reader here. 42 42 */ 43 43 struct sock *__inet6_lookup_established(const struct net *net, 44 - struct inet_hashinfo *hashinfo, 45 44 const struct in6_addr *saddr, 46 45 const __be16 sport, 47 46 const struct in6_addr *daddr, ··· 64 65 inet6_ehashfn_t *ehashfn); 65 66 66 67 struct sock *inet6_lookup_listener(const struct net *net, 67 - struct inet_hashinfo *hashinfo, 68 68 struct sk_buff *skb, int doff, 69 69 const struct in6_addr *saddr, 70 70 const __be16 sport, ··· 81 83 inet6_ehashfn_t *ehashfn); 82 84 83 85 static inline struct sock *__inet6_lookup(const struct net *net, 84 - struct inet_hashinfo *hashinfo, 85 86 struct sk_buff *skb, int doff, 86 87 const struct in6_addr *saddr, 87 88 const __be16 sport, ··· 89 92 const int dif, const int sdif, 90 93 bool *refcounted) 91 94 { 92 - struct sock *sk = __inet6_lookup_established(net, hashinfo, saddr, 93 - sport, daddr, hnum, 95 + struct sock *sk = __inet6_lookup_established(net, saddr, sport, 96 + daddr, hnum, 94 97 dif, sdif); 95 98 *refcounted = true; 96 99 if (sk) 97 100 return sk; 98 101 *refcounted = false; 99 - return inet6_lookup_listener(net, hashinfo, skb, doff, saddr, sport, 102 + return inet6_lookup_listener(net, skb, doff, saddr, sport, 100 103 daddr, hnum, dif, sdif); 101 104 } 102 105 ··· 140 143 return reuse_sk; 141 144 } 142 145 143 - static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, 144 - struct sk_buff *skb, int doff, 146 + static inline struct sock *__inet6_lookup_skb(struct sk_buff *skb, int doff, 145 147 const __be16 sport, 146 148 const __be16 dport, 147 149 int iif, int sdif, ··· 157 161 if (sk) 158 162 return sk; 159 163 160 - return __inet6_lookup(net, hashinfo, skb, 161 - doff, &ip6h->saddr, sport, 164 + return __inet6_lookup(net, skb, doff, &ip6h->saddr, sport, 162 165 &ip6h->daddr, ntohs(dport), 163 166 iif, sdif, refcounted); 164 167 } 165 168 166 - struct sock *inet6_lookup(const struct net *net, struct inet_hashinfo *hashinfo, 167 - struct sk_buff *skb, int doff, 169 + struct sock *inet6_lookup(const struct net *net, struct sk_buff *skb, int doff, 168 170 const struct in6_addr *saddr, const __be16 sport, 169 171 const struct in6_addr *daddr, const __be16 dport, 170 172 const int dif);
+15 -22
include/net/inet_hashtables.h
··· 294 294 void inet_unhash(struct sock *sk); 295 295 296 296 struct sock *__inet_lookup_listener(const struct net *net, 297 - struct inet_hashinfo *hashinfo, 298 297 struct sk_buff *skb, int doff, 299 298 const __be32 saddr, const __be16 sport, 300 299 const __be32 daddr, ··· 301 302 const int dif, const int sdif); 302 303 303 304 static inline struct sock *inet_lookup_listener(struct net *net, 304 - struct inet_hashinfo *hashinfo, 305 - struct sk_buff *skb, int doff, 306 - __be32 saddr, __be16 sport, 307 - __be32 daddr, __be16 dport, int dif, int sdif) 305 + struct sk_buff *skb, int doff, 306 + __be32 saddr, __be16 sport, 307 + __be32 daddr, __be16 dport, 308 + int dif, int sdif) 308 309 { 309 - return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, sport, 310 + return __inet_lookup_listener(net, skb, doff, saddr, sport, 310 311 daddr, ntohs(dport), dif, sdif); 311 312 } 312 313 ··· 357 358 * not check it for lookups anymore, thanks Alexey. -DaveM 358 359 */ 359 360 struct sock *__inet_lookup_established(const struct net *net, 360 - struct inet_hashinfo *hashinfo, 361 361 const __be32 saddr, const __be16 sport, 362 362 const __be32 daddr, const u16 hnum, 363 363 const int dif, const int sdif); ··· 382 384 __be32 daddr, u16 hnum, const int dif, 383 385 inet_ehashfn_t *ehashfn); 384 386 385 - static inline struct sock * 386 - inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo, 387 - const __be32 saddr, const __be16 sport, 388 - const __be32 daddr, const __be16 dport, 389 - const int dif) 387 + static inline struct sock *inet_lookup_established(struct net *net, 388 + const __be32 saddr, const __be16 sport, 389 + const __be32 daddr, const __be16 dport, 390 + const int dif) 390 391 { 391 - return __inet_lookup_established(net, hashinfo, saddr, sport, daddr, 392 + return __inet_lookup_established(net, saddr, sport, daddr, 392 393 ntohs(dport), dif, 0); 393 394 } 394 395 395 396 static inline struct sock *__inet_lookup(struct net *net, 396 - struct inet_hashinfo *hashinfo, 397 397 struct sk_buff *skb, int doff, 398 398 const __be32 saddr, const __be16 sport, 399 399 const __be32 daddr, const __be16 dport, ··· 401 405 u16 hnum = ntohs(dport); 402 406 struct sock *sk; 403 407 404 - sk = __inet_lookup_established(net, hashinfo, saddr, sport, 408 + sk = __inet_lookup_established(net, saddr, sport, 405 409 daddr, hnum, dif, sdif); 406 410 *refcounted = true; 407 411 if (sk) 408 412 return sk; 409 413 *refcounted = false; 410 - return __inet_lookup_listener(net, hashinfo, skb, doff, saddr, 414 + return __inet_lookup_listener(net, skb, doff, saddr, 411 415 sport, daddr, hnum, dif, sdif); 412 416 } 413 417 414 418 static inline struct sock *inet_lookup(struct net *net, 415 - struct inet_hashinfo *hashinfo, 416 419 struct sk_buff *skb, int doff, 417 420 const __be32 saddr, const __be16 sport, 418 421 const __be32 daddr, const __be16 dport, ··· 420 425 struct sock *sk; 421 426 bool refcounted; 422 427 423 - sk = __inet_lookup(net, hashinfo, skb, doff, saddr, sport, daddr, 428 + sk = __inet_lookup(net, skb, doff, saddr, sport, daddr, 424 429 dport, dif, 0, &refcounted); 425 430 426 431 if (sk && !refcounted && !refcount_inc_not_zero(&sk->sk_refcnt)) ··· 468 473 return reuse_sk; 469 474 } 470 475 471 - static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, 472 - struct sk_buff *skb, 476 + static inline struct sock *__inet_lookup_skb(struct sk_buff *skb, 473 477 int doff, 474 478 const __be16 sport, 475 479 const __be16 dport, ··· 486 492 if (sk) 487 493 return sk; 488 494 489 - return __inet_lookup(net, hashinfo, skb, 490 - doff, iph->saddr, sport, 495 + return __inet_lookup(net, skb, doff, iph->saddr, sport, 491 496 iph->daddr, dport, inet_iif(skb), sdif, 492 497 refcounted); 493 498 }
-7
include/net/timewait_sock.h
··· 15 15 struct kmem_cache *twsk_slab; 16 16 char *twsk_slab_name; 17 17 unsigned int twsk_obj_size; 18 - void (*twsk_destructor)(struct sock *sk); 19 18 }; 20 - 21 - static inline void twsk_destructor(struct sock *sk) 22 - { 23 - if (sk->sk_prot->twsk_prot->twsk_destructor != NULL) 24 - sk->sk_prot->twsk_prot->twsk_destructor(sk); 25 - } 26 19 27 20 #endif /* _TIMEWAIT_SOCK_H */
+2 -3
net/core/filter.c
··· 6767 6767 static struct sock *sk_lookup(struct net *net, struct bpf_sock_tuple *tuple, 6768 6768 int dif, int sdif, u8 family, u8 proto) 6769 6769 { 6770 - struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo; 6771 6770 bool refcounted = false; 6772 6771 struct sock *sk = NULL; 6773 6772 ··· 6775 6776 __be32 dst4 = tuple->ipv4.daddr; 6776 6777 6777 6778 if (proto == IPPROTO_TCP) 6778 - sk = __inet_lookup(net, hinfo, NULL, 0, 6779 + sk = __inet_lookup(net, NULL, 0, 6779 6780 src4, tuple->ipv4.sport, 6780 6781 dst4, tuple->ipv4.dport, 6781 6782 dif, sdif, &refcounted); ··· 6789 6790 struct in6_addr *dst6 = (struct in6_addr *)&tuple->ipv6.daddr; 6790 6791 6791 6792 if (proto == IPPROTO_TCP) 6792 - sk = __inet6_lookup(net, hinfo, NULL, 0, 6793 + sk = __inet6_lookup(net, NULL, 0, 6793 6794 src6, tuple->ipv6.sport, 6794 6795 dst6, ntohs(tuple->ipv6.dport), 6795 6796 dif, sdif, &refcounted);
+2 -2
net/ipv4/esp4.c
··· 132 132 dport = encap->encap_dport; 133 133 spin_unlock_bh(&x->lock); 134 134 135 - sk = inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, x->id.daddr.a4, 136 - dport, x->props.saddr.a4, sport, 0); 135 + sk = inet_lookup_established(net, x->id.daddr.a4, dport, 136 + x->props.saddr.a4, sport, 0); 137 137 if (!sk) 138 138 return ERR_PTR(-ENOENT); 139 139
-479
net/ipv4/inet_diag.c
··· 20 20 #include <net/ipv6.h> 21 21 #include <net/inet_common.h> 22 22 #include <net/inet_connection_sock.h> 23 - #include <net/inet_hashtables.h> 24 - #include <net/inet_timewait_sock.h> 25 - #include <net/inet6_hashtables.h> 26 23 #include <net/bpf_sk_storage.h> 27 24 #include <net/netlink.h> 28 25 ··· 93 96 } 94 97 } 95 98 EXPORT_SYMBOL_GPL(inet_diag_msg_common_fill); 96 - 97 - static size_t inet_sk_attr_size(struct sock *sk, 98 - const struct inet_diag_req_v2 *req, 99 - bool net_admin) 100 - { 101 - const struct inet_diag_handler *handler; 102 - size_t aux = 0; 103 - 104 - rcu_read_lock(); 105 - handler = rcu_dereference(inet_diag_table[req->sdiag_protocol]); 106 - DEBUG_NET_WARN_ON_ONCE(!handler); 107 - if (handler && handler->idiag_get_aux_size) 108 - aux = handler->idiag_get_aux_size(sk, net_admin); 109 - rcu_read_unlock(); 110 - 111 - return nla_total_size(sizeof(struct tcp_info)) 112 - + nla_total_size(sizeof(struct inet_diag_msg)) 113 - + inet_diag_msg_attrs_size() 114 - + nla_total_size(sizeof(struct inet_diag_meminfo)) 115 - + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) 116 - + nla_total_size(TCP_CA_NAME_MAX) 117 - + nla_total_size(sizeof(struct tcpvegas_info)) 118 - + aux 119 - + 64; 120 - } 121 99 122 100 int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, 123 101 struct inet_diag_msg *r, int ext, ··· 393 421 return -EMSGSIZE; 394 422 } 395 423 EXPORT_SYMBOL_GPL(inet_sk_diag_fill); 396 - 397 - static int inet_twsk_diag_fill(struct sock *sk, 398 - struct sk_buff *skb, 399 - struct netlink_callback *cb, 400 - u16 nlmsg_flags, bool net_admin) 401 - { 402 - struct inet_timewait_sock *tw = inet_twsk(sk); 403 - struct inet_diag_msg *r; 404 - struct nlmsghdr *nlh; 405 - long tmo; 406 - 407 - nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, 408 - cb->nlh->nlmsg_seq, cb->nlh->nlmsg_type, 409 - sizeof(*r), nlmsg_flags); 410 - if (!nlh) 411 - return -EMSGSIZE; 412 - 413 - r = nlmsg_data(nlh); 414 - BUG_ON(tw->tw_state != TCP_TIME_WAIT); 415 - 416 - inet_diag_msg_common_fill(r, sk); 417 - r->idiag_retrans = 0; 418 - 419 - r->idiag_state = READ_ONCE(tw->tw_substate); 420 - r->idiag_timer = 3; 421 - tmo = tw->tw_timer.expires - jiffies; 422 - r->idiag_expires = jiffies_delta_to_msecs(tmo); 423 - r->idiag_rqueue = 0; 424 - r->idiag_wqueue = 0; 425 - r->idiag_uid = 0; 426 - r->idiag_inode = 0; 427 - 428 - if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, 429 - tw->tw_mark)) { 430 - nlmsg_cancel(skb, nlh); 431 - return -EMSGSIZE; 432 - } 433 - 434 - nlmsg_end(skb, nlh); 435 - return 0; 436 - } 437 - 438 - static int inet_req_diag_fill(struct sock *sk, struct sk_buff *skb, 439 - struct netlink_callback *cb, 440 - u16 nlmsg_flags, bool net_admin) 441 - { 442 - struct request_sock *reqsk = inet_reqsk(sk); 443 - struct inet_diag_msg *r; 444 - struct nlmsghdr *nlh; 445 - long tmo; 446 - 447 - nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, 448 - cb->nlh->nlmsg_type, sizeof(*r), nlmsg_flags); 449 - if (!nlh) 450 - return -EMSGSIZE; 451 - 452 - r = nlmsg_data(nlh); 453 - inet_diag_msg_common_fill(r, sk); 454 - r->idiag_state = TCP_SYN_RECV; 455 - r->idiag_timer = 1; 456 - r->idiag_retrans = reqsk->num_retrans; 457 - 458 - BUILD_BUG_ON(offsetof(struct inet_request_sock, ir_cookie) != 459 - offsetof(struct sock, sk_cookie)); 460 - 461 - tmo = inet_reqsk(sk)->rsk_timer.expires - jiffies; 462 - r->idiag_expires = jiffies_delta_to_msecs(tmo); 463 - r->idiag_rqueue = 0; 464 - r->idiag_wqueue = 0; 465 - r->idiag_uid = 0; 466 - r->idiag_inode = 0; 467 - 468 - if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, 469 - inet_rsk(reqsk)->ir_mark)) { 470 - nlmsg_cancel(skb, nlh); 471 - return -EMSGSIZE; 472 - } 473 - 474 - nlmsg_end(skb, nlh); 475 - return 0; 476 - } 477 - 478 - static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, 479 - struct netlink_callback *cb, 480 - const struct inet_diag_req_v2 *r, 481 - u16 nlmsg_flags, bool net_admin) 482 - { 483 - if (sk->sk_state == TCP_TIME_WAIT) 484 - return inet_twsk_diag_fill(sk, skb, cb, nlmsg_flags, net_admin); 485 - 486 - if (sk->sk_state == TCP_NEW_SYN_RECV) 487 - return inet_req_diag_fill(sk, skb, cb, nlmsg_flags, net_admin); 488 - 489 - return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, r, nlmsg_flags, 490 - net_admin); 491 - } 492 - 493 - struct sock *inet_diag_find_one_icsk(struct net *net, 494 - struct inet_hashinfo *hashinfo, 495 - const struct inet_diag_req_v2 *req) 496 - { 497 - struct sock *sk; 498 - 499 - rcu_read_lock(); 500 - if (req->sdiag_family == AF_INET) 501 - sk = inet_lookup(net, hashinfo, NULL, 0, req->id.idiag_dst[0], 502 - req->id.idiag_dport, req->id.idiag_src[0], 503 - req->id.idiag_sport, req->id.idiag_if); 504 - #if IS_ENABLED(CONFIG_IPV6) 505 - else if (req->sdiag_family == AF_INET6) { 506 - if (ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_dst) && 507 - ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_src)) 508 - sk = inet_lookup(net, hashinfo, NULL, 0, req->id.idiag_dst[3], 509 - req->id.idiag_dport, req->id.idiag_src[3], 510 - req->id.idiag_sport, req->id.idiag_if); 511 - else 512 - sk = inet6_lookup(net, hashinfo, NULL, 0, 513 - (struct in6_addr *)req->id.idiag_dst, 514 - req->id.idiag_dport, 515 - (struct in6_addr *)req->id.idiag_src, 516 - req->id.idiag_sport, 517 - req->id.idiag_if); 518 - } 519 - #endif 520 - else { 521 - rcu_read_unlock(); 522 - return ERR_PTR(-EINVAL); 523 - } 524 - rcu_read_unlock(); 525 - if (!sk) 526 - return ERR_PTR(-ENOENT); 527 - 528 - if (sock_diag_check_cookie(sk, req->id.idiag_cookie)) { 529 - sock_gen_put(sk); 530 - return ERR_PTR(-ENOENT); 531 - } 532 - 533 - return sk; 534 - } 535 - EXPORT_SYMBOL_GPL(inet_diag_find_one_icsk); 536 - 537 - int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 538 - struct netlink_callback *cb, 539 - const struct inet_diag_req_v2 *req) 540 - { 541 - struct sk_buff *in_skb = cb->skb; 542 - bool net_admin = netlink_net_capable(in_skb, CAP_NET_ADMIN); 543 - struct net *net = sock_net(in_skb->sk); 544 - struct sk_buff *rep; 545 - struct sock *sk; 546 - int err; 547 - 548 - sk = inet_diag_find_one_icsk(net, hashinfo, req); 549 - if (IS_ERR(sk)) 550 - return PTR_ERR(sk); 551 - 552 - rep = nlmsg_new(inet_sk_attr_size(sk, req, net_admin), GFP_KERNEL); 553 - if (!rep) { 554 - err = -ENOMEM; 555 - goto out; 556 - } 557 - 558 - err = sk_diag_fill(sk, rep, cb, req, 0, net_admin); 559 - if (err < 0) { 560 - WARN_ON(err == -EMSGSIZE); 561 - nlmsg_free(rep); 562 - goto out; 563 - } 564 - err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid); 565 - 566 - out: 567 - if (sk) 568 - sock_gen_put(sk); 569 - 570 - return err; 571 - } 572 - EXPORT_SYMBOL_GPL(inet_diag_dump_one_icsk); 573 424 574 425 static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb, 575 426 const struct nlmsghdr *nlh, ··· 786 991 } 787 992 return len == 0 ? 0 : -EINVAL; 788 993 } 789 - 790 - static void twsk_build_assert(void) 791 - { 792 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_family) != 793 - offsetof(struct sock, sk_family)); 794 - 795 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_num) != 796 - offsetof(struct inet_sock, inet_num)); 797 - 798 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_dport) != 799 - offsetof(struct inet_sock, inet_dport)); 800 - 801 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_rcv_saddr) != 802 - offsetof(struct inet_sock, inet_rcv_saddr)); 803 - 804 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_daddr) != 805 - offsetof(struct inet_sock, inet_daddr)); 806 - 807 - #if IS_ENABLED(CONFIG_IPV6) 808 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_v6_rcv_saddr) != 809 - offsetof(struct sock, sk_v6_rcv_saddr)); 810 - 811 - BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_v6_daddr) != 812 - offsetof(struct sock, sk_v6_daddr)); 813 - #endif 814 - } 815 - 816 - void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, 817 - struct netlink_callback *cb, 818 - const struct inet_diag_req_v2 *r) 819 - { 820 - bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); 821 - struct inet_diag_dump_data *cb_data = cb->data; 822 - struct net *net = sock_net(skb->sk); 823 - u32 idiag_states = r->idiag_states; 824 - int i, num, s_i, s_num; 825 - struct nlattr *bc; 826 - struct sock *sk; 827 - 828 - bc = cb_data->inet_diag_nla_bc; 829 - if (idiag_states & TCPF_SYN_RECV) 830 - idiag_states |= TCPF_NEW_SYN_RECV; 831 - s_i = cb->args[1]; 832 - s_num = num = cb->args[2]; 833 - 834 - if (cb->args[0] == 0) { 835 - if (!(idiag_states & TCPF_LISTEN) || r->id.idiag_dport) 836 - goto skip_listen_ht; 837 - 838 - for (i = s_i; i <= hashinfo->lhash2_mask; i++) { 839 - struct inet_listen_hashbucket *ilb; 840 - struct hlist_nulls_node *node; 841 - 842 - num = 0; 843 - ilb = &hashinfo->lhash2[i]; 844 - 845 - if (hlist_nulls_empty(&ilb->nulls_head)) { 846 - s_num = 0; 847 - continue; 848 - } 849 - spin_lock(&ilb->lock); 850 - sk_nulls_for_each(sk, node, &ilb->nulls_head) { 851 - struct inet_sock *inet = inet_sk(sk); 852 - 853 - if (!net_eq(sock_net(sk), net)) 854 - continue; 855 - 856 - if (num < s_num) { 857 - num++; 858 - continue; 859 - } 860 - 861 - if (r->sdiag_family != AF_UNSPEC && 862 - sk->sk_family != r->sdiag_family) 863 - goto next_listen; 864 - 865 - if (r->id.idiag_sport != inet->inet_sport && 866 - r->id.idiag_sport) 867 - goto next_listen; 868 - 869 - if (!inet_diag_bc_sk(bc, sk)) 870 - goto next_listen; 871 - 872 - if (inet_sk_diag_fill(sk, inet_csk(sk), skb, 873 - cb, r, NLM_F_MULTI, 874 - net_admin) < 0) { 875 - spin_unlock(&ilb->lock); 876 - goto done; 877 - } 878 - 879 - next_listen: 880 - ++num; 881 - } 882 - spin_unlock(&ilb->lock); 883 - 884 - s_num = 0; 885 - } 886 - skip_listen_ht: 887 - cb->args[0] = 1; 888 - s_i = num = s_num = 0; 889 - } 890 - 891 - /* Process a maximum of SKARR_SZ sockets at a time when walking hash buckets 892 - * with bh disabled. 893 - */ 894 - #define SKARR_SZ 16 895 - 896 - /* Dump bound but inactive (not listening, connecting, etc.) sockets */ 897 - if (cb->args[0] == 1) { 898 - if (!(idiag_states & TCPF_BOUND_INACTIVE)) 899 - goto skip_bind_ht; 900 - 901 - for (i = s_i; i < hashinfo->bhash_size; i++) { 902 - struct inet_bind_hashbucket *ibb; 903 - struct inet_bind2_bucket *tb2; 904 - struct sock *sk_arr[SKARR_SZ]; 905 - int num_arr[SKARR_SZ]; 906 - int idx, accum, res; 907 - 908 - resume_bind_walk: 909 - num = 0; 910 - accum = 0; 911 - ibb = &hashinfo->bhash2[i]; 912 - 913 - if (hlist_empty(&ibb->chain)) { 914 - s_num = 0; 915 - continue; 916 - } 917 - spin_lock_bh(&ibb->lock); 918 - inet_bind_bucket_for_each(tb2, &ibb->chain) { 919 - if (!net_eq(ib2_net(tb2), net)) 920 - continue; 921 - 922 - sk_for_each_bound(sk, &tb2->owners) { 923 - struct inet_sock *inet = inet_sk(sk); 924 - 925 - if (num < s_num) 926 - goto next_bind; 927 - 928 - if (sk->sk_state != TCP_CLOSE || 929 - !inet->inet_num) 930 - goto next_bind; 931 - 932 - if (r->sdiag_family != AF_UNSPEC && 933 - r->sdiag_family != sk->sk_family) 934 - goto next_bind; 935 - 936 - if (!inet_diag_bc_sk(bc, sk)) 937 - goto next_bind; 938 - 939 - sock_hold(sk); 940 - num_arr[accum] = num; 941 - sk_arr[accum] = sk; 942 - if (++accum == SKARR_SZ) 943 - goto pause_bind_walk; 944 - next_bind: 945 - num++; 946 - } 947 - } 948 - pause_bind_walk: 949 - spin_unlock_bh(&ibb->lock); 950 - 951 - res = 0; 952 - for (idx = 0; idx < accum; idx++) { 953 - if (res >= 0) { 954 - res = inet_sk_diag_fill(sk_arr[idx], 955 - NULL, skb, cb, 956 - r, NLM_F_MULTI, 957 - net_admin); 958 - if (res < 0) 959 - num = num_arr[idx]; 960 - } 961 - sock_put(sk_arr[idx]); 962 - } 963 - if (res < 0) 964 - goto done; 965 - 966 - cond_resched(); 967 - 968 - if (accum == SKARR_SZ) { 969 - s_num = num + 1; 970 - goto resume_bind_walk; 971 - } 972 - 973 - s_num = 0; 974 - } 975 - skip_bind_ht: 976 - cb->args[0] = 2; 977 - s_i = num = s_num = 0; 978 - } 979 - 980 - if (!(idiag_states & ~TCPF_LISTEN)) 981 - goto out; 982 - 983 - for (i = s_i; i <= hashinfo->ehash_mask; i++) { 984 - struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 985 - spinlock_t *lock = inet_ehash_lockp(hashinfo, i); 986 - struct hlist_nulls_node *node; 987 - struct sock *sk_arr[SKARR_SZ]; 988 - int num_arr[SKARR_SZ]; 989 - int idx, accum, res; 990 - 991 - if (hlist_nulls_empty(&head->chain)) 992 - continue; 993 - 994 - if (i > s_i) 995 - s_num = 0; 996 - 997 - next_chunk: 998 - num = 0; 999 - accum = 0; 1000 - spin_lock_bh(lock); 1001 - sk_nulls_for_each(sk, node, &head->chain) { 1002 - int state; 1003 - 1004 - if (!net_eq(sock_net(sk), net)) 1005 - continue; 1006 - if (num < s_num) 1007 - goto next_normal; 1008 - state = (sk->sk_state == TCP_TIME_WAIT) ? 1009 - READ_ONCE(inet_twsk(sk)->tw_substate) : sk->sk_state; 1010 - if (!(idiag_states & (1 << state))) 1011 - goto next_normal; 1012 - if (r->sdiag_family != AF_UNSPEC && 1013 - sk->sk_family != r->sdiag_family) 1014 - goto next_normal; 1015 - if (r->id.idiag_sport != htons(sk->sk_num) && 1016 - r->id.idiag_sport) 1017 - goto next_normal; 1018 - if (r->id.idiag_dport != sk->sk_dport && 1019 - r->id.idiag_dport) 1020 - goto next_normal; 1021 - twsk_build_assert(); 1022 - 1023 - if (!inet_diag_bc_sk(bc, sk)) 1024 - goto next_normal; 1025 - 1026 - if (!refcount_inc_not_zero(&sk->sk_refcnt)) 1027 - goto next_normal; 1028 - 1029 - num_arr[accum] = num; 1030 - sk_arr[accum] = sk; 1031 - if (++accum == SKARR_SZ) 1032 - break; 1033 - next_normal: 1034 - ++num; 1035 - } 1036 - spin_unlock_bh(lock); 1037 - res = 0; 1038 - for (idx = 0; idx < accum; idx++) { 1039 - if (res >= 0) { 1040 - res = sk_diag_fill(sk_arr[idx], skb, cb, r, 1041 - NLM_F_MULTI, net_admin); 1042 - if (res < 0) 1043 - num = num_arr[idx]; 1044 - } 1045 - sock_gen_put(sk_arr[idx]); 1046 - } 1047 - if (res < 0) 1048 - break; 1049 - cond_resched(); 1050 - if (accum == SKARR_SZ) { 1051 - s_num = num + 1; 1052 - goto next_chunk; 1053 - } 1054 - } 1055 - 1056 - done: 1057 - cb->args[1] = i; 1058 - cb->args[2] = num; 1059 - out: 1060 - ; 1061 - } 1062 - EXPORT_SYMBOL_GPL(inet_diag_dump_icsk); 1063 994 1064 995 static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 1065 996 const struct inet_diag_req_v2 *r)
+17 -17
net/ipv4/inet_hashtables.c
··· 425 425 } 426 426 427 427 struct sock *__inet_lookup_listener(const struct net *net, 428 - struct inet_hashinfo *hashinfo, 429 428 struct sk_buff *skb, int doff, 430 429 const __be32 saddr, __be16 sport, 431 430 const __be32 daddr, const unsigned short hnum, 432 431 const int dif, const int sdif) 433 432 { 434 433 struct inet_listen_hashbucket *ilb2; 434 + struct inet_hashinfo *hashinfo; 435 435 struct sock *result = NULL; 436 436 unsigned int hash2; 437 437 438 438 /* Lookup redirect from BPF */ 439 - if (static_branch_unlikely(&bpf_sk_lookup_enabled) && 440 - hashinfo == net->ipv4.tcp_death_row.hashinfo) { 439 + if (static_branch_unlikely(&bpf_sk_lookup_enabled)) { 441 440 result = inet_lookup_run_sk_lookup(net, IPPROTO_TCP, skb, doff, 442 441 saddr, sport, daddr, hnum, dif, 443 442 inet_ehashfn); ··· 444 445 goto done; 445 446 } 446 447 448 + hashinfo = net->ipv4.tcp_death_row.hashinfo; 447 449 hash2 = ipv4_portaddr_hash(net, daddr, hnum); 448 450 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 449 451 ··· 490 490 EXPORT_SYMBOL(sock_edemux); 491 491 492 492 struct sock *__inet_lookup_established(const struct net *net, 493 - struct inet_hashinfo *hashinfo, 494 - const __be32 saddr, const __be16 sport, 495 - const __be32 daddr, const u16 hnum, 496 - const int dif, const int sdif) 493 + const __be32 saddr, const __be16 sport, 494 + const __be32 daddr, const u16 hnum, 495 + const int dif, const int sdif) 497 496 { 498 - INET_ADDR_COOKIE(acookie, saddr, daddr); 499 497 const __portpair ports = INET_COMBINED_PORTS(sport, hnum); 500 - struct sock *sk; 498 + INET_ADDR_COOKIE(acookie, saddr, daddr); 501 499 const struct hlist_nulls_node *node; 502 - /* Optimize here for direct hit, only listening connections can 503 - * have wildcards anyways. 504 - */ 505 - unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport); 506 - unsigned int slot = hash & hashinfo->ehash_mask; 507 - struct inet_ehash_bucket *head = &hashinfo->ehash[slot]; 500 + struct inet_ehash_bucket *head; 501 + struct inet_hashinfo *hashinfo; 502 + unsigned int hash, slot; 503 + struct sock *sk; 504 + 505 + hashinfo = net->ipv4.tcp_death_row.hashinfo; 506 + hash = inet_ehashfn(net, daddr, hnum, saddr, sport); 507 + slot = hash & hashinfo->ehash_mask; 508 + head = &hashinfo->ehash[slot]; 508 509 509 510 begin: 510 511 sk_nulls_for_each_rcu(sk, node, &head->chain) { ··· 580 579 if (likely(inet_match(net, sk2, acookie, ports, dif, sdif))) { 581 580 if (sk2->sk_state == TCP_TIME_WAIT) { 582 581 tw = inet_twsk(sk2); 583 - if (sk->sk_protocol == IPPROTO_TCP && 584 - tcp_twsk_unique(sk, sk2, twp)) 582 + if (tcp_twsk_unique(sk, sk2, twp)) 585 583 break; 586 584 } 587 585 goto not_unique;
+3 -2
net/ipv4/inet_timewait_sock.c
··· 15 15 #include <net/inet_hashtables.h> 16 16 #include <net/inet_timewait_sock.h> 17 17 #include <net/ip.h> 18 - 18 + #include <net/tcp.h> 19 19 20 20 /** 21 21 * inet_twsk_bind_unhash - unhash a timewait socket from bind hash ··· 74 74 void inet_twsk_free(struct inet_timewait_sock *tw) 75 75 { 76 76 struct module *owner = tw->tw_prot->owner; 77 - twsk_destructor((struct sock *)tw); 77 + 78 + tcp_twsk_destructor((struct sock *)tw); 78 79 kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); 79 80 module_put(owner); 80 81 }
+1 -2
net/ipv4/netfilter/nf_socket_ipv4.c
··· 71 71 { 72 72 switch (protocol) { 73 73 case IPPROTO_TCP: 74 - return inet_lookup(net, net->ipv4.tcp_death_row.hashinfo, 75 - skb, doff, saddr, sport, daddr, dport, 74 + return inet_lookup(net, skb, doff, saddr, sport, daddr, dport, 76 75 in->ifindex); 77 76 case IPPROTO_UDP: 78 77 return udp4_lib_lookup(net, saddr, sport, daddr, dport,
+2 -3
net/ipv4/netfilter/nf_tproxy_ipv4.c
··· 81 81 const struct net_device *in, 82 82 const enum nf_tproxy_lookup_t lookup_type) 83 83 { 84 - struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo; 85 84 struct sock *sk; 86 85 87 86 switch (protocol) { ··· 94 95 95 96 switch (lookup_type) { 96 97 case NF_TPROXY_LOOKUP_LISTENER: 97 - sk = inet_lookup_listener(net, hinfo, skb, 98 + sk = inet_lookup_listener(net, skb, 98 99 ip_hdrlen(skb) + __tcp_hdrlen(hp), 99 100 saddr, sport, daddr, dport, 100 101 in->ifindex, 0); ··· 108 109 */ 109 110 break; 110 111 case NF_TPROXY_LOOKUP_ESTABLISHED: 111 - sk = inet_lookup_established(net, hinfo, saddr, sport, 112 + sk = inet_lookup_established(net, saddr, sport, 112 113 daddr, dport, in->ifindex); 113 114 break; 114 115 default:
+451 -12
net/ipv4/tcp_diag.c
··· 12 12 13 13 #include <linux/tcp.h> 14 14 15 + #include <net/inet_hashtables.h> 16 + #include <net/inet6_hashtables.h> 17 + #include <net/inet_timewait_sock.h> 15 18 #include <net/netlink.h> 16 19 #include <net/tcp.h> 17 20 ··· 177 174 size += ulp_ops->get_info_size(sk, net_admin); 178 175 } 179 176 } 180 - return size; 177 + 178 + return size 179 + + nla_total_size(sizeof(struct tcp_info)) 180 + + nla_total_size(sizeof(struct inet_diag_msg)) 181 + + inet_diag_msg_attrs_size() 182 + + nla_total_size(sizeof(struct inet_diag_meminfo)) 183 + + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) 184 + + nla_total_size(TCP_CA_NAME_MAX) 185 + + nla_total_size(sizeof(struct tcpvegas_info)) 186 + + 64; 187 + } 188 + 189 + static int tcp_twsk_diag_fill(struct sock *sk, 190 + struct sk_buff *skb, 191 + struct netlink_callback *cb, 192 + u16 nlmsg_flags, bool net_admin) 193 + { 194 + struct inet_timewait_sock *tw = inet_twsk(sk); 195 + struct inet_diag_msg *r; 196 + struct nlmsghdr *nlh; 197 + long tmo; 198 + 199 + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, 200 + cb->nlh->nlmsg_seq, cb->nlh->nlmsg_type, 201 + sizeof(*r), nlmsg_flags); 202 + if (!nlh) 203 + return -EMSGSIZE; 204 + 205 + r = nlmsg_data(nlh); 206 + DEBUG_NET_WARN_ON_ONCE(tw->tw_state != TCP_TIME_WAIT); 207 + 208 + inet_diag_msg_common_fill(r, sk); 209 + r->idiag_retrans = 0; 210 + 211 + r->idiag_state = READ_ONCE(tw->tw_substate); 212 + r->idiag_timer = 3; 213 + tmo = tw->tw_timer.expires - jiffies; 214 + r->idiag_expires = jiffies_delta_to_msecs(tmo); 215 + r->idiag_rqueue = 0; 216 + r->idiag_wqueue = 0; 217 + r->idiag_uid = 0; 218 + r->idiag_inode = 0; 219 + 220 + if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, 221 + tw->tw_mark)) { 222 + nlmsg_cancel(skb, nlh); 223 + return -EMSGSIZE; 224 + } 225 + 226 + nlmsg_end(skb, nlh); 227 + return 0; 228 + } 229 + 230 + static int tcp_req_diag_fill(struct sock *sk, struct sk_buff *skb, 231 + struct netlink_callback *cb, 232 + u16 nlmsg_flags, bool net_admin) 233 + { 234 + struct request_sock *reqsk = inet_reqsk(sk); 235 + struct inet_diag_msg *r; 236 + struct nlmsghdr *nlh; 237 + long tmo; 238 + 239 + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, 240 + cb->nlh->nlmsg_type, sizeof(*r), nlmsg_flags); 241 + if (!nlh) 242 + return -EMSGSIZE; 243 + 244 + r = nlmsg_data(nlh); 245 + inet_diag_msg_common_fill(r, sk); 246 + r->idiag_state = TCP_SYN_RECV; 247 + r->idiag_timer = 1; 248 + r->idiag_retrans = reqsk->num_retrans; 249 + 250 + BUILD_BUG_ON(offsetof(struct inet_request_sock, ir_cookie) != 251 + offsetof(struct sock, sk_cookie)); 252 + 253 + tmo = inet_reqsk(sk)->rsk_timer.expires - jiffies; 254 + r->idiag_expires = jiffies_delta_to_msecs(tmo); 255 + r->idiag_rqueue = 0; 256 + r->idiag_wqueue = 0; 257 + r->idiag_uid = 0; 258 + r->idiag_inode = 0; 259 + 260 + if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, 261 + inet_rsk(reqsk)->ir_mark)) { 262 + nlmsg_cancel(skb, nlh); 263 + return -EMSGSIZE; 264 + } 265 + 266 + nlmsg_end(skb, nlh); 267 + return 0; 268 + } 269 + 270 + static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, 271 + struct netlink_callback *cb, 272 + const struct inet_diag_req_v2 *r, 273 + u16 nlmsg_flags, bool net_admin) 274 + { 275 + if (sk->sk_state == TCP_TIME_WAIT) 276 + return tcp_twsk_diag_fill(sk, skb, cb, nlmsg_flags, net_admin); 277 + 278 + if (sk->sk_state == TCP_NEW_SYN_RECV) 279 + return tcp_req_diag_fill(sk, skb, cb, nlmsg_flags, net_admin); 280 + 281 + return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, r, nlmsg_flags, 282 + net_admin); 283 + } 284 + 285 + static void twsk_build_assert(void) 286 + { 287 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_family) != 288 + offsetof(struct sock, sk_family)); 289 + 290 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_num) != 291 + offsetof(struct inet_sock, inet_num)); 292 + 293 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_dport) != 294 + offsetof(struct inet_sock, inet_dport)); 295 + 296 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_rcv_saddr) != 297 + offsetof(struct inet_sock, inet_rcv_saddr)); 298 + 299 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_daddr) != 300 + offsetof(struct inet_sock, inet_daddr)); 301 + 302 + #if IS_ENABLED(CONFIG_IPV6) 303 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_v6_rcv_saddr) != 304 + offsetof(struct sock, sk_v6_rcv_saddr)); 305 + 306 + BUILD_BUG_ON(offsetof(struct inet_timewait_sock, tw_v6_daddr) != 307 + offsetof(struct sock, sk_v6_daddr)); 308 + #endif 181 309 } 182 310 183 311 static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 184 312 const struct inet_diag_req_v2 *r) 185 313 { 186 - struct inet_hashinfo *hinfo; 314 + bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); 315 + struct inet_diag_dump_data *cb_data = cb->data; 316 + struct net *net = sock_net(skb->sk); 317 + u32 idiag_states = r->idiag_states; 318 + struct inet_hashinfo *hashinfo; 319 + int i, num, s_i, s_num; 320 + struct nlattr *bc; 321 + struct sock *sk; 187 322 188 - hinfo = sock_net(cb->skb->sk)->ipv4.tcp_death_row.hashinfo; 323 + hashinfo = net->ipv4.tcp_death_row.hashinfo; 324 + bc = cb_data->inet_diag_nla_bc; 325 + if (idiag_states & TCPF_SYN_RECV) 326 + idiag_states |= TCPF_NEW_SYN_RECV; 327 + s_i = cb->args[1]; 328 + s_num = num = cb->args[2]; 189 329 190 - inet_diag_dump_icsk(hinfo, skb, cb, r); 330 + if (cb->args[0] == 0) { 331 + if (!(idiag_states & TCPF_LISTEN) || r->id.idiag_dport) 332 + goto skip_listen_ht; 333 + 334 + for (i = s_i; i <= hashinfo->lhash2_mask; i++) { 335 + struct inet_listen_hashbucket *ilb; 336 + struct hlist_nulls_node *node; 337 + 338 + num = 0; 339 + ilb = &hashinfo->lhash2[i]; 340 + 341 + if (hlist_nulls_empty(&ilb->nulls_head)) { 342 + s_num = 0; 343 + continue; 344 + } 345 + spin_lock(&ilb->lock); 346 + sk_nulls_for_each(sk, node, &ilb->nulls_head) { 347 + struct inet_sock *inet = inet_sk(sk); 348 + 349 + if (!net_eq(sock_net(sk), net)) 350 + continue; 351 + 352 + if (num < s_num) { 353 + num++; 354 + continue; 355 + } 356 + 357 + if (r->sdiag_family != AF_UNSPEC && 358 + sk->sk_family != r->sdiag_family) 359 + goto next_listen; 360 + 361 + if (r->id.idiag_sport != inet->inet_sport && 362 + r->id.idiag_sport) 363 + goto next_listen; 364 + 365 + if (!inet_diag_bc_sk(bc, sk)) 366 + goto next_listen; 367 + 368 + if (inet_sk_diag_fill(sk, inet_csk(sk), skb, 369 + cb, r, NLM_F_MULTI, 370 + net_admin) < 0) { 371 + spin_unlock(&ilb->lock); 372 + goto done; 373 + } 374 + 375 + next_listen: 376 + ++num; 377 + } 378 + spin_unlock(&ilb->lock); 379 + 380 + s_num = 0; 381 + } 382 + skip_listen_ht: 383 + cb->args[0] = 1; 384 + s_i = num = s_num = 0; 385 + } 386 + 387 + /* Process a maximum of SKARR_SZ sockets at a time when walking hash buckets 388 + * with bh disabled. 389 + */ 390 + #define SKARR_SZ 16 391 + 392 + /* Dump bound but inactive (not listening, connecting, etc.) sockets */ 393 + if (cb->args[0] == 1) { 394 + if (!(idiag_states & TCPF_BOUND_INACTIVE)) 395 + goto skip_bind_ht; 396 + 397 + for (i = s_i; i < hashinfo->bhash_size; i++) { 398 + struct inet_bind_hashbucket *ibb; 399 + struct inet_bind2_bucket *tb2; 400 + struct sock *sk_arr[SKARR_SZ]; 401 + int num_arr[SKARR_SZ]; 402 + int idx, accum, res; 403 + 404 + resume_bind_walk: 405 + num = 0; 406 + accum = 0; 407 + ibb = &hashinfo->bhash2[i]; 408 + 409 + if (hlist_empty(&ibb->chain)) { 410 + s_num = 0; 411 + continue; 412 + } 413 + spin_lock_bh(&ibb->lock); 414 + inet_bind_bucket_for_each(tb2, &ibb->chain) { 415 + if (!net_eq(ib2_net(tb2), net)) 416 + continue; 417 + 418 + sk_for_each_bound(sk, &tb2->owners) { 419 + struct inet_sock *inet = inet_sk(sk); 420 + 421 + if (num < s_num) 422 + goto next_bind; 423 + 424 + if (sk->sk_state != TCP_CLOSE || 425 + !inet->inet_num) 426 + goto next_bind; 427 + 428 + if (r->sdiag_family != AF_UNSPEC && 429 + r->sdiag_family != sk->sk_family) 430 + goto next_bind; 431 + 432 + if (!inet_diag_bc_sk(bc, sk)) 433 + goto next_bind; 434 + 435 + sock_hold(sk); 436 + num_arr[accum] = num; 437 + sk_arr[accum] = sk; 438 + if (++accum == SKARR_SZ) 439 + goto pause_bind_walk; 440 + next_bind: 441 + num++; 442 + } 443 + } 444 + pause_bind_walk: 445 + spin_unlock_bh(&ibb->lock); 446 + 447 + res = 0; 448 + for (idx = 0; idx < accum; idx++) { 449 + if (res >= 0) { 450 + res = inet_sk_diag_fill(sk_arr[idx], 451 + NULL, skb, cb, 452 + r, NLM_F_MULTI, 453 + net_admin); 454 + if (res < 0) 455 + num = num_arr[idx]; 456 + } 457 + sock_put(sk_arr[idx]); 458 + } 459 + if (res < 0) 460 + goto done; 461 + 462 + cond_resched(); 463 + 464 + if (accum == SKARR_SZ) { 465 + s_num = num + 1; 466 + goto resume_bind_walk; 467 + } 468 + 469 + s_num = 0; 470 + } 471 + skip_bind_ht: 472 + cb->args[0] = 2; 473 + s_i = num = s_num = 0; 474 + } 475 + 476 + if (!(idiag_states & ~TCPF_LISTEN)) 477 + goto out; 478 + 479 + for (i = s_i; i <= hashinfo->ehash_mask; i++) { 480 + struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 481 + spinlock_t *lock = inet_ehash_lockp(hashinfo, i); 482 + struct hlist_nulls_node *node; 483 + struct sock *sk_arr[SKARR_SZ]; 484 + int num_arr[SKARR_SZ]; 485 + int idx, accum, res; 486 + 487 + if (hlist_nulls_empty(&head->chain)) 488 + continue; 489 + 490 + if (i > s_i) 491 + s_num = 0; 492 + 493 + next_chunk: 494 + num = 0; 495 + accum = 0; 496 + spin_lock_bh(lock); 497 + sk_nulls_for_each(sk, node, &head->chain) { 498 + int state; 499 + 500 + if (!net_eq(sock_net(sk), net)) 501 + continue; 502 + if (num < s_num) 503 + goto next_normal; 504 + state = (sk->sk_state == TCP_TIME_WAIT) ? 505 + READ_ONCE(inet_twsk(sk)->tw_substate) : sk->sk_state; 506 + if (!(idiag_states & (1 << state))) 507 + goto next_normal; 508 + if (r->sdiag_family != AF_UNSPEC && 509 + sk->sk_family != r->sdiag_family) 510 + goto next_normal; 511 + if (r->id.idiag_sport != htons(sk->sk_num) && 512 + r->id.idiag_sport) 513 + goto next_normal; 514 + if (r->id.idiag_dport != sk->sk_dport && 515 + r->id.idiag_dport) 516 + goto next_normal; 517 + twsk_build_assert(); 518 + 519 + if (!inet_diag_bc_sk(bc, sk)) 520 + goto next_normal; 521 + 522 + if (!refcount_inc_not_zero(&sk->sk_refcnt)) 523 + goto next_normal; 524 + 525 + num_arr[accum] = num; 526 + sk_arr[accum] = sk; 527 + if (++accum == SKARR_SZ) 528 + break; 529 + next_normal: 530 + ++num; 531 + } 532 + spin_unlock_bh(lock); 533 + 534 + res = 0; 535 + for (idx = 0; idx < accum; idx++) { 536 + if (res >= 0) { 537 + res = sk_diag_fill(sk_arr[idx], skb, cb, r, 538 + NLM_F_MULTI, net_admin); 539 + if (res < 0) 540 + num = num_arr[idx]; 541 + } 542 + sock_gen_put(sk_arr[idx]); 543 + } 544 + if (res < 0) 545 + break; 546 + 547 + cond_resched(); 548 + 549 + if (accum == SKARR_SZ) { 550 + s_num = num + 1; 551 + goto next_chunk; 552 + } 553 + } 554 + 555 + done: 556 + cb->args[1] = i; 557 + cb->args[2] = num; 558 + out: 559 + ; 560 + } 561 + 562 + static struct sock *tcp_diag_find_one_icsk(struct net *net, 563 + const struct inet_diag_req_v2 *req) 564 + { 565 + struct sock *sk; 566 + 567 + rcu_read_lock(); 568 + if (req->sdiag_family == AF_INET) { 569 + sk = inet_lookup(net, NULL, 0, req->id.idiag_dst[0], 570 + req->id.idiag_dport, req->id.idiag_src[0], 571 + req->id.idiag_sport, req->id.idiag_if); 572 + #if IS_ENABLED(CONFIG_IPV6) 573 + } else if (req->sdiag_family == AF_INET6) { 574 + if (ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_dst) && 575 + ipv6_addr_v4mapped((struct in6_addr *)req->id.idiag_src)) 576 + sk = inet_lookup(net, NULL, 0, req->id.idiag_dst[3], 577 + req->id.idiag_dport, req->id.idiag_src[3], 578 + req->id.idiag_sport, req->id.idiag_if); 579 + else 580 + sk = inet6_lookup(net, NULL, 0, 581 + (struct in6_addr *)req->id.idiag_dst, 582 + req->id.idiag_dport, 583 + (struct in6_addr *)req->id.idiag_src, 584 + req->id.idiag_sport, 585 + req->id.idiag_if); 586 + #endif 587 + } else { 588 + rcu_read_unlock(); 589 + return ERR_PTR(-EINVAL); 590 + } 591 + rcu_read_unlock(); 592 + if (!sk) 593 + return ERR_PTR(-ENOENT); 594 + 595 + if (sock_diag_check_cookie(sk, req->id.idiag_cookie)) { 596 + sock_gen_put(sk); 597 + return ERR_PTR(-ENOENT); 598 + } 599 + 600 + return sk; 191 601 } 192 602 193 603 static int tcp_diag_dump_one(struct netlink_callback *cb, 194 604 const struct inet_diag_req_v2 *req) 195 605 { 196 - struct inet_hashinfo *hinfo; 606 + struct sk_buff *in_skb = cb->skb; 607 + struct sk_buff *rep; 608 + struct sock *sk; 609 + struct net *net; 610 + bool net_admin; 611 + int err; 197 612 198 - hinfo = sock_net(cb->skb->sk)->ipv4.tcp_death_row.hashinfo; 613 + net = sock_net(in_skb->sk); 614 + sk = tcp_diag_find_one_icsk(net, req); 615 + if (IS_ERR(sk)) 616 + return PTR_ERR(sk); 199 617 200 - return inet_diag_dump_one_icsk(hinfo, cb, req); 618 + net_admin = netlink_net_capable(in_skb, CAP_NET_ADMIN); 619 + rep = nlmsg_new(tcp_diag_get_aux_size(sk, net_admin), GFP_KERNEL); 620 + if (!rep) { 621 + err = -ENOMEM; 622 + goto out; 623 + } 624 + 625 + err = sk_diag_fill(sk, rep, cb, req, 0, net_admin); 626 + if (err < 0) { 627 + WARN_ON(err == -EMSGSIZE); 628 + nlmsg_free(rep); 629 + goto out; 630 + } 631 + err = nlmsg_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid); 632 + 633 + out: 634 + if (sk) 635 + sock_gen_put(sk); 636 + 637 + return err; 201 638 } 202 639 203 640 #ifdef CONFIG_INET_DIAG_DESTROY ··· 645 202 const struct inet_diag_req_v2 *req) 646 203 { 647 204 struct net *net = sock_net(in_skb->sk); 648 - struct inet_hashinfo *hinfo; 649 205 struct sock *sk; 650 206 int err; 651 207 652 - hinfo = net->ipv4.tcp_death_row.hashinfo; 653 - sk = inet_diag_find_one_icsk(net, hinfo, req); 654 - 208 + sk = tcp_diag_find_one_icsk(net, req); 655 209 if (IS_ERR(sk)) 656 210 return PTR_ERR(sk); 657 211 ··· 666 226 .dump_one = tcp_diag_dump_one, 667 227 .idiag_get_info = tcp_diag_get_info, 668 228 .idiag_get_aux = tcp_diag_get_aux, 669 - .idiag_get_aux_size = tcp_diag_get_aux_size, 670 229 .idiag_type = IPPROTO_TCP, 671 230 .idiag_info_size = sizeof(struct tcp_info), 672 231 #ifdef CONFIG_INET_DIAG_DESTROY
+5 -12
net/ipv4/tcp_ipv4.c
··· 506 506 struct sock *sk; 507 507 int err; 508 508 509 - sk = __inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 510 - iph->daddr, th->dest, iph->saddr, 509 + sk = __inet_lookup_established(net, iph->daddr, th->dest, iph->saddr, 511 510 ntohs(th->source), inet_iif(skb), 0); 512 511 if (!sk) { 513 512 __ICMP_INC_STATS(net, ICMP_MIB_INERRORS); ··· 822 823 * Incoming packet is checked with md5 hash with finding key, 823 824 * no RST generated if md5 hash doesn't match. 824 825 */ 825 - sk1 = __inet_lookup_listener(net, net->ipv4.tcp_death_row.hashinfo, 826 - NULL, 0, ip_hdr(skb)->saddr, 826 + sk1 = __inet_lookup_listener(net, NULL, 0, ip_hdr(skb)->saddr, 827 827 th->source, ip_hdr(skb)->daddr, 828 828 ntohs(th->source), dif, sdif); 829 829 /* don't send rst if it can't find key */ ··· 1990 1992 if (th->doff < sizeof(struct tcphdr) / 4) 1991 1993 return 0; 1992 1994 1993 - sk = __inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 1994 - iph->saddr, th->source, 1995 + sk = __inet_lookup_established(net, iph->saddr, th->source, 1995 1996 iph->daddr, ntohs(th->dest), 1996 1997 skb->skb_iif, inet_sdif(skb)); 1997 1998 if (sk) { ··· 2233 2236 th = (const struct tcphdr *)skb->data; 2234 2237 iph = ip_hdr(skb); 2235 2238 lookup: 2236 - sk = __inet_lookup_skb(net->ipv4.tcp_death_row.hashinfo, 2237 - skb, __tcp_hdrlen(th), th->source, 2239 + sk = __inet_lookup_skb(skb, __tcp_hdrlen(th), th->source, 2238 2240 th->dest, sdif, &refcounted); 2239 2241 if (!sk) 2240 2242 goto no_tcp_socket; ··· 2422 2426 &drop_reason); 2423 2427 switch (tw_status) { 2424 2428 case TCP_TW_SYN: { 2425 - struct sock *sk2 = inet_lookup_listener(net, 2426 - net->ipv4.tcp_death_row.hashinfo, 2427 - skb, __tcp_hdrlen(th), 2429 + struct sock *sk2 = inet_lookup_listener(net, skb, __tcp_hdrlen(th), 2428 2430 iph->saddr, th->source, 2429 2431 iph->daddr, th->dest, 2430 2432 inet_iif(skb), ··· 2453 2459 2454 2460 static struct timewait_sock_ops tcp_timewait_sock_ops = { 2455 2461 .twsk_obj_size = sizeof(struct tcp_timewait_sock), 2456 - .twsk_destructor= tcp_twsk_destructor, 2457 2462 }; 2458 2463 2459 2464 void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
-1
net/ipv4/tcp_minisocks.c
··· 401 401 #endif 402 402 tcp_ao_destroy_sock(sk, true); 403 403 } 404 - EXPORT_IPV6_MOD_GPL(tcp_twsk_destructor); 405 404 406 405 void tcp_twsk_purge(struct list_head *net_exit_list) 407 406 {
+1 -2
net/ipv4/tcp_offload.c
··· 434 434 inet_get_iif_sdif(skb, &iif, &sdif); 435 435 iph = skb_gro_network_header(skb); 436 436 net = dev_net_rcu(skb->dev); 437 - sk = __inet_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 438 - iph->saddr, th->source, 437 + sk = __inet_lookup_established(net, iph->saddr, th->source, 439 438 iph->daddr, ntohs(th->dest), 440 439 iif, sdif); 441 440 NAPI_GRO_CB(skb)->is_flist = !sk;
+2 -2
net/ipv6/esp6.c
··· 149 149 dport = encap->encap_dport; 150 150 spin_unlock_bh(&x->lock); 151 151 152 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, &x->id.daddr.in6, 153 - dport, &x->props.saddr.in6, ntohs(sport), 0, 0); 152 + sk = __inet6_lookup_established(net, &x->id.daddr.in6, dport, 153 + &x->props.saddr.in6, ntohs(sport), 0, 0); 154 154 if (!sk) 155 155 return ERR_PTR(-ENOENT); 156 156
+25 -26
net/ipv6/inet6_hashtables.c
··· 47 47 * The sockhash lock must be held as a reader here. 48 48 */ 49 49 struct sock *__inet6_lookup_established(const struct net *net, 50 - struct inet_hashinfo *hashinfo, 51 - const struct in6_addr *saddr, 52 - const __be16 sport, 53 - const struct in6_addr *daddr, 54 - const u16 hnum, 55 - const int dif, const int sdif) 50 + const struct in6_addr *saddr, 51 + const __be16 sport, 52 + const struct in6_addr *daddr, 53 + const u16 hnum, 54 + const int dif, const int sdif) 56 55 { 57 - struct sock *sk; 58 - const struct hlist_nulls_node *node; 59 56 const __portpair ports = INET_COMBINED_PORTS(sport, hnum); 60 - /* Optimize here for direct hit, only listening connections can 61 - * have wildcards anyways. 62 - */ 63 - unsigned int hash = inet6_ehashfn(net, daddr, hnum, saddr, sport); 64 - unsigned int slot = hash & hashinfo->ehash_mask; 65 - struct inet_ehash_bucket *head = &hashinfo->ehash[slot]; 57 + const struct hlist_nulls_node *node; 58 + struct inet_ehash_bucket *head; 59 + struct inet_hashinfo *hashinfo; 60 + unsigned int hash, slot; 61 + struct sock *sk; 66 62 67 - 63 + hashinfo = net->ipv4.tcp_death_row.hashinfo; 64 + hash = inet6_ehashfn(net, daddr, hnum, saddr, sport); 65 + slot = hash & hashinfo->ehash_mask; 66 + head = &hashinfo->ehash[slot]; 68 67 begin: 69 68 sk_nulls_for_each_rcu(sk, node, &head->chain) { 70 69 if (sk->sk_hash != hash) ··· 199 200 EXPORT_SYMBOL_GPL(inet6_lookup_run_sk_lookup); 200 201 201 202 struct sock *inet6_lookup_listener(const struct net *net, 202 - struct inet_hashinfo *hashinfo, 203 - struct sk_buff *skb, int doff, 204 - const struct in6_addr *saddr, 205 - const __be16 sport, const struct in6_addr *daddr, 206 - const unsigned short hnum, const int dif, const int sdif) 203 + struct sk_buff *skb, int doff, 204 + const struct in6_addr *saddr, 205 + const __be16 sport, 206 + const struct in6_addr *daddr, 207 + const unsigned short hnum, 208 + const int dif, const int sdif) 207 209 { 208 210 struct inet_listen_hashbucket *ilb2; 211 + struct inet_hashinfo *hashinfo; 209 212 struct sock *result = NULL; 210 213 unsigned int hash2; 211 214 212 215 /* Lookup redirect from BPF */ 213 - if (static_branch_unlikely(&bpf_sk_lookup_enabled) && 214 - hashinfo == net->ipv4.tcp_death_row.hashinfo) { 216 + if (static_branch_unlikely(&bpf_sk_lookup_enabled)) { 215 217 result = inet6_lookup_run_sk_lookup(net, IPPROTO_TCP, skb, doff, 216 218 saddr, sport, daddr, hnum, dif, 217 219 inet6_ehashfn); ··· 220 220 goto done; 221 221 } 222 222 223 + hashinfo = net->ipv4.tcp_death_row.hashinfo; 223 224 hash2 = ipv6_portaddr_hash(net, daddr, hnum); 224 225 ilb2 = inet_lhash2_bucket(hashinfo, hash2); 225 226 ··· 245 244 EXPORT_SYMBOL_GPL(inet6_lookup_listener); 246 245 247 246 struct sock *inet6_lookup(const struct net *net, 248 - struct inet_hashinfo *hashinfo, 249 247 struct sk_buff *skb, int doff, 250 248 const struct in6_addr *saddr, const __be16 sport, 251 249 const struct in6_addr *daddr, const __be16 dport, ··· 253 253 struct sock *sk; 254 254 bool refcounted; 255 255 256 - sk = __inet6_lookup(net, hashinfo, skb, doff, saddr, sport, daddr, 256 + sk = __inet6_lookup(net, skb, doff, saddr, sport, daddr, 257 257 ntohs(dport), dif, 0, &refcounted); 258 258 if (sk && !refcounted && !refcount_inc_not_zero(&sk->sk_refcnt)) 259 259 sk = NULL; ··· 305 305 dif, sdif))) { 306 306 if (sk2->sk_state == TCP_TIME_WAIT) { 307 307 tw = inet_twsk(sk2); 308 - if (sk->sk_protocol == IPPROTO_TCP && 309 - tcp_twsk_unique(sk, sk2, twp)) 308 + if (tcp_twsk_unique(sk, sk2, twp)) 310 309 break; 311 310 } 312 311 goto not_unique;
+1 -2
net/ipv6/netfilter/nf_socket_ipv6.c
··· 83 83 { 84 84 switch (protocol) { 85 85 case IPPROTO_TCP: 86 - return inet6_lookup(net, net->ipv4.tcp_death_row.hashinfo, 87 - skb, doff, saddr, sport, daddr, dport, 86 + return inet6_lookup(net, skb, doff, saddr, sport, daddr, dport, 88 87 in->ifindex); 89 88 case IPPROTO_UDP: 90 89 return udp6_lib_lookup(net, saddr, sport, daddr, dport,
+2 -3
net/ipv6/netfilter/nf_tproxy_ipv6.c
··· 80 80 const struct net_device *in, 81 81 const enum nf_tproxy_lookup_t lookup_type) 82 82 { 83 - struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo; 84 83 struct sock *sk; 85 84 86 85 switch (protocol) { ··· 93 94 94 95 switch (lookup_type) { 95 96 case NF_TPROXY_LOOKUP_LISTENER: 96 - sk = inet6_lookup_listener(net, hinfo, skb, 97 + sk = inet6_lookup_listener(net, skb, 97 98 thoff + __tcp_hdrlen(hp), 98 99 saddr, sport, 99 100 daddr, ntohs(dport), ··· 108 109 */ 109 110 break; 110 111 case NF_TPROXY_LOOKUP_ESTABLISHED: 111 - sk = __inet6_lookup_established(net, hinfo, saddr, sport, daddr, 112 + sk = __inet6_lookup_established(net, saddr, sport, daddr, 112 113 ntohs(dport), in->ifindex, 0); 113 114 break; 114 115 default:
+5 -10
net/ipv6/tcp_ipv6.c
··· 388 388 bool fatal; 389 389 int err; 390 390 391 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 392 - &hdr->daddr, th->dest, 391 + sk = __inet6_lookup_established(net, &hdr->daddr, th->dest, 393 392 &hdr->saddr, ntohs(th->source), 394 393 skb->dev->ifindex, inet6_sdif(skb)); 395 394 ··· 1072 1073 * Incoming packet is checked with md5 hash with finding key, 1073 1074 * no RST generated if md5 hash doesn't match. 1074 1075 */ 1075 - sk1 = inet6_lookup_listener(net, net->ipv4.tcp_death_row.hashinfo, 1076 - NULL, 0, &ipv6h->saddr, th->source, 1076 + sk1 = inet6_lookup_listener(net, NULL, 0, &ipv6h->saddr, th->source, 1077 1077 &ipv6h->daddr, ntohs(th->source), 1078 1078 dif, sdif); 1079 1079 if (!sk1) ··· 1787 1789 hdr = ipv6_hdr(skb); 1788 1790 1789 1791 lookup: 1790 - sk = __inet6_lookup_skb(net->ipv4.tcp_death_row.hashinfo, skb, __tcp_hdrlen(th), 1792 + sk = __inet6_lookup_skb(skb, __tcp_hdrlen(th), 1791 1793 th->source, th->dest, inet6_iif(skb), sdif, 1792 1794 &refcounted); 1793 1795 if (!sk) ··· 1974 1976 { 1975 1977 struct sock *sk2; 1976 1978 1977 - sk2 = inet6_lookup_listener(net, net->ipv4.tcp_death_row.hashinfo, 1978 - skb, __tcp_hdrlen(th), 1979 + sk2 = inet6_lookup_listener(net, skb, __tcp_hdrlen(th), 1979 1980 &ipv6_hdr(skb)->saddr, th->source, 1980 1981 &ipv6_hdr(skb)->daddr, 1981 1982 ntohs(th->dest), ··· 2026 2029 return; 2027 2030 2028 2031 /* Note : We use inet6_iif() here, not tcp_v6_iif() */ 2029 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 2030 - &hdr->saddr, th->source, 2032 + sk = __inet6_lookup_established(net, &hdr->saddr, th->source, 2031 2033 &hdr->daddr, ntohs(th->dest), 2032 2034 inet6_iif(skb), inet6_sdif(skb)); 2033 2035 if (sk) { ··· 2046 2050 2047 2051 static struct timewait_sock_ops tcp6_timewait_sock_ops = { 2048 2052 .twsk_obj_size = sizeof(struct tcp6_timewait_sock), 2049 - .twsk_destructor = tcp_twsk_destructor, 2050 2053 }; 2051 2054 2052 2055 INDIRECT_CALLABLE_SCOPE void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
+1 -2
net/ipv6/tcpv6_offload.c
··· 36 36 inet6_get_iif_sdif(skb, &iif, &sdif); 37 37 hdr = skb_gro_network_header(skb); 38 38 net = dev_net_rcu(skb->dev); 39 - sk = __inet6_lookup_established(net, net->ipv4.tcp_death_row.hashinfo, 40 - &hdr->saddr, th->source, 39 + sk = __inet6_lookup_established(net, &hdr->saddr, th->source, 41 40 &hdr->daddr, ntohs(th->dest), 42 41 iif, sdif); 43 42 NAPI_GRO_CB(skb)->is_flist = !sk;