ref: ee7692fd4fc467cedfa28b4e59ef8242143ab0b2
parent: 3abb0cfc0cbae7d67ec1ebb3689d3e80b6e02bdc
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 */
--
⑨