Commit 55cdea9ed9cf2d76993e40ed7a1fc649a14db07c

Authored by Hendrik Brueckner
Committed by David S. Miller
1 parent 48e4cc777c

af_iucv: New error return codes for connect()

If the iucv_path_connect() call fails then return an error code that
corresponds to the iucv_path_connect() failure condition; instead of
returning -ECONNREFUSED for any failure.

This helps to improve error handling for user space applications
(e.g.  inform the user that the z/VM guest is not authorized to
connect to other guest virtual machines).

The error return codes are based on those described in connect(2).

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 15 additions and 1 deletions Side-by-side Diff

... ... @@ -494,7 +494,21 @@
494 494 if (err) {
495 495 iucv_path_free(iucv->path);
496 496 iucv->path = NULL;
497   - err = -ECONNREFUSED;
  497 + switch (err) {
  498 + case 0x0b: /* Target communicator is not logged on */
  499 + err = -ENETUNREACH;
  500 + break;
  501 + case 0x0d: /* Max connections for this guest exceeded */
  502 + case 0x0e: /* Max connections for target guest exceeded */
  503 + err = -EAGAIN;
  504 + break;
  505 + case 0x0f: /* Missing IUCV authorization */
  506 + err = -EACCES;
  507 + break;
  508 + default:
  509 + err = -ECONNREFUSED;
  510 + break;
  511 + }
498 512 goto done;
499 513 }
500 514