This source file includes following definitions.
- llc_mac_hdr_init
- llc_build_and_send_ui_pkt
1
2
3
4
5
6
7
8
9 #include <linux/if_arp.h>
10 #include <linux/netdevice.h>
11 #include <linux/skbuff.h>
12 #include <linux/export.h>
13 #include <net/llc.h>
14 #include <net/llc_pdu.h>
15
16
17
18
19
20
21
22
23
24
25 int llc_mac_hdr_init(struct sk_buff *skb,
26 const unsigned char *sa, const unsigned char *da)
27 {
28 int rc = -EINVAL;
29
30 switch (skb->dev->type) {
31 case ARPHRD_ETHER:
32 case ARPHRD_LOOPBACK:
33 rc = dev_hard_header(skb, skb->dev, ETH_P_802_2, da, sa,
34 skb->len);
35 if (rc > 0)
36 rc = 0;
37 break;
38 default:
39 break;
40 }
41 return rc;
42 }
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
59 unsigned char *dmac, unsigned char dsap)
60 {
61 int rc;
62 llc_pdu_header_init(skb, LLC_PDU_TYPE_U, sap->laddr.lsap,
63 dsap, LLC_PDU_CMD);
64 llc_pdu_init_as_ui_cmd(skb);
65 rc = llc_mac_hdr_init(skb, skb->dev->dev_addr, dmac);
66 if (likely(!rc))
67 rc = dev_queue_xmit(skb);
68 else
69 kfree_skb(skb);
70 return rc;
71 }
72
73 EXPORT_SYMBOL(llc_mac_hdr_init);
74 EXPORT_SYMBOL(llc_build_and_send_ui_pkt);