12 #include <linux/module.h>
13 #include <linux/net.h>
15 #include <linux/errqueue.h>
16 #include <linux/udp.h>
18 #include <linux/in6.h>
19 #include <linux/icmp.h>
32 "DATA",
"ACK",
"BUSY",
"ABORT",
"ACKALL",
"CHALL",
"RESP",
"DEBUG",
33 "?09",
"?10",
"?11",
"?12",
"?13",
"?14",
"?15"
45 bool force,
bool terminal)
52 _enter(
",,%d,%d", force, terminal);
62 _debug(
"already terminated");
97 _debug(
"<<<< TERMINAL MESSAGE >>>>");
113 _net(
"post skb %p", skb);
143 static int rxrpc_fast_process_data(
struct rxrpc_call *call,
155 spin_lock(&call->
lock);
157 if (call->
state > RXRPC_CALL_COMPLETE)
164 if (seq < call->rx_data_post) {
168 goto discard_and_ack;
175 _debug(
"dup oos #%u [%u,%u]",
178 goto discard_and_ack;
185 goto discard_and_ack;
196 goto enqueue_and_ack;
211 if (call->
conn->security)
223 goto discard_and_ack;
240 _debug(
"drain rx oos now");
242 if (call->
state < RXRPC_CALL_COMPLETE &&
248 spin_unlock(&call->
lock);
257 spin_unlock(&call->
lock);
262 _debug(
"discard and ACK packet %p", skb);
265 spin_unlock(&call->
lock);
267 _leave(
" = 0 [discarded]");
273 _net(
"defer skb %p", skb);
274 spin_unlock(&call->
lock);
278 if (call->
state < RXRPC_CALL_DEAD)
293 switch (call->
state) {
294 case RXRPC_CALL_CLIENT_AWAIT_REPLY:
295 call->
state = RXRPC_CALL_CLIENT_RECV_REPLY;
325 _enter(
"%p,%p", call, skb);
329 #if 0 // INJECT RX ERROR
333 printk(
"DROPPED 3RD PACKET!!!!!!!!!!!!!\n");
344 while (serial > hi_serial)
351 _proto(
"ACK Requested on %%%u", serial);
356 switch (sp->
hdr.type) {
361 sizeof(_abort_code)) < 0)
364 abort_code =
ntohl(_abort_code);
365 _proto(
"Rx ABORT %%%u { %x }", serial, abort_code);
368 if (call->
state < RXRPC_CALL_COMPLETE) {
369 call->
state = RXRPC_CALL_REMOTELY_ABORTED;
374 goto free_packet_unlock;
377 _proto(
"Rx BUSY %%%u", serial);
379 if (call->
conn->out_clientflag)
383 switch (call->
state) {
384 case RXRPC_CALL_CLIENT_SEND_REQUEST:
385 call->
state = RXRPC_CALL_SERVER_BUSY;
388 case RXRPC_CALL_SERVER_BUSY:
389 goto free_packet_unlock;
391 goto protocol_error_locked;
401 _proto(
"Rx DATA %%%u { #%u }", serial, seq);
410 if (call->
state == RXRPC_CALL_CLIENT_AWAIT_REPLY)
411 rxrpc_assume_implicit_ackall(call, serial);
413 switch (rxrpc_fast_process_data(call, skb, seq)) {
430 if (call->
state < RXRPC_CALL_DEAD) {
442 protocol_error_locked:
443 if (call->
state <= RXRPC_CALL_COMPLETE) {
444 call->
state = RXRPC_CALL_LOCALLY_ABORTED;
460 static void rxrpc_process_jumbo_packet(
struct rxrpc_call *call,
491 if (!pskb_pull(jumbo,
sizeof(jhdr)))
496 sp->
hdr.flags = jhdr.flags;
497 sp->
hdr._rsvd = jhdr._rsvd;
515 if (call->
state <= RXRPC_CALL_COMPLETE) {
516 call->
state = RXRPC_CALL_LOCALLY_ABORTED;
537 _enter(
"%p,%p", conn, skb);
545 if (!call || call->
call_id != sp->
hdr.callNumber)
546 goto call_not_extant;
552 switch (call->
state) {
553 case RXRPC_CALL_LOCALLY_ABORTED:
556 case RXRPC_CALL_REMOTELY_ABORTED:
557 case RXRPC_CALL_NETWORK_ERROR:
558 case RXRPC_CALL_DEAD:
570 rxrpc_process_jumbo_packet(call, skb);
580 _debug(
"call not extant");
582 call_id = sp->
hdr.callNumber;
583 p = conn->
calls.rb_node;
587 if (call_id < call->call_id)
589 else if (call_id > call->
call_id)
592 goto found_completed_call;
617 found_completed_call:
626 call->
state, >=, RXRPC_CALL_COMPLETE);
628 if (call->
state == RXRPC_CALL_LOCALLY_ABORTED ||
629 call->
state == RXRPC_CALL_REMOTELY_ABORTED ||
630 call->
state == RXRPC_CALL_DEAD) {
635 if (call->
conn->in_clientflag) {
640 _debug(
"final ack again");
660 _enter(
"%p,%p", conn, skb);
681 _enter(
"%p, %d", sk, count);
702 _debug(
"UDP socket error %d", ret);
708 _net(
"recv skb %p", skb);
711 if (skb_checksum_complete(skb)) {
725 memset(sp, 0,
sizeof(*sp));
727 _net(
"Rx UDP packet from %08x:%04hu",
732 sizeof(sp->
hdr)) < 0)
734 if (!pskb_pull(skb,
sizeof(
struct udphdr) +
sizeof(sp->
hdr)))
737 _net(
"Rx RxRPC %s ep=%x call=%x:%x",
744 _proto(
"Rx Bad Packet Type %u", sp->
hdr.type);
749 (sp->
hdr.callNumber == 0 || sp->
hdr.seq == 0))
754 goto cant_route_call;
759 goto cant_route_call;
764 goto cant_route_call;
768 if (sp->
hdr.callNumber == 0)
769 rxrpc_post_packet_to_conn(conn, skb);
771 rxrpc_post_packet_to_call(conn, skb);
777 _debug(
"can't route call");