On Tue, Oct 18, 2016 at 08:35:56AM +0200, Richard Cochran wrote: > On Mon, Oct 17, 2016 at 05:16:21PM +0200, Miroslav Lichvar wrote: > > I'm testing this, but I'm not sure if it's working correctly. When I > > take the interface down I see a "link up" message from ptp4l. When I > > bring it up, there is another "link up" message. > > I only tested by pulling the cable! A quick test with ifdown works > for me. Does the link actually go down after "ifdown ethX"? Maybe > there is a seperate rtnl message for ifup/down...
It looks like ifdown with NetworkManager doesn't really take down the interface, it just removes its addresses. When I take it down manually with "ip", it seems to be working as expected. Sorry for the noise. Would it be possible to make the netlink socket optional? If it can't be opened (e.g. in a simulated environment), I think it would be nice if it worked as before. I was thinking something like this: diff --git a/clock.c b/clock.c index dd0c631..09c737f 100644 --- a/clock.c +++ b/clock.c @@ -272,7 +272,8 @@ void clock_destroy(struct clock *c) LIST_FOREACH_SAFE(p, &c->ports, list, tmp) { clock_remove_port(c, p); } - rtnl_close(c->pollfd[0].fd); + if (c->pollfd[0].fd >= 0) + rtnl_close(c->pollfd[0].fd); port_close(c->uds_port); free(c->pollfd); hash_destroy(c->index2port, NULL); @@ -1124,9 +1125,6 @@ struct clock *clock_create(enum clock_type type, struct config *config, /* Open a RT netlink socket. */ c->pollfd[0].fd = rtnl_open(); - if (c->pollfd[0].fd < 0) { - return NULL; - } c->pollfd[0].events = POLLIN|POLLPRI; /* Create the UDS interface. */ @@ -1156,7 +1154,8 @@ struct clock *clock_create(enum clock_type type, struct config *config, port_dispatch(p, EV_INITIALIZE, 0); } port_dispatch(c->uds_port, EV_INITIALIZE, 0); - rtnl_link_query(c->pollfd[0].fd); + if (c->pollfd[0].fd >= 0) + rtnl_link_query(c->pollfd[0].fd); return c; } -- Miroslav Lichvar ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel