2 * Copyright (c) 2007-2012 Nicira, Inc.
3 * Distributed under the terms of the GNU GPL version 2.
5 * Significant portions of this file may be copied from parts of the Linux
6 * kernel, by Linus Torvalds and others.
9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 #include <linux/version.h>
12 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
17 #include <linux/list.h>
18 #include <linux/net.h>
19 #include <net/net_namespace.h>
22 #include <net/inet_frag.h>
24 #include <net/protocol.h>
30 #include "vport-generic.h"
32 #define CAPWAP_SRC_PORT 58881
33 #define CAPWAP_DST_PORT 58882
35 #define CAPWAP_FRAG_TIMEOUT (30 * HZ)
36 #define CAPWAP_FRAG_MAX_MEM (256 * 1024)
37 #define CAPWAP_FRAG_PRUNE_MEM (192 * 1024)
38 #define CAPWAP_FRAG_SECRET_INTERVAL (10 * 60 * HZ)
41 * The CAPWAP header is a mess, with all kinds of odd size bit fields that
42 * cross byte boundaries, which are difficult to represent correctly in
43 * various byte orderings. Luckily we only care about a few permutations, so
44 * statically create them and we can do very fast parsing by checking all 12
47 #define CAPWAP_PREAMBLE_MASK __cpu_to_be32(0xFF000000)
48 #define CAPWAP_HLEN_SHIFT 17
49 #define CAPWAP_HLEN_MASK __cpu_to_be32(0x00F80000)
50 #define CAPWAP_RID_MASK __cpu_to_be32(0x0007C000)
51 #define CAPWAP_WBID_MASK __cpu_to_be32(0x00003E00)
52 #define CAPWAP_F_MASK __cpu_to_be32(0x000001FF)
54 #define CAPWAP_F_FRAG __cpu_to_be32(0x00000080)
55 #define CAPWAP_F_LASTFRAG __cpu_to_be32(0x00000040)
56 #define CAPWAP_F_WSI __cpu_to_be32(0x00000020)
57 #define CAPWAP_F_RMAC __cpu_to_be32(0x00000010)
59 #define CAPWAP_RMAC_LEN 4
61 /* Standard CAPWAP looks for a WBID value of 2.
62 * When we insert WSI field, use WBID value of 30, which has been
63 * proposed for all "experimental" usage - users with no reserved WBID value
66 #define CAPWAP_WBID_30 __cpu_to_be32(0x00003C00)
67 #define CAPWAP_WBID_2 __cpu_to_be32(0x00000200)
69 #define FRAG_HDR (CAPWAP_F_FRAG)
70 #define FRAG_LAST_HDR (FRAG_HDR | CAPWAP_F_LASTFRAG)
72 /* Keyed packet, WBID 30, and length long enough to include WSI key */
73 #define CAPWAP_KEYED (CAPWAP_WBID_30 | CAPWAP_F_WSI | htonl(20 << CAPWAP_HLEN_SHIFT))
74 /* A backward-compatible packet, WBID 2 and length of 2 words (no WSI fields) */
75 #define CAPWAP_NO_WSI (CAPWAP_WBID_2 | htonl(8 << CAPWAP_HLEN_SHIFT))
77 /* Mask for all parts of header that must be 0. */
78 #define CAPWAP_ZERO_MASK (CAPWAP_PREAMBLE_MASK | \
79 (CAPWAP_F_MASK ^ (CAPWAP_F_WSI | CAPWAP_F_FRAG | CAPWAP_F_LASTFRAG | CAPWAP_F_RMAC)))
84 /* low 3 bits of frag_off are reserved */
89 * We use the WSI field to hold additional tunnel data.
90 * The first eight bits store the size of the wsi data in bytes.
92 struct capwaphdr_wsi {
95 __be16 reserved_padding;
98 struct capwaphdr_wsi_key {
102 /* Flag indicating a 64bit key is stored in WSI data field */
103 #define CAPWAP_WSI_F_KEY64 0x80
105 static struct capwaphdr *capwap_hdr(const struct sk_buff *skb)
107 return (struct capwaphdr *)(udp_hdr(skb) + 1);
111 * The fragment offset is actually the high 13 bits of the last 16 bit field,
112 * so we would normally need to right shift 3 places. However, it stores the
113 * offset in 8 byte chunks, which would involve a 3 place left shift. So we
114 * just mask off the last 3 bits and be done with it.
116 #define FRAG_OFF_MASK (~0x7U)
119 * The minimum header length. The header may be longer if the optional
122 #define CAPWAP_MIN_HLEN (sizeof(struct udphdr) + sizeof(struct capwaphdr))
131 struct inet_frag_queue ifq;
132 struct frag_match match;
138 #define FRAG_CB(skb) ((struct frag_skb_cb *)(skb)->cb)
140 static struct sk_buff *fragment(struct sk_buff *, const struct vport *,
141 struct dst_entry *dst, unsigned int hlen);
142 static struct sk_buff *defrag(struct sk_buff *, bool frag_last);
144 static void capwap_frag_init(struct inet_frag_queue *, void *match);
145 static unsigned int capwap_frag_hash(struct inet_frag_queue *);
146 static int capwap_frag_match(struct inet_frag_queue *, void *match);
147 static void capwap_frag_expire(unsigned long ifq);
149 static struct inet_frags frag_state = {
150 .constructor = capwap_frag_init,
151 .qsize = sizeof(struct frag_queue),
152 .hashfn = capwap_frag_hash,
153 .match = capwap_frag_match,
154 .frag_expire = capwap_frag_expire,
155 .secret_interval = CAPWAP_FRAG_SECRET_INTERVAL,
158 static int capwap_hdr_len(const struct tnl_mutable_config *mutable)
160 int size = CAPWAP_MIN_HLEN;
162 /* CAPWAP has no checksums. */
163 if (mutable->flags & TNL_F_CSUM)
166 /* if keys are specified, then add WSI field */
167 if (mutable->out_key || (mutable->flags & TNL_F_OUT_KEY_ACTION)) {
168 size += sizeof(struct capwaphdr_wsi) +
169 sizeof(struct capwaphdr_wsi_key);
175 static void capwap_build_header(const struct vport *vport,
176 const struct tnl_mutable_config *mutable,
179 struct udphdr *udph = header;
180 struct capwaphdr *cwh = (struct capwaphdr *)(udph + 1);
182 udph->source = htons(CAPWAP_SRC_PORT);
183 udph->dest = htons(CAPWAP_DST_PORT);
189 if (mutable->out_key || (mutable->flags & TNL_F_OUT_KEY_ACTION)) {
190 struct capwaphdr_wsi *wsi = (struct capwaphdr_wsi *)(cwh + 1);
192 cwh->begin = CAPWAP_KEYED;
194 /* -1 for wsi_len byte, not included in length as per spec */
195 wsi->wsi_len = sizeof(struct capwaphdr_wsi) - 1
196 + sizeof(struct capwaphdr_wsi_key);
197 wsi->flags = CAPWAP_WSI_F_KEY64;
198 wsi->reserved_padding = 0;
200 if (mutable->out_key) {
201 struct capwaphdr_wsi_key *opt = (struct capwaphdr_wsi_key *)(wsi + 1);
202 opt->key = mutable->out_key;
205 /* make packet readable by old capwap code */
206 cwh->begin = CAPWAP_NO_WSI;
210 static struct sk_buff *capwap_update_header(const struct vport *vport,
211 const struct tnl_mutable_config *mutable,
212 struct dst_entry *dst,
215 struct udphdr *udph = udp_hdr(skb);
217 if (mutable->flags & TNL_F_OUT_KEY_ACTION) {
218 /* first field in WSI is key */
219 struct capwaphdr *cwh = (struct capwaphdr *)(udph + 1);
220 struct capwaphdr_wsi *wsi = (struct capwaphdr_wsi *)(cwh + 1);
221 struct capwaphdr_wsi_key *opt = (struct capwaphdr_wsi_key *)(wsi + 1);
223 opt->key = OVS_CB(skb)->tun_id;
226 udph->len = htons(skb->len - skb_transport_offset(skb));
228 if (unlikely(skb->len - skb_network_offset(skb) > dst_mtu(dst))) {
229 unsigned int hlen = skb_transport_offset(skb) + capwap_hdr_len(mutable);
230 skb = fragment(skb, vport, dst, hlen);
236 static int process_capwap_wsi(struct sk_buff *skb, __be64 *key)
238 struct capwaphdr *cwh = capwap_hdr(skb);
239 struct capwaphdr_wsi *wsi;
244 if (((cwh->begin & CAPWAP_WBID_MASK) != CAPWAP_WBID_30))
247 if (cwh->begin & CAPWAP_F_RMAC)
248 rmac_len = CAPWAP_RMAC_LEN;
250 hdr_len = ntohl(cwh->begin & CAPWAP_HLEN_MASK) >> CAPWAP_HLEN_SHIFT;
252 if (unlikely(sizeof(struct capwaphdr) + rmac_len + sizeof(struct capwaphdr_wsi) > hdr_len))
255 /* read wsi header to find out how big it really is */
256 wsi = (struct capwaphdr_wsi *)((u8 *)(cwh + 1) + rmac_len);
257 /* +1 for length byte not included in wsi_len */
258 wsi_len = 1 + wsi->wsi_len;
260 if (unlikely(sizeof(struct capwaphdr) + rmac_len + wsi_len != hdr_len))
263 wsi_len -= sizeof(struct capwaphdr_wsi);
265 if (wsi->flags & CAPWAP_WSI_F_KEY64) {
266 struct capwaphdr_wsi_key *opt;
268 if (unlikely(wsi_len < sizeof(struct capwaphdr_wsi_key)))
271 opt = (struct capwaphdr_wsi_key *)(wsi + 1);
278 static struct sk_buff *process_capwap_proto(struct sk_buff *skb, __be64 *key)
280 struct capwaphdr *cwh = capwap_hdr(skb);
281 int hdr_len = sizeof(struct udphdr);
283 if (unlikely((cwh->begin & CAPWAP_ZERO_MASK) != 0))
286 hdr_len += ntohl(cwh->begin & CAPWAP_HLEN_MASK) >> CAPWAP_HLEN_SHIFT;
287 if (unlikely(hdr_len < CAPWAP_MIN_HLEN))
290 if (unlikely(!pskb_may_pull(skb, hdr_len + ETH_HLEN)))
293 cwh = capwap_hdr(skb);
294 __skb_pull(skb, hdr_len);
295 skb_postpull_rcsum(skb, skb_transport_header(skb), hdr_len + ETH_HLEN);
297 if (cwh->begin & CAPWAP_F_FRAG) {
298 skb = defrag(skb, (__force bool)(cwh->begin & CAPWAP_F_LASTFRAG));
301 cwh = capwap_hdr(skb);
304 if ((cwh->begin & CAPWAP_F_WSI) && process_capwap_wsi(skb, key))
313 /* Called with rcu_read_lock and BH disabled. */
314 static int capwap_rcv(struct sock *sk, struct sk_buff *skb)
317 const struct tnl_mutable_config *mutable;
321 if (unlikely(!pskb_may_pull(skb, CAPWAP_MIN_HLEN + ETH_HLEN)))
324 skb = process_capwap_proto(skb, &key);
329 vport = ovs_tnl_find_port(sock_net(sk), iph->daddr, iph->saddr, key,
330 TNL_T_PROTO_CAPWAP, &mutable);
331 if (unlikely(!vport)) {
332 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
336 if (mutable->flags & TNL_F_IN_KEY_MATCH)
337 OVS_CB(skb)->tun_id = key;
339 OVS_CB(skb)->tun_id = 0;
341 ovs_tnl_rcv(vport, skb, iph->tos);
350 static const struct tnl_ops capwap_tnl_ops = {
351 .tunnel_type = TNL_T_PROTO_CAPWAP,
352 .ipproto = IPPROTO_UDP,
353 .hdr_len = capwap_hdr_len,
354 .build_header = capwap_build_header,
355 .update_header = capwap_update_header,
358 static inline struct capwap_net *ovs_get_capwap_net(struct net *net)
360 struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
361 return &ovs_net->vport_net.capwap;
364 /* Arbitrary value. Irrelevant as long as it's not 0 since we set the handler. */
365 #define UDP_ENCAP_CAPWAP 10
366 static int init_socket(struct net *net)
369 struct capwap_net *capwap_net = ovs_get_capwap_net(net);
370 struct sockaddr_in sin;
372 if (capwap_net->n_tunnels) {
373 capwap_net->n_tunnels++;
377 err = sock_create_kern(AF_INET, SOCK_DGRAM, 0,
378 &capwap_net->capwap_rcv_socket);
382 /* release net ref. */
383 sk_change_net(capwap_net->capwap_rcv_socket->sk, net);
385 sin.sin_family = AF_INET;
386 sin.sin_addr.s_addr = htonl(INADDR_ANY);
387 sin.sin_port = htons(CAPWAP_DST_PORT);
389 err = kernel_bind(capwap_net->capwap_rcv_socket,
390 (struct sockaddr *)&sin,
391 sizeof(struct sockaddr_in));
395 udp_sk(capwap_net->capwap_rcv_socket->sk)->encap_type = UDP_ENCAP_CAPWAP;
396 udp_sk(capwap_net->capwap_rcv_socket->sk)->encap_rcv = capwap_rcv;
398 capwap_net->frag_state.timeout = CAPWAP_FRAG_TIMEOUT;
399 capwap_net->frag_state.high_thresh = CAPWAP_FRAG_MAX_MEM;
400 capwap_net->frag_state.low_thresh = CAPWAP_FRAG_PRUNE_MEM;
402 inet_frags_init_net(&capwap_net->frag_state);
404 capwap_net->n_tunnels++;
408 sk_release_kernel(capwap_net->capwap_rcv_socket->sk);
410 pr_warn("cannot register capwap protocol handler : %d\n", err);
414 static void release_socket(struct net *net)
416 struct capwap_net *capwap_net = ovs_get_capwap_net(net);
418 capwap_net->n_tunnels--;
419 if (capwap_net->n_tunnels)
422 inet_frags_exit_net(&capwap_net->frag_state, &frag_state);
423 sk_release_kernel(capwap_net->capwap_rcv_socket->sk);
426 static struct vport *capwap_create(const struct vport_parms *parms)
431 err = init_socket(ovs_dp_get_net(parms->dp));
435 vport = ovs_tnl_create(parms, &ovs_capwap_vport_ops, &capwap_tnl_ops);
437 release_socket(ovs_dp_get_net(parms->dp));
442 static void capwap_destroy(struct vport *vport)
444 ovs_tnl_destroy(vport);
445 release_socket(ovs_dp_get_net(vport->dp));
448 static int capwap_init(void)
450 inet_frags_init(&frag_state);
454 static void capwap_exit(void)
456 inet_frags_fini(&frag_state);
459 static void copy_skb_metadata(struct sk_buff *from, struct sk_buff *to)
461 to->pkt_type = from->pkt_type;
462 to->priority = from->priority;
463 to->protocol = from->protocol;
464 skb_dst_set(to, dst_clone(skb_dst(from)));
466 to->mark = from->mark;
469 skb_set_owner_w(to, from->sk);
471 #ifdef CONFIG_NET_SCHED
472 to->tc_index = from->tc_index;
474 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
475 to->ipvs_property = from->ipvs_property;
477 skb_copy_secmark(to, from);
480 static struct sk_buff *fragment(struct sk_buff *skb, const struct vport *vport,
481 struct dst_entry *dst, unsigned int hlen)
483 struct tnl_vport *tnl_vport = tnl_vport_priv(vport);
484 unsigned int headroom;
485 unsigned int max_frame_len = dst_mtu(dst) + skb_network_offset(skb);
486 struct sk_buff *result = NULL, *list_cur = NULL;
487 unsigned int remaining;
491 if (hlen + ~FRAG_OFF_MASK + 1 > max_frame_len) {
493 pr_warn("capwap link mtu (%d) is less than minimum packet (%d)\n",
495 hlen - skb_network_offset(skb) + ~FRAG_OFF_MASK + 1);
499 remaining = skb->len - hlen;
501 frag_id = htons(atomic_inc_return(&tnl_vport->frag_id));
503 headroom = dst->header_len + 16;
504 if (!skb_network_offset(skb))
505 headroom += LL_RESERVED_SPACE(dst->dev);
508 struct sk_buff *skb2;
511 struct capwaphdr *cwh;
513 frag_size = min(remaining, max_frame_len - hlen);
514 if (remaining > frag_size)
515 frag_size &= FRAG_OFF_MASK;
517 skb2 = alloc_skb(headroom + hlen + frag_size, GFP_ATOMIC);
521 skb_reserve(skb2, headroom);
522 __skb_put(skb2, hlen + frag_size);
524 if (skb_network_offset(skb))
525 skb_reset_mac_header(skb2);
526 skb_set_network_header(skb2, skb_network_offset(skb));
527 skb_set_transport_header(skb2, skb_transport_offset(skb));
529 /* Copy (Ethernet)/IP/UDP/CAPWAP header. */
530 copy_skb_metadata(skb, skb2);
531 skb_copy_from_linear_data(skb, skb2->data, hlen);
533 /* Copy this data chunk. */
534 if (skb_copy_bits(skb, hlen + offset, skb2->data + hlen, frag_size))
537 udph = udp_hdr(skb2);
538 udph->len = htons(skb2->len - skb_transport_offset(skb2));
540 cwh = capwap_hdr(skb2);
541 if (remaining > frag_size)
542 cwh->begin |= FRAG_HDR;
544 cwh->begin |= FRAG_LAST_HDR;
545 cwh->frag_id = frag_id;
546 cwh->frag_off = htons(offset);
549 list_cur->next = skb2;
552 result = list_cur = skb2;
555 remaining -= frag_size;
562 ovs_tnl_free_linked_skbs(result);
567 /* All of the following functions relate to fragmentation reassembly. */
569 static struct frag_queue *ifq_cast(struct inet_frag_queue *ifq)
571 return container_of(ifq, struct frag_queue, ifq);
574 static u32 frag_hash(struct frag_match *match)
576 return jhash_3words((__force u16)match->id, (__force u32)match->saddr,
577 (__force u32)match->daddr,
578 frag_state.rnd) & (INETFRAGS_HASHSZ - 1);
581 static struct frag_queue *queue_find(struct netns_frags *ns_frag_state,
582 struct frag_match *match)
584 struct inet_frag_queue *ifq;
586 read_lock(&frag_state.lock);
588 ifq = inet_frag_find(ns_frag_state, &frag_state, match, frag_hash(match));
592 /* Unlock happens inside inet_frag_find(). */
594 return ifq_cast(ifq);
597 static struct sk_buff *frag_reasm(struct frag_queue *fq, struct net_device *dev)
599 struct sk_buff *head = fq->ifq.fragments;
600 struct sk_buff *frag;
602 /* Succeed or fail, we're done with this queue. */
603 inet_frag_kill(&fq->ifq, &frag_state);
605 if (fq->ifq.len > 65535)
608 /* Can't have the head be a clone. */
609 if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
613 * We're about to build frag list for this SKB. If it already has a
614 * frag list, alloc a new SKB and put the existing frag list there.
616 if (skb_shinfo(head)->frag_list) {
620 frag = alloc_skb(0, GFP_ATOMIC);
624 frag->next = head->next;
626 skb_shinfo(frag)->frag_list = skb_shinfo(head)->frag_list;
627 skb_shinfo(head)->frag_list = NULL;
629 for (i = 0; i < skb_shinfo(head)->nr_frags; i++)
630 paged_len += skb_shinfo(head)->frags[i].size;
631 frag->len = frag->data_len = head->data_len - paged_len;
632 head->data_len -= frag->len;
633 head->len -= frag->len;
635 frag->ip_summed = head->ip_summed;
636 atomic_add(frag->truesize, &fq->ifq.net->mem);
639 skb_shinfo(head)->frag_list = head->next;
640 atomic_sub(head->truesize, &fq->ifq.net->mem);
642 /* Properly account for data in various packets. */
643 for (frag = head->next; frag; frag = frag->next) {
644 head->data_len += frag->len;
645 head->len += frag->len;
647 if (head->ip_summed != frag->ip_summed)
648 head->ip_summed = CHECKSUM_NONE;
649 else if (head->ip_summed == CHECKSUM_COMPLETE)
650 head->csum = csum_add(head->csum, frag->csum);
652 head->truesize += frag->truesize;
653 atomic_sub(frag->truesize, &fq->ifq.net->mem);
658 head->tstamp = fq->ifq.stamp;
659 fq->ifq.fragments = NULL;
664 static struct sk_buff *frag_queue(struct frag_queue *fq, struct sk_buff *skb,
665 u16 offset, bool frag_last)
667 struct sk_buff *prev, *next;
668 struct net_device *dev;
671 if (fq->ifq.last_in & INET_FRAG_COMPLETE)
677 end = offset + skb->len;
681 * Last fragment, shouldn't already have data past our end or
682 * have another last fragment.
684 if (end < fq->ifq.len || fq->ifq.last_in & INET_FRAG_LAST_IN)
687 fq->ifq.last_in |= INET_FRAG_LAST_IN;
690 /* Fragments should align to 8 byte chunks. */
691 if (end & ~FRAG_OFF_MASK)
694 if (end > fq->ifq.len) {
696 * Shouldn't have data past the end, if we already
699 if (fq->ifq.last_in & INET_FRAG_LAST_IN)
706 /* Find where we fit in. */
708 for (next = fq->ifq.fragments; next != NULL; next = next->next) {
709 if (FRAG_CB(next)->offset >= offset)
715 * Overlapping fragments aren't allowed. We shouldn't start before
716 * the end of the previous fragment.
718 if (prev && FRAG_CB(prev)->offset + prev->len > offset)
721 /* We also shouldn't end after the beginning of the next fragment. */
722 if (next && end > FRAG_CB(next)->offset)
725 FRAG_CB(skb)->offset = offset;
727 /* Link into list. */
732 fq->ifq.fragments = skb;
737 fq->ifq.stamp = skb->tstamp;
738 fq->ifq.meat += skb->len;
739 atomic_add(skb->truesize, &fq->ifq.net->mem);
741 fq->ifq.last_in |= INET_FRAG_FIRST_IN;
743 /* If we have all fragments do reassembly. */
744 if (fq->ifq.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
745 fq->ifq.meat == fq->ifq.len)
746 return frag_reasm(fq, dev);
748 write_lock(&frag_state.lock);
749 list_move_tail(&fq->ifq.lru_list, &fq->ifq.net->lru_list);
750 write_unlock(&frag_state.lock);
759 static struct sk_buff *defrag(struct sk_buff *skb, bool frag_last)
761 struct iphdr *iph = ip_hdr(skb);
762 struct capwaphdr *cwh = capwap_hdr(skb);
763 struct capwap_net *capwap_net = ovs_get_capwap_net(dev_net(skb->dev));
764 struct netns_frags *ns_frag_state = &capwap_net->frag_state;
765 struct frag_match match;
767 struct frag_queue *fq;
769 if (atomic_read(&ns_frag_state->mem) > ns_frag_state->high_thresh)
770 inet_frag_evictor(ns_frag_state, &frag_state);
772 match.daddr = iph->daddr;
773 match.saddr = iph->saddr;
774 match.id = cwh->frag_id;
775 frag_off = ntohs(cwh->frag_off) & FRAG_OFF_MASK;
777 fq = queue_find(ns_frag_state, &match);
779 spin_lock(&fq->ifq.lock);
780 skb = frag_queue(fq, skb, frag_off, frag_last);
781 spin_unlock(&fq->ifq.lock);
783 inet_frag_put(&fq->ifq, &frag_state);
792 static void capwap_frag_init(struct inet_frag_queue *ifq, void *match_)
794 struct frag_match *match = match_;
796 ifq_cast(ifq)->match = *match;
799 static unsigned int capwap_frag_hash(struct inet_frag_queue *ifq)
801 return frag_hash(&ifq_cast(ifq)->match);
804 static int capwap_frag_match(struct inet_frag_queue *ifq, void *a_)
806 struct frag_match *a = a_;
807 struct frag_match *b = &ifq_cast(ifq)->match;
809 return a->id == b->id && a->saddr == b->saddr && a->daddr == b->daddr;
812 /* Run when the timeout for a given queue expires. */
813 static void capwap_frag_expire(unsigned long ifq)
815 struct frag_queue *fq;
817 fq = ifq_cast((struct inet_frag_queue *)ifq);
819 spin_lock(&fq->ifq.lock);
821 if (!(fq->ifq.last_in & INET_FRAG_COMPLETE))
822 inet_frag_kill(&fq->ifq, &frag_state);
824 spin_unlock(&fq->ifq.lock);
825 inet_frag_put(&fq->ifq, &frag_state);
828 const struct vport_ops ovs_capwap_vport_ops = {
829 .type = OVS_VPORT_TYPE_CAPWAP,
830 .flags = VPORT_F_TUN_ID,
833 .create = capwap_create,
834 .destroy = capwap_destroy,
835 .set_addr = ovs_tnl_set_addr,
836 .get_name = ovs_tnl_get_name,
837 .get_addr = ovs_tnl_get_addr,
838 .get_options = ovs_tnl_get_options,
839 .set_options = ovs_tnl_set_options,
840 .get_dev_flags = ovs_vport_gen_get_dev_flags,
841 .is_running = ovs_vport_gen_is_running,
842 .get_operstate = ovs_vport_gen_get_operstate,
843 .send = ovs_tnl_send,
846 #warning CAPWAP tunneling will not be available on kernels before 2.6.26
847 #endif /* Linux kernel < 2.6.26 */