Deleted Added
full compact
driver_wired.c (302408) driver_wired.c (337817)
1/*
2 * Wired Ethernet driver interface
3 * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2004, Gunter Burchardt <tira@isx.de>
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */
9
10#include "includes.h"
1/*
2 * Wired Ethernet driver interface
3 * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
4 * Copyright (c) 2004, Gunter Burchardt <tira@isx.de>
5 *
6 * This software may be distributed under the terms of the BSD license.
7 * See README for more details.
8 */
9
10#include "includes.h"
11
12#include "common.h"
13#include "eloop.h"
14#include "driver.h"
15
11#include <sys/ioctl.h>
16#include <sys/ioctl.h>
17#undef IFNAMSIZ
12#include <net/if.h>
13#ifdef __linux__
14#include <netpacket/packet.h>
15#include <net/if_arp.h>
18#include <net/if.h>
19#ifdef __linux__
20#include <netpacket/packet.h>
21#include <net/if_arp.h>
16#include <net/if.h>
17#endif /* __linux__ */
18#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
19#include <net/if_dl.h>
20#include <net/if_media.h>
21#endif /* defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) */
22#ifdef __sun__
23#include <sys/sockio.h>
24#endif /* __sun__ */
25
22#endif /* __linux__ */
23#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
24#include <net/if_dl.h>
25#include <net/if_media.h>
26#endif /* defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) */
27#ifdef __sun__
28#include <sys/sockio.h>
29#endif /* __sun__ */
30
26#include "common.h"
27#include "eloop.h"
28#include "driver.h"
29
30#ifdef _MSC_VER
31#pragma pack(push, 1)
32#endif /* _MSC_VER */
33
34struct ieee8023_hdr {
35 u8 dest[6];
36 u8 src[6];
37 u16 ethertype;

--- 427 unchanged lines hidden (view full) ---

465 strerror(errno));
466 close(s);
467 return -1;
468 }
469 close(s);
470 return 0;
471}
472
31#ifdef _MSC_VER
32#pragma pack(push, 1)
33#endif /* _MSC_VER */
34
35struct ieee8023_hdr {
36 u8 dest[6];
37 u8 src[6];
38 u16 ethertype;

--- 427 unchanged lines hidden (view full) ---

466 strerror(errno));
467 close(s);
468 return -1;
469 }
470 close(s);
471 return 0;
472}
473
474
473#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
474static int wpa_driver_wired_get_ifstatus(const char *ifname, int *status)
475{
476 struct ifmediareq ifmr;
477 int s;
478
479 s = socket(PF_INET, SOCK_DGRAM, 0);
480 if (s < 0) {

--- 71 unchanged lines hidden (view full) ---

552 close(s);
553 return 0;
554}
555
556
557static void * wpa_driver_wired_init(void *ctx, const char *ifname)
558{
559 struct wpa_driver_wired_data *drv;
475#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
476static int wpa_driver_wired_get_ifstatus(const char *ifname, int *status)
477{
478 struct ifmediareq ifmr;
479 int s;
480
481 s = socket(PF_INET, SOCK_DGRAM, 0);
482 if (s < 0) {

--- 71 unchanged lines hidden (view full) ---

554 close(s);
555 return 0;
556}
557
558
559static void * wpa_driver_wired_init(void *ctx, const char *ifname)
560{
561 struct wpa_driver_wired_data *drv;
560 int flags, status;
562 int flags;
561
562 drv = os_zalloc(sizeof(*drv));
563 if (drv == NULL)
564 return NULL;
565 os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
566 drv->ctx = ctx;
567
568#ifdef __linux__

--- 111 unchanged lines hidden ---
563
564 drv = os_zalloc(sizeof(*drv));
565 if (drv == NULL)
566 return NULL;
567 os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));
568 drv->ctx = ctx;
569
570#ifdef __linux__

--- 111 unchanged lines hidden ---