Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
network plugin does not allow `localhost` #2203
Steps to Reproduce the Problem
I can confirm that I can ping localhost.
kdb mount test.conf /network dump network kdb setmeta spec/network/addr check/ipaddr "" kdb set /network/addr localhost #>Using name system/network/addr #>The command kdb set failed while accessing the key database with the info: #>Sorry, the error (#51) occurred ;( #>Description: value of key is not a valid IP Address #>Reason: name: system/network/addr value: localhost message: Name or service not known #>Ingroup: plugin #>Module: network #>At: /media/wespe/extended/repository/piankero-libelektra/src/plugins/network/network.c:90 #>Mountpoint: system/network #>Configfile: /etc/kdb/test.conf.31841:1534931163.130183.tmp kdb set /network/addr 127.0.0.1 #> Using name system/network/addr #> Set string to "127.0.0.1"
Thank you for reporting the issue!
The problem is, that we have
The patch should be trivial but we need to design how the metadata should look like. It should be consistent with check/port as proposed in #2169 where we have the same problem (some applications might allow non-numeric ports, others might not).
Maybe the best way is that we always allow non-numeric names (for both IP and ports) but let the plugin transform to a numeric name. This way applications would always work, irrelevant if they themselves pass AI_NUMERICHOST.
Who would look at the flag?
I think the transformation would be better. In the error message we would need to make sure that also the original setting is mentioned, so something like:
Cannot bind to IP "127.0.0.1" as resolved from configuration value "localhost".
Let me put it into other words (or better pseudocode):
The code basically checks if it starts with a string [A-Za-z] and assumes a non-numeric name and makes
http://man7.org/linux/man-pages/man3/gethostbyname.3.html does the dns request.
Isn't this possible?