]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rx: provide mechanism to send a bare abort packet
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 1 Jun 2012 17:20:57 +0000 (13:20 -0400)
committerDerrick Brashear <shadow@dementix.org>
Fri, 6 Jul 2012 18:28:16 +0000 (11:28 -0700)
simply put an abort on the wire

Reviewed-on: http://gerrit.openafs.org/7562
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 5019ecd5fad0846abcd92835411c7b0f3f2170ca)

Change-Id: I21a8f2b5df84c49bda6b6fced5088cdeb3127017
Reviewed-on: http://gerrit.openafs.org/7591
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/rx/rx_packet.c
src/rx/rx_prototypes.h

index 314504a7f737256236e2870183073965c47dfbff..4d733dea4e00a61269525194bf1d193442f5d7f6 100644 (file)
@@ -2548,6 +2548,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
index 331511605067301bc1fc98d8c644ef713bea54c9..d433dfeecad662b8bff227c97520c68c22eee271 100644 (file)
@@ -564,6 +564,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,