diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-10-01 18:07:08 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-10-01 18:07:08 +0000 |
commit | 6bc13e1485487232dfecb823e9f7f225c80a8f3a (patch) | |
tree | aee8273eedc0b90022a252e786e2733455a310f9 /sys | |
parent | 9453c7902bf96769d12b7fb46b5658086c0dd14b (diff) | |
download | FreeBSD-src-6bc13e1485487232dfecb823e9f7f225c80a8f3a.zip FreeBSD-src-6bc13e1485487232dfecb823e9f7f225c80a8f3a.tar.gz |
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)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/in.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index a6643df..8008d79 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -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; |