]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Send hostname/fqdn in DISCOVER and INFORM messages too.
authorRoy Marples <roy@marples.name>
Mon, 4 Dec 2006 21:13:04 +0000 (21:13 +0000)
committerRoy Marples <roy@marples.name>
Mon, 4 Dec 2006 21:13:04 +0000 (21:13 +0000)
ChangeLog
Makefile
arp.c
configure.c
dhcp.c
interface.c
logger.c

index 53be0849444b3ff6e89c46dbfa86f4cf752c0e76..c952b2e64cf641a01006db42917d56762966a513 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+Send hostname/fqdn in DISCOVER and INFORM messages too.
 Add more debug messages.
 Fix writing to resolv.conf when resolvconf not present.
 Include linux/if_addr.h for 2.6.19+ kernels, thanks to AlexExtreme.
index da6410303cc9aaa3090c210aafe0166e147d6d9c..822485d53055ae0e8f4e23dda1c52c7cba5ad9f9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 # Should work for both GNU make and BSD mke
 
-VERSION = 3.0.3_pre1
+VERSION = 3.0.3_pre2
 
 INSTALL ?= install
 CFLAGS ?= -Wall -O2 -pedantic -std=gnu99
diff --git a/arp.c b/arp.c
index f5c0830bd6e3e88963037ffbd8477a3009218406..5afa3aed2c1c7c1c31c55cd2a4fd725f6a55890a 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -70,7 +70,7 @@ int arp_check (interface_t *iface, struct in_addr address)
   unsigned char buf[256];
   struct arphdr *ah = (struct arphdr *) buf;
 
-  memset (&buf, 0, sizeof (buf));
+  memset (buf, 0, sizeof (buf));
 
   ah->ar_hrd = htons (ARPHRD_ETHER);
   ah->ar_pro = htons (ETHERTYPE_IP);
@@ -118,7 +118,7 @@ int arp_check (interface_t *iface, struct in_addr address)
 
       while (bufpos != 0)
        {
-         memset (&reply, 0, sizeof (reply));
+         memset (reply, 0, sizeof (reply));
          if ((bytes = get_packet (iface, (unsigned char *) &reply, buffer,
                                   &buflen, &bufpos)) < 0)
            break;
index f2fe22338b7dd078ae609ef80f0ac1d7d49940af..98a167560c239a62ea9e08113d63672111929e12 100644 (file)
@@ -356,7 +356,7 @@ int configure (options_t *options, interface_t *iface, dhcp_t *dhcp)
   route_t *new_route = NULL;
   route_t *old_route = NULL;
   struct hostent *he = NULL;
-  char *newhostname[HOSTNAME_MAX_LEN] = {0};
+  char newhostname[HOSTNAME_MAX_LEN] = {0};
   char curhostname[HOSTNAME_MAX_LEN] = {0};
   char *dname = NULL;
   int dnamel = 0;
@@ -522,9 +522,9 @@ int configure (options_t *options, interface_t *iface, dhcp_t *dhcp)
       || strcmp (curhostname, "localhost") == 0)
     {
       if (dhcp->hostname)
-       strcpy ((char *) newhostname, dhcp->hostname); 
+       strcpy (newhostname, dhcp->hostname); 
 
-      sethostname ((char *) newhostname, strlen ((char *) newhostname));
+      sethostname (newhostname, strlen (newhostname));
       logger (LOG_INFO, "setting hostname to `%s'", newhostname);
     }
 
diff --git a/dhcp.c b/dhcp.c
index 5f85947a853597c97502173bf3914a649e8634e5..599d813693a077300f6454bdcfc24763b94507a3 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -185,10 +185,7 @@ size_t send_message (interface_t *iface, dhcp_t *dhcp,
        }
 
       *n_params = p - n_params - 1;
-    }
 
-  if (type == DHCP_REQUEST)
-    {
       if (options->hostname) 
        {
          if (options->fqdn == FQDN_DISABLE)
@@ -220,7 +217,7 @@ size_t send_message (interface_t *iface, dhcp_t *dhcp,
 
   if (type != DHCP_DECLINE && type != DHCP_RELEASE)
     {
-      if (options->userclass)
+      if (options->userclass_len > 0)
        {
          *p++ = DHCP_USERCLASS;
          *p++ = options->userclass_len;
index 75b088d2d0cf92f563213c0eac2e4739ab2c5b5c..20aa2278eb2e666f8cc93fa50311593db39a7c1e 100644 (file)
@@ -127,7 +127,7 @@ interface_t *read_interface (const char *ifname, int metric)
          return NULL;
        }
 
-      memcpy (&hwaddr, sdl->sdl_data + sdl->sdl_nlen, ETHER_ADDR_LEN);
+      memcpy (hwaddr, sdl->sdl_data + sdl->sdl_nlen, ETHER_ADDR_LEN);
       break;
     }
   freeifaddrs (ifap);
@@ -160,7 +160,7 @@ interface_t *read_interface (const char *ifname, int metric)
       close (s);
       return NULL;
     }
-  memcpy (&hwaddr, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
+  memcpy (hwaddr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
 #else
   ifr.ifr_metric = metric;
   if (ioctl (s, SIOCSIFMETRIC, &ifr) < 0)
@@ -192,7 +192,7 @@ interface_t *read_interface (const char *ifname, int metric)
   memset (iface, 0, sizeof (interface_t));
   strncpy (iface->name, ifname, IF_NAMESIZE);
   snprintf (iface->infofile, PATH_MAX, INFOFILE, ifname);
-  memcpy (&iface->ethernet_address, &hwaddr, ETHER_ADDR_LEN);
+  memcpy (&iface->ethernet_address, hwaddr, ETHER_ADDR_LEN);
 
   iface->arpable = ! (ifr.ifr_flags & (IFF_NOARP | IFF_LOOPBACK));
 
@@ -380,7 +380,7 @@ static int send_netlink(struct nlmsghdr *hdr)
     }
 
   char buffer[16384];
-  memset (&buffer, 0, sizeof (buffer));
+  memset (buffer, 0, sizeof (buffer));
   iov.iov_base = buffer;
 
   struct nlmsghdr *h;
@@ -542,11 +542,11 @@ static int do_address(const char *ifname,
   nlm.ifa.ifa_family = AF_INET;
 
   /* Store the netmask in the prefix */
-  uint32_t mask = htonl (netmask.s_addr);
+  uint32_t mask = netmask.s_addr;
   while (mask)
     {
       nlm.ifa.ifa_prefixlen++;
-      mask <<= 1;
+      mask >>= 1;
     }
 
   add_attr_l (&nlm.hdr, sizeof (nlm), IFA_LOCAL, &address.s_addr,
index aea56fd3200806866d0b6148a7784e8beb2ea4ed..e2760e101b6dba36ee43967010d169bcccbe10b2 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -100,7 +100,7 @@ void logger(int level, const char *fmt, ...)
       int len = strlen (logprefix);
       char *fmt2 = xmalloc (strlen (fmt) + len + 1);
       char *p = fmt2;
-      memcpy (p, &logprefix, len);
+      memcpy (p, logprefix, len);
       p += len;
       strcpy (p, fmt);
       vsyslog (level, fmt2, p2);