NetReg: Possible NetReg 1.3rc2 bug + suggestions..

New Message Reply Date view Thread view Subject view Author view Attachment view

From: Nathan Lloyd (nlloyd@smumn.edu)
Date: Fri May 16 2003 - 10:12:41 CDT


Greetings.
I just finished setting up the 1.3rc2 version of netreg and I wanted to toss
you guys a few comments:

I'm running it on redhat 8 (for your information)
I noticed a problem with refresh-dhcpdconf if the PID file for dhcpd doesn't
exist.. it just seems to bomb out of the script without making a .conf.bad and
without trying to start the dhcpd again.. At first I thought this meant it
wouldn't work at all, but I just noticed that it's been up for a full day now,
and it created a .bad file so I'm not sure what fluke of circumstances made it
fail for me in the beginning..

I added a feature to my copy of the admin.cgi so that you can manually add a
registration, which was a feature I thought would be in this version by now..

Some other features I'd like to see included in the admin.cgi are:
- Tail of error files (dhcpd.conf.bad and register-errors.log) so that you can
see from the web what has been going wrong

- archive the leases file so you can search a history of who had what lease
when (useful for when there are 2 week old accusations of copyright violation)

anyhow, thanks for your time..
I'm gonna paste in the hackjob I created for the manual reservation.. I'm sure
it can be cleaned up if you want to include it in a future version of netreg..

#-------------SMU-----------------------------------------------------------\
# inserts a "reservation" record (originally written for 1.2)
#-------------SMU-----------------------------------------------------------\
  sub add_reserv {
    if (($FORM{'host_name'}) && ($FORM{'mac_addy'}) && ($FORM{'platform'})) {
    #User entered host name, mac address, and platform note, check info and
    #add the record (modified from register.cgi::append_host_entry())
      ($SEC,$MIN,$HOUR,$DAY,$MO,$YR) = localtime;
      $YR+=1900; $MO++;
      if ($DAY<10) { $DAY="0$DAY"; }
      if ($MO<10) { $MO="0$MO"; }
      if ($HOUR<10) { $HOUR="0$HOUR"; }
      if ($MIN<10) { $MIN="0$MIN"; }
      if ($SEC<10) { $SEC="0$SEC"; }
      $TIME="$HOUR:$MIN:$SEC";
      #check if MAC_ADDY is already registered
      open (DHCPDCONFNEW, "$DHCPDCONFPATH/dhcpd.conf.new");
      while (<DHCPDCONFNEW>) {
        if ($_ =~ /$FORM{'mac_addy'}/) {
           printf "$FORM{'mac_addy'} Already Exists in DHCPD.CONF.NEW!";
           exit;
        }
        if ($_ =~ /$FORM{'host_name'}/) {
           printf "$FORM{'host_name'} Already Exists in DHCPD.CONF.NEW!";
           exit;
        }
        if (($FORM{'ip_addy'} ne "") && ($_ =~ $FORM{'ip_addy'})) {
           printf "$FORM{'ip_addy'} Already Exists in DHCPD.CONF.NEW!";
           exit;
        }
      }
      close(DHCPDCONFNEW);
      open(LEASES, "$LEASESPATH/dhcpd.leases");
      while (<LEASES>) {
        if (($FORM{'ip_addy'} ne "") && ($_ =~ $FORM{'ip_addy'})) {
           printf "$FORM{'ip_addy'} Already Exists in DHCPD.LEASES!";
           exit;
        }
      }
      close(LEASES);
      $_ = $FORM{'host_name'} ;
      tr/'//d;
      $GOODHOSTNAME = $_;
      open (DHCPDCONFNEW, ">>$DHCPDCONFPATH/dhcpd.conf.new");
      print DHCPDCONFNEW "host $GOODHOSTNAME { hardware ethernet ";
      print DHCPDCONFNEW "$FORM{'mac_addy'} \; ";
      if ($FORM{'ip_addy'} ne "") {
        print DHCPDCONFNEW "fixed-address $FORM{'ip_addy'} \; ";
      }
      print DHCPDCONFNEW "}\#$FORM{'platform'}";
      print DHCPDCONFNEW "\#$YR$MO$DAY $TIME\n";
      close(DHCPDCONFNEW);
      printf "$FORM{'host_name'} $FORM{'mac_addy'} $FORM{'ip_addy'}";
    }
    else {
    #no form data entered, print the entry form
    printf "<form method=get action=$ADMINPATH/admin.cgi>";
    printf "<input type=hidden name=action value=AR>";
    printf "<ul><b> Enter information for Static IP Reservation/Registration
without an IP Address</b><p>";
    printf "<pre>";
    printf " Hostname: <input type=text name=host_name><P>";
    printf "Mac Address: <input type=text name=mac_addy><P>";
    printf " IP Address: <input type=text name=ip_addy><P>";
    printf "Description: <input type=text name=platform><P>";
    printf "</pre></ul>";
    printf "<input type=submit>";
    }
  }
#-------------SMU-----------------------------------------------------------/

-Nathan Lloyd
-(nlloyd@smumn.edu)/(507-457-1748)
-Uniface/Cold Fusion Programmer
-Assistant Network Administrator
=Saint Mary's University of Minnesota
=700 Terrace Heights #17
=Winona, MN 55987

**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************


New Message Reply Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:39 CDT