needless attempt to solicit an IPv6 RA.
#include "ipv4ll.h"
#include "ipv6rs.h"
#include "net.h"
+#include "platform.h"
#include "signals.h"
/* We should define a maximum for the NAK exponential backoff */
}
#endif
+ if (options & DHCPCD_IPV6RS && !check_ipv6())
+ options &= ~DHCPCD_IPV6RS;
if (options & DHCPCD_IPV6RS) {
ipv6rsfd = ipv6rs_open();
if (ipv6rsfd == -1) {
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2011 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
*/
#include <sys/param.h>
+#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
+#include <netinet/in.h>
+
+#include <syslog.h>
#include "platform.h"
return NULL;
return march;
}
+
+static int
+inet6_sysctl(int code)
+{
+ int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
+ int val;
+ size_t size;
+
+ mib[3] = code;
+ size = sizeof(val);
+ if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &val, &size, NULL, 0) == -1)
+ return -1;
+ return val;
+}
+
+int
+check_ipv6(void)
+{
+
+ if (!inet6_sysctl(IPV6CTL_ACCEPT_RTADV)) {
+ syslog(LOG_WARNING,
+ "Kernel is not configured to accept IPv6 RAs");
+ return 0;
+ }
+ if (inet6_sysctl(IPV6CTL_FORWARDING)) {
+ syslog(LOG_WARNING,
+ "Kernel is configured as a router, not a host");
+ return 0;
+ }
+ return 1;
+}
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
errno = ESRCH;
return p;
}
+
+int
+check_ipv6(void)
+{
+
+ // FIXME: Add IPv6 detection here
+ return 1;
+}
/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
#define PLATFORM_H
char * hardware_platform(void);
+int check_ipv6(void);
#endif