From 836c696dc38adc0ec03fff638704ea00d5ffd0da Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 24 Nov 2012 19:47:01 -0500 Subject: [PATCH] rx: RX_INVALID_OPERATION abort unknown service only Patchset 1fbe83f9aacfc36a9c426ba1fd18ad7c72869dc1 introduced the sending of RX_INVALID_OPERATION aborts for connection attempts requesting a service not offered by the rx peer. By sending aborts for all failures of rxi_FindConnection() the set of incoming packets that are responded to is broader than simply those with non-matching serviceIds. This patchset restricts the transmission of RX_INVALID_OPERATION aborts only to the explicit case in which rxi_FindConnection() attempted to find a service and either failed to find a match or couldn't apply the requested security class/level to that service. Reviewed-on: http://gerrit.openafs.org/8512 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 81212b18b3411b538c4a1bb94732948902005beb) Change-Id: Ic732c013d6f77df991e97de7f1c5af88a194e81c Reviewed-on: http://gerrit.openafs.org/8608 Tested-by: Stephan Wiesand Tested-by: BuildBot Reviewed-by: Simon Wilkinson Reviewed-by: Paul Smeddle Reviewed-by: Stephan Wiesand --- src/rx/rx.c | 11 ++++++++--- src/rx/rx_prototypes.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 4ac971678..7982c7794 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -2910,10 +2910,12 @@ rxi_FindPeer(afs_uint32 host, u_short port, struct rx_connection * rxi_FindConnection(osi_socket socket, afs_uint32 host, u_short port, u_short serviceId, afs_uint32 cid, - afs_uint32 epoch, int type, u_int securityIndex) + afs_uint32 epoch, int type, u_int securityIndex, + int *unknownService) { int hashindex, flag, i; struct rx_connection *conn; + *unknownService = 0; hashindex = CONN_HASH(host, port, cid, epoch, type); MUTEX_ENTER(&rx_connHashTable_lock); rxLastConn ? (conn = rxLastConn, flag = 0) : (conn = @@ -2957,6 +2959,7 @@ rxi_FindConnection(osi_socket socket, afs_uint32 host, service = rxi_FindService(socket, serviceId); if (!service || (securityIndex >= service->nSecurityObjects) || (service->securityObjects[securityIndex] == 0)) { + *unknownService = 1; MUTEX_EXIT(&rx_connHashTable_lock); return (struct rx_connection *)0; } @@ -3114,6 +3117,7 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, afs_uint32 currentCallNumber; int type; int skew; + int unknownService = 0; #ifdef RXDEBUG char *packetType; #endif @@ -3169,12 +3173,13 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, conn = rxi_FindConnection(socket, host, port, np->header.serviceId, np->header.cid, np->header.epoch, type, - np->header.securityIndex); + np->header.securityIndex, + &unknownService); /* To avoid having 2 connections just abort at each other, don't abort an abort. */ if (!conn) { - if (np->header.type != RX_PACKET_TYPE_ABORT) + if (unknownService && (np->header.type != RX_PACKET_TYPE_ABORT)) rxi_SendRawAbort(socket, host, port, RX_INVALID_OPERATION, np, 0); return np; diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index d433dfeec..0a9a389a6 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -111,7 +111,8 @@ extern struct rx_connection *rxi_FindConnection(osi_socket socket, u_short serviceId, afs_uint32 cid, afs_uint32 epoch, int type, - u_int securityIndex); + u_int securityIndex, + int *unknownService); extern struct rx_packet *rxi_ReceivePacket(struct rx_packet *np, osi_socket socket, afs_uint32 host, u_short port, int *tnop, -- 2.39.5