diff options
Diffstat (limited to 'sys/netinet/in_pcb.c')
| -rw-r--r-- | sys/netinet/in_pcb.c | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 3d333bcfc6fd..cc404e6f1510 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)in_pcb.c 7.14 (Berkeley) 4/20/91 - * $Id: in_pcb.c,v 1.2 1993/10/16 18:26:01 rgrimes Exp $ + * $Id: in_pcb.c,v 1.5 1993/12/19 00:52:37 wollman Exp $ */ #include "param.h" @@ -52,8 +52,7 @@ #include "in_pcb.h" #include "in_var.h" -struct in_addr zeroin_addr; - +int in_pcballoc(so, head) struct socket *so; struct inpcb *head; @@ -72,6 +71,7 @@ in_pcballoc(so, head) return (0); } +int in_pcbbind(inp, nam) register struct inpcb *inp; struct mbuf *nam; @@ -135,12 +135,13 @@ noname: * 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 in_ifaddr *ia; - struct sockaddr_in *ifaddr; + struct sockaddr_in *ifaddr = 0; register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); if (nam->m_len != sizeof (*sin)) @@ -232,19 +233,31 @@ in_pcbconnect(inp, nam) } inp->inp_faddr = sin->sin_addr; inp->inp_fport = sin->sin_port; +#ifdef MTUDISC + /* + * If the upper layer asked for PMTU discovery services, see + * if we can get an idea of what the MTU should be... + */ + in_pcbmtu(inp); +#endif /* MTUDISC */ return (0); } +void in_pcbdisconnect(inp) struct inpcb *inp; { inp->inp_faddr.s_addr = INADDR_ANY; inp->inp_fport = 0; +#ifdef MTUDISC + inp->inp_flags &= ~INP_MTUDISCOVERED; +#endif if (inp->inp_socket->so_state & SS_NOFDREF) in_pcbdetach(inp); } +void in_pcbdetach(inp) struct inpcb *inp; { @@ -260,6 +273,7 @@ in_pcbdetach(inp) (void) m_free(dtom(inp)); } +void in_setsockaddr(inp, nam) register struct inpcb *inp; struct mbuf *nam; @@ -275,6 +289,7 @@ in_setsockaddr(inp, nam) sin->sin_addr = inp->inp_laddr; } +void in_setpeeraddr(inp, nam) struct inpcb *inp; struct mbuf *nam; @@ -301,18 +316,18 @@ in_setpeeraddr(inp, nam) * * Must be called at splnet. */ +void in_pcbnotify(head, dst, fport, laddr, lport, cmd, notify) struct inpcb *head; struct sockaddr *dst; u_short fport, lport; struct in_addr laddr; - int cmd, (*notify)(); + int cmd; + void (*notify)(struct inpcb *, int); { register struct inpcb *inp, *oinp; struct in_addr faddr; int errno; - int in_rtchange(); - extern u_char inetctlerrmap[]; if ((unsigned)cmd > PRC_NCMDS || dst->sa_family != AF_INET) return; @@ -324,14 +339,16 @@ in_pcbnotify(head, dst, fport, laddr, lport, cmd, notify) * Redirects go to all references to the destination, * and use in_rtchange to invalidate the route cache. * Dead host indications: notify all references to the destination. + * MTU change indications: same thing. * Otherwise, if we have knowledge of the local port and address, * deliver only to that socket. */ - if (PRC_IS_REDIRECT(cmd) || cmd == PRC_HOSTDEAD) { + if (PRC_IS_REDIRECT(cmd) || cmd == PRC_HOSTDEAD + || cmd == PRC_MTUCHANGED) { fport = 0; lport = 0; laddr.s_addr = 0; - if (cmd != PRC_HOSTDEAD) + if (cmd != PRC_HOSTDEAD && cmd != PRC_MTUCHANGED) notify = in_rtchange; } errno = inetctlerrmap[cmd]; @@ -357,6 +374,7 @@ in_pcbnotify(head, dst, fport, laddr, lport, cmd, notify) * routing information. If the route was created dynamically * (by a redirect), time to try a default gateway again. */ +void in_losing(inp) struct inpcb *inp; { @@ -372,10 +390,14 @@ in_losing(inp) (struct rtentry **)0); inp->inp_route.ro_rt = 0; rtfree(rt); + +#ifdef MTUDISC /* - * A new route can be allocated - * the next time output is attempted. + * When doing MTU discovery, we want to find out as + * quickly as possible what the MTU of the new route is. */ + in_pcbmtu(inp); +#endif /* MTUDISC */ } } @@ -383,16 +405,22 @@ in_losing(inp) * After a routing change, flush old routing * and allocate a (hopefully) better one. */ -in_rtchange(inp) +void +in_rtchange(inp, errno) register struct inpcb *inp; + int errno; { if (inp->inp_route.ro_rt) { rtfree(inp->inp_route.ro_rt); inp->inp_route.ro_rt = 0; +#ifdef MTUDISC /* * A new route can be allocated the next time - * output is attempted. + * output is attempted, but make sure to let + * MTU discovery know about it. */ + in_pcbmtu(inp); +#endif /* MTUDISC */ } } |
