diff options
| author | Roy Marples <roy@marples.name> | 2009-02-24 12:38:02 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-02-24 12:38:02 +0000 |
| commit | 82ba93a1de061e9eb577907cf102628a45de51e8 (patch) | |
| tree | 3662e8319449c6c4981ead9cc5785e23a42bca2e /if-linux.c | |
| parent | acb1cf88cf6a35c5156908349c31de634f107141 (diff) | |
| download | dhcpcd-82ba93a1de061e9eb577907cf102628a45de51e8.tar.xz | |
Finally fix compile on vanilla kernel headers.
This is done by moving the wireless calls to a separate file that
just includes linux/wireless.h.
This is needed because linux/wireless.h includes linux/if.h which may
or may not have been fixed to co-exist with net/if.h.
Maybe one day this won't be needed ....
Diffstat (limited to 'if-linux.c')
| -rw-r--r-- | if-linux.c | 46 |
1 files changed, 8 insertions, 38 deletions
@@ -33,14 +33,19 @@ #include <sys/ioctl.h> #include <sys/param.h> +#include <linux/netlink.h> +#include <linux/rtnetlink.h> + +/* Support older kernels */ +#ifndef IFLA_WIRELESS +# define IFLA_WIRELESS (IFLA_MASTER + 1) +#endif + #include <arpa/inet.h> #include <net/if.h> #include <netinet/ether.h> #include <netpacket/packet.h> -#include <linux/netlink.h> -#include <linux/rtnetlink.h> - #include <errno.h> #include <ctype.h> #include <fnmatch.h> @@ -50,14 +55,6 @@ #include <string.h> #include <unistd.h> -/* Support older kernels */ -#ifdef IFLA_WIRELESS -# include <linux/if.h> -# include <linux/wireless.h> -#else -# define IFLA_WIRELESS (IFLA_MASTER + 1) -#endif - #include "config.h" #include "common.h" #include "configure.h" @@ -73,33 +70,6 @@ static void (*nl_remove)(const char *); static int sock_fd; static struct sockaddr_nl sock_nl; -int -getifssid(const char *ifname, char *ssid) -{ -#ifdef SIOCGIWESSID - int s, retval; - struct iwreq iwr; - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) - return -1; - memset(&iwr, 0, sizeof(iwr)); - strlcpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name)); - iwr.u.essid.pointer = ssid; - iwr.u.essid.length = IF_SSIDSIZE - 1; - - if (ioctl(s, SIOCGIWESSID, &iwr) == 0) - retval = iwr.u.essid.length; - else - retval = -1; - close(s); - return retval; -#else - /* Stop gcc warning about unused paramters */ - ifname = ssid; - return -1; -#endif -} - static int _open_link_socket(struct sockaddr_nl *nl) { |
