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

TOMOYO Linux Cross Reference
Linux/net/802/p8022.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 /*
  3  *      NET3:   Support for 802.2 demultiplexing off Ethernet
  4  *
  5  *              Demultiplex 802.2 encoded protocols. We match the entry by the
  6  *              SSAP/DSAP pair and then deliver to the registered datalink that
  7  *              matches. The control byte is ignored and handling of such items
  8  *              is up to the routine passed the frame.
  9  *
 10  *              Unlike the 802.3 datalink we have a list of 802.2 entries as
 11  *              there are multiple protocols to demux. The list is currently
 12  *              short (3 or 4 entries at most). The current demux assumes this.
 13  */
 14 #include <linux/module.h>
 15 #include <linux/netdevice.h>
 16 #include <linux/skbuff.h>
 17 #include <linux/slab.h>
 18 #include <net/datalink.h>
 19 #include <linux/mm.h>
 20 #include <linux/in.h>
 21 #include <linux/init.h>
 22 #include <net/llc.h>
 23 #include <net/p8022.h>
 24 
 25 static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
 26                          const unsigned char *dest)
 27 {
 28         llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
 29         return 0;
 30 }
 31 
 32 struct datalink_proto *register_8022_client(unsigned char type,
 33                                             int (*func)(struct sk_buff *skb,
 34                                                         struct net_device *dev,
 35                                                         struct packet_type *pt,
 36                                                         struct net_device *orig_dev))
 37 {
 38         struct datalink_proto *proto;
 39 
 40         proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
 41         if (proto) {
 42                 proto->type[0]          = type;
 43                 proto->header_length    = 3;
 44                 proto->request          = p8022_request;
 45                 proto->sap = llc_sap_open(type, func);
 46                 if (!proto->sap) {
 47                         kfree(proto);
 48                         proto = NULL;
 49                 }
 50         }
 51         return proto;
 52 }
 53 
 54 void unregister_8022_client(struct datalink_proto *proto)
 55 {
 56         llc_sap_put(proto->sap);
 57         kfree(proto);
 58 }
 59 
 60 EXPORT_SYMBOL(register_8022_client);
 61 EXPORT_SYMBOL(unregister_8022_client);
 62 
 63 MODULE_DESCRIPTION("Support for 802.2 demultiplexing off Ethernet");
 64 MODULE_LICENSE("GPL");
 65 

~ [ 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