Kolejność wpisów w generowanych plikach
1. Kolejność wpisów z dhcpd.conf generowanych przez lms-makedhcpconf jest obecnie losowa. IMHO wygodniej przeglądać posortowane:
--- lms-makedhcpconf 2004-09-02 00:39:12.000000000 +0200 +++ lms-makedhcpconfmy 2004-09-02 00:21:03.000000000 +0200 @@ -256,7 +256,7 @@ print DHCPDCONF "\t\toption netbios-name-servers $row->{'wins'};\n"; } print DHCPDCONF "\n"; - my $dbq2 = $dbase->prepare("SELECT id, name, ipaddr, mac, ownerid FROM nodes"); + my $dbq2 = $dbase->prepare("SELECT id, name, ipaddr, mac, ownerid FROM nodes ORDER BY ipaddr"); $dbq2->execute(); while (my $row2 = $dbq2->fetchrow_hashref()) {
2. W konfiguracji generowanej przez lms-makeiptables adresy IP sortowane są leksykograficznie a nie numerycznie. Poprawka:
--- lms-makeiptables 2004-09-01 23:51:21.000000000 +0200 +++ lms-makeiptables.new 2004-09-02 00:45:26.000000000 +0200 @@ -227,18 +227,18 @@ my $dbq = $dbase->prepare("SELECT inet_ntoa(address) AS address, mask FROM networks WHERE name = UPPER('$key')"); $dbq->execute(); while (my $row = $dbq->fetchrow_hashref()) { - my $sdbq = $dbase->prepare("SELECT inet_ntoa(ipaddr) AS ipaddr FROM nodes WHERE access = 1 ORDER BY ipaddr"); + my $sdbq = $dbase->prepare("SELECT inet_ntoa(ipaddr) AS addr FROM nodes WHERE access = 1 ORDER BY ipaddr"); $sdbq->execute(); while(my $srow = $sdbq->fetchrow_hashref()) { - if(matchip($srow->{'ipaddr'},$row->{'address'},$row->{'mask'})) + if(matchip($srow->{'addr'},$row->{'address'},$row->{'mask'})) { - print IPTABLESSCRIPT "$ipbin -t filter -A FORWARD -s $srow->{'ipaddr'} -j ACCEPT\n"; - print IPTABLESSCRIPT "$ipbin -t filter -A FORWARD -d $srow->{'ipaddr'} -j ACCEPT\n"; + print IPTABLESSCRIPT "$ipbin -t filter -A FORWARD -s $srow->{'addr'} -j ACCEPT\n"; + print IPTABLESSCRIPT "$ipbin -t filter -A FORWARD -d $srow->{'addr'} -j ACCEPT\n"; - if(isprivate($srow->{'ipaddr'})) + if(isprivate($srow->{'addr'})) { - print IPTABLESSCRIPT "$ipbin -t nat -A POSTROUTING -s $srow->{'ipaddr'} "; + print IPTABLESSCRIPT "$ipbin -t nat -A POSTROUTING -s $srow->{'addr'} "; if($snataddr) { print IPTABLESSCRIPT "-j SNAT --to $snataddr\n";
uczestnicy (1)
-
Tomasz Orzechowski