Skip to contentSkip to conversation

ifconfig and SIOCSIFADDR

DISCUSSION [email protected] 3 participants 3 messages Jul 25, 2001 – Jul 26, 2001

lore
Share & tools
lore
#0 lore raw

From [email protected] Wed Jul 25 18:37:10 2001

> and the last ioctl destroys the information set by the previous two.

Exactly.

> I consider this a kernel bug,

No. And even not a feature, but just the only eligible way. SIOCSIFADDR resets all previously set address information

Yes. It didn't in 2.0. It does in 2.2 and 2.4.

BTW, if no address was selected before, setting netmask and broadcast etc. simply fails.
So that you had some address set on the interface before you did the operation and that netmask is set for _that_ address_.

Yes. I liked such logic thirty years ago. That is Unix. Today I am less sure that it is a good idea to expect users to read the kernel and ifconfig sources, but I did and know.

Since you don't like changing the current behaviour, we should probably document it (say, in ifconfig(8)).

Andries

ifconfig(8):
SYNOPSIS
...
ifconfig interface [aftype] [address] options

OPTIONS
Since options are read and transmitted to the kernel in the order given, and since giving an address parameter causes resetting address related information (such as netmask and broadcast address) to a default, any non-default such address related information should be given after the address parameter (if any).

#1 lore raw

Hello!

Quoted 1 line

Yes. It didn't in 2.0.

Soooory, it did. This behavior is copied from there. :-)

Quoted 1 line

Yes. I liked such logic thirty years ago. That is Unix.

:-) Seems, thirty years ago there were not only Internet but Unix too.

BTW I did not hear about any kind of Unix, which forgets to set a valid mask on newly selected address.

ifconfig eth0 193.233.7.65 works nicely everywhere. Only on 4.2BSD it creates bad "zero" broadcast.

Alexey

#2 lore raw

I used to be all for the OS guessing the correct mask. Then I started work for my latest employer and tried to trace down strange errors that were reported to me as an attack on our system. What I discovered was that the last few people to attempt my job had set the IP and let the OS guess at the mask. The result? Everything had 66.0.0.0 as the mask (and 66.255.255.255 for the broadcast). And not just linux either.. freebsd, nt 4/windows 2000 and even the cisco catalysts all had the same default mask set.

Please *don't* guess. If the admin fails to enter it just spit back an error or something. You have no way to know the layout and that gets even more annoying in these days of isps handing out blocks of 16 and 32.

Gerhard

Quoted 18 lines · On Wed, 25 Jul 2001 [email protected] wrote:

Hello!

Quoted 1 line

Yes. It didn't in 2.0.

Soooory, it did. This behavior is copied from there. :-)

Quoted 1 line

Yes. I liked such logic thirty years ago. That is Unix.

:-) Seems, thirty years ago there were not only Internet but Unix too.

BTW I did not hear about any kind of Unix, which forgets to set a valid mask on newly selected address.

ifconfig eth0 193.233.7.65 works nicely everywhere. Only on 4.2BSD it creates bad "zero" broadcast.

Quoted 8 lines

Alexey

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
Gerhard Mack

[email protected]

<>< As a computer I find your faith in technology amusing.