Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142143139
D667.id1231.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D667.id1231.diff
View Options
Index: head/sys/netinet/in.c
===================================================================
--- head/sys/netinet/in.c
+++ head/sys/netinet/in.c
@@ -242,19 +242,26 @@
return (EADDRNOTAVAIL);
/*
- * For SIOCGIFADDR, pick the first address. For the rest of
- * ioctls, try to find specified address.
+ * Find address for this interface, if it exists. If an
+ * address was specified, find that one instead of the
+ * first one on the interface, if possible.
*/
IF_ADDR_RLOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
ia = (struct in_ifaddr *)ifa;
- if (cmd == SIOCGIFADDR || addr->sin_addr.s_addr == INADDR_ANY)
- break;
if (ia->ia_addr.sin_addr.s_addr == addr->sin_addr.s_addr)
break;
}
+ if (ifa == NULL)
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
+ if (ifa->ifa_addr->sa_family == AF_INET) {
+ ia = (struct in_ifaddr *)ifa;
+ if (prison_check_ip4(td->td_ucred,
+ &ia->ia_addr.sin_addr) == 0)
+ break;
+ }
if (ifa == NULL) {
IF_ADDR_RUNLOCK(ifp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 17, 10:59 AM (9 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27689727
Default Alt Text
D667.id1231.diff (1 KB)
Attached To
Mode
D667: Return first address for legacy ioctls SIOCGIFBRDADDR, SIOCGIFDSTADDR, SIOCGIFNETMASK and SIOCGIFADDR.
Attached
Detach File
Event Timeline
Log In to Comment