diff options
author | suz <suz@FreeBSD.org> | 2002-10-22 22:50:38 +0000 |
---|---|---|
committer | suz <suz@FreeBSD.org> | 2002-10-22 22:50:38 +0000 |
commit | 40a7f7ee5a748995cd3ca500e9545999f7f3d54d (patch) | |
tree | ce3ebd0496320d91c183f9adbf51b238ac94ecb8 /sys | |
parent | f8977b69ec55802ba9cb1124d044391cae18caa6 (diff) | |
download | FreeBSD-src-40a7f7ee5a748995cd3ca500e9545999f7f3d54d.zip FreeBSD-src-40a7f7ee5a748995cd3ca500e9545999f7f3d54d.tar.gz |
fixed a kernel crash by "ifconfig stf0 inet 1.2.3.4"
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/in.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 5f4179d..d66abc2 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -664,7 +664,12 @@ in_ifinit(ifp, ia, sin, scrub) int s = splimp(), flags = RTF_UP, error = 0; oldaddr = ia->ia_addr; + if (oldaddr.sin_family == AF_INET) + LIST_REMOVE(ia, ia_hash); ia->ia_addr = *sin; + if (ia->ia_addr.sin_family == AF_INET) + LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), + ia, ia_hash); /* * Give the interface a chance to initialize * if this is its first address, @@ -673,14 +678,13 @@ in_ifinit(ifp, ia, sin, scrub) if (ifp->if_ioctl && (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia))) { splx(s); + /* LIST_REMOVE(ia, ia_hash) is done in in_control */ ia->ia_addr = oldaddr; + if (ia->ia_addr.sin_family == AF_INET) + LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), + ia, ia_hash); return (error); } - if (oldaddr.sin_family == AF_INET) - LIST_REMOVE(ia, ia_hash); - if (ia->ia_addr.sin_family == AF_INET) - LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), - ia, ia_hash); splx(s); if (scrub) { ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr; |