From: Simon Wilkinson Date: Fri, 1 Jun 2012 17:20:57 +0000 (-0400) Subject: rx: provide mechanism to send a bare abort packet X-Git-Tag: upstream/1.8.0_pre1^2~2327 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5019ecd5fad0846abcd92835411c7b0f3f2170ca;p=packages%2Fo%2Fopenafs.git rx: provide mechanism to send a bare abort packet simply put an abort on the wire Change-Id: I0486e1826da9466a2982ac07c3749876848a7f66 Reviewed-on: http://gerrit.openafs.org/7562 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index e7a82780c..119f8ef4a 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -2504,6 +2504,41 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, } } +/* Send a raw abort packet, without any call or connection structures */ +void +rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, + afs_int32 error, struct rx_packet *source, int istack) +{ + struct rx_header theader; + struct sockaddr_in addr; + struct iovec iov[2]; + + memset(&theader, 0, sizeof(theader)); + theader.epoch = htonl(source->header.epoch); + theader.callNumber = htonl(source->header.callNumber); + theader.serial = htonl(1); + theader.type = RX_PACKET_TYPE_ABORT; + theader.serviceId = htons(source->header.serviceId); + theader.securityIndex = source->header.securityIndex; + theader.cid = htonl(source->header.cid); + + error = htonl(error); + + iov[0].iov_base = &theader; + iov[0].iov_len = sizeof(struct rx_header); + iov[1].iov_base = &error; + iov[1].iov_len = sizeof(error); + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = host; + addr.sin_port = port; +#ifdef STRUCT_SOCKADDR_HAS_SA_LEN + addr.sin_len = sizeof(struct sockaddr_in); +#endif + + osi_NetSend(socket, &addr, iov, 2, + sizeof(struct rx_header) + sizeof(error), istack); +} /* Send a "special" packet to the peer connection. If call is * specified, then the packet is directed to a specific call channel diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index 7cfb7ed8c..c42fdcb8d 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -438,6 +438,9 @@ extern void rxi_SendPacket(struct rx_call *call, struct rx_connection *conn, extern void rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn, struct rx_packet **list, int len, int istack); +extern void rxi_SendRawAbort(osi_socket socket, afs_uint32 host, u_short port, + afs_int32 error, struct rx_packet *source, + int istack); extern struct rx_packet *rxi_SendSpecial(struct rx_call *call, struct rx_connection *conn, struct rx_packet *optionalPacket,