network: wiznet: zeroconf
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues regarding this feature, and didn't find any.
Description
Working with boards with a wiznet ethernet interface, sometimes there isn't a DHCP server.
So, in this scenario, the interface is unusable.
It is easy to develop a zeroconf
implementation to auto assign a IP address without DHCP server.
Zeroconf checks if an IP address is in use (by other network peers) doing ARP requests.
Problem: the class WIZNET5K has the method send_ethernet but not a read_ethernet
I have written, pure python, two function:
arp_probe : about 40 lines
zeroconf : 13 lines
At the moment I can send ARP probes but not check the peers replies... so my zeroconf return a (random) IP address that theoretically can collide with other peers.
Are there other boards with a Ethernet interface that could benefit of zeroconf ?
Class WIZNET5K: if I wtore a PR to add read_ethernet, will the maintainers accept it ?
Code Size
I see in [network_wiznet5k.c(https://github.com/micropython/micropython/blob/30a9ccf4caa72c62cb8656a1572518fef34b08a4/extmod/network_wiznet5k.c#L248)
there are the two functions:
- wiznet5k_send_ethernet
- wiznet5k_recv_ethernet
wiznet5k_send_ethernet is already available to Python, see https://github.com/micropython/micropython/issues/15169
I think adding a wrapper also for wiznet5k_recv_ethernet will take few bytes.
Implementation
- I intend to implement this feature and would submit a Pull Request if desirable.
- I hope the MicroPython maintainers or community will implement this feature.
- I would like to Sponsor development of this feature.
network: wiznet: send_ethernet
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues and didn't find any that matched.
Documentation URL
https://docs.micropython.org/en/latest/library/network.WIZNET5K.html
Description
The nic instance has also this method: send_ethernet
It is undocumented.
I tried and it works: it permits to send raw ethernet packets on the wire.