| 990 | } |
| 991 | |
| 992 | static int |
| 993 | rip_bind(struct socket *so, struct sockaddr *nam, struct thread *td) |
| 994 | { |
| 995 | struct sockaddr_in *addr = (struct sockaddr_in *)nam; |
| 996 | struct inpcb *inp; |
| 997 | int error; |
| 998 | |
| 999 | if (nam->sa_len != sizeof(*addr)) |
| 1000 | return (EINVAL); |
| 1001 | |
| 1002 | error = prison_check_ip4(td->td_ucred, &addr->sin_addr); |
| 1003 | if (error != 0) |
| 1004 | return (error); |
| 1005 | |
| 1006 | inp = sotoinpcb(so); |
| 1007 | KASSERT(inp != NULL, ("rip_bind: inp == NULL")); |
| 1008 | |
| 1009 | if (CK_STAILQ_EMPTY(&V_ifnet) || |
| 1010 | (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) || |
| 1011 | (addr->sin_addr.s_addr && |
| 1012 | (inp->inp_flags & INP_BINDANY) == 0 && |
| 1013 | ifa_ifwithaddr_check((struct sockaddr *)addr) == 0)) |
| 1014 | return (EADDRNOTAVAIL); |
| 1015 | |
| 1016 | INP_INFO_WLOCK(&V_ripcbinfo); |
| 1017 | INP_WLOCK(inp); |
| 1018 | rip_delhash(inp); |
| 1019 | inp->inp_laddr = addr->sin_addr; |
| 1020 | rip_inshash(inp); |
| 1021 | INP_WUNLOCK(inp); |
| 1022 | INP_INFO_WUNLOCK(&V_ripcbinfo); |
| 1023 | return (0); |
| 1024 | } |
| 1025 | |
| 1026 | static int |
| 1027 | rip_connect(struct socket *so, struct sockaddr *nam, struct thread *td) |
nothing calls this directly
no test coverage detected