* Fixed compilation due to removed ether_init_params from ether_driver.h, thanks

to Hugo for reporting :-)
* Implemented setting promiscuous mode on ethernet device level.
* Set net_device::media to something useful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20538 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-04-03 16:39:30 +00:00
parent a34967de86
commit c79ae507aa
1 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -16,8 +16,9 @@
#include <errno.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <new>
#include <stdlib.h>
#include <string.h>
@ -28,7 +29,6 @@ struct ethernet_device : net_device {
uint32 frame_size;
};
struct net_buffer_module_info *gBufferModule;
@ -57,6 +57,7 @@ ethernet_init(const char *name, net_device **_device)
device->flags = IFF_BROADCAST;
device->type = IFT_ETHER;
device->mtu = 1500;
device->media = IFM_ACTIVE;
device->header_length = ETHER_HEADER_LENGTH;
device->fd = -1;
@ -84,11 +85,6 @@ ethernet_up(net_device *_device)
if (device->fd < 0)
return errno;
ether_init_params params;
memset(&params, 0, sizeof(ether_init_params));
if (ioctl(device->fd, ETHER_INIT, &params, sizeof(ether_init_params)) < 0)
goto err;
if (ioctl(device->fd, ETHER_GETADDR, device->address.data, ETHER_ADDRESS_LENGTH) < 0)
goto err;
@ -243,9 +239,15 @@ ethernet_set_mtu(net_device *_device, size_t mtu)
status_t
ethernet_set_promiscuous(net_device *device, bool promiscuous)
ethernet_set_promiscuous(net_device *_device, bool promiscuous)
{
return EOPNOTSUPP;
ethernet_device *device = (ethernet_device *)_device;
int32 value = (int32)promiscuous;
if (ioctl(device->fd, ETHER_GETADDR, &value, sizeof(value)) < 0)
return EOPNOTSUPP;
return B_OK;
}