2

The broadcast address is apparently misconfigured on some (old) Linux embedded device that I setup (but that I don't own anymore) because it doesn't match the expected value given the IP address and the netmask (for example, it has a broadcast of 192.168.70.255 instead of 192.168.71.255 for 192.168.70.243/255.255.254.0). It runs a kernel 2.4.31 with busybox 0.60.5. The network configuration is simply done with that shell snippet:

ifconfig eth0 $IPADDR netmask $NETMASK
if [ -n "$GATEWAY" ]; then
    route add default gw $GATEWAY
fi

Thus the broadcast address is not explicitely configured. The question is: what is responsible of this bad behaviour? Is it busybox's ifconfig that doesn't set the broadcast address correctly or is it the kernel that set it up badly?

Note: it's possible that none of them are responsible but something else gets in the way in the boot process (and reconfigures it badly) as the device runs user-specific software that I don't know. I will follow up with more info once I have them.

Raphaël Hertzog
  • 706
  • 1
  • 5
  • 11

4 Answers4

2

Starting investigations on the topic I discovered with strace that changing the broadcast address with ifconfig leads to a supplementary ioctl() call (SIOCSIFBRDADDR - Set InterFace BRoadcast ADDRess) that doesn't appear in the normal trace when you leave out the broadcast parameter. So it looks like that ifconfig doesn't deal with the broadcast address in the default case and leave that up to the kernel.

Raphaël Hertzog
  • 706
  • 1
  • 5
  • 11
  • I'd suggest then that the kernel is doing the wrong thing. You'd think that 2.4.31 is recent enough to do the right thing. – David Pashley Jun 08 '09 at 15:32
  • Of course there is the question of who should be responsible for fixing it? Should the kernel do the right thing given a netmask and ip address or should ifconfig set a broadcast if one isn't specified. Was your testing with busybox's ifconfig or net-tools's? Maybe see what the other one does. I'd err towards the kernel doing the right thing. Fancy installing 2.4.31 on a box to see if it's in Linus's tree or if it's a custom kernel patch? – David Pashley Jun 08 '09 at 15:36
  • I saw the same behaviour concerning ioctl with busybox's ifconfig and the one of net-tools in Debian sid. – Raphaël Hertzog Jun 08 '09 at 16:29
0

It isn't the kernel, I would bet.

If you've got shell access to the machine, try to recursively grep in /etc for that string:

  grep -R "192.168.70.255" * 

That should tell you where the config is that needs changed.

Matt Simmons
  • 20,218
  • 10
  • 67
  • 114
0

Having actually read the question this time, my gut reaction is that the problem would lie in BusyBox making the wrong assumptions or possibly living in some parallel universe where classful routing didn't disappear. You don't say how old the kernel or the busybox is, but you might be able to test which is at fault if you can get a more recent version of busybox, a copy of ip or strace on the box. ip or newer busybox would allow you to set the ip and netmask with a tool with a known good behaviour. If it's still wrong, it's probably the kernel. If it's right, it's busybox. With strace you could see what syscalls busybox is making.

If you can't get any new binaries on the box then there's not really much more you can do other than set the broadcast to the right value yourself.

David Pashley
  • 23,151
  • 2
  • 41
  • 71
  • My question states “It runs a kernel 2.4.31 with busybox 0.60.5.” so you know how old it is. :-) I have a copy of the original image (but I don't have the old device as it's discontinued since a few years so I can't test it live) and my goal is to provide a fix if it's a bug in the original image (and not a bad manipulation of one of the user applications installed afterwards). – Raphaël Hertzog Jun 08 '09 at 14:47
  • Wow, I really didn't read it properly the second time did I. – David Pashley Jun 08 '09 at 15:31
0

Is it possible that the broadcast is dynamically generated from the IP/Mask combo and that you actually entered the netmask wrong?

jj33
  • 11,038
  • 1
  • 36
  • 50
  • The broadcast is dynamically generated in the default case... my question is precisely “what is generating it with a wrong value?”. And no, I have made no error in what got typed. – Raphaël Hertzog Jun 08 '09 at 15:25