Bug 616706

Summary: yast2-printer: test_* scripts should do the most meaningful test first
Product: [openSUSE] openSUSE 11.3 Reporter: Chris Rhodes <chris>
Component: YaST2Assignee: Johannes Meixner <jsmeix>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P4 - Low CC: jsmeix
Version: Factory   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 11.3   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: improved test_remote_socket

Description Chris Rhodes 2010-06-23 13:39:39 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/3.5.9-0.1.1 Firefox/3.5.9

When adding a printer via the Yast Printer Connection wizard and selecting TCP as the connection method, adding a printer fails even if the specified tcp port is open and reachable, if ICMP echo is not also allowed.   ICMP echo should not be a requirement for adding a remote printer.  A simple tcp ping on the specified port should be good enough, syn, syn/ack, ack. 

Reproducible: Always

Steps to Reproduce:
1.Add a printer from Yast.
2.Choose the connection Wizard
3.Choose TCP and fill in the blanks with the destination being a printer in a network that the client does not have ICMP echo open to.  (remote printer is Firewalled, access listed, etc...)
4.Test the connection.
Actual Results:  
Observed with TCP dump that the connection wizard was attempting ICMP echo to the printer ip address and then failing without ever attempting a tcp connection on the port specified.  (Telnet from console on the tcp port to the printer works fine)

Expected Results:  
Connection wizard should not rely on ICMP echo to check the availability of a device.  A connection to the actual TCP port specified should instead be attempted.

Thanks!
Comment 1 Johannes Meixner 2010-06-23 15:03:56 UTC
Adding auch a print queue works regardless
if the test was successful or not.
Just ignore the test result and proceed.

yast2-printer runs the script
/usr/lib/YaST2/bin/test_remote_socket
to test this kind of connection which does basically those tests:
1. ping IP
2. netcat IP port

If ping (which does ICMP echo) fails, there is an error message
(use the [Details] button to get in in the YaST GUI) 
like this:
---------------------------------------------------------------------
PING 10.11.12.13 (10.11.12.13) 56(84) bytes of data.

--- 10.11.12.13 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms

Host 10.11.12.13 unreachable (network issue or firewall active?)
---------------------------------------------------------------------

If netcat fails, there is an error message like this:
---------------------------------------------------------------------
No connection possible to port 65000 on host 10.10.11.92
(wrong port or firewall active there?)
---------------------------------------------------------------------

The connection test is just a basic connection test.

To test whether or not the whole print queue (connection plus driver)
really works, you have to print a test page.

If you run a firewall, the messages already show you
why the test may have failed in your particular case.


I will not remove the initial ping test because I like
to distinguish whether or not the IP is accessible via "ping IP"
and afterwards whether or not the particular port on this IP
is accessible (via "netcat IP port").

It works as intended and therefore the bug report is invalid.
Comment 2 Johannes Meixner 2010-06-23 15:15:44 UTC
I have an idea...
Comment 3 Johannes Meixner 2010-06-23 15:23:53 UTC
In /usr/lib/YaST2/bin/test_remote_socket
I can exchange the ordering of the tests:

If "netcat IP port" works then exit successfuly
else show the netcat-related error message and
     do "ping IP" and if this also fails
                      then show also the ping error message

Then the most meaningful "netcat IP port" test alone
is sufficient for a successful test result so that
in your particular case no ping (ICMP echo) would be
required.
Comment 4 Johannes Meixner 2010-07-01 14:12:18 UTC
Created attachment 373249 [details]
improved test_remote_socket

You may copy the attached test_remote_socket
to /usr/lib/YaST2/bin/test_remote_socket
to test and and report if this works better
in your particular case.
Comment 5 Chris Rhodes 2010-07-02 12:34:03 UTC
Thank you very much Johannes, your fix works very well for us.
Comment 6 Johannes Meixner 2010-07-02 14:02:50 UTC
I will do the same (i.e. exchange the ordering of the tests
according to comment #3) also for the other test_* scripts.
Comment 7 Johannes Meixner 2010-07-02 15:02:49 UTC
Fixed in YaST SVN revision 62178:
-----------------------------------------------------------------
Enhanced the test_* tools to do the most meaningful test first
so that ICMP echo (ping) is no longer required in any case
(see Novell/Suse Bugzilla bnc#616706).
This is an enhancement for after openSUSE 11.3
Increased VERSION to 2.19.14
-----------------------------------------------------------------
Comment 8 Johannes Meixner 2010-08-10 15:28:05 UTC
Submitted and accepted to YaST:Head via submitrequest 45299
and forwarded this to openSUSE:Factory via submitrequest 45299.
The yast2-printer RPM package version is now 2.20.0
Comment 9 Johannes Meixner 2010-08-10 15:33:15 UTC
A typo:
Submitted and accepted to YaST:Head via submitrequest 45295
and forwarded this to openSUSE:Factory via submitrequest 45299.
Comment 10 Bernhard Wiedemann 2016-04-15 11:55:09 UTC
This is an autogenerated message for OBS integration:
This bug (616706) was mentioned in
https://build.opensuse.org/request/show/45299 Factory / yast2-printer