On 27/05/17 04:29, Hunt Xu wrote:
> On Fri, May 26, 2017 at 11:46 PM, Ben Pfaff <[email protected]> wrote:
>> It's becoming more common that OSes include "ip" but not "ifconfig", so
>> it's best to avoid using the latter.  This commit removes most references
>> to "ifconfig" and replaces them by "ip".  It also adds a build-time check
>> to make it harder to introduce new uses of "ifconfig".
>>
>> Signed-off-by: Ben Pfaff <[email protected]>
>> ---
> 
> <snip>
> 
>> diff --git a/Documentation/faq/issues.rst b/Documentation/faq/issues.rst
>> index c60336a10569..82d0605da125 100644
>> --- a/Documentation/faq/issues.rst
>> +++ b/Documentation/faq/issues.rst
>> @@ -43,8 +43,8 @@ eth0.  Help!
>>      itself.  For example, assuming that eth0's IP address is 192.168.128.5, 
>> you
>>      could run the commands below to fix up the situation::
>>
>> -        $ ifconfig eth0 0.0.0.0
>> -        $ ifconfig br0 192.168.128.5
>> +        $ ip addr flush dev eth0
>> +        $ ip addr add 192.168.128.5 dev br0
> 
> ip addr add 192.168.128.5/24 dev br0
> 
> It seems using ifconfig without specifying any netmask the netmask/prefixlen
> will still be properly set (not diving quite deep, but strace indicates that
> this is not done by ifconfig, ifconfig don't even try to set the netmask),
> whlie using ip-address with only the address specified the prefixlen is
> always 32.
> 
> Some tests on my Ubuntu 16.04:
> 1a. ifconfig br0 192.168.128.5 -> br0 gets 192.168.128.5/24
> 1b. ip addr add 192.168.128.5 dev br0 -> br0 gets 192.168.128.5/32
> 2a. ifconfig br0 172.16.128.5 -> br0 gets 172.16.128.5/16
> 2b. ip addr add 172.16.128.5 dev br0 -> br0 gets 172.16.128.5/32
> 3a. ifconfig br0 10.0.128.5 -> br0 gets 10.0.128.5/8
> 3b. ip addr add 10.0.128.5 dev br0 -> br0 gets 10.0.128.5/32
> 
>>
*snip*

You might want to consider to add brd + to the ip command.
E.g. ip addr add 192.168.128.5/24 brd + dev br0

Without:
7: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 
1000
    link/ether 1a:78:fe:72:9c:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.128.5/24 scope global br0
       valid_lft forever preferred_lft forever

With:
7: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 
1000
    link/ether 1a:78:fe:72:9c:be brd ff:ff:ff:ff:ff:ff
    inet 192.168.128.5/24 brd 192.168.128.255 scope global br0
       valid_lft forever preferred_lft forever

As you can see the broadcast address isn't set without.

I see you already posted a v4 but this comment seems more appropriate in this 
thread.

BR
Matthias
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to