linux_socket.c (874108aed99d76099ff9eb6c8d830479a504c1ad) linux_socket.c (5cb9c68cc97026748f7a0889fa07646b51f27541)
1/*-
2 * Copyright (c) 1995 S�ren Schmidt
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

--- 114 unchanged lines hidden (view full) ---

123
124 kosa = malloc(alloclen, mtype, M_WAITOK);
125
126 if ((error = copyin(osa, kosa, *osalen)))
127 goto out;
128
129 bdom = linux_to_bsd_domain(kosa->sa_family);
130 if (bdom == -1) {
1/*-
2 * Copyright (c) 1995 S�ren Schmidt
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

--- 114 unchanged lines hidden (view full) ---

123
124 kosa = malloc(alloclen, mtype, M_WAITOK);
125
126 if ((error = copyin(osa, kosa, *osalen)))
127 goto out;
128
129 bdom = linux_to_bsd_domain(kosa->sa_family);
130 if (bdom == -1) {
131 error = EINVAL;
131 error = EAFNOSUPPORT;
132 goto out;
133 }
134
135#ifdef INET6
136 /*
137 * Older Linux IPv6 code uses obsolete RFC2133 struct sockaddr_in6,
138 * which lacks the scope id compared with RFC2553 one. If we detect
139 * the situation, reject the address and write a message to system log.

--- 12 unchanged lines hidden (view full) ---

152 } else {
153 log(LOG_DEBUG,
154 "obsolete pre-RFC2553 sockaddr_in6 rejected\n");
155 error = EINVAL;
156 goto out;
157 }
158 } else
159#endif
132 goto out;
133 }
134
135#ifdef INET6
136 /*
137 * Older Linux IPv6 code uses obsolete RFC2133 struct sockaddr_in6,
138 * which lacks the scope id compared with RFC2553 one. If we detect
139 * the situation, reject the address and write a message to system log.

--- 12 unchanged lines hidden (view full) ---

152 } else {
153 log(LOG_DEBUG,
154 "obsolete pre-RFC2553 sockaddr_in6 rejected\n");
155 error = EINVAL;
156 goto out;
157 }
158 } else
159#endif
160 if (bdom == AF_INET)
160 if (bdom == AF_INET) {
161 alloclen = sizeof(struct sockaddr_in);
161 alloclen = sizeof(struct sockaddr_in);
162 if (*osalen < alloclen) {
163 error = EINVAL;
164 goto out;
165 }
166 }
162
163 sa = (struct sockaddr *) kosa;
164 sa->sa_family = bdom;
165 sa->sa_len = alloclen;
166
167 *sap = sa;
168 *osalen = alloclen;
169 return (0);

--- 1424 unchanged lines hidden ---
167
168 sa = (struct sockaddr *) kosa;
169 sa->sa_family = bdom;
170 sa->sa_len = alloclen;
171
172 *sap = sa;
173 *osalen = alloclen;
174 return (0);

--- 1424 unchanged lines hidden ---