summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 242601d1da..2bf72fbaac 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -317,6 +317,14 @@ static int ip_compare(struct in_addr *ip1, struct in_addr *ip2)
max_bits1 = MAX(bits1, max_bits1);
max_bits2 = MAX(bits2, max_bits2);
}
+
+ /* bias towards directly reachable IPs */
+ if (iface_local(*ip1)) {
+ max_bits1 += 32;
+ }
+ if (iface_local(*ip2)) {
+ max_bits2 += 32;
+ }
return max_bits2 - max_bits1;
}