[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

netcfg doing a DHCP request that can be identified.



Hello,

In svn of d-i has under /people/stappers/packages/netcfg/
a netcfg that does a DHCP request that can be identified
a request from netcfg.

At DHCP server side you have in /etc/dhcp3/dhcpd.conf lines like these:

    if substring (option vendor-class-identifier, 0, 14) = "NetcfgDHClient" {
      filename "proto://host.tld/newFileName"; }
    else { filename "i386/pxelinux.0"; }


It is work in progress. The following patch is for your information.

ndex: debian/changelog
===================================================================
--- debian/changelog    (.../trunk/packages/netcfg)     (revision 30884)
+++ debian/changelog    (.../people/stappers/packages/netcfg)   (working
copy)
@@ -1,6 +1,9 @@
-netcfg (1.15) UNRELEASED; urgency=low
+netcfg (1.15.2) UNRELEASED; urgency=low

   [ Geert Stappers ]
+  * Create dhclient config files.
+    So netcfg DHCP requests can be identified.
+
   * Use the macro for the resolve file in dhcp.c
     (patch by Torsten Landschoff from #328646).

Index: dhcp.c
===================================================================
--- dhcp.c      (.../trunk/packages/netcfg)     (revision 30884)
+++ dhcp.c      (.../people/stappers/packages/netcfg)   (working copy)
@@ -146,7 +146,7 @@

         if (dhostname)
         {
-          if ((dc = file_open(DHCLIENT_CONF, "w")))
+          if ((dc = file_open(DHCLIENT_CONF, "a")))
           {
             fprintf(dc, "send host-name \"%s\";\n", dhostname);
             fclose(dc);
@@ -161,7 +161,7 @@

         if (dhostname)
         {
-          if ((dc = file_open(DHCLIENT3_CONF, "w")))
+          if ((dc = file_open(DHCLIENT3_CONF, "a")))
           {
             fprintf(dc, "send host-name \"%s\";\n", dhostname);
             fclose(dc);
Index: netcfg-common.c
===================================================================
--- netcfg-common.c     (.../trunk/packages/netcfg)     (revision 30884)
+++ netcfg-common.c     (.../people/stappers/packages/netcfg)   (working
copy)
@@ -859,11 +859,24 @@
 {
   static char* remove[] =
     { INTERFACES_FILE, HOSTS_FILE, HOSTNAME_FILE, NETWORKS_FILE,
-      RESOLV_FILE, DHCLIENT_CONF, DHCLIENT3_CONF, DOMAIN_FILE, 0 };
+      RESOLV_FILE, DOMAIN_FILE, 0 };
   char **ptr = remove;
+  FILE *dc = NULL;

   while (*ptr)
     unlink(*ptr++);
+
+  if ((dc = file_open(DHCLIENT_CONF, "w")))
+  {
+    fprintf(dc, "send dhcp-class-identifier \"NetcfgDHClient\";\n" );
+    fclose(dc);
+  }
+
+  if ((dc = file_open(DHCLIENT3_CONF, "w")))
+  {
+    fprintf(dc, "send dhcp-class-identifier \"NetcfgDHClient\";\n" );
+    fclose(dc);
+  }
 }

 void netcfg_nameservers_to_array(char *nameservers, struct in_addr array[])




Looking forward for your comments
Geert Stappers

Attachment: signature.asc
Description: Digital signature


Reply to: