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

sctp: Remove sctp_pf.create_accept_sk().

sctp_v[46]_create_accept_sk() are no longer used.

Let's remove sctp_pf.create_accept_sk().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20251023231751.4168390-7-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kuniyuki Iwashima and committed by
Jakub Kicinski
c49ed521 16942cf4

-75
-3
include/net/sctp/structs.h
··· 497 497 int (*bind_verify) (struct sctp_sock *, union sctp_addr *); 498 498 int (*send_verify) (struct sctp_sock *, union sctp_addr *); 499 499 int (*supported_addrs)(const struct sctp_sock *, __be16 *); 500 - struct sock *(*create_accept_sk) (struct sock *sk, 501 - struct sctp_association *asoc, 502 - bool kern); 503 500 int (*addr_to_user)(struct sctp_sock *sk, union sctp_addr *addr); 504 501 void (*to_sk_saddr)(union sctp_addr *, struct sock *sk); 505 502 void (*to_sk_daddr)(union sctp_addr *, struct sock *sk);
-45
net/sctp/ipv6.c
··· 777 777 return retval; 778 778 } 779 779 780 - /* Create and initialize a new sk for the socket to be returned by accept(). */ 781 - static struct sock *sctp_v6_create_accept_sk(struct sock *sk, 782 - struct sctp_association *asoc, 783 - bool kern) 784 - { 785 - struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 786 - struct sctp6_sock *newsctp6sk; 787 - struct inet_sock *newinet; 788 - struct sock *newsk; 789 - 790 - newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, kern); 791 - if (!newsk) 792 - return NULL; 793 - 794 - sock_init_data(NULL, newsk); 795 - 796 - sctp_copy_sock(newsk, sk, asoc); 797 - sock_reset_flag(sk, SOCK_ZAPPED); 798 - 799 - newsctp6sk = (struct sctp6_sock *)newsk; 800 - newinet = inet_sk(newsk); 801 - newinet->pinet6 = &newsctp6sk->inet6; 802 - newinet->ipv6_fl_list = NULL; 803 - 804 - sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped; 805 - 806 - newnp = inet6_sk(newsk); 807 - 808 - memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 809 - newnp->ipv6_mc_list = NULL; 810 - newnp->ipv6_ac_list = NULL; 811 - 812 - sctp_v6_copy_ip_options(sk, newsk); 813 - 814 - /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() 815 - * and getpeername(). 816 - */ 817 - sctp_v6_to_sk_daddr(&asoc->peer.primary_addr, newsk); 818 - 819 - newsk->sk_v6_rcv_saddr = sk->sk_v6_rcv_saddr; 820 - 821 - return newsk; 822 - } 823 - 824 780 /* Format a sockaddr for return to user space. This makes sure the return is 825 781 * AF_INET or AF_INET6 depending on the SCTP_I_WANT_MAPPED_V4_ADDR option. 826 782 */ ··· 1123 1167 .bind_verify = sctp_inet6_bind_verify, 1124 1168 .send_verify = sctp_inet6_send_verify, 1125 1169 .supported_addrs = sctp_inet6_supported_addrs, 1126 - .create_accept_sk = sctp_v6_create_accept_sk, 1127 1170 .addr_to_user = sctp_v6_addr_to_user, 1128 1171 .to_sk_saddr = sctp_v6_to_sk_saddr, 1129 1172 .to_sk_daddr = sctp_v6_to_sk_daddr,
-27
net/sctp/protocol.c
··· 580 580 return INET_ECN_is_ce(ip_hdr(skb)->tos); 581 581 } 582 582 583 - /* Create and initialize a new sk for the socket returned by accept(). */ 584 - static struct sock *sctp_v4_create_accept_sk(struct sock *sk, 585 - struct sctp_association *asoc, 586 - bool kern) 587 - { 588 - struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, 589 - sk->sk_prot, kern); 590 - struct inet_sock *newinet; 591 - 592 - if (!newsk) 593 - return NULL; 594 - 595 - sock_init_data(NULL, newsk); 596 - 597 - sctp_copy_sock(newsk, sk, asoc); 598 - sock_reset_flag(newsk, SOCK_ZAPPED); 599 - 600 - sctp_v4_copy_ip_options(sk, newsk); 601 - 602 - newinet = inet_sk(newsk); 603 - 604 - newinet->inet_daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; 605 - 606 - return newsk; 607 - } 608 - 609 583 static int sctp_v4_addr_to_user(struct sctp_sock *sp, union sctp_addr *addr) 610 584 { 611 585 /* No address mapping for V4 sockets */ ··· 1087 1113 .bind_verify = sctp_inet_bind_verify, 1088 1114 .send_verify = sctp_inet_send_verify, 1089 1115 .supported_addrs = sctp_inet_supported_addrs, 1090 - .create_accept_sk = sctp_v4_create_accept_sk, 1091 1116 .addr_to_user = sctp_v4_addr_to_user, 1092 1117 .to_sk_saddr = sctp_v4_to_sk_saddr, 1093 1118 .to_sk_daddr = sctp_v4_to_sk_daddr,