Deleted Added
full compact
udp_usrreq.c (185348) udp_usrreq.c (185435)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California.
4 * Copyright (c) 2008 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California.
4 * Copyright (c) 2008 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/netinet/udp_usrreq.c 185348 2008-11-26 22:32:07Z zec $");
35__FBSDID("$FreeBSD: head/sys/netinet/udp_usrreq.c 185435 2008-11-29 14:32:14Z bz $");
36
37#include "opt_ipfw.h"
38#include "opt_inet6.h"
39#include "opt_ipsec.h"
40#include "opt_mac.h"
41
42#include <sys/param.h>
43#include <sys/domain.h>

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

935 error = EISCONN;
936 goto release;
937 }
938
939 /*
940 * Jail may rewrite the destination address, so let it do
941 * that before we use it.
942 */
36
37#include "opt_ipfw.h"
38#include "opt_inet6.h"
39#include "opt_ipsec.h"
40#include "opt_mac.h"
41
42#include <sys/param.h>
43#include <sys/domain.h>

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

935 error = EISCONN;
936 goto release;
937 }
938
939 /*
940 * Jail may rewrite the destination address, so let it do
941 * that before we use it.
942 */
943 if (jailed(td->td_ucred))
944 prison_remote_ip(td->td_ucred, 0,
945 &sin->sin_addr.s_addr);
943 if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
944 error = EINVAL;
945 goto release;
946 }
946
947 /*
948 * If a local address or port hasn't yet been selected, or if
949 * the destination address needs to be rewritten due to using
950 * a special INADDR_ constant, invoke in_pcbconnect_setup()
951 * to do the heavy lifting. Once a port is selected, we
952 * commit the binding back to the socket; we also commit the
953 * binding of the address if in jail.

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

1189 INP_INFO_WLOCK(&V_udbinfo);
1190 INP_WLOCK(inp);
1191 if (inp->inp_faddr.s_addr != INADDR_ANY) {
1192 INP_WUNLOCK(inp);
1193 INP_INFO_WUNLOCK(&V_udbinfo);
1194 return (EISCONN);
1195 }
1196 sin = (struct sockaddr_in *)nam;
947
948 /*
949 * If a local address or port hasn't yet been selected, or if
950 * the destination address needs to be rewritten due to using
951 * a special INADDR_ constant, invoke in_pcbconnect_setup()
952 * to do the heavy lifting. Once a port is selected, we
953 * commit the binding back to the socket; we also commit the
954 * binding of the address if in jail.

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

1190 INP_INFO_WLOCK(&V_udbinfo);
1191 INP_WLOCK(inp);
1192 if (inp->inp_faddr.s_addr != INADDR_ANY) {
1193 INP_WUNLOCK(inp);
1194 INP_INFO_WUNLOCK(&V_udbinfo);
1195 return (EISCONN);
1196 }
1197 sin = (struct sockaddr_in *)nam;
1197 if (jailed(td->td_ucred))
1198 prison_remote_ip(td->td_ucred, 0, &sin->sin_addr.s_addr);
1198 if (prison_remote_ip4(td->td_ucred, &sin->sin_addr) != 0) {
1199 INP_WUNLOCK(inp);
1200 INP_INFO_WUNLOCK(&udbinfo);
1201 return (EAFNOSUPPORT);
1202 }
1199 error = in_pcbconnect(inp, nam, td->td_ucred);
1200 if (error == 0)
1201 soisconnected(so);
1202 INP_WUNLOCK(inp);
1203 INP_INFO_WUNLOCK(&V_udbinfo);
1204 return (error);
1205}
1206

--- 84 unchanged lines hidden ---
1203 error = in_pcbconnect(inp, nam, td->td_ucred);
1204 if (error == 0)
1205 soisconnected(so);
1206 INP_WUNLOCK(inp);
1207 INP_INFO_WUNLOCK(&V_udbinfo);
1208 return (error);
1209}
1210

--- 84 unchanged lines hidden ---