diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-10 08:43:17 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-08-10 08:43:17 +0300 |
| commit | 0dd152a83012764a77ef2a7ae7bf7c20c3d43c35 (patch) | |
| tree | eb5a02c5a74b655afa219f3dd44a115d49cbd3c4 /accel-pppd/ctrl/ipoe/ipoe.c | |
| parent | 52a01730fd02c2579f474c01ebf72a312f737825 (diff) | |
| download | accel-ppp-0dd152a83012764a77ef2a7ae7bf7c20c3d43c35.tar.gz accel-ppp-0dd152a83012764a77ef2a7ae7bf7c20c3d43c35.zip | |
ipoe: fix netmask computation for classless routes
The netmask was built with a loop shifting 1 into place, which was wrong
in three ways. At i == 0 it evaluated 1 << 32, undefined for a 32 bit
int, and at i == 1 it shifted into the sign bit of a signed value. The
shift amount was off by one, so a /24 produced 0xfffffe00 rather than
0xffffff00. And mask1 was initialized once before the loop over the
routes and only ever OR'ed into, so the mask of every route accumulated
into the routes that followed it.
A well formed option carrying 10.0.1.0/24 via 1.1.1.1 and 172.16.0.0/12
via 2.2.2.2 printed as 10.0.0.1/24 and 172.16.2.0/12.
Compute the mask directly instead, and reject a prefix length above 32
rather than shifting by a negative amount.
Diffstat (limited to 'accel-pppd/ctrl/ipoe/ipoe.c')
0 files changed, 0 insertions, 0 deletions
