Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why don't we reply arp request for specific mac address #140

Open
578141611 opened this issue Jan 6, 2021 · 5 comments
Open

why don't we reply arp request for specific mac address #140

578141611 opened this issue Jan 6, 2021 · 5 comments

Comments

@578141611
Copy link

I encounter a situation in win10 like the picture.
image
I open the nic with tun mode,then the mac address of gateway is generated by nic driver.but I find the code of arp response only accept broadcast type.while the arp cahe expired the system will send specific mac address for checking.

@cron2
Copy link
Contributor

cron2 commented Jan 6, 2021 via email

@578141611
Copy link
Author

Excatly, I use tun2socks to open nic tap6 with tun mode,but there is a customer can not get ip packet via wireshark,so I check the code of tap6.I find the is limit for arp reply.
//----------------------------------------------- // Is this the kind of packet we are looking for? //----------------------------------------------- if (src->m_Proto == htons (NDIS_ETH_TYPE_ARP) && MAC_EQUAL (src->m_MAC_Source, Adapter->PermanentAddress) && MAC_EQUAL (src->m_ARP_MAC_Source, Adapter->PermanentAddress) && ETH_IS_BROADCAST(src->m_MAC_Destination) && src->m_ARP_Operation == htons (ARP_REQUEST) && src->m_MAC_AddressType == htons (MAC_ADDR_TYPE) && src->m_MAC_AddressSize == sizeof (MACADDR) && src->m_PROTO_AddressType == htons (NDIS_ETH_TYPE_IPV4) && src->m_PROTO_AddressSize == sizeof (IPADDR) && src->m_ARP_IP_Source == adapter_ip && (src->m_ARP_IP_Destination & ip_netmask) == ip_network && src->m_ARP_IP_Destination != adapter_ip)
ETH_IS_BROADCAST(src->m_MAC_Destination)
2.0.0.1 is the ip address if nic,2.0.0.4 is the geteway.

@578141611
Copy link
Author

578141611 commented Jan 8, 2021

I want modify little code ,follows down.
ETH_IS_BROADCAST(src->m_MAC_Destination)

to

ETH_IS_BROADCAST(src->m_MAC_Destination) || MAC_EQUAL (src->m_MAC_Destination, mac)

according rfc 826
https://tools.ietf.org/html/rfc826

Another alternative is to have a daemon perform the timeouts.
After a suitable time, the daemon considers removing an entry.
It first sends (with a small number of retransmissions if needed)
an address resolution packet with opcode REQUEST directly to the
Ethernet address in the table. If a REPLY is not seen in a short
amount of time, the entry is deleted. The request is sent
directly so as not to bother every station on the Ethernet. Just
forgetting entries will likely cause useful information to be
forgotten, which must be regained.

@578141611
Copy link
Author

@cron2
Wish your reply, sincerely.

@cron2
Copy link
Contributor

cron2 commented Jan 16, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants