1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

in_ifinit apparently can be used to rewrite an ip address; recalculate

the correct hash bucket for the entry.

Submitted by: iedowse  (with some munging by me)
This commit is contained in:
Jonathan Lemon 2001-10-01 18:07:08 +00:00
parent a743950fc2
commit 22c819a73a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=84317

View File

@ -655,7 +655,6 @@ in_ifinit(ifp, ia, sin, scrub)
oldaddr = ia->ia_addr;
ia->ia_addr = *sin;
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,
@ -667,6 +666,11 @@ in_ifinit(ifp, ia, sin, scrub)
ia->ia_addr = oldaddr;
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;