0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <linux/module.h>
0015 #include <linux/netdevice.h>
0016 #include <linux/skbuff.h>
0017 #include <linux/slab.h>
0018 #include <net/datalink.h>
0019 #include <linux/mm.h>
0020 #include <linux/in.h>
0021 #include <linux/init.h>
0022 #include <net/llc.h>
0023 #include <net/p8022.h>
0024
0025 static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
0026 const unsigned char *dest)
0027 {
0028 llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
0029 return 0;
0030 }
0031
0032 struct datalink_proto *register_8022_client(unsigned char type,
0033 int (*func)(struct sk_buff *skb,
0034 struct net_device *dev,
0035 struct packet_type *pt,
0036 struct net_device *orig_dev))
0037 {
0038 struct datalink_proto *proto;
0039
0040 proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
0041 if (proto) {
0042 proto->type[0] = type;
0043 proto->header_length = 3;
0044 proto->request = p8022_request;
0045 proto->sap = llc_sap_open(type, func);
0046 if (!proto->sap) {
0047 kfree(proto);
0048 proto = NULL;
0049 }
0050 }
0051 return proto;
0052 }
0053
0054 void unregister_8022_client(struct datalink_proto *proto)
0055 {
0056 llc_sap_put(proto->sap);
0057 kfree(proto);
0058 }
0059
0060 EXPORT_SYMBOL(register_8022_client);
0061 EXPORT_SYMBOL(unregister_8022_client);
0062
0063 MODULE_LICENSE("GPL");