Bug 15126 - getent returning ipv6 value in a ipv4 setup.
Summary: getent returning ipv6 value in a ipv4 setup.
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Base system maintainers
QA Contact:
URL:
Whiteboard:
Keywords: 6sta2
Depends on:
Blocks:
 
Reported: 2015-01-24 17:03 CET by Bit Twister
Modified: 2018-09-09 01:50 CEST (History)
3 users (show)

See Also:
Source RPM: glibc-2.28-7.mga7.src.rpm
CVE:
Status comment:


Attachments

Description Bit Twister 2015-01-24 17:03:33 CET
Description of problem:

getent returning ipv6 value in a ipv4 setup.


$ grep ^hosts: /etc/nsswitch.conf
hosts: files dns myhostname


$ getent hosts localhost
::1             localhost

$ dig +short localhost
127.0.0.1


$ getent hosts $(hostname)
::1             wb.home.test


$ dig +short $(hostname)
192.168.0.132


avahi is disabled
$ systemctl status avahi-daemon | grep -i active
   Active: inactive (dead)

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    10     0        0 enp3s0
192.168.0.0     0.0.0.0         255.255.255.0   U     10     0        0 enp3s0

Version-Release number of selected component (if applicable):


How reproducible: Always


Steps to Reproduce:
1. getent hosts localhost
2. getent hosts $(hostname)




Reproducible: 

Steps to Reproduce:
Comment 1 Thomas Backlund 2015-01-24 17:37:53 CET
that's by upstream design (and have been for a very long time).

if an ipv6 address is available, it will always return it, if not it will return an ipv4 one.

you need to completely block out ipv6 init if you want to enforce ipv4

CC: (none) => tmb

Comment 2 Bit Twister 2015-01-24 18:02:04 CET
(In reply to Thomas Backlund from comment #1)
> that's by upstream design (and have been for a very long time).
> 
> if an ipv6 address is available, it will always return it, if not it will
> return an ipv4 one.

Well guessing that is causing my cups service problems in a default out of the box setup.

> you need to completely block out ipv6 init if you want to enforce ipv4

Any idea what systemd service/trigger I need to disable/mask?
Comment 3 Thomas Backlund 2015-01-24 18:30:40 CET
(In reply to Bit Twister from comment #2)
> (In reply to Thomas Backlund from comment #1)
> > that's by upstream design (and have been for a very long time).
> > 
> > if an ipv6 address is available, it will always return it, if not it will
> > return an ipv4 one.
> 
> Well guessing that is causing my cups service problems in a default out of
> the box setup.
> 

Why ? ::1 matches localhost, so it's available... 

> > you need to completely block out ipv6 init if you want to enforce ipv4
> 
> Any idea what systemd service/trigger I need to disable/mask?

Not an systemd thing... it's lower level... you need to block ipv6 module from loading / initializing...

Something like:
echo "alias net-pf-10 off" >> /etc/modprobe.d/disable-ipv6.conf
echo "blacklist ipv6" >>/etc/modprobe.d/disable-ipv6.conf
echo "options ipv6 disable=1" >>/etc/modprobe.d/disable-ipv6.conf

and reboot.


The first line blocks auto-loading
The second line blocks alias loading
The third line ensures it stays disabled even if someone / something force loads the ipv6 module.
Comment 4 Bit Twister 2015-01-24 19:19:12 CET
(In reply to Thomas Backlund from comment #3)
> (In reply to Bit Twister from comment #2)
> > (In reply to Thomas Backlund from comment #1)
> > > that's by upstream design (and have been for a very long time).
> > > 
> > > if an ipv6 address is available, it will always return it, if not it will
> > > return an ipv4 one.
> > 
> > Well guessing that is causing my cups service problems in a default out of
> > the box setup.
> > 
> 
> Why ? ::1 matches localhost, so it's available... 

It may be but default cups /etc/cups/cupsd.conf Listen directive is
   Listen *:631
which will cause an 
     Jan 24 12:12:58 wb.home.test cupsd[23936]: Unable to open listen socket
     for address [v1.::]:631 - Address family not supported by protocol.
error, which will cause unable to open socket problem when I turn the printer on.
Comment 5 David Walser 2015-01-26 21:48:58 CET
Sounds like a CUPS bug then.
Comment 6 Bit Twister 2015-01-28 11:19:41 CET
(In reply to David Walser from comment #5)
> Sounds like a CUPS bug then.

I would not think so. If ipv6 is disabled during install, then getent should not be returning something like
$ getent hosts $(hostname)
::1             wb.home.test

instead of
$ dig +short $(hostname)
192.168.0.132
Samuel Verschelde 2015-05-31 23:36:34 CEST

Whiteboard: (none) => MGA5TOO

Comment 7 Bit Twister 2016-07-06 22:04:41 CEST
(In reply to Thomas Backlund from comment #3)

> Not an systemd thing... it's lower level... you need to block ipv6 module
> from loading / initializing...

Was still getting applications running ipv6 connections before modprobe commands  gained control or my /etc/sysctl.d/ ipv6 disables.

Workaround is add  ipv6.disable=1 to kernel boot arguments.

Summary: 5b2: getent returning ipv6 value in a ipv4 setup. => 6_s1: getent returning ipv6 value in a ipv4 setup.

Samuel Verschelde 2016-11-01 11:58:27 CET

Assignee: bugsquad => basesystem

Bit Twister 2017-01-24 09:05:58 CET

Status comment: (none) => 6_s2
Summary: 6_s1: getent returning ipv6 value in a ipv4 setup. => getent returning ipv6 value in a ipv4 setup.
Source RPM: glibc-2.20-14.mga5.src.rpm => glibc-2.22-21.mga6.src.rpm

Bit Twister 2017-01-31 18:39:19 CET

Keywords: (none) => 6sta2
Status comment: 6_s2 => (none)

Comment 8 Pascal Terjan 2017-01-31 19:12:50 CET
(In reply to Bit Twister from comment #6)
> (In reply to David Walser from comment #5)
> > Sounds like a CUPS bug then.
> 
> I would not think so. If ipv6 is disabled during install, then getent should
> not be returning something like

What do you mean by disabled?

CC: (none) => pterjan

Comment 9 Bit Twister 2017-01-31 19:39:14 CET
(In reply to Pascal Terjan from comment #8)
> > I would not think so. If ipv6 is disabled during install, then getent should
> > not be returning something like
> 
> What do you mean by disabled?

$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-desktop root=LABEL=cauldron noiswmd ipv6.disable=1 audit=0 vga=795

$ grep ipv6 /etc/sysctl.d/xx__sysctl.conf
# disable all ipv6
# http://ask.xmodulo.com/disable-ipv6-linux.html
net.ipv6.conf.all.disable_ipv6  =  1
net.ipv6.conf.default.disable_ipv6  =  1
net.ipv6.conf.lo.disable_ipv6  =  1

$ grep -v ^# /etc/modprobe.d/20_xx__custom.conf | sort | uniq

alias net-pf-10 off
blacklist firewire-core
blacklist ipv6
blacklist thunderbolt
options ipv6 disable=1
Comment 10 Pascal Terjan 2017-01-31 19:57:14 CET
You say it was disabled during install, did all of this get written by the install?
Comment 11 Bit Twister 2017-01-31 22:53:54 CET
(In reply to Pascal Terjan from comment #10)

> You say it was disabled during install, did all of this get written
> by the install?

No. I would add ipv6.disable=1 on clean installs in boot setup. 
The rest after install, or would be there on upgrades.
Johnny A. Solbu 2017-02-17 11:47:16 CET

CC: (none) => cooker

Bit Twister 2017-05-03 13:25:25 CEST

Source RPM: glibc-2.22-21.mga6.src.rpm => glibc-2.22-24.mga6.src.rpm

Bit Twister 2018-09-09 01:50:25 CEST

Whiteboard: MGA5TOO => (none)
Source RPM: glibc-2.22-24.mga6.src.rpm => glibc-2.28-7.mga7.src.rpm


Note You need to log in before you can comment on or make changes to this bug.