Page MenuHomeVyOS Platform

Wrong dhcp-server static route subnet bytes
Closed, ResolvedPublicBUG

Description

Network bytes calculated wrong here:
https://github.com/vyos/vyos-1x/blob/current/src/conf_mode/dhcp_server.py#L596-L600

if the network_address (with /24 netmask) is 10.10.0.X or 10.0.10.X, the resulted string will be same: "10, 10,"

Details

Difficulty level
Unknown (require assessment)
Version
1.3
Why the issue appeared?
Implementation mistake
Is it a breaking change?
Perfectly compatible

Event Timeline

Here is a solution (based from https://github.com/jansegre/dhcplib/blob/master/dhcplib/rfc.py#L225-L232):

# add network bytes
if net.prefixlen:
    width = net.prefixlen // 8
    if net.prefixlen % 8:
        width += 1
    string += ','.join(map(str,tuple(net.network_address.packed)[:width])) + ','
dmbaturin changed Why the issue appeared? from Will be filled on close to Implementation mistake.
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin claimed this task.