From: Hans-Joachim Picht <hpicht@redhat.com> Date: Fri, 27 Feb 2009 20:51:35 +0100 Subject: [s390] af_iucv: new error return codes for connect Message-id: 20090227195135.GP2447@redhat.com O-Subject: [RHEL5 U4 PATCH 2/7] s390 - af_iucv: New error return codes for connect() Bugzilla: 487697 Description ============ 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). Bugzilla ========= BZ 487697 https://bugzilla.redhat.com/show_bug.cgi?id=487697 Upstream status of the patch: ============================= This patch is included in linux-2.6 as git commit 55cdea9ed9cf2d76993e40ed7a1fc649a14db07c Test status: ============ The patch has been tested and fixes the problem. The fix has been verified by the IBM test department. Please ACK. With best regards, --Hans diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 8038be3..acaa174 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -494,7 +494,21 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr, if (err) { iucv_path_free(iucv->path); iucv->path = NULL; - err = -ECONNREFUSED; + switch (err) { + case 0x0b: /* Target communicator is not logged on */ + err = -ENETUNREACH; + break; + case 0x0d: /* Max connections for this guest exceeded */ + case 0x0e: /* Max connections for target guest exceeded */ + err = -EAGAIN; + break; + case 0x0f: /* Missing IUCV authorization */ + err = -EACCES; + break; + default: + err = -ECONNREFUSED; + break; + } goto done; }