diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-03-20 02:45:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-03-20 02:45:07 +0000 |
commit | 6cb19bb9dafc67b548725f9f7ad34b9ab06f6362 (patch) | |
tree | 7bc0524f1371f1da0bf687b914fd02d4c9d82188 | |
parent | 78aa73f009d8283b90e504cf5089313e8dfd7b14 (diff) |
for SIOCGIF{NETMASK,DSTADDR,BRDADDR} calls match address to if aliases entries
so that correct information is returned (previously information about the
primary address was returned). If the address cannot be found on the
interface, return information about the primary (for OSIOC* compatibility).
work by angelos and myself.
-rw-r--r-- | sys/netinet/in.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 6589cc10a17..5da03f4e951 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.9 1998/03/19 21:21:44 angelos Exp $ */ +/* $OpenBSD: in.c,v 1.10 1998/03/20 02:45:06 deraadt Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -208,6 +208,18 @@ in_control(so, cmd, data, ifp) case SIOCGIFNETMASK: case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: + if (ia && satosin(&ifr->ifr_addr)->sin_addr.s_addr) { + struct in_ifaddr *ia2; + + for (ia2 = ia; ia2; ia2 = ia2->ia_list.tqe_next) { + if (ia2->ia_ifp == ifp && + ia2->ia_addr.sin_addr.s_addr == + satosin(&ifr->ifr_addr)->sin_addr.s_addr) + break; + } + if (ia2 && ia2->ia_ifp == ifp) + ia = ia2; + } if (ia == (struct in_ifaddr *)0) return (EADDRNOTAVAIL); break; |