GithubHelp home page GithubHelp logo

Comments (3)

schmonz avatar schmonz commented on June 14, 2024

A few amd64 results:

macOS 10.14

$ sudo ifconfig lo0 inet 23.45.67.89 alias
$ sudo ifconfig en0 inet 12.34.56.78 alias

$ for i in lo0 en0; do ifconfig $i | egrep -v 'ether|options|media|inet6|nd6|status'; done
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	inet 127.0.0.1 netmask 0xff000000
	inet 23.45.67.89 netmask 0xff000000
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 192.168.1.153 netmask 0xffffff00 broadcast 192.168.1.255
	inet 12.34.56.78 netmask 0xff000000 broadcast 12.255.255.255

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
192.168.1.153
12.34.56.78

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
192.168.1.153
12.34.56.78

Can't reproduce the bug. Code path: sa_len. If I #undef HASSALEN to get the #if 1 output, it gives 0.0.0.0 and that's it.

CentOS 6

$ sudo ip a add 23.45.67.89 dev lo
$ sudo ip a add 12.34.56.78 dev eth0

$ ip addr list | grep -e 'inet ' -e ^[0-9]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    inet 127.0.0.1/8 scope host lo
    inet 23.45.67.89/32 scope global lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
    inet 12.34.56.78/32 scope global eth0

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
127.0.0.1
10.0.2.15
10.0.2.15

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
ipme.c:56: error: ‘NULL’ undeclared (first use in this function)

(change it to 0, try again)

0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15
12.34.56.78

Code path: non-sa_len. #if 1 output looks correct.

CentOS 7

$ sudo ip a add 23.45.67.89 dev lo
$ sudo ip a add 12.34.56.78 dev enp0s3

$ ip addr list | grep -e 'inet ' -e ^[0-9]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
    inet 23.45.67.89/32 scope global lo
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
    inet 12.34.56.78/32 scope global enp0s3

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
127.0.0.1
10.0.2.15
10.0.2.15
$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15
12.34.56.78

Code path: non-sa_len. #if 1 output looks correct.

Tribblix m21.0

$ sudo ifconfig lo0 addif 23.45.67.89 up
$ sudo ifconfig e1000g0 addif 12.34.56.78 up

I think autoconfig is preventing the second additional IP from persisting:

$ ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 23.45.67.89 netmask ff000000
e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
        inet 10.0.2.15 netmask ffffff00 broadcast 10.0.2.255

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15

Can't reproduce the bug. Code path: non-sa_len. #if 1 output looks correct.

FreeBSD 12

$ sudo ifconfig lo0 inet 23.45.67.89 alias
$ sudo ifconfig em0 inet 12.34.56.78 alias

$ for i in lo0 em0; do ifconfig $i | egrep -v 'ether|options|media|inet6|nd6|status|groups'; done
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	inet 127.0.0.1 netmask 0xff000000
	inet 23.45.67.89 netmask 0xff000000
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	inet 10.0.2.15 netmask 0xffffff00 broadcast 10.0.2.255
	inet 12.34.56.78 netmask 0xff000000 broadcast 12.255.255.255

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
10.0.2.15
12.34.56.78
127.0.0.1
23.45.67.89

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
10.0.2.15
12.34.56.78
127.0.0.1
23.45.67.89

Can't reproduce the bug. Code path: sa_len.

NetBSD 8 and -current

$ sudo ifconfig lo0 inet 23.45.67.89 alias
$ sudo ifconfig wm0 inet 12.34.56.78 alias

$ for i in lo0 wm0; do ifconfig $i | egrep -v 'ether|options|media|inet6|nd6|status|groups|capabilities|enabled|address'; done
lo0: flags=0x8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33624
        inet 127.0.0.1/8 flags 0x0
        inet 23.45.67.89/8 flags 0x0
wm0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 10.0.2.15/24 broadcast 10.0.2.255 flags 0x0
        inet 12.34.56.78/8 broadcast 12.255.255.255 flags 0x0

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
10.0.2.15
12.34.56.78
127.0.0.1
23.45.67.89

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
10.0.2.15
12.34.56.78
127.0.0.1
23.45.67.89

Can't reproduce the bug. Code path: sa_len.

OpenBSD 6.5

$ sudo ifconfig lo0 inet 23.45.67.89 alias
$ sudo ifconfig em0 inet 12.34.56.78 alias

$ for i in lo0 em0; do ifconfig $i | egrep -v 'ether|options|media|inet6|nd6|status|groups|index|lladdr'; done
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
	inet 127.0.0.1 netmask 0xff000000
	inet 23.45.67.89 netmask 0xff000000
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 10.0.2.15 netmask 0xffffff00 broadcast 10.0.2.255
	inet 12.34.56.78 netmask 0xff000000 broadcast 12.255.255.255

$ git co master && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15
12.34.56.78

$ git co Dakon-ipme && make ipmeprint && ./ipmeprint
0.0.0.0
127.0.0.1
23.45.67.89
10.0.2.15
12.34.56.78

Can't reproduce the bug. Code path: sa_len.

from notqmail.

schmonz avatar schmonz commented on June 14, 2024

I'm assured by someone who understands Illumos that there is only ever a one-to-one mapping between IPs and logical interfaces, and the system creates logical interfaces as needed to keep this true. So I think we can be sure the code works correctly on Illumos.

from notqmail.

schmonz avatar schmonz commented on June 14, 2024

See #96 for the proposed fix.

from notqmail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.