starrs icon indicating copy to clipboard operation
starrs copied to clipboard

DHCP classes not required

Open cohoe opened this issue 12 years ago • 4 comments

systems.interface_addresses.class needs to be NULL-able

@agargiulo: for dhcpgen, if(address.class is null) then (skip "subclass" lines for address)

cohoe avatar Jan 01 '13 20:01 cohoe

would this fix it then?

diff --git a/API/plperl.sql b/API/plperl.sql
index 2c59205..be1a35f 100644
--- a/API/plperl.sql
+++ b/API/plperl.sql
@@ -267,8 +267,8 @@ CREATE OR REPLACE FUNCTION "api"."generate_dhcpd_config"() RETURNS VOID AS $$
                $output .= "  ddns-domainname \"$zone\";\n" if (defined($zone));
                $output .= "  option domain-name \"$zone\";\n" if (defined($zone));
                $output .= "}\n";
-               $output .= "subclass \"$class\" 1:$mac;\n";
-               $output .= "subclass \"$class\" $mac;\n\n";
+               $output .= "subclass \"$class\" 1:$mac;\n" if ($class != null);
+               $output .= "subclass \"$class\" $mac;\n\n" if ($class != null);
                return $output;
        }

agargiulo avatar Jan 01 '13 20:01 agargiulo

Or is this better:

diff --git a/API/plperl.sql b/API/plperl.sql
index 2c59205..d1bbb99 100644
--- a/API/plperl.sql
+++ b/API/plperl.sql
@@ -267,8 +267,8 @@ CREATE OR REPLACE FUNCTION "api"."generate_dhcpd_config"() RETURNS VOID AS $$
                $output .= "  ddns-domainname \"$zone\";\n" if (defined($zone));
                $output .= "  option domain-name \"$zone\";\n" if (defined($zone));
                $output .= "}\n";
-               $output .= "subclass \"$class\" 1:$mac;\n";
-               $output .= "subclass \"$class\" $mac;\n\n";
+               $output .= "subclass \"$class\" 1:$mac;\n" if (defined($class));
+               $output .= "subclass \"$class\" $mac;\n\n" if (defined($class));
                return $output;
        }

agargiulo avatar Jan 01 '13 20:01 agargiulo

Bump

agargiulo avatar Jan 28 '13 07:01 agargiulo

The problem is that I don't remember if there are other dependencies on DHCP classes. This hasn't been enough of a priority to look at.

cohoe avatar Mar 11 '13 14:03 cohoe