14 #include <linux/kernel.h>
15 #include <linux/netfilter_bridge.h>
17 #include <linux/llc.h>
18 #include <linux/slab.h>
23 #include <asm/unaligned.h>
30 #define LLC_RESERVE sizeof(struct llc_pdu_un)
45 memcpy(__skb_put(skb, length), data, length);
49 llc_pdu_init_as_ui_cmd(skb);
53 skb_reset_mac_header(skb);
59 static inline void br_set_ticks(
unsigned char *
dest,
int j)
63 put_unaligned_be16(ticks, dest);
66 static inline int br_get_ticks(
const unsigned char *
src)
68 unsigned long ticks = get_unaligned_be16(src);
76 unsigned char buf[35];
78 if (p->
br->stp_enabled != BR_KERNEL_STP)
107 buf[25] = (bpdu->
port_id >> 8) & 0xFF;
108 buf[26] = bpdu->
port_id & 0xFF;
111 br_set_ticks(buf+29, bpdu->
max_age);
115 br_send_bpdu(p, buf, 35);
121 unsigned char buf[4];
123 if (p->
br->stp_enabled != BR_KERNEL_STP)
130 br_send_bpdu(p, buf, 4);
141 const unsigned char *
dest = eth_hdr(skb)->h_dest;
144 const unsigned char *
buf;
146 if (!pskb_may_pull(skb, 4))
151 if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0)
154 p = br_port_get_rcu(dev);
159 spin_lock(&br->
lock);
178 if (!pskb_may_pull(skb, 32))
206 bpdu.
port_id = (buf[22] << 8) | buf[23];
209 bpdu.
max_age = br_get_ticks(buf+26);
216 "port %u config from %pM"
217 " (message_age %ul > max_age %ul)\n",
229 spin_unlock(&br->
lock);