Remove all the code to maintain ia_inpcbs. This information was only used to

close sockets on address changes, which was deemed to be a bad idea and was
summarily removed, so there is no point in wasting effort on maintaining it
any more.
This commit is contained in:
mycroft 2003-10-23 20:55:08 +00:00
parent 2ffebceb85
commit 5a8b331f54
6 changed files with 11 additions and 91 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.c,v 1.91 2003/08/16 11:30:35 itojun Exp $ */
/* $NetBSD: in.c,v 1.92 2003/10/23 20:55:08 mycroft Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.91 2003/08/16 11:30:35 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.92 2003/10/23 20:55:08 mycroft Exp $");
#include "opt_inet.h"
#include "opt_inet_conf.h"
@ -542,41 +542,8 @@ in_purgeaddr(ifa, ifp)
struct ifnet *ifp;
{
struct in_ifaddr *ia = (void *) ifa;
struct in_ifaddr *nia;
struct inpcb *inp, *inp_ialink;
in_ifscrub(ifp, ia);
nia = ia;
NEXT_IA_WITH_SAME_ADDR(nia);
/*
* Kick all the sockets!
*/
for (inp = LIST_FIRST(&ia->ia_inpcbs); inp != NULL; inp = inp_ialink) {
inp_ialink = LIST_NEXT(inp, inp_ialink);
KASSERT(inp != inp_ialink);
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&ia->ia_ifa);
inp->inp_ia = NULL;
if (nia != NULL) {
KASSERT(nia != ia);
inp->inp_ia = nia;
IFAREF(&nia->ia_ifa);
LIST_INSERT_HEAD(&nia->ia_inpcbs, inp, inp_ialink);
} else if (inp->inp_socket != NULL) {
#if 0
if ((inp->inp_socket->so_state & SS_NOFDREF) &&
inp->inp_socket->so_head == NULL) {
soabort(inp->inp_socket);
} else {
inp->inp_socket->so_error = ECONNABORTED;
sorwakeup(inp->inp_socket);
sowwakeup(inp->inp_socket);
}
#endif
}
}
LIST_REMOVE(ia, ia_hash);
TAILQ_REMOVE(&ifp->if_addrlist, &ia->ia_ifa, ifa_list);
IFAFREE(&ia->ia_ifa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.c,v 1.88 2003/09/04 09:16:57 itojun Exp $ */
/* $NetBSD: in_pcb.c,v 1.89 2003/10/23 20:55:08 mycroft Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.88 2003/09/04 09:16:57 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.89 2003/10/23 20:55:08 mycroft Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -305,19 +305,7 @@ in_pcbbind(v, nam, p)
if (t && (reuseport & t->inp_socket->so_options) == 0)
return (EADDRINUSE);
}
if (!in_nullhost(inp->inp_laddr)) {
KASSERT(inp->inp_ia != NULL);
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&inp->inp_ia->ia_ifa);
inp->inp_ia = NULL;
}
inp->inp_laddr = sin->sin_addr;
if (ia != NULL) {
inp->inp_ia = ia;
LIST_INSERT_HEAD(&ia->ia_inpcbs, inp, inp_ialink);
IFAREF(&ia->ia_ifa);
}
noname:
if (lport == 0) {
@ -354,14 +342,8 @@ noname:
htons(lport), 1))
goto found;
}
if (!in_nullhost(inp->inp_laddr)) {
if (inp->inp_ia != NULL) {
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&inp->inp_ia->ia_ifa);
inp->inp_ia = NULL;
}
if (!in_nullhost(inp->inp_laddr))
inp->inp_laddr.s_addr = INADDR_ANY;
}
return (EAGAIN);
found:
inp->inp_flags |= INP_ANONPORT;
@ -463,11 +445,7 @@ in_pcbconnect(v, nam)
if (error == EAGAIN)
return (error);
}
KASSERT(inp->inp_ia == NULL);
inp->inp_laddr = ia->ia_addr.sin_addr;
inp->inp_ia = ia;
LIST_INSERT_HEAD(&ia->ia_inpcbs, inp, inp_ialink);
IFAREF(&ia->ia_ifa);
inp->inp_laddr = ifaddr->sin_addr;
}
inp->inp_faddr = sin->sin_addr;
@ -520,11 +498,6 @@ in_pcbdetach(v)
if (inp->inp_route.ro_rt)
rtfree(inp->inp_route.ro_rt);
ip_freemoptions(inp->inp_moptions);
if (inp->inp_ia != NULL) {
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&inp->inp_ia->ia_ifa);
inp->inp_ia = NULL;
}
s = splnet();
in_pcbstate(inp, INP_ATTACHED);
CIRCLEQ_REMOVE(&inp->inp_table->inpt_queue, &inp->inp_head,

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.h,v 1.35 2003/09/04 09:16:58 itojun Exp $ */
/* $NetBSD: in_pcb.h,v 1.36 2003/10/23 20:55:08 mycroft Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,8 +91,6 @@ struct inpcb {
struct mbuf *inp_options; /* IP options */
struct ip_moptions *inp_moptions; /* IP multicast options */
int inp_errormtu; /* MTU of last xmit status = EMSGSIZE */
LIST_ENTRY(inpcb) inp_ialink;
struct in_ifaddr *inp_ia; /* in_ifaddr which laddr is bound */
};
#define inp_faddr inp_ip.ip_dst

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_var.h,v 1.49 2003/08/18 22:28:51 itojun Exp $ */
/* $NetBSD: in_var.h,v 1.50 2003/10/23 20:55:08 mycroft Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -98,7 +98,6 @@ struct in_ifaddr {
LIST_HEAD(, in_multi) ia_multiaddrs; /* list of multicast addresses */
struct in_multi *ia_allhosts; /* multicast address record for
the allhosts multicast group */
LIST_HEAD(, inpcb) ia_inpcbs; /* list of pcbs with this source */
};
struct in_aliasreq {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_input.c,v 1.184 2003/09/10 01:46:27 itojun Exp $ */
/* $NetBSD: tcp_input.c,v 1.185 2003/10/23 20:55:08 mycroft Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.184 2003/09/10 01:46:27 itojun Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.185 2003/10/23 20:55:08 mycroft Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -3188,16 +3188,9 @@ syn_cache_get(src, dst, th, hlen, tlen, so, m)
#ifdef INET
case AF_INET:
if (inp) {
struct in_ifaddr *ia;
inp->inp_laddr = ((struct sockaddr_in *)dst)->sin_addr;
inp->inp_lport = ((struct sockaddr_in *)dst)->sin_port;
inp->inp_options = ip_srcroute();
INADDR_TO_IA(inp->inp_laddr, ia);
KASSERT(ia != NULL);
KASSERT(inp->inp_ia == NULL);
inp->inp_ia = ia;
LIST_INSERT_HEAD(&ia->ia_inpcbs, inp, inp_ialink);
IFAREF(&ia->ia_ifa);
in_pcbstate(inp, INP_BOUND);
if (inp->inp_options == NULL) {
inp->inp_options = sc->sc_ipopts;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.112 2003/10/18 13:05:45 enami Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.113 2003/10/23 20:55:08 mycroft Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.112 2003/10/18 13:05:45 enami Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.113 2003/10/23 20:55:08 mycroft Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1024,11 +1024,6 @@ udp_usrreq(so, req, m, nam, control, p)
so->so_state &= ~SS_ISCONNECTED; /* XXX */
in_pcbdisconnect(inp);
inp->inp_laddr = zeroin_addr; /* XXX */
if (inp->inp_ia != NULL) {
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&inp->inp_ia->ia_ifa);
inp->inp_ia = NULL;
}
in_pcbstate(inp, INP_BOUND); /* XXX */
break;
@ -1073,11 +1068,6 @@ udp_usrreq(so, req, m, nam, control, p)
in_pcbstate(inp, INP_BOUND); /* XXX */
}
die:
if (inp->inp_ia != NULL && in_nullhost(inp->inp_laddr)) {
LIST_REMOVE(inp, inp_ialink);
IFAFREE(&inp->inp_ia->ia_ifa);
inp->inp_ia = NULL;
}
if (m)
m_freem(m);
}