From 05551576e3af571d405842ab4a86847f8035c5ff Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 13 Jan 2025 17:52:14 +0100 Subject: [PATCH] init_buildsystem: explain the remark about 127.0.0.2 --- init_buildsystem | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/init_buildsystem b/init_buildsystem index 5c26b06a..60a07f1b 100755 --- a/init_buildsystem +++ b/init_buildsystem @@ -1286,6 +1286,21 @@ test -e $BUILD_ROOT/etc/hosts || echo "127.0.0.1 localhost" > $BUILD_ROOT/etc/ho if ! grep -F "127.0.0.1 $HOST" $BUILD_ROOT/etc/hosts > /dev/null ; then # this makes a reverse lookup on 127.0.0.1 return the host name, # which is bad, but 127.0.0.2 does not work on all unix systems + # + # For any address added to the a netdev, kernels normally add a + # corresponding network route implicitly. + # + # Linux adds the RTF_LOCAL flag to such implicit routes if they are for lo. + # Packets whose dstaddr matches a RTF_LOCAL routes are locally-delivered, + # and so those dstaddrs effectively appear "live" even if the address is + # nowhere assigned :-/ + # + # Classic Unixes do not add implicit network routes for addresses added to + # lo. Nor do they set a LOCAL flag for lo's network routes. + # + # Long story short: if you need 127.0.0.2, explicitly add it as an address + # on the interface no matter the OS! + # echo "127.0.0.1 $HOST" > $BUILD_ROOT/etc/hosts.new test -f $BUILD_ROOT/etc/hosts && cat $BUILD_ROOT/etc/hosts >> $BUILD_ROOT/etc/hosts.new mv $BUILD_ROOT/etc/hosts.new $BUILD_ROOT/etc/hosts