Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2024 18:14:53 +0200
From:      Michael Gmelin <grembo@freebsd.org>
To:        "Poul-Henning Kamp" <phk@phk.freebsd.dk>
Cc:        Michael Gmelin <grembo@freebsd.org>, "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, current@freebsd.org
Subject:   Re: 14.1-R rc.conf/ifconfig netmask issue was really hard to figure out
Message-ID:  <20240612181453.17715d51.grembo@freebsd.org>
In-Reply-To: <202406121535.45CFZwgS011605@critter.freebsd.dk>
References:  <202406120747.45C7lRGZ009491@critter.freebsd.dk> <5ss109s8-1086-700s-p199-rpr429on41p9@yvfgf.mnoonqbm.arg> <202406121436.45CEaZ0o011207@critter.freebsd.dk> <20240612165722.5ec89d11.grembo@freebsd.org> <05ors010-q60q-s261-no16-1577rq1p1610@yvfgf.mnoonqbm.arg> <404q3127-9p57-1oqq-qqoo-3479q27830ss@yvfgf.mnoonqbm.arg> <20240612172936.52cf62f0.grembo@freebsd.org> <202406121535.45CFZwgS011605@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 12 Jun 2024 15:35:58 +0000
"Poul-Henning Kamp" <phk@phk.freebsd.dk> wrote:

> --------
> Michael Gmelin writes:
> 
> > @phk From which version did you upgrade?  
> 
> To be totally honest: I'm not entirely sure.  Probably 13.x
> 

@Bjoern I checked again, I'm pretty sure the problem was introduced in
https://cgit.freebsd.org/src/commit/?id=4bf44dd73bc0a (this was part of
adding netlink into the code). The preparation work by the late Mike
Karels was consistent, as one can see in 13.x.

So basically the behavior on 13.x is:
- ifconfig bla0 10.1.1.1 => 10.1.1.1/8
- ifconfig bla0 192.168.1.1 => 192.168.1.1/24

This is in line with one would expect. On 14.x it's the opposite.

The code in 4bf44dd73bc0a68b73f7ee50d52adf5d7cda3eb8 introduced a
function to emulate the previous behavior. This function uses
IN_CLASSX_NSHIFT as bitmask - therefore 10.1.1.1 uses /24 and
192.168.1.1 uses /8. To fix the code, one has to actually use the
bitmask, which is (32 - IN_CLASSX_NSHIFT).

So this is simply a bug.

I opened a code review request to fix this:
https://reviews.freebsd.org/D45570

Best
Michael

-- 
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240612181453.17715d51.grembo>