Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107293940
D31491.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31491.diff
View Options
diff --git a/usr.sbin/rpcbind/tests/addrmerge_test.c b/usr.sbin/rpcbind/tests/addrmerge_test.c
--- a/usr.sbin/rpcbind/tests/addrmerge_test.c
+++ b/usr.sbin/rpcbind/tests/addrmerge_test.c
@@ -257,6 +257,22 @@
IFF_UP | IFF_RUNNING | IFF_POINTOPOINT | IFF_MULTICAST, 0, false);
}
+static void
+mock_mlxen0(void)
+{
+ mock_ifaddr4("mlxen0", "192.0.3.1", "255.255.255.128", "192.0.3.127",
+ IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_SIMPLEX | IFF_MULTICAST,
+ false);
+ /* Setting link local address before ipv6 address*/
+ mock_ifaddr6("mlxen0", "fe80::4", "ffff:ffff:ffff:ffff::",
+ "fe80::ffff:ffff:ffff:ffff",
+ IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_SIMPLEX | IFF_MULTICAST,
+ 3, false);
+ mock_ifaddr6("mlxen0", "2001:db8::7", "ffff:ffff:ffff:ffff::",
+ "2001:db8::ffff:ffff:ffff:ffff",
+ IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_SIMPLEX | IFF_MULTICAST,
+ 0, false);
+}
/* Stub rpcbind functions */
int
@@ -835,6 +851,23 @@
ATF_CHECK_STREQ("2001:db8::2.3.46", maddr);
free(maddr);
}
+
+ATF_TC_WITHOUT_HEAD(addrmerge_ipv6_other_subnet);
+ATF_TC_BODY(addrmerge_ipv6_other_subnet, tc)
+{
+ char *maddr;
+
+ /* getifaddrs will return link local before normal ipv6 */
+ mock_lo0();
+ mock_mlxen0();
+
+ maddr = do_addrmerge6("2001:db8:1::1.3.46");
+
+ /* We must return the closest ipv6 address*/
+ ATF_REQUIRE(maddr != NULL);
+ ATF_CHECK_STREQ("2001:db8::7.3.46", maddr);
+ free(maddr);
+}
#endif /* INET6 */
@@ -864,6 +897,7 @@
ATF_TP_ADD_TC(tp, addrmerge_ipv6_linklocal_rev);
ATF_TP_ADD_TC(tp, addrmerge_recvdstaddr6);
ATF_TP_ADD_TC(tp, addrmerge_recvdstaddr6_rev);
+ ATF_TP_ADD_TC(tp, addrmerge_ipv6_other_subnet);
#endif
return (atf_no_error());
diff --git a/usr.sbin/rpcbind/util.c b/usr.sbin/rpcbind/util.c
--- a/usr.sbin/rpcbind/util.c
+++ b/usr.sbin/rpcbind/util.c
@@ -229,17 +229,19 @@
* a link-local address then use the scope id to see
* which one.
*/
- if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(ifsa)) &&
- IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(caller_sa)) &&
- IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(hint_sa))) {
- if (SA2SIN6(ifsa)->sin6_scope_id ==
- SA2SIN6(caller_sa)->sin6_scope_id) {
+ if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(ifsa))) {
+ if (IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(caller_sa)) &&
+ IN6_IS_ADDR_LINKLOCAL(&SA2SIN6ADDR(hint_sa)) &&
+ (SA2SIN6(ifsa)->sin6_scope_id ==
+ SA2SIN6(caller_sa)->sin6_scope_id)) {
const int goodness = 3;
if (bestif_goodness < goodness) {
bestif = ifap;
bestif_goodness = goodness;
}
+ } else {
+ continue;
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 3:01 AM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15760396
Default Alt Text
D31491.diff (2 KB)
Attached To
Mode
D31491: Rpcbind: skip ipv6 link local if a request doesn't come from link local address
Attached
Detach File
Event Timeline
Log In to Comment