hyperboria / bugs

Peer-to-peer IPv6 networking, secure and near-zero-conf.
153 stars 17 forks source link

Make ETHInterface bind:all ignore unconfigured devices #183

Open yangm97 opened 6 years ago

yangm97 commented 6 years ago

The current default config (bind:all) won't let cjdroute start up on macOS. It floods the logs with Error writing to eth device [Device not configured] and dies.

Besides, I believe it would be useful if interfaces were checked constantly instead of just on startup. Imagine a notebook, it could, on a single day, switch from wired ethernet to wifi connections, use bluetooth hotspots, etc. You get the idea.

wfleurant commented 6 years ago

if you can find out where the exit is hit in (i think) interface/ETHInterface_darwin.c may be you could fix up the section to prevent it from calling on cjd's exception_throw code

List* ETHInterface_listDevices(struct Allocator* alloc, struct Except* eh)
{
    List* out = List_new(alloc);
    struct ifaddrs* ifaddr = NULL;
    if (getifaddrs(&ifaddr) || ifaddr == NULL) {
        Except_throw(eh, "getifaddrs() -> errno:%d [%s]", errno, strerror(errno));
    }

...

may be instead of the Except_throw just comment it out and see what breaks? Not really recomended but I did something similiar to the _linux.c code (i made it throw cjds exception call, leaving systemd to restart it) This isn't the right way to do it, obviously. Alternatively, you can also use the cjdns api to add (and remove) eth-interfaces. Let us know if you make progress here :]

yangm97 commented 6 years ago

While commenting that exception did make cjdroute start up, by looking at tcpdump, it seems like it is not broadcasting peer packets into any interface.