dinetwork: remove mcast_chk and check for multicast in recv (nw)

netdev_tap: do mac filtering (nw)
This commit is contained in:
cracyc 2013-03-02 03:29:47 +00:00
parent a4de4e1876
commit 36201eba9d
9 changed files with 13 additions and 36 deletions

View File

@ -26,12 +26,6 @@ void device_network_interface::recv_cb(UINT8 *buf, int len)
{
}
bool device_network_interface::mcast_chk(const UINT8 *buf, int len)
{
// reject multicast packets
return false;
}
void device_network_interface::set_promisc(bool promisc)
{
m_promisc = promisc;

View File

@ -19,7 +19,6 @@ public:
int send(UINT8 *buf, int len);
virtual void recv_cb(UINT8 *buf, int len);
virtual bool mcast_chk(const UINT8 *buf, int len);
protected:
bool m_promisc;

View File

@ -855,6 +855,13 @@ int threecom3c505_device::ethernet_packet_is_for_me(const UINT8 mac_address[])
return 1;
}
}
for (i = 0; i + ETHERNET_ADDR_SIZE < sizeof(m_multicast_list); i += ETHERNET_ADDR_SIZE)
{
if (memcmp(mac_address, m_multicast_list + i, ETHERNET_ADDR_SIZE) == 0)
{
return 1;
}
}
return 0;
}
@ -896,19 +903,6 @@ void threecom3c505_device::recv_cb(UINT8 *data, int length)
}
}
bool threecom3c505_device::mcast_chk(const UINT8 *buf, int len) {
int i;
for (i = 0; i + ETHERNET_ADDR_SIZE < sizeof(m_multicast_list); i += ETHERNET_ADDR_SIZE)
{
if (memcmp(buf, m_multicast_list + i, ETHERNET_ADDR_SIZE) == 0)
{
LOG2(("threecom3c505_device::mcast_chk: true (len=%d)", len));
return true;
}
}
return false;
}
void threecom3c505_device::write_command_port( UINT8 data)
{
LOG2(("writing 3C505 command port %02x - m_status=%02x m_control=%02x m_command_index=%02x", data, m_status, m_control, m_command_index));

View File

@ -163,7 +163,6 @@ public:
static void static_set_interface(device_t &device, const threecom3c505_interface &interface);
void recv_cb(UINT8 *buf, int len);
bool mcast_chk(const UINT8 *buf, int len);
// device register I/O
UINT8 read_port(offs_t offset);

View File

@ -132,7 +132,9 @@ void dp8390_device::recv(UINT8 *buf, int len) {
offset = start + 4;
high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
if(buf[0] & 1) {
if(!(m_regs.rcr & 4) && !memcmp((const char *)buf, "\xff\xff\xff\xff\xff\xff", 6)) return;
if(!memcmp((const char *)buf, "\xff\xff\xff\xff\xff\xff", 6)) {
if(!(m_regs.rcr & 4)) return;
} else return; // multicast
m_regs.rsr = 0x20;
} else m_regs.rsr = 0;
len &= 0xffff;
@ -161,12 +163,6 @@ void dp8390_device::recv_cb(UINT8 *buf, int len) {
if(!LOOPBACK) recv(buf, len);
}
bool dp8390_device::mcast_chk(const UINT8 *buf, int len) {
if(!(m_regs.rcr & 8)) return false;
return false; // TODO: multicast
}
WRITE_LINE_MEMBER(dp8390_device::dp8390_cs) {
m_cs = state;
}

View File

@ -33,7 +33,6 @@ public:
DECLARE_WRITE_LINE_MEMBER( dp8390_cs );
DECLARE_WRITE_LINE_MEMBER( dp8390_reset );
void recv_cb(UINT8 *buf, int len);
bool mcast_chk(const UINT8* buf, int len);
protected:
// device-level overrides

View File

@ -79,11 +79,6 @@ void mb8795_device::recv_cb(UINT8 *buf, int len)
receive();
}
bool mb8795_device::mcast_chk(const UINT8 *buf, int len)
{
return true;
}
READ8_MEMBER(mb8795_device::txstat_r)
{
// fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc());

View File

@ -43,7 +43,6 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
virtual void recv_cb(UINT8 *buf, int len);
virtual bool mcast_chk(const UINT8* buf, int len);
private:
enum { TIMER_TX, TIMER_RX };

View File

@ -81,7 +81,9 @@ int netdev_tap::recv_dev(UINT8 **buf)
{
int len;
if(m_fd == -1) return 0;
len = read(m_fd, m_buf, sizeof(m_buf));
do {
len = read(m_fd, m_buf, sizeof(m_buf));
} while(!get_promisc() && memcmp(get_mac(), m_buf, 6));
*buf = m_buf;
return (len == -1)?0:len;
}