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

TOMOYO Linux Cross Reference
Linux/net/802/p8022.c

Version: ~ [ linux-4.17-rc2 ] ~ [ linux-4.16.4 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.36 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.96 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.129 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.51 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.106 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.56 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.101 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp