#ifdef ENABLE_ARP
/* Check that no-one is using the address */
if ((options->dolastlease ||
- (IN_LINKLOCAL (dhcp->address.s_addr) &&
+ (IN_LINKLOCAL (ntohl (dhcp->address.s_addr)) &&
(! options->doipv4ll ||
arp_claim (iface, dhcp->address)))))
{
return (-1);
}
- if (! options->daemonised && IN_LINKLOCAL (dhcp->address.s_addr)) {
+ if (! options->daemonised &&
+ IN_LINKLOCAL (ntohl (dhcp->address.s_addr)))
+ {
logger (LOG_ERR, "cannot request a link local address");
return (-1);
}
|| state == STATE_REBINDING)
{
logger (LOG_INFO, "received SIGHUP, releasing lease");
- if (! IN_LINKLOCAL (dhcp->address.s_addr)) {
+ if (! IN_LINKLOCAL (ntohl (dhcp->address.s_addr))) {
SOCKET_MODE (SOCKET_OPEN);
xid = random ();
if ((open_socket (iface, false)) >= 0)
case STATE_INIT:
if (xid != 0) {
if (iface->previous_address.s_addr != 0 &&
- ! IN_LINKLOCAL (iface->previous_address.s_addr) &&
+ ! IN_LINKLOCAL (ntohl (iface->previous_address.s_addr)) &&
! options->doinform)
{
logger (LOG_ERR, "lost lease");
if (! options->persistent)
DROP_CONFIG;
- } else
+ } else if (! IN_LINKLOCAL (ntohl (iface->previous_address.s_addr)))
logger (LOG_ERR, "timed out");
SOCKET_MODE (SOCKET_CLOSED);
#ifdef ENABLE_IPV4LL
if (! options->test && options->doipv4ll &&
(! dhcp->address.s_addr ||
- (! IN_LINKLOCAL (dhcp->address.s_addr) &&
+ (! IN_LINKLOCAL (ntohl (dhcp->address.s_addr)) &&
! options->dolastlease)))
{
logger (LOG_INFO, "probing for an IPV4LL address");
if (ipv4ll_get_address (iface, dhcp) == -1) {
break;
}
- if (! daemonised)
- logger (LOG_WARNING, "using IPV4LL address %s",
- inet_ntoa (dhcp->address));
timeout = dhcp->renewaltime;
}
#endif
#if defined (ENABLE_INFO) || defined (ENABLE_IPV4LL)
if (dhcp->address.s_addr)
{
+ if (! daemonised &&
+ IN_LINKLOCAL (ntohl (dhcp->address.s_addr)))
+ logger (LOG_WARNING, "using IPV4LL address %s",
+ inet_ntoa (dhcp->address));
if (configure (options, iface, dhcp, true) == -1 &&
! daemonised)
{
break;
case STATE_BOUND:
case STATE_RENEW_REQUESTED:
- if (IN_LINKLOCAL (dhcp->address.s_addr)) {
+ if (IN_LINKLOCAL (ntohl (dhcp->address.s_addr))) {
memset (&dhcp->address, 0, sizeof (struct in_addr));
state = STATE_INIT;
xid = 0;
if ((type == DHCP_INFORM ||
type == DHCP_RELEASE ||
type == DHCP_REQUEST) &&
- ! IN_LINKLOCAL (iface->previous_address.s_addr))
+ ! IN_LINKLOCAL (ntohl (iface->previous_address.s_addr)))
{
message->ciaddr = iface->previous_address.s_addr;
from.s_addr = iface->previous_address.s_addr;
memcpy (p, &_val.s_addr, 4); \
p += 4; \
}
- if (IN_LINKLOCAL (dhcp->address.s_addr))
+ if (IN_LINKLOCAL (ntohl (dhcp->address.s_addr)))
logger (LOG_ERR, "cannot request a link local address");
else {
if (dhcp->address.s_addr != iface->previous_address.s_addr &&
* 192.168/16
*/
#ifndef IN_PRIVATE
-# define IN_PRIVATE(addr) (((ntohl (addr) & IN_CLASSA_NET) == 0x0a000000) || \
- ((ntohl (addr) & 0xfff00000) == 0xac100000) || \
- ((ntohl (addr) & IN_CLASSB_NET) == 0xc0a80000))
+# define IN_PRIVATE(addr) (((addr & IN_CLASSA_NET) == 0x0a000000) || \
+ ((addr & 0xfff00000) == 0xac100000) || \
+ ((addr & IN_CLASSB_NET) == 0xc0a80000))
#endif
#define LINKLOCAL_ADDR 0xa9fe0000
#define LINKLOCAL_BRDC 0xa9feffff
#ifndef IN_LINKLOCAL
-# define IN_LINKLOCAL(addr) ((ntohl (addr) & IN_CLASSB_NET) == LINKLOCAL_ADDR)
+# define IN_LINKLOCAL(addr) ((addr & IN_CLASSB_NET) == LINKLOCAL_ADDR)
#endif
typedef struct route_t