~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/rxrpc/local_event.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /* AF_RXRPC local endpoint management
  3  *
  4  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5  * Written by David Howells (dhowells@redhat.com)
  6  */
  7 
  8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  9 
 10 #include <linux/module.h>
 11 #include <linux/net.h>
 12 #include <linux/skbuff.h>
 13 #include <linux/slab.h>
 14 #include <net/sock.h>
 15 #include <net/af_rxrpc.h>
 16 #include <generated/utsrelease.h>
 17 #include "ar-internal.h"
 18 
 19 static char rxrpc_version_string[65]; // "linux-" UTS_RELEASE " AF_RXRPC";
 20 
 21 /*
 22  * Generate the VERSION packet string.
 23  */
 24 void rxrpc_gen_version_string(void)
 25 {
 26         snprintf(rxrpc_version_string, sizeof(rxrpc_version_string),
 27                  "linux-%.49s AF_RXRPC", UTS_RELEASE);
 28 }
 29 
 30 /*
 31  * Reply to a version request
 32  */
 33 void rxrpc_send_version_request(struct rxrpc_local *local,
 34                                 struct rxrpc_host_header *hdr,
 35                                 struct sk_buff *skb)
 36 {
 37         struct rxrpc_wire_header whdr;
 38         struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
 39         struct sockaddr_rxrpc srx;
 40         struct msghdr msg;
 41         struct kvec iov[2];
 42         size_t len;
 43         int ret;
 44 
 45         _enter("");
 46 
 47         if (rxrpc_extract_addr_from_skb(&srx, skb) < 0)
 48                 return;
 49 
 50         msg.msg_name    = &srx.transport;
 51         msg.msg_namelen = srx.transport_len;
 52         msg.msg_control = NULL;
 53         msg.msg_controllen = 0;
 54         msg.msg_flags   = 0;
 55 
 56         whdr.epoch      = htonl(sp->hdr.epoch);
 57         whdr.cid        = htonl(sp->hdr.cid);
 58         whdr.callNumber = htonl(sp->hdr.callNumber);
 59         whdr.seq        = 0;
 60         whdr.serial     = 0;
 61         whdr.type       = RXRPC_PACKET_TYPE_VERSION;
 62         whdr.flags      = RXRPC_LAST_PACKET | (~hdr->flags & RXRPC_CLIENT_INITIATED);
 63         whdr.userStatus = 0;
 64         whdr.securityIndex = 0;
 65         whdr._rsvd      = 0;
 66         whdr.serviceId  = htons(sp->hdr.serviceId);
 67 
 68         iov[0].iov_base = &whdr;
 69         iov[0].iov_len  = sizeof(whdr);
 70         iov[1].iov_base = (char *)rxrpc_version_string;
 71         iov[1].iov_len  = sizeof(rxrpc_version_string);
 72 
 73         len = iov[0].iov_len + iov[1].iov_len;
 74 
 75         ret = kernel_sendmsg(local->socket, &msg, iov, 2, len);
 76         if (ret < 0)
 77                 trace_rxrpc_tx_fail(local->debug_id, 0, ret,
 78                                     rxrpc_tx_point_version_reply);
 79         else
 80                 trace_rxrpc_tx_packet(local->debug_id, &whdr,
 81                                       rxrpc_tx_point_version_reply);
 82 
 83         _leave("");
 84 }
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php