Bug #3286

dhcp lease has wrong netmask

Added by Filippo Carletti almost 6 years ago. Updated over 5 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-dnsmasq
Target version:v6.7
Security class: Resolution:
Affected version: NEEDINFO:No

Description

All dhcp client receives the wrong netmask, i.e. the lan interface has a /24 netmask, but clients receive a /8 mask.
Dnsmasq tries to guess the netmask, but it seems that it gets it wrong sometimes (maybe related to the lan if being a bridge).

Associated revisions

Revision 2e38185d
Added by Stefano Fancello almost 6 years ago

Add netmask in DHCP configuration to prevent lease to have a wrong mask. Refs #3286

History

#1 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

The bug has been found only in one installation and there is no clue about what can lead to this condition.
By the way, we can safely add the netmask option to all DHCP ranges.

Tested template-custom:

--- /etc/e-smith/templates/etc/dnsmasq.conf/30dhcp    2015-09-08 14:24:39.000000000 +0200
+++ /etc/e-smith/templates-custom/etc/dnsmasq.conf/30dhcp    2015-10-22 10:35:51.208749255 +0200
@@ -16,6 +16,7 @@
         my $status = $_->prop('status') || 'disabled';
         if ( $status eq 'enabled') {
             my $interface = $_->key;
+            my $netmask = $ndb->get($interface)->prop('netmask') || next;
             my $start = $_->prop('DhcpRangeStart') || next;
             my $end = $_->prop('DhcpRangeEnd') || next;
             my $start_ip = new NetAddr::IP($start);
@@ -23,7 +24,7 @@
             my $range_length = $end_ip->numeric - $start_ip->numeric;
             $tot_range_length += $range_length;
             my $lease = $_->prop('DhcpLeaseTime') || '86400';
-            $OUT .= 'dhcp-range=' . join(',',$_->key,$start,$end,$lease) . "\n";
+            $OUT .= 'dhcp-range=' . join(',',$_->key,$start,$end,$netmask,$lease) . "\n";

             my $domain = $_->prop('DhcpDomain') || '';
             if ($domain ne '') {

#2 Updated by Stefano Fancello almost 6 years ago

  • Status changed from TRIAGED to ON_DEV
  • Assignee set to Stefano Fancello
  • % Done changed from 20 to 30

#3 Updated by Stefano Fancello almost 6 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 60

Test case:
- Install package
- enable DHCP on one interface
- verify that /etc/dnsmasq.conf dhcp-range option has netmask as third value

#4 Updated by Stefano Fancello almost 6 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Stefano Fancello)
  • % Done changed from 60 to 70

repo testing: nethserver-dnsmasq-1.5.3-1.1.g2e38185.ns6.noarch.rpm

#5 Updated by dz0 0te almost 6 years ago

  • Assignee set to dz0 0te

#6 Updated by dz0 0te almost 6 years ago

  • Status changed from ON_QA to VERIFIED
  • Assignee deleted (dz0 0te)
  • % Done changed from 70 to 90

System and Package Version installed
VM KVM - Clean install of Nethserver 6.7 fully updated
Package Installed: nethserver-dnsmasq-1.5.3-1.ns6.noarch
Other Package installed: Basic firewall, DNS and DHCP server, Intrusion Prevention System

Test Original Problem
not replicated

Install Updated Package

yum --enablerepo=nethserver-testing update nethserver-dnsmasq-1.5.3-1.1.g2e38185.ns6.noarch

Test Results after update
Test case 1:
on a clean system, installed dhcp, updated with new package and configured

#  cat /etc/dnsmasq.conf | grep dhcp-range
dhcp-range=eth0,192.168.100.110,192.168.100.111,255.255.255.0,86400

Test case 2:
on a clean system, installed dhcp, configured then updated with new package

after update

# cat /etc/dnsmasq.conf | grep dhcp-range
dhcp-range=eth0,192.168.100.98,192.168.100.99,255.255.255.0,86400

Verified or Reopen
Verified

Note

#7 Updated by Giacomo Sanchietti over 5 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100
Released in nethserver-updates:
  • nethserver-dnsmasq-1.5.4-1.ns6.noarch.rpm

Also available in: Atom PDF