T/TCP changes to generic IP code. This is all ifdefed TTCP so should

have no effect on most users for now.  (Eventually, once this code is
fully tested, the ifdefs will go away.)
This commit is contained in:
Garrett Wollman 1995-02-08 20:22:09 +00:00
parent eb6ad69646
commit 999f1343a5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6248
2 changed files with 65 additions and 3 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
* $Id$
* $Id: in_pcb.c,v 1.3 1994/08/02 07:48:18 davidg Exp $
*/
#include <sys/param.h>
@ -151,17 +151,39 @@ in_pcbbind(inp, nam)
return (0);
}
#ifdef TTCP
/*
* Transform old in_pcbconnect() into an inner subroutine for new
* in_pcbconnect(): Do some validity-checking on the remote
* address (in mbuf 'nam') and then determine local host address
* (i.e., which interface) to use to access that remote host.
*
* This preserves definition of in_pcbconnect(), while supporting a
* slightly different version for T/TCP. (This is more than
* a bit of a kludge, but cleaning up the internal interfaces would
* have forced minor changes in every protocol).
*/
int
in_pcbladdr(inp, nam, plocal_sin)
register struct inpcb *inp;
struct mbuf *nam;
struct sockaddr_in **plocal_sin;
{
#else /* TTCP */
/*
* 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.
*/
int
in_pcbconnect(inp, nam)
register struct inpcb *inp;
struct mbuf *nam;
{
#endif /* TTCP */
struct in_ifaddr *ia;
struct sockaddr_in *ifaddr = 0;
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
@ -256,8 +278,43 @@ in_pcbconnect(inp, nam)
return (EADDRNOTAVAIL);
}
}
#ifdef TTCP
/*
* Don't do pcblookup call here; return interface in plocal_sin
* and exit to caller, that will do the lookup.
*/
*plocal_sin = &ia->ia_addr;
}
return(0);
}
/*
* Outer subroutine:
* 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.
*/
int
in_pcbconnect(inp, nam)
register struct inpcb *inp;
struct mbuf *nam;
{
struct sockaddr_in *ifaddr;
register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
int error;
/*
* Call inner routine, to assign local interface address.
*/
if (error = in_pcbladdr(inp, nam, &ifaddr))
return(error);
#else /* TTCP */
ifaddr = (struct sockaddr_in *)&ia->ia_addr;
}
#endif /* TTCP */
if (in_pcblookup(inp->inp_head,
sin->sin_addr,
sin->sin_port,

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_proto.c 8.1 (Berkeley) 6/10/93
* $Id: in_proto.c,v 1.7 1994/11/02 04:41:39 wollman Exp $
* $Id: in_proto.c,v 1.8 1994/12/11 21:36:10 wollman Exp $
*/
#include <sys/param.h>
@ -94,10 +94,15 @@ struct protosw inetsw[] = {
udp_usrreq,
udp_init, 0, 0, 0, udp_sysctl
},
#ifdef TTCP
{ SOCK_STREAM, &inetdomain, IPPROTO_TCP,
PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD,
#else
{ SOCK_STREAM, &inetdomain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD,
#endif
tcp_input, 0, tcp_ctlinput, tcp_ctloutput,
tcp_usrreq,
tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain,
tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, tcp_sysctl
},
{ SOCK_RAW, &inetdomain, IPPROTO_RAW, PR_ATOMIC|PR_ADDR,
rip_input, rip_output, 0, rip_ctloutput,