SCCS-vsn: sys/netinet/in_pcb.c 4.19
SCCS-vsn: sys/netinet/tcp_input.c 1.59
SCCS-vsn: sys/netinet/tcp_subr.c 4.16
SCCS-vsn: sys/netinet/tcp_usrreq.c 1.53
-/* in_pcb.c 4.18 82/03/03 */
+/* in_pcb.c 4.19 82/03/11 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
#include "../net/in_systm.h"
#include "../net/if.h"
#include "../net/in_pcb.h"
#include "../net/in_systm.h"
#include "../net/if.h"
#include "../net/in_pcb.h"
+#include "../h/protosw.h"
/*
* Routines to manage internet protocol control blocks.
/*
* Routines to manage internet protocol control blocks.
lport = sin->sin_port;
if (lport) {
u_short aport = lport;
lport = sin->sin_port;
if (lport) {
u_short aport = lport;
#if vax
aport = htons(aport);
#endif
/* GROSS */
if (aport < IPPORT_RESERVED && u.u_uid != 0)
return (EPERM);
#if vax
aport = htons(aport);
#endif
/* GROSS */
if (aport < IPPORT_RESERVED && u.u_uid != 0)
return (EPERM);
+ if ((so->so_proto->pr_flags & PR_CONNREQUIRED) == 0 ||
+ (so->so_options & SO_ACCEPTCONN) == 0)
+ wild = INPLOOKUP_WILDCARD;
- zeroin_addr, 0, sin->sin_addr, lport, 0))
+ zeroin_addr, 0, sin->sin_addr, lport, wild))
+/*
+ * Connect from a socket to a specified address.
+ * Both address and port must be specified in argument sin.
+ * If don't have a local address for this socket yet,
+ * then pick one.
+ */
in_pcbconnect(inp, sin)
struct inpcb *inp;
struct sockaddr_in *sin;
in_pcbconnect(inp, sin)
struct inpcb *inp;
struct sockaddr_in *sin;
ifp = ifnet;
}
if (in_pcblookup(inp->inp_head,
ifp = ifnet;
}
if (in_pcblookup(inp->inp_head,
- sin->sin_addr, sin->sin_port, inp->inp_laddr, inp->inp_lport, 0))
+ sin->sin_addr,
+ sin->sin_port,
+ inp->inp_laddr.s_addr ? inp->inp_laddr : ifp->if_addr,
+ inp->inp_lport,
+ 0))
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == 0)
inp->inp_laddr = ifp->if_addr;
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == 0)
inp->inp_laddr = ifp->if_addr;
- * Look for a control block to accept a segment.
+ * Look for a control block to accept a segment, or to make
+ * sure
* First choice is an exact address match.
* Second choice is a match with either the foreign or the local
* address specified.
* First choice is an exact address match.
* Second choice is a match with either the foreign or the local
* address specified.
continue;
wildcard = 0;
if (inp->inp_laddr.s_addr != 0) {
continue;
wildcard = 0;
if (inp->inp_laddr.s_addr != 0) {
- if (inp->inp_laddr.s_addr != laddr.s_addr)
+ if (laddr.s_addr == 0)
+ wildcard++;
+ else if (inp->inp_laddr.s_addr != laddr.s_addr)
continue;
} else {
if (laddr.s_addr != 0)
wildcard++;
}
if (inp->inp_faddr.s_addr != 0) {
continue;
} else {
if (laddr.s_addr != 0)
wildcard++;
}
if (inp->inp_faddr.s_addr != 0) {
- if (inp->inp_faddr.s_addr != faddr.s_addr ||
+ if (faddr.s_addr == 0)
+ wildcard++;
+ else if (inp->inp_faddr.s_addr != faddr.s_addr ||
inp->inp_fport != fport)
continue;
} else {
inp->inp_fport != fport)
continue;
} else {
-/* tcp_input.c 1.58 82/03/10 */
+/* tcp_input.c 1.59 82/03/11 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
struct tcpiphdr *ti;
{
register struct mbuf *m;
struct tcpiphdr *ti;
{
register struct mbuf *m;
- int cnt = sizeof (struct tcpiphdr) + ti->ti_urp - 1;
+ int cnt = ti->ti_urp - 1;
m = dtom(ti);
while (cnt >= 0) {
m = dtom(ti);
while (cnt >= 0) {
-/* tcp_subr.c 4.15 82/02/15 */
+/* tcp_subr.c 4.16 82/03/11 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
m = dtom(ti);
m_freem(m->m_next);
m->m_next = 0;
m = dtom(ti);
m_freem(m->m_next);
m->m_next = 0;
+ m->m_off = (int)ti - (int)m;
m->m_len = sizeof (struct tcpiphdr);
#define xchg(a,b,type) { type t; t=a; a=b; b=t; }
xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_long);
m->m_len = sizeof (struct tcpiphdr);
#define xchg(a,b,type) { type t; t=a; a=b; b=t; }
xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_long);
-/* tcp_usrreq.c 1.52 82/02/27 */
+/* tcp_usrreq.c 1.53 82/03/11 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
* done at higher levels; just return the address
* of the peer, storing through addr.
*/
* done at higher levels; just return the address
* of the peer, storing through addr.
*/
+ case PRU_ACCEPT: {
+ struct sockaddr_in *sin = (struct sockaddr_in *)addr;
+
+ if (sin) {
+ bzero((caddr_t)sin, sizeof (*sin));
+ sin->sin_family = AF_INET;
+ sin->sin_port = inp->inp_fport;
+ sin->sin_addr = inp->inp_faddr;
+ }
+ }