On Sat, 2014-11-01 at 04:44 +0100, Christian Hofstaedtler wrote: > I've tried to debug this a bit more tonight, and after a good 4 > hours there are two things I can report: > > 1. with the default ruleset, udev leaks an ethtool socket to > net.agent (and by extension to ifup, dhclient, ...)
This is a bug but probably harmless. SIOCETHTOOL doesn't depend on any
socket state so it is normally used with an unconnected socket of an
arbitrary address family.
[...]
> A patch for #1 that totally ignores error branches, but could serve
> as a starting point for somebody else:
>
> --- systemd-215/src/udev/net/link-config.c 2014-11-01 04:40:50.000000000
> +0100
> +++ systemd-215.ch/src/udev/net/link-config.c 2014-11-01 04:41:50.603183984
> +0100
> @@ -130,6 +130,16 @@
> }
> }
>
> +void link_config_ctx_disconnect(link_config_ctx *ctx) {
> + if (!ctx)
> + return;
> +
> + safe_close(ctx->ethtool_fd);
> + ctx->ethtool_fd = -1;
> + sd_rtnl_unref(ctx->rtnl);
> + ctx->rtnl = NULL;
> +}
> +
[...]
I think the proper fix for #1 is:
--- a/src/udev/net/ethtool-util.c
+++ b/src/udev/net/ethtool-util.c
@@ -53,7 +53,7 @@ int ethtool_connect(int *ret) {
assert_return(ret, -EINVAL);
- fd = socket(PF_INET, SOCK_DGRAM, 0);
+ fd = socket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (fd < 0) {
return -errno;
}
--- END ---
Ben.
--
Ben Hutchings
Kids! Bringing about Armageddon can be dangerous. Do not attempt it in
your own home. - Terry Pratchett and Neil Gaiman, `Good Omens'
signature.asc
Description: This is a digitally signed message part

