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

Already on GitHub? Sign in to your account

pmcd wants to bind on ipv6 event if it is disabled #102

Closed
test-account-0 opened this Issue Aug 2, 2016 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

test-account-0 commented Aug 2, 2016

On ubuntu/debian when PMCD_LOCAL=1 is set, when starting pmcd (service pmcd start) a message appears:

Starting pmcd ... [Tue Aug  2 11:13:31] pmcd(31925) Error: OpenRequestSocket(44321, INADDR_LOOPBACK, ipv6) __pmBind: Cannot assign requested address

ipv6 is disabled through sysctls

Contributor

dbrolley commented Aug 3, 2016

On 08/02/2016 07:50 AM, test-account-0 wrote:

On ubuntu/debian when PMCD_LOCAL=1 is set, when starting pmcd (service
pmcd start) a message appears:

|Starting pmcd ... [Tue Aug 2 11:13:31] pmcd(31925) Error: OpenRequestSocket(44321, INADDR_LOOPBACK, ipv6) __pmBind: Cannot assign requested address
|

ipv6 is disabled through sysctls

There are a couple of things to address here.

The code which detects whether ipv6 is enabled is in
src/libpcp/src/config.c:

static const char *
ipv6_enabled(void)
{
#if defined(IS_LINUX)
return access("/proc/net/if_inet6", F_OK) == 0 ? enabled() :
disabled();
#else
return enabled();
#endif
}

This code is reached when calling __pmGetAPIConfig("ipv6"), which is
what pmcd does.

Secondly, setting PMCD_LOCAL in the environment causes pmcd to call

__pmServerSetFeature(PM_SERVER_FEATURE_LOCAL)

but I can't see where __pmServerHasFeature(PM_SERVER_FEATURE_LOCAL) is
ever called. As far as I can tell, this feature has no effect on pmcd.

Dave

Contributor

natoscott commented Aug 3, 2016

__pmServerSetFeature(PM_SERVER_FEATURE_LOCAL)

In this case, the above call is performed (pmcd main.c) solely to ensure the pmcd.feature.local metric can export that setting.

but I can't see where __pmServerHasFeature(PM_SERVER_FEATURE_LOCAL) is ever called. As > far as I can tell, this feature has no effect on pmcd.

All of the work is done in pmcd main.c so it turns out there's no need to test it using that interface (unlike most of the other feature flags).

Contributor

dbrolley commented Aug 4, 2016

On 08/03/2016 06:07 PM, Nathan Scott wrote:

__pmServerSetFeature(PM_SERVER_FEATURE_LOCAL)

In this case, the above call is performed (pmcd main.c) solely to
ensure the pmcd.feature.local metric can export that setting.

but I can't see where
__pmServerHasFeature(PM_SERVER_FEATURE_LOCAL) is ever called. As >
far as I can tell, this feature has no effect on pmcd.

All of the work is done in pmcd main.c so it turns out there's no need
to test it using that interface (unlike most of the other feature flags).

OK, so the main issue is that the implementation of ipv6_enabled() is
inadequate for detecting that ipv6 is disabled on this platform. I have
no idea how to fix this.

The behaviour of PMCD_LOCAL is a secondary issue. It is correctly adding
the loopback (INADDR_LOOPBACK) interface and disabling the use of
INADDR_ANY, but it does not prevent the use of the -i option to add
other interfaces. The man page suggests that -i should perhaps be
disabled in this mode.

Dave

Contributor

natoscott commented Aug 4, 2016 edited

OK, so the main issue is that the implementation of ipv6_enabled() is
inadequate for detecting that ipv6 is disabled on this platform.

+1

I have no idea how to fix this.

It looks like sysctl uses values from /proc/sys/net/ipv6/conf/*/disable_ipv6;
that might form the basis for a more robust implementation. Looks like
it can be disabled globally ("default") and/or per-interface.

[...] does not prevent the use of the -i option to add
other interfaces. The man page suggests that -i should perhaps be
disabled in this mode.

Yeah, and/or we could make use of the per-interface enabled/disabled
state from those procfs files.

cheers.

Contributor

natoscott commented Sep 28, 2016

Dave's fix for this was merged a few weeks back.

@natoscott natoscott closed this Sep 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment