udp6_usrreq.c (e2a4005dcc19d37fc2f35035a304a35dfde904b5) | udp6_usrreq.c (79288c112cc4b7f2f9acccbe904d45fe5d1baf7a) |
---|---|
1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 835 unchanged lines hidden (view full) --- 844 inp->inp_vflag |= INP_IPV6; 845 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { 846 struct sockaddr_in6 *sin6_p; 847 848 sin6_p = (struct sockaddr_in6 *)nam; 849 850 if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) 851 inp->inp_vflag |= INP_IPV4; | 1/*- 2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 835 unchanged lines hidden (view full) --- 844 inp->inp_vflag |= INP_IPV6; 845 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { 846 struct sockaddr_in6 *sin6_p; 847 848 sin6_p = (struct sockaddr_in6 *)nam; 849 850 if (IN6_IS_ADDR_UNSPECIFIED(&sin6_p->sin6_addr)) 851 inp->inp_vflag |= INP_IPV4; |
852#ifdef INET |
|
852 else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) { 853 struct sockaddr_in sin; 854 855 in6_sin6_2_sin(&sin, sin6_p); 856 inp->inp_vflag |= INP_IPV4; 857 inp->inp_vflag &= ~INP_IPV6; 858 error = in_pcbbind(inp, (struct sockaddr *)&sin, 859 td->td_ucred); 860 goto out; 861 } | 853 else if (IN6_IS_ADDR_V4MAPPED(&sin6_p->sin6_addr)) { 854 struct sockaddr_in sin; 855 856 in6_sin6_2_sin(&sin, sin6_p); 857 inp->inp_vflag |= INP_IPV4; 858 inp->inp_vflag &= ~INP_IPV6; 859 error = in_pcbbind(inp, (struct sockaddr *)&sin, 860 td->td_ucred); 861 goto out; 862 } |
863#endif |
|
862 } 863 864 error = in6_pcbbind(inp, nam, td->td_ucred); | 864 } 865 866 error = in6_pcbbind(inp, nam, td->td_ucred); |
867#ifdef INET |
|
865out: | 868out: |
869#endif |
|
866 INP_WUNLOCK(inp); 867 INP_INFO_WUNLOCK(&V_udbinfo); 868 return (error); 869} 870 871static void 872udp6_close(struct socket *so) 873{ --- 30 unchanged lines hidden (view full) --- 904 int error; 905 906 inp = sotoinpcb(so); 907 sin6 = (struct sockaddr_in6 *)nam; 908 KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); 909 910 INP_INFO_WLOCK(&V_udbinfo); 911 INP_WLOCK(inp); | 870 INP_WUNLOCK(inp); 871 INP_INFO_WUNLOCK(&V_udbinfo); 872 return (error); 873} 874 875static void 876udp6_close(struct socket *so) 877{ --- 30 unchanged lines hidden (view full) --- 908 int error; 909 910 inp = sotoinpcb(so); 911 sin6 = (struct sockaddr_in6 *)nam; 912 KASSERT(inp != NULL, ("udp6_connect: inp == NULL")); 913 914 INP_INFO_WLOCK(&V_udbinfo); 915 INP_WLOCK(inp); |
916#ifdef INET |
|
912 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { 913 struct sockaddr_in sin; 914 915 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) { 916 error = EINVAL; 917 goto out; 918 } 919 if (inp->inp_faddr.s_addr != INADDR_ANY) { --- 7 unchanged lines hidden (view full) --- 927 if (error != 0) 928 goto out; 929 error = in_pcbconnect(inp, (struct sockaddr *)&sin, 930 td->td_ucred); 931 if (error == 0) 932 soisconnected(so); 933 goto out; 934 } | 917 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { 918 struct sockaddr_in sin; 919 920 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) { 921 error = EINVAL; 922 goto out; 923 } 924 if (inp->inp_faddr.s_addr != INADDR_ANY) { --- 7 unchanged lines hidden (view full) --- 932 if (error != 0) 933 goto out; 934 error = in_pcbconnect(inp, (struct sockaddr *)&sin, 935 td->td_ucred); 936 if (error == 0) 937 soisconnected(so); 938 goto out; 939 } |
940#endif |
|
935 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { 936 error = EISCONN; 937 goto out; 938 } 939 inp->inp_vflag &= ~INP_IPV4; 940 inp->inp_vflag |= INP_IPV6; 941 error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); 942 if (error != 0) --- 158 unchanged lines hidden --- | 941 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { 942 error = EISCONN; 943 goto out; 944 } 945 inp->inp_vflag &= ~INP_IPV4; 946 inp->inp_vflag |= INP_IPV6; 947 error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); 948 if (error != 0) --- 158 unchanged lines hidden --- |