Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 1 down vote accepted

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.

share|improve this answer
    
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 8 '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 8 '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 8 '09 at 16:29

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.

share|improve this answer

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.

share|improve this answer
    
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 8 '09 at 14:47
    
Wow, I really didn't read it properly the second time did I. –  David Pashley Jun 8 '09 at 15:31

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

share|improve this answer
    
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 8 '09 at 15:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.