Project

General

Profile

Bug #474

ddns-myip on ruby 1.9.1 fails to answer

Added by Guillaume Walck over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Category:
ddns-client
Start date:
2015-08-24
Due date:
% Done:

100%

Estimated time:
Patch Available:
Found in Versions:
Confirmed:
No
Security:
Help Needed:

Description

Function is blocking when an ipv6 interace is up but another interface is tested.

ddns-myip eth6
CTRL-C
/usr/lib/ruby/vendor_ruby/curl/easy.rb:58:in `perform': Interrupt
    from /usr/lib/ruby/vendor_ruby/curl/easy.rb:58:in `perform'
    from /usr/local/lib/site_ruby/1.9.1/ddns/myip.rb:46:in `find'
    from /usr/bin/ddns-myip:34:in `<main>'

DPKG info

ii  libcurl3-gnutls:i386     7.36.0-1          i386              easy-to-use client-side URL transfer library

if my eth3 which has ipv4 and ipv6 links is down, and eth6 with only ipv4 link is up I can get

curl --interface eth6 https://myip.duckcorp.org/
---
ip: 85.171.xxx.yyy

non-blocking

if eth3 is up and eth6 is up

 curl -v --interface eth6 https://myip.duckcorp.org/
* Hostname was NOT found in DNS cache
*   Trying 2001:67c:1740:aaaa::bbbb:cccc

blocking there.

after modifying the code as request to do printouts

client_config.profiles.to_h.each_pair do |hostname, profile|
 [:ipv4, :ipv6].each do |ipver|
    ip = profile[ipver.to_s]
    p hostname
    if ip
      ip = myip.find(ipver, profile.interface) if ip == 'auto'
      ip = '' if ip == 'none'
      regip.setns(ipver, hostname, ip)
    end
  end
end

#<OpenStruct log=#<OpenStruct console_level="verbose", path="/var/log/ddns/">, myip=#<OpenStruct>, regip=#<OpenStruct url="https://ddns.duckcorp.org/", user="guihome-xxxxxxxxxxx", passwd="xxxxxxxxxxxx">, profiles=#<OpenStruct gh-parhome-nc.ddns.duckcorp.org=#<OpenStruct ipv4="auto", interface="eth6">>>
/usr/bin/ddns-client:43:in `block (2 levels) in <main>': undefined method `[]' for #<OpenStruct ipv4="auto", interface="eth6"> (NoMethodError)
    from /usr/bin/ddns-client:42:in `each'
    from /usr/bin/ddns-client:42:in `block in <main>'
    from /usr/bin/ddns-client:41:in `each_pair'
    from /usr/bin/ddns-client:41:in `<main>

Files

ddns_timeout.patch (1.5 KB) ddns_timeout.patch Marc Dequènes, 2015-08-31 22:12

Associated revisions

Revision 0f8b6fd9 (diff)
Added by Marc Dequènes over 6 years ago

[fix] adds OpenStruct#[] for older Ruby versions (refs #474)

Revision 01cb38ac (diff)
Added by Marc Dequènes over 6 years ago

[fix] adds OpenStruct#each_pair for older Ruby versions (refs #474)

History

#1

Updated by Marc Dequènes over 6 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 20

I pushed changes for older Ruby into git, but not sure it it sufficient. Could you please retry?

#2

Updated by Guillaume Walck over 6 years ago

After pulling the latest changes AND installing, I still get a blocked command on ddns-myip eth6

ddns-myip eth6
^C/usr/lib/ruby/vendor_ruby/curl/easy.rb:58:in `perform': Interrupt
    from /usr/lib/ruby/vendor_ruby/curl/easy.rb:58:in `perform'
    from /usr/local/lib/site_ruby/1.9.1/ddns/myip.rb:46:in `find'
    from /usr/bin/ddns-myip:34:in `<main>'

I also tested ddns-client eth6 and it return but doing nothing.
While investigating, I realized that probably the previous test given in the first issue report, was not actually applying the changes requested because I was running in a local setup which apparently did not override a past real installation and was still calling this installed bin. So now I install every time I test and I got some interesting results :

The to_h function is needed otherwise the content of

client_config.profiles.each_pair

is nil

with to_h it executes the next commands and the new lang_additions.rb fixed the OpenStruct access. I get now

 ddns-client eth6
[ INFO - 2015-08-31 00:20:22] Updated ipv4 'gh-xxxxxxxx.ddns.duckcorp.org' to 'AAA.BBB.CCC.DDD' successfully

ddns-myip probably still blocks on ipv6 test due to curl issues while ddns-client looks only for interfaces set in the profile.

just to sum up
this patch fixes ddns-client

-client_config.profiles.each_pair do |hostname, profile|
+client_config.profiles.to_h.each_pair do |hostname, profile|

but ddns-myip still blocks

#3

Updated by Marc Dequènes over 6 years ago

In fact this patch was pending since February but I missed it somehow. I was not very happy about this change and decided to it another way. It should give you the same result. Could you please test it?

As for Curl hanging, I'm not sure if we can do something without upgrading or even patching it. Nevertheless there is a timeout parameter which could be nice in any case, but I would like to test it first before inclusion. Could you then test the attached patch with the necessary parameter in the configuration file?

#4

Updated by Guillaume Walck over 6 years ago

patch is working. ddns-myip now finishes if no answer from server or interface has ipv6 and such.

as for curl hanging a while, it also was influenced by a surprisingly slow dns of my ISP. Solved thanks to you suggestions by using unbound.

#5

Updated by Marc Dequènes over 6 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 30 to 100

Also available in: Atom PDF