+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.
# 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
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);
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;
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;
|| 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);
}
}
*n_params = p - n_params - 1;
- }
- if (type == DHCP_REQUEST)
- {
if (options->hostname)
{
if (options->fqdn == FQDN_DISABLE)
if (type != DHCP_DECLINE && type != DHCP_RELEASE)
{
- if (options->userclass)
+ if (options->userclass_len > 0)
{
*p++ = DHCP_USERCLASS;
*p++ = options->userclass_len;
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);
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)
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));
}
char buffer[16384];
- memset (&buffer, 0, sizeof (buffer));
+ memset (buffer, 0, sizeof (buffer));
iov.iov_base = buffer;
struct nlmsghdr *h;
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,
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);