View | Details | Raw Unified | Return to bug 25651
Collapse All | Expand All

(-)tcp_usrreq.c (-4 / +8 lines)
Lines 165-189 Link Here
165
	TCPDEBUG1();
165
	TCPDEBUG1();
166
	tp = tcp_disconnect(tp);
166
	tp = tcp_disconnect(tp);
167
167
168
	TCPDEBUG2(PRU_DETACH);
168
	TCPDEBUG2(PRU_DETACH);
169
	splx(s);
169
	splx(s);
170
	return error;
170
	return error;
171
}
171
}
172
172
173
#define	COMMON_START()	TCPDEBUG0; \
173
#define	COMMON_START1()	do { \
174
			do { \
175
				     if (inp == 0) { \
174
				     if (inp == 0) { \
176
					     splx(s); \
175
					     splx(s); \
177
					     return EINVAL; \
176
					     return EINVAL; \
178
				     } \
177
				     } \
179
				     tp = intotcpcb(inp); \
178
				     tp = intotcpcb(inp); \
180
				     TCPDEBUG1(); \
179
				     TCPDEBUG1(); \
181
		     } while(0)
180
		     } while(0)
181
#define	COMMON_START()	TCPDEBUG0; COMMON_START1()
182
			     
182
			     
183
#define COMMON_END(req)	out: TCPDEBUG2(req); splx(s); return error; goto out
183
#define COMMON_END(req)	out: TCPDEBUG2(req); splx(s); return error; goto out
184
184
185
185
186
/*
186
/*
187
 * Give the socket an address.
187
 * Give the socket an address.
188
 */
188
 */
189
static int
189
static int
Lines 412-450 Link Here
412
static int
412
static int
413
tcp_usr_accept(struct socket *so, struct sockaddr **nam)
413
tcp_usr_accept(struct socket *so, struct sockaddr **nam)
414
{
414
{
415
	int s = splnet();
415
	int s = splnet();
416
	int error = 0;
416
	int error = 0;
417
	struct inpcb *inp = sotoinpcb(so);
417
	struct inpcb *inp = sotoinpcb(so);
418
	struct tcpcb *tp;
418
	struct tcpcb *tp;
419
419
420
	TCPDEBUG0;
421
420
	if (so->so_state & SS_ISDISCONNECTED) {
422
	if (so->so_state & SS_ISDISCONNECTED) {
421
		error = ECONNABORTED;
423
		error = ECONNABORTED;
422
		goto out;
424
		goto out;
423
	}
425
	}
424
	COMMON_START();
426
	COMMON_START1();
425
	in_setpeeraddr(so, nam);
427
	in_setpeeraddr(so, nam);
426
	COMMON_END(PRU_ACCEPT);
428
	COMMON_END(PRU_ACCEPT);
427
}
429
}
428
430
429
#ifdef INET6
431
#ifdef INET6
430
static int
432
static int
431
tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
433
tcp6_usr_accept(struct socket *so, struct sockaddr **nam)
432
{
434
{
433
	int s = splnet();
435
	int s = splnet();
434
	int error = 0;
436
	int error = 0;
435
	struct inpcb *inp = sotoinpcb(so);
437
	struct inpcb *inp = sotoinpcb(so);
436
	struct tcpcb *tp;
438
	struct tcpcb *tp;
437
439
440
	TCPDEBUG0;
441
438
	if (so->so_state & SS_ISDISCONNECTED) {
442
	if (so->so_state & SS_ISDISCONNECTED) {
439
		error = ECONNABORTED;
443
		error = ECONNABORTED;
440
		goto out;
444
		goto out;
441
	}
445
	}
442
	COMMON_START();
446
	COMMON_START1();
443
	in6_mapped_peeraddr(so, nam);
447
	in6_mapped_peeraddr(so, nam);
444
	COMMON_END(PRU_ACCEPT);
448
	COMMON_END(PRU_ACCEPT);
445
}
449
}
446
#endif /* INET6 */
450
#endif /* INET6 */
447
/*
451
/*
448
 * Mark the connection as being incapable of further output.
452
 * Mark the connection as being incapable of further output.
449
 */
453
 */
450
static int
454
static int

Return to bug 25651