-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
-static struct llc_sap *dp_stp_sap;
-
-static int dp_stp_rcv(struct sk_buff *skb, struct net_device *dev,
- struct packet_type *pt, struct net_device *orig_dev)
-{
- /* We don't really care about STP packets, we just listen for them for
- * mutual exclusion with the bridge module, so this just discards
- * them. */
- kfree_skb(skb);
- return 0;
-}
-
-static int dp_avoid_bridge_init(void)
-{
- /* Register to receive STP packets because the bridge module also
- * attempts to do so. Since there can only be a single listener for a
- * given protocol, this provides mutual exclusion against the bridge
- * module, preventing both of them from being loaded at the same
- * time. */
- dp_stp_sap = llc_sap_open(LLC_SAP_BSPAN, dp_stp_rcv);
- if (!dp_stp_sap) {
- printk(KERN_ERR "openvswitch: can't register sap for STP (probably the bridge module is loaded)\n");
- return -EADDRINUSE;
- }
- return 0;
-}
-
-static void dp_avoid_bridge_exit(void)
-{
- llc_sap_put(dp_stp_sap);
-}
-#else /* Linux 2.6.27 or later. */
-static int dp_avoid_bridge_init(void)
-{
- /* Linux 2.6.27 introduces a way for multiple clients to register for
- * STP packets, which interferes with what we try to do above.
- * Instead, just check whether there's a bridge hook defined. This is
- * not as safe--the bridge module is willing to load over the top of
- * us--but it provides a little bit of protection. */
- if (br_handle_frame_hook) {
- printk(KERN_ERR "openvswitch: bridge module is loaded, cannot load over it\n");
- return -EADDRINUSE;
- }
- return 0;
-}
-
-static void dp_avoid_bridge_exit(void)
-{
- /* Nothing to do. */
-}
-#endif /* Linux 2.6.27 or later */
-