Skip to content

AI_ADDRCONFIG dropping loopback in IPv6 only network with IPv4 loopback #14

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
skrivy opened this issue Feb 12, 2020 · 0 comments
Open

Comments

@skrivy
Copy link

skrivy commented Feb 12, 2020

Testing environment:

  • Network configuration:
root@test:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
48: eth0@if49: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:62:e8:9f brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet6 2001:db8::1/64 scope global mngtmpaddr dynamic
       valid_lft 86103sec preferred_lft 14103sec
    inet6 fe80::216:3eff:fe62:e89f/64 scope link
       valid_lft forever preferred_lft forever
  • Memcached listening on IPv4 loopback:
root@test:~# lsof -n -i -P | grep 11211
memcached 8655 memcache   26u  IPv4 18850563      0t0  TCP 127.0.0.1:11211 (LISTEN)
  • Memcached is working properly - telnet 127.0.0.1 11211 with commands work fine

Test script:

#!/usr/bin/perl

use Cache::Memcached::Fast;

my $memcached = Cache::Memcached::Fast->new({
        'servers'            => [ '127.0.0.1:11211' ],
});

# Ensure we can actually talk to the memcached server
my $ismemcached = $memcached->set('ismemcached','1');
unless ($ismemcached) {
    warn "\nNOT WORKING\n";
}

However, when I reconfigure memcached to listen on IPv6 as well and update the code:

-        'servers'            => [ '127.0.0.1:11211' ],
+        'servers'            => [ '::1:11211' ],

Everything works as expected.

Culprit:

https://github.com/JRaspass/Cache-Memcached-Fast/blob/master/src/connect.c#L44

Is there any reason to set AI_ADDRCONFIG flag in this library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant