ref: 44143b94e3e716ffd9ebd1b5e08b9fcb69f22dd5
parent: 1348c68ccfadf992d57f9d7bc69d12cc0ec96963
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Mar 6 11:13:17 EST 2025
devip: don't add default broadcast addresses for ipv4 (thanks cgnarne) When adding an ip address, we would also add a default network mask (class A,B,C) in the selftab/routing table based on the ip address only using defmask(). This can make some addresses unreachable when one uses classless routing. So remove this, as the add command already provides the exact netmask that should be used.
--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -640,18 +640,6 @@
bcast[i] = (ip[i] & mask[i]) & mask[i];
addselfcache(f, ifc, lifc, bcast, Rbcast);
- /* add network directed broadcast address to the self cache */
- memmove(mask, defmask(ip), IPaddrlen);
- for(i = 0; i < IPaddrlen; i++)
- bcast[i] = (ip[i] & mask[i]) | ~mask[i];
- addselfcache(f, ifc, lifc, bcast, Rbcast);
-
- /* add network directed network address to the self cache */
- memmove(mask, defmask(ip), IPaddrlen);
- for(i = 0; i < IPaddrlen; i++)
- bcast[i] = (ip[i] & mask[i]) & mask[i];
- addselfcache(f, ifc, lifc, bcast, Rbcast);
-
addselfcache(f, ifc, lifc, IPv4bcast, Rbcast);
/* add all nodes multicast address */
--
⑨