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

net/ipv6: Make __inet6_bind static

BPF core gets access to __inet6_bind via ipv6_bpf_stub_impl, so it is
not invoked directly outside of af_inet6.c. Make it static and move
inet6_bind after to avoid forward declaration.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Ahern and committed by
David S. Miller
032234d8 684009d4

+26 -29
-2
include/net/ipv6.h
··· 1044 1044 void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu); 1045 1045 1046 1046 int inet6_release(struct socket *sock); 1047 - int __inet6_bind(struct sock *sock, struct sockaddr *uaddr, int addr_len, 1048 - bool force_bind_address_no_port, bool with_lock); 1049 1047 int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); 1050 1048 int inet6_getname(struct socket *sock, struct sockaddr *uaddr, 1051 1049 int peer);
+26 -27
net/ipv6/af_inet6.c
··· 273 273 goto out; 274 274 } 275 275 276 - 277 - /* bind for INET6 API */ 278 - int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 279 - { 280 - struct sock *sk = sock->sk; 281 - int err = 0; 282 - 283 - /* If the socket has its own bind function then use it. */ 284 - if (sk->sk_prot->bind) 285 - return sk->sk_prot->bind(sk, uaddr, addr_len); 286 - 287 - if (addr_len < SIN6_LEN_RFC2133) 288 - return -EINVAL; 289 - 290 - /* BPF prog is run before any checks are done so that if the prog 291 - * changes context in a wrong way it will be caught. 292 - */ 293 - err = BPF_CGROUP_RUN_PROG_INET6_BIND(sk, uaddr); 294 - if (err) 295 - return err; 296 - 297 - return __inet6_bind(sk, uaddr, addr_len, false, true); 298 - } 299 - EXPORT_SYMBOL(inet6_bind); 300 - 301 - int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, 302 - bool force_bind_address_no_port, bool with_lock) 276 + static int __inet6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len, 277 + bool force_bind_address_no_port, bool with_lock) 303 278 { 304 279 struct sockaddr_in6 *addr = (struct sockaddr_in6 *)uaddr; 305 280 struct inet_sock *inet = inet_sk(sk); ··· 418 443 rcu_read_unlock(); 419 444 goto out; 420 445 } 446 + 447 + /* bind for INET6 API */ 448 + int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 449 + { 450 + struct sock *sk = sock->sk; 451 + int err = 0; 452 + 453 + /* If the socket has its own bind function then use it. */ 454 + if (sk->sk_prot->bind) 455 + return sk->sk_prot->bind(sk, uaddr, addr_len); 456 + 457 + if (addr_len < SIN6_LEN_RFC2133) 458 + return -EINVAL; 459 + 460 + /* BPF prog is run before any checks are done so that if the prog 461 + * changes context in a wrong way it will be caught. 462 + */ 463 + err = BPF_CGROUP_RUN_PROG_INET6_BIND(sk, uaddr); 464 + if (err) 465 + return err; 466 + 467 + return __inet6_bind(sk, uaddr, addr_len, false, true); 468 + } 469 + EXPORT_SYMBOL(inet6_bind); 421 470 422 471 int inet6_release(struct socket *sock) 423 472 {