diff options
author | wollman <wollman@FreeBSD.org> | 1995-02-08 20:22:09 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-02-08 20:22:09 +0000 |
commit | 97873f1113d5f586ea9a11de2af074fad9f3bf3a (patch) | |
tree | 2d55430ebecdbd8ee043b496605e5ceeda5fa536 /sys/netinet/in_pcb.c | |
parent | 25cedbd345ed4b346d3d46291559be67f2b621ce (diff) | |
download | FreeBSD-src-97873f1113d5f586ea9a11de2af074fad9f3bf3a.zip FreeBSD-src-97873f1113d5f586ea9a11de2af074fad9f3bf3a.tar.gz |
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.)
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index f4a3287..1080fbe 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -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, |