Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_buildsystem: explain the remark about 127.0.0.2 #1050

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading