From c50bfba5ab2fc65c9a8b44c138a2603d60fdfe83 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sun, 1 May 2016 14:51:10 +0000 Subject: [PATCH] Fix compile on sunos again. --- configure | 3 +- dhcp-common.c | 4 +-- if-sun.c | 76 +++++++++++++++++++++++++++++++++++---------------- ipv6.h | 2 +- 4 files changed, 58 insertions(+), 27 deletions(-) diff --git a/configure b/configure index fc7b76c2..eaa6db2b 100755 --- a/configure +++ b/configure @@ -347,8 +347,9 @@ CFLAGS+= -Wpointer-sign -Wmissing-noreturn EOF case "$OS" in mirbsd*|openbsd*);; # OpenBSD has many redundant decs in system headers - bitrig*) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK + bitrig*|sunos*) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK ;; # Bitrig spouts many conversion errors with htons + # sunos has many as well *) echo "CFLAGS+= -Wredundant-decls" >>$CONFIG_MK echo "CFLAGS+= -Wconversion" >>$CONFIG_MK ;; diff --git a/dhcp-common.c b/dhcp-common.c index 92ff8ceb..d8028ce7 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -27,8 +27,6 @@ #include -#include - #include #include #include @@ -37,6 +35,8 @@ #include #include +#include /* after normal includes for sunos */ + #include "config.h" #include "common.h" diff --git a/if-sun.c b/if-sun.c index 42082c00..68986a42 100644 --- a/if-sun.c +++ b/if-sun.c @@ -1,6 +1,6 @@ /* * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2015 Roy Marples + * Copyright (c) 2006-2016 Roy Marples * All rights reserved * Redistribution and use in source and binary forms, with or without @@ -41,29 +41,35 @@ #include "ipv6nd.h" int -if_init(__unused struct interface *iface) +if_init(__unused struct interface *ifp) { return 0; } int -if_conf(__unused struct interface *iface) +if_conf(__unused struct interface *ifp) { return 0; } int -if_openlinksocket(void) +if_opensockets_os(struct dhcpcd_ctx *ctx) { errno = ENOTSUP; return -1; } +void +if_closesockets_os(struct dhcpcd_ctx *ctx) +{ + +} + int -if_getssid(const char *ifname, char *ssid) +if_getssid(struct interface *ifp) { errno = ENOTSUP; @@ -71,15 +77,32 @@ if_getssid(const char *ifname, char *ssid) } int -if_vimaster(const char *ifname) +if_vimaster(__unused const struct dhcpcd_ctx *ctx, __unused const char *ifname) { return 0; } +int +if_managelink(struct dhcpcd_ctx *ctx) +{ + + errno = ENOTSUP; + return -1; +} + +if_machinearch(char *str, size_t len) +{ + + errno = ENOTSUP; + return -1; +} + #ifdef INET +const char *if_pfname = "SunOS"; + int -if_openrawsocket(struct interface *ifp, int protocol) +if_openrawsocket(struct interface *ifp, uint16_t protocol) { errno = ENOTSUP; @@ -87,7 +110,7 @@ if_openrawsocket(struct interface *ifp, int protocol) } ssize_t -if_sendrawpacket(const struct interface *ifp, int protocol, +if_sendrawpacket(const struct interface *ifp, uint16_t protocol, const void *data, size_t len) { @@ -96,7 +119,7 @@ if_sendrawpacket(const struct interface *ifp, int protocol, } ssize_t -if_readrawpacket(struct interface *ifp, int protocol, +if_readrawpacket(struct interface *ifp, uint16_t protocol, void *data, size_t len, int *flags) { @@ -105,8 +128,8 @@ if_readrawpacket(struct interface *ifp, int protocol, } int -if_address(const struct interface *iface, const struct in_addr *address, - const struct in_addr *netmask, const struct in_addr *broadcast, +if_address(const struct interface *iface, const struct in_addr *addr, + const struct in_addr *net, const struct in_addr *bcast, int action) { @@ -115,17 +138,15 @@ if_address(const struct interface *iface, const struct in_addr *address, } int -if_route(const struct rt *rt, int action) +if_addrflags(const struct in_addr *addr, const struct interface *ifp) { errno = ENOTSUP; return -1; } -#endif -#ifdef INET6 int -if_address6(const struct ipv6_addr *a, int action) +if_route(unsigned char cmd, const struct rt *rt) { errno = ENOTSUP; @@ -133,7 +154,7 @@ if_address6(const struct ipv6_addr *a, int action) } int -if_route6(const struct rt6 *rt, int action) +if_initrt(struct interface *ifp) { errno = ENOTSUP; @@ -142,6 +163,14 @@ if_route6(const struct rt6 *rt, int action) #endif #ifdef INET6 +int +if_address6(const struct ipv6_addr *a, int action) +{ + + errno = ENOTSUP; + return -1; +} + int if_addrflags6(const struct in6_addr *addr, const struct interface *ifp) { @@ -149,32 +178,33 @@ if_addrflags6(const struct in6_addr *addr, const struct interface *ifp) errno = ENOTSUP; return -1; } -#endif int -if_managelink(struct dhcpcd_ctx *ctx) +if_getlifetime6(struct ipv6_addr *addr) { errno = ENOTSUP; return -1; } -if_machinearch(char *str, size_t len) +int +if_route6(unsigned char cmd, const struct rt6 *rt) { errno = ENOTSUP; return -1; } -#ifdef INET6 -void -if_rarestore(struct dhcpcd_ctx *ctx) +int +if_initrt6(struct interface *ifp) { + errno = ENOTSUP; + return -1; } int -if_checkipv6(struct dhcpcd_ctx *ctx, const char *ifname, int own) +if_checkipv6(struct dhcpcd_ctx *ctx, const struct interface *ifp, int own) { errno = ENOTSUP; diff --git a/ipv6.h b/ipv6.h index 0eee0dae..1fe13817 100644 --- a/ipv6.h +++ b/ipv6.h @@ -34,7 +34,7 @@ #include "config.h" #ifndef __linux__ -# ifndef __QNX__ +# if !defined(__QNX__) && !defined(__sun) # include # endif # include -- 2.47.3