mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
dinetwork: remove mcast_chk and check for multicast in recv (nw)
netdev_tap: do mac filtering (nw)
This commit is contained in:
parent
a4de4e1876
commit
36201eba9d
@ -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)
|
void device_network_interface::set_promisc(bool promisc)
|
||||||
{
|
{
|
||||||
m_promisc = promisc;
|
m_promisc = promisc;
|
||||||
|
@ -19,7 +19,6 @@ public:
|
|||||||
|
|
||||||
int send(UINT8 *buf, int len);
|
int send(UINT8 *buf, int len);
|
||||||
virtual void recv_cb(UINT8 *buf, int len);
|
virtual void recv_cb(UINT8 *buf, int len);
|
||||||
virtual bool mcast_chk(const UINT8 *buf, int len);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_promisc;
|
bool m_promisc;
|
||||||
|
@ -855,6 +855,13 @@ int threecom3c505_device::ethernet_packet_is_for_me(const UINT8 mac_address[])
|
|||||||
return 1;
|
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;
|
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)
|
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));
|
LOG2(("writing 3C505 command port %02x - m_status=%02x m_control=%02x m_command_index=%02x", data, m_status, m_control, m_command_index));
|
||||||
|
@ -163,7 +163,6 @@ public:
|
|||||||
static void static_set_interface(device_t &device, const threecom3c505_interface &interface);
|
static void static_set_interface(device_t &device, const threecom3c505_interface &interface);
|
||||||
|
|
||||||
void recv_cb(UINT8 *buf, int len);
|
void recv_cb(UINT8 *buf, int len);
|
||||||
bool mcast_chk(const UINT8 *buf, int len);
|
|
||||||
|
|
||||||
// device register I/O
|
// device register I/O
|
||||||
UINT8 read_port(offs_t offset);
|
UINT8 read_port(offs_t offset);
|
||||||
|
@ -132,7 +132,9 @@ void dp8390_device::recv(UINT8 *buf, int len) {
|
|||||||
offset = start + 4;
|
offset = start + 4;
|
||||||
high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
|
high16 = (m_regs.dcr & 4)?m_regs.rsar<<16:0;
|
||||||
if(buf[0] & 1) {
|
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;
|
m_regs.rsr = 0x20;
|
||||||
} else m_regs.rsr = 0;
|
} else m_regs.rsr = 0;
|
||||||
len &= 0xffff;
|
len &= 0xffff;
|
||||||
@ -161,12 +163,6 @@ void dp8390_device::recv_cb(UINT8 *buf, int len) {
|
|||||||
if(!LOOPBACK) recv(buf, 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) {
|
WRITE_LINE_MEMBER(dp8390_device::dp8390_cs) {
|
||||||
m_cs = state;
|
m_cs = state;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ public:
|
|||||||
DECLARE_WRITE_LINE_MEMBER( dp8390_cs );
|
DECLARE_WRITE_LINE_MEMBER( dp8390_cs );
|
||||||
DECLARE_WRITE_LINE_MEMBER( dp8390_reset );
|
DECLARE_WRITE_LINE_MEMBER( dp8390_reset );
|
||||||
void recv_cb(UINT8 *buf, int len);
|
void recv_cb(UINT8 *buf, int len);
|
||||||
bool mcast_chk(const UINT8* buf, int len);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
|
@ -79,11 +79,6 @@ void mb8795_device::recv_cb(UINT8 *buf, int len)
|
|||||||
receive();
|
receive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mb8795_device::mcast_chk(const UINT8 *buf, int len)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
READ8_MEMBER(mb8795_device::txstat_r)
|
READ8_MEMBER(mb8795_device::txstat_r)
|
||||||
{
|
{
|
||||||
// fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc());
|
// fprintf(stderr, "mb8795: txstat_r %02x (%08x)\n", txstat, space.device().safe_pc());
|
||||||
|
@ -43,7 +43,6 @@ protected:
|
|||||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
|
||||||
virtual void recv_cb(UINT8 *buf, int len);
|
virtual void recv_cb(UINT8 *buf, int len);
|
||||||
virtual bool mcast_chk(const UINT8* buf, int len);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { TIMER_TX, TIMER_RX };
|
enum { TIMER_TX, TIMER_RX };
|
||||||
|
@ -81,7 +81,9 @@ int netdev_tap::recv_dev(UINT8 **buf)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
if(m_fd == -1) return 0;
|
if(m_fd == -1) return 0;
|
||||||
|
do {
|
||||||
len = read(m_fd, m_buf, sizeof(m_buf));
|
len = read(m_fd, m_buf, sizeof(m_buf));
|
||||||
|
} while(!get_promisc() && memcmp(get_mac(), m_buf, 6));
|
||||||
*buf = m_buf;
|
*buf = m_buf;
|
||||||
return (len == -1)?0:len;
|
return (len == -1)?0:len;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user