[mythtv-commits] Ticket #12034: Ping incorrectly sets the TTL rather than the timeout - setting an http proxy fails

MythTV noreply at mythtv.org
Tue Jan 28 04:06:42 UTC 2014


#12034: Ping incorrectly sets the TTL rather than the timeout - setting an http
proxy fails
-------------------------------------------------+-------------------------
     Reporter:  Greg Brackley <greg.brackley-    |      Owner:
  mythtv-trac-2014@…>                            |     Status:  new
         Type:  Bug Report - General             |  Milestone:  unknown
     Priority:  minor                            |    Version:  Unspecified
    Component:  MythTV - General                 |   Keywords:
     Severity:  medium                           |
Ticket locked:  0                                |
-------------------------------------------------+-------------------------
 The function:
 {{{
   bool ping(const QString &host, int timeout) file mythmiscutil.cpp line
 220
 }}}
 has a timeout parameter, but in both the win32 and other code paths it is
 passed as a TTL parameter.

 This means attempts to ping a host more than one hop away will fail. If I
 run the command manually it fails as I would expect:
 {{{
 # ping -t 1 -c 1 proxy.lucidsolutions.co.nz
 PING proxy.lucidsolutions.co.nz (10.20.5.3) 56(84) bytes of data.
 From gbe-12.orange.lucidsolutions.co.nz (10.20.12.1) icmp_seq=1 Time to
 live exceeded

 --- proxy.lucidsolutions.co.nz ping statistics ---
 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 1ms
 }}}

 The function:
 {{{
   void setHttpProxy(void), file mythmiscutil.cpp line 831
 }}}
 uses the ping function to check if the proxy is available. My proxy is on
 another network.  When I run mythfilldatabase I get the error:

 {{{
 E  setHttpProxy() - cannot locate host proxy.lucidsolutions.co.nz
                         Please check HTTP_PROXY environment variable!
 }}}

 I am having this issue with 0.27. The code appears to be the same on
 master.

 == Fix ==

 The non-WIN32 ping command is:
 {{{
  QString cmd = QString("ping -t %1 -c 1 %2 >/dev/null 2>&1")
                   .arg(timeout).arg(host);
 }}}

 I think the '-t' option should be '-W'.

 The WIN32 ping command is:
 {{{
     QString cmd = QString("%systemroot%\\system32\\ping.exe -i %1 -n 1
 %2>NUL")
                   .arg(timeout).arg(host);
 }}}
 I think it should use the '-w' switch instead of '-i' and convert the 1
 second to 1000 milli-seconds.

 I believe the current code will appear to work if the proxy is on the same
 network as the machine running the mythtv code. If the proxy is down, then
 the intended short timeout behaviour will not be observed.

 == Links ==
 [https://github.com/MythTV/mythtv/blob/fixes/0.27/mythtv/libs/libmythbase/mythmiscutil.cpp]
 [https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythbase/mythmiscutil.cpp]

--
Ticket URL: <http://code.mythtv.org/trac/ticket/12034>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list