blob: 4ce8b7b90c7cf6ee0956a218a4665e5ad99a8a45 [file] [log] [blame]
John W. Linville2d07dc72015-05-13 12:57:30 -04001/*
2 * GENEVE: Generic Network Virtualization Encapsulation
3 *
4 * Copyright (c) 2015 Red Hat, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/netdevice.h>
16#include <linux/etherdevice.h>
17#include <linux/hash.h>
Pravin B Shelare305ac62015-08-26 23:46:52 -070018#include <net/dst_metadata.h>
Jesse Gross8e816df2015-08-28 16:54:40 -070019#include <net/gro_cells.h>
John W. Linville2d07dc72015-05-13 12:57:30 -040020#include <net/rtnetlink.h>
21#include <net/geneve.h>
Pravin B Shelar371bd102015-08-26 23:46:54 -070022#include <net/protocol.h>
John W. Linville2d07dc72015-05-13 12:57:30 -040023
24#define GENEVE_NETDEV_VER "0.6"
25
26#define GENEVE_UDP_PORT 6081
27
28#define GENEVE_N_VID (1u << 24)
29#define GENEVE_VID_MASK (GENEVE_N_VID - 1)
30
31#define VNI_HASH_BITS 10
32#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
33
34static bool log_ecn_error = true;
35module_param(log_ecn_error, bool, 0644);
36MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN");
37
Pravin B Shelar371bd102015-08-26 23:46:54 -070038#define GENEVE_VER 0
39#define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr))
40
John W. Linville2d07dc72015-05-13 12:57:30 -040041/* per-network namespace private data for this module */
42struct geneve_net {
Pravin B Shelar371bd102015-08-26 23:46:54 -070043 struct list_head geneve_list;
Pravin B Shelar371bd102015-08-26 23:46:54 -070044 struct list_head sock_list;
John W. Linville2d07dc72015-05-13 12:57:30 -040045};
46
Pravin B Shelar371bd102015-08-26 23:46:54 -070047static int geneve_net_id;
48
John W. Linville2d07dc72015-05-13 12:57:30 -040049/* Pseudo network device */
50struct geneve_dev {
51 struct hlist_node hlist; /* vni hash table */
52 struct net *net; /* netns for packet i/o */
53 struct net_device *dev; /* netdev for geneve tunnel */
54 struct geneve_sock *sock; /* socket used for geneve tunnel */
John W. Linville8760ce52015-06-01 15:51:34 -040055 u8 vni[3]; /* virtual network ID for tunnel */
56 u8 ttl; /* TTL override */
John W. Linvilled8951122015-06-01 15:51:35 -040057 u8 tos; /* TOS override */
John W. Linville2d07dc72015-05-13 12:57:30 -040058 struct sockaddr_in remote; /* IPv4 address for link partner */
59 struct list_head next; /* geneve's per namespace list */
Pravin B Shelarcd7918b2015-08-26 23:46:51 -070060 __be16 dst_port;
Pravin B Shelare305ac62015-08-26 23:46:52 -070061 bool collect_md;
Jesse Gross8e816df2015-08-28 16:54:40 -070062 struct gro_cells gro_cells;
John W. Linville2d07dc72015-05-13 12:57:30 -040063};
64
Pravin B Shelar371bd102015-08-26 23:46:54 -070065struct geneve_sock {
66 bool collect_md;
Pravin B Shelar371bd102015-08-26 23:46:54 -070067 struct list_head list;
68 struct socket *sock;
69 struct rcu_head rcu;
70 int refcnt;
71 struct udp_offload udp_offloads;
Pravin B Shelar66d47002015-08-26 23:46:55 -070072 struct hlist_head vni_list[VNI_HASH_SIZE];
Pravin B Shelar371bd102015-08-26 23:46:54 -070073};
John W. Linville2d07dc72015-05-13 12:57:30 -040074
75static inline __u32 geneve_net_vni_hash(u8 vni[3])
76{
77 __u32 vnid;
78
79 vnid = (vni[0] << 16) | (vni[1] << 8) | vni[2];
80 return hash_32(vnid, VNI_HASH_BITS);
81}
82
Pravin B Shelare305ac62015-08-26 23:46:52 -070083static __be64 vni_to_tunnel_id(const __u8 *vni)
84{
85#ifdef __BIG_ENDIAN
86 return (vni[0] << 16) | (vni[1] << 8) | vni[2];
87#else
88 return (__force __be64)(((__force u64)vni[0] << 40) |
89 ((__force u64)vni[1] << 48) |
90 ((__force u64)vni[2] << 56));
91#endif
92}
93
Pravin B Shelar66d47002015-08-26 23:46:55 -070094static struct geneve_dev *geneve_lookup(struct geneve_sock *gs,
Pravin B Shelar371bd102015-08-26 23:46:54 -070095 __be32 addr, u8 vni[])
John W. Linville2d07dc72015-05-13 12:57:30 -040096{
John W. Linville2d07dc72015-05-13 12:57:30 -040097 struct hlist_head *vni_list_head;
Pravin B Shelare305ac62015-08-26 23:46:52 -070098 struct geneve_dev *geneve;
John W. Linville2d07dc72015-05-13 12:57:30 -040099 __u32 hash;
100
John W. Linville2d07dc72015-05-13 12:57:30 -0400101 /* Find the device for this VNI */
Pravin B Shelar371bd102015-08-26 23:46:54 -0700102 hash = geneve_net_vni_hash(vni);
Pravin B Shelar66d47002015-08-26 23:46:55 -0700103 vni_list_head = &gs->vni_list[hash];
Pravin B Shelare305ac62015-08-26 23:46:52 -0700104 hlist_for_each_entry_rcu(geneve, vni_list_head, hlist) {
Pravin B Shelar371bd102015-08-26 23:46:54 -0700105 if (!memcmp(vni, geneve->vni, sizeof(geneve->vni)) &&
Pravin B Shelar66d47002015-08-26 23:46:55 -0700106 addr == geneve->remote.sin_addr.s_addr)
Pravin B Shelare305ac62015-08-26 23:46:52 -0700107 return geneve;
John W. Linville2d07dc72015-05-13 12:57:30 -0400108 }
Pravin B Shelare305ac62015-08-26 23:46:52 -0700109 return NULL;
110}
111
Pravin B Shelar371bd102015-08-26 23:46:54 -0700112static inline struct genevehdr *geneve_hdr(const struct sk_buff *skb)
113{
114 return (struct genevehdr *)(udp_hdr(skb) + 1);
115}
116
Pravin B Shelare305ac62015-08-26 23:46:52 -0700117/* geneve receive/decap routine */
118static void geneve_rx(struct geneve_sock *gs, struct sk_buff *skb)
119{
120 struct genevehdr *gnvh = geneve_hdr(skb);
121 struct metadata_dst *tun_dst = NULL;
122 struct geneve_dev *geneve = NULL;
123 struct pcpu_sw_netstats *stats;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700124 struct iphdr *iph;
Pravin B Shelar371bd102015-08-26 23:46:54 -0700125 u8 *vni;
126 __be32 addr;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700127 int err;
128
John W. Linville08399ef2015-09-21 10:29:09 -0400129 iph = ip_hdr(skb); /* outer IP header... */
130
Pravin B Shelar371bd102015-08-26 23:46:54 -0700131 if (gs->collect_md) {
132 static u8 zero_vni[3];
133
134 vni = zero_vni;
135 addr = 0;
136 } else {
137 vni = gnvh->vni;
138 addr = iph->saddr;
139 }
140
Pravin B Shelar66d47002015-08-26 23:46:55 -0700141 geneve = geneve_lookup(gs, addr, vni);
John W. Linville2d07dc72015-05-13 12:57:30 -0400142 if (!geneve)
143 goto drop;
144
Pravin B Shelar371bd102015-08-26 23:46:54 -0700145 if (ip_tunnel_collect_metadata() || gs->collect_md) {
Pravin B Shelare305ac62015-08-26 23:46:52 -0700146 __be16 flags;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700147
148 flags = TUNNEL_KEY | TUNNEL_GENEVE_OPT |
149 (gnvh->oam ? TUNNEL_OAM : 0) |
150 (gnvh->critical ? TUNNEL_CRIT_OPT : 0);
151
152 tun_dst = udp_tun_rx_dst(skb, AF_INET, flags,
153 vni_to_tunnel_id(gnvh->vni),
154 gnvh->opt_len * 4);
155 if (!tun_dst)
156 goto drop;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700157 /* Update tunnel dst according to Geneve options. */
Pravin B Shelar4c222792015-08-30 18:09:38 -0700158 ip_tunnel_info_opts_set(&tun_dst->u.tun_info,
159 gnvh->options, gnvh->opt_len * 4);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700160 } else {
161 /* Drop packets w/ critical options,
162 * since we don't support any...
163 */
164 if (gnvh->critical)
165 goto drop;
166 }
John W. Linville2d07dc72015-05-13 12:57:30 -0400167
168 skb_reset_mac_header(skb);
169 skb_scrub_packet(skb, !net_eq(geneve->net, dev_net(geneve->dev)));
170 skb->protocol = eth_type_trans(skb, geneve->dev);
171 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
172
Pravin B Shelare305ac62015-08-26 23:46:52 -0700173 if (tun_dst)
174 skb_dst_set(skb, &tun_dst->dst);
175
John W. Linville2d07dc72015-05-13 12:57:30 -0400176 /* Ignore packet loops (and multicast echo) */
177 if (ether_addr_equal(eth_hdr(skb)->h_source, geneve->dev->dev_addr))
178 goto drop;
179
180 skb_reset_network_header(skb);
181
John W. Linville2d07dc72015-05-13 12:57:30 -0400182 err = IP_ECN_decapsulate(iph, skb);
183
184 if (unlikely(err)) {
185 if (log_ecn_error)
186 net_info_ratelimited("non-ECT from %pI4 with TOS=%#x\n",
187 &iph->saddr, iph->tos);
188 if (err > 1) {
189 ++geneve->dev->stats.rx_frame_errors;
190 ++geneve->dev->stats.rx_errors;
191 goto drop;
192 }
193 }
194
195 stats = this_cpu_ptr(geneve->dev->tstats);
196 u64_stats_update_begin(&stats->syncp);
197 stats->rx_packets++;
198 stats->rx_bytes += skb->len;
199 u64_stats_update_end(&stats->syncp);
200
Jesse Gross8e816df2015-08-28 16:54:40 -0700201 gro_cells_receive(&geneve->gro_cells, skb);
John W. Linville2d07dc72015-05-13 12:57:30 -0400202 return;
203drop:
204 /* Consume bad packet */
205 kfree_skb(skb);
206}
207
208/* Setup stats when device is created */
209static int geneve_init(struct net_device *dev)
210{
Jesse Gross8e816df2015-08-28 16:54:40 -0700211 struct geneve_dev *geneve = netdev_priv(dev);
212 int err;
213
John W. Linville2d07dc72015-05-13 12:57:30 -0400214 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
215 if (!dev->tstats)
216 return -ENOMEM;
Jesse Gross8e816df2015-08-28 16:54:40 -0700217
218 err = gro_cells_init(&geneve->gro_cells, dev);
219 if (err) {
220 free_percpu(dev->tstats);
221 return err;
222 }
223
John W. Linville2d07dc72015-05-13 12:57:30 -0400224 return 0;
225}
226
227static void geneve_uninit(struct net_device *dev)
228{
Jesse Gross8e816df2015-08-28 16:54:40 -0700229 struct geneve_dev *geneve = netdev_priv(dev);
230
231 gro_cells_destroy(&geneve->gro_cells);
John W. Linville2d07dc72015-05-13 12:57:30 -0400232 free_percpu(dev->tstats);
233}
234
Pravin B Shelar371bd102015-08-26 23:46:54 -0700235/* Callback from net/ipv4/udp.c to receive packets */
236static int geneve_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
237{
238 struct genevehdr *geneveh;
239 struct geneve_sock *gs;
240 int opts_len;
241
242 /* Need Geneve and inner Ethernet header to be present */
243 if (unlikely(!pskb_may_pull(skb, GENEVE_BASE_HLEN)))
244 goto error;
245
246 /* Return packets with reserved bits set */
247 geneveh = geneve_hdr(skb);
248 if (unlikely(geneveh->ver != GENEVE_VER))
249 goto error;
250
251 if (unlikely(geneveh->proto_type != htons(ETH_P_TEB)))
252 goto error;
253
254 opts_len = geneveh->opt_len * 4;
255 if (iptunnel_pull_header(skb, GENEVE_BASE_HLEN + opts_len,
256 htons(ETH_P_TEB)))
257 goto drop;
258
259 gs = rcu_dereference_sk_user_data(sk);
260 if (!gs)
261 goto drop;
262
263 geneve_rx(gs, skb);
264 return 0;
265
266drop:
267 /* Consume bad packet */
268 kfree_skb(skb);
269 return 0;
270
271error:
272 /* Let the UDP layer deal with the skb */
273 return 1;
274}
275
276static struct socket *geneve_create_sock(struct net *net, bool ipv6,
277 __be16 port)
278{
279 struct socket *sock;
280 struct udp_port_cfg udp_conf;
281 int err;
282
283 memset(&udp_conf, 0, sizeof(udp_conf));
284
285 if (ipv6) {
286 udp_conf.family = AF_INET6;
287 } else {
288 udp_conf.family = AF_INET;
289 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
290 }
291
292 udp_conf.local_udp_port = port;
293
294 /* Open UDP socket */
295 err = udp_sock_create(net, &udp_conf, &sock);
296 if (err < 0)
297 return ERR_PTR(err);
298
299 return sock;
300}
301
302static void geneve_notify_add_rx_port(struct geneve_sock *gs)
303{
304 struct sock *sk = gs->sock->sk;
305 sa_family_t sa_family = sk->sk_family;
306 int err;
307
308 if (sa_family == AF_INET) {
309 err = udp_add_offload(&gs->udp_offloads);
310 if (err)
311 pr_warn("geneve: udp_add_offload failed with status %d\n",
312 err);
313 }
314}
315
316static int geneve_hlen(struct genevehdr *gh)
317{
318 return sizeof(*gh) + gh->opt_len * 4;
319}
320
321static struct sk_buff **geneve_gro_receive(struct sk_buff **head,
322 struct sk_buff *skb,
323 struct udp_offload *uoff)
324{
325 struct sk_buff *p, **pp = NULL;
326 struct genevehdr *gh, *gh2;
327 unsigned int hlen, gh_len, off_gnv;
328 const struct packet_offload *ptype;
329 __be16 type;
330 int flush = 1;
331
332 off_gnv = skb_gro_offset(skb);
333 hlen = off_gnv + sizeof(*gh);
334 gh = skb_gro_header_fast(skb, off_gnv);
335 if (skb_gro_header_hard(skb, hlen)) {
336 gh = skb_gro_header_slow(skb, hlen, off_gnv);
337 if (unlikely(!gh))
338 goto out;
339 }
340
341 if (gh->ver != GENEVE_VER || gh->oam)
342 goto out;
343 gh_len = geneve_hlen(gh);
344
345 hlen = off_gnv + gh_len;
346 if (skb_gro_header_hard(skb, hlen)) {
347 gh = skb_gro_header_slow(skb, hlen, off_gnv);
348 if (unlikely(!gh))
349 goto out;
350 }
351
352 flush = 0;
353
354 for (p = *head; p; p = p->next) {
355 if (!NAPI_GRO_CB(p)->same_flow)
356 continue;
357
358 gh2 = (struct genevehdr *)(p->data + off_gnv);
359 if (gh->opt_len != gh2->opt_len ||
360 memcmp(gh, gh2, gh_len)) {
361 NAPI_GRO_CB(p)->same_flow = 0;
362 continue;
363 }
364 }
365
366 type = gh->proto_type;
367
368 rcu_read_lock();
369 ptype = gro_find_receive_by_type(type);
370 if (!ptype) {
371 flush = 1;
372 goto out_unlock;
373 }
374
375 skb_gro_pull(skb, gh_len);
376 skb_gro_postpull_rcsum(skb, gh, gh_len);
377 pp = ptype->callbacks.gro_receive(head, skb);
378
379out_unlock:
380 rcu_read_unlock();
381out:
382 NAPI_GRO_CB(skb)->flush |= flush;
383
384 return pp;
385}
386
387static int geneve_gro_complete(struct sk_buff *skb, int nhoff,
388 struct udp_offload *uoff)
389{
390 struct genevehdr *gh;
391 struct packet_offload *ptype;
392 __be16 type;
393 int gh_len;
394 int err = -ENOSYS;
395
396 udp_tunnel_gro_complete(skb, nhoff);
397
398 gh = (struct genevehdr *)(skb->data + nhoff);
399 gh_len = geneve_hlen(gh);
400 type = gh->proto_type;
401
402 rcu_read_lock();
403 ptype = gro_find_complete_by_type(type);
404 if (ptype)
405 err = ptype->callbacks.gro_complete(skb, nhoff + gh_len);
406
407 rcu_read_unlock();
408 return err;
409}
410
411/* Create new listen socket if needed */
412static struct geneve_sock *geneve_socket_create(struct net *net, __be16 port,
413 bool ipv6)
414{
415 struct geneve_net *gn = net_generic(net, geneve_net_id);
416 struct geneve_sock *gs;
417 struct socket *sock;
418 struct udp_tunnel_sock_cfg tunnel_cfg;
Pravin B Shelar66d47002015-08-26 23:46:55 -0700419 int h;
Pravin B Shelar371bd102015-08-26 23:46:54 -0700420
421 gs = kzalloc(sizeof(*gs), GFP_KERNEL);
422 if (!gs)
423 return ERR_PTR(-ENOMEM);
424
425 sock = geneve_create_sock(net, ipv6, port);
426 if (IS_ERR(sock)) {
427 kfree(gs);
428 return ERR_CAST(sock);
429 }
430
431 gs->sock = sock;
432 gs->refcnt = 1;
Pravin B Shelar66d47002015-08-26 23:46:55 -0700433 for (h = 0; h < VNI_HASH_SIZE; ++h)
434 INIT_HLIST_HEAD(&gs->vni_list[h]);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700435
436 /* Initialize the geneve udp offloads structure */
437 gs->udp_offloads.port = port;
438 gs->udp_offloads.callbacks.gro_receive = geneve_gro_receive;
439 gs->udp_offloads.callbacks.gro_complete = geneve_gro_complete;
440 geneve_notify_add_rx_port(gs);
441
442 /* Mark socket as an encapsulation socket */
443 tunnel_cfg.sk_user_data = gs;
444 tunnel_cfg.encap_type = 1;
445 tunnel_cfg.encap_rcv = geneve_udp_encap_recv;
446 tunnel_cfg.encap_destroy = NULL;
447 setup_udp_tunnel_sock(net, sock, &tunnel_cfg);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700448 list_add(&gs->list, &gn->sock_list);
449 return gs;
450}
451
452static void geneve_notify_del_rx_port(struct geneve_sock *gs)
453{
454 struct sock *sk = gs->sock->sk;
455 sa_family_t sa_family = sk->sk_family;
456
457 if (sa_family == AF_INET)
458 udp_del_offload(&gs->udp_offloads);
459}
460
461static void geneve_sock_release(struct geneve_sock *gs)
462{
463 if (--gs->refcnt)
464 return;
465
466 list_del(&gs->list);
467 geneve_notify_del_rx_port(gs);
468 udp_tunnel_sock_release(gs->sock);
469 kfree_rcu(gs, rcu);
470}
471
472static struct geneve_sock *geneve_find_sock(struct geneve_net *gn,
473 __be16 dst_port)
474{
475 struct geneve_sock *gs;
476
477 list_for_each_entry(gs, &gn->sock_list, list) {
478 if (inet_sk(gs->sock->sk)->inet_sport == dst_port &&
479 inet_sk(gs->sock->sk)->sk.sk_family == AF_INET) {
480 return gs;
481 }
482 }
483 return NULL;
484}
485
John W. Linville2d07dc72015-05-13 12:57:30 -0400486static int geneve_open(struct net_device *dev)
487{
488 struct geneve_dev *geneve = netdev_priv(dev);
489 struct net *net = geneve->net;
Pravin B Shelar371bd102015-08-26 23:46:54 -0700490 struct geneve_net *gn = net_generic(net, geneve_net_id);
John W. Linville2d07dc72015-05-13 12:57:30 -0400491 struct geneve_sock *gs;
Pravin B Shelar66d47002015-08-26 23:46:55 -0700492 __u32 hash;
John W. Linville2d07dc72015-05-13 12:57:30 -0400493
Pravin B Shelar371bd102015-08-26 23:46:54 -0700494 gs = geneve_find_sock(gn, geneve->dst_port);
495 if (gs) {
496 gs->refcnt++;
497 goto out;
498 }
499
500 gs = geneve_socket_create(net, geneve->dst_port, false);
John W. Linville2d07dc72015-05-13 12:57:30 -0400501 if (IS_ERR(gs))
502 return PTR_ERR(gs);
503
Pravin B Shelar371bd102015-08-26 23:46:54 -0700504out:
505 gs->collect_md = geneve->collect_md;
John W. Linville2d07dc72015-05-13 12:57:30 -0400506 geneve->sock = gs;
Pravin B Shelar66d47002015-08-26 23:46:55 -0700507
508 hash = geneve_net_vni_hash(geneve->vni);
509 hlist_add_head_rcu(&geneve->hlist, &gs->vni_list[hash]);
John W. Linville2d07dc72015-05-13 12:57:30 -0400510 return 0;
511}
512
513static int geneve_stop(struct net_device *dev)
514{
515 struct geneve_dev *geneve = netdev_priv(dev);
Pravin B Shelar66d47002015-08-26 23:46:55 -0700516 struct geneve_sock *gs = geneve->sock;
John W. Linville2d07dc72015-05-13 12:57:30 -0400517
Pravin B Shelar66d47002015-08-26 23:46:55 -0700518 if (!hlist_unhashed(&geneve->hlist))
519 hlist_del_rcu(&geneve->hlist);
520 geneve_sock_release(gs);
John W. Linville2d07dc72015-05-13 12:57:30 -0400521 return 0;
522}
523
Pravin B Shelar371bd102015-08-26 23:46:54 -0700524static int geneve_build_skb(struct rtable *rt, struct sk_buff *skb,
525 __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt,
526 bool csum)
527{
528 struct genevehdr *gnvh;
529 int min_headroom;
530 int err;
531
532 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
533 + GENEVE_BASE_HLEN + opt_len + sizeof(struct iphdr);
534 err = skb_cow_head(skb, min_headroom);
535 if (unlikely(err)) {
536 kfree_skb(skb);
537 goto free_rt;
538 }
539
540 skb = udp_tunnel_handle_offloads(skb, csum);
541 if (IS_ERR(skb)) {
542 err = PTR_ERR(skb);
543 goto free_rt;
544 }
545
546 gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len);
547 gnvh->ver = GENEVE_VER;
548 gnvh->opt_len = opt_len / 4;
549 gnvh->oam = !!(tun_flags & TUNNEL_OAM);
550 gnvh->critical = !!(tun_flags & TUNNEL_CRIT_OPT);
551 gnvh->rsvd1 = 0;
552 memcpy(gnvh->vni, vni, 3);
553 gnvh->proto_type = htons(ETH_P_TEB);
554 gnvh->rsvd2 = 0;
555 memcpy(gnvh->options, opt, opt_len);
556
557 skb_set_inner_protocol(skb, htons(ETH_P_TEB));
558 return 0;
559
560free_rt:
561 ip_rt_put(rt);
562 return err;
563}
564
Pravin B Shelare305ac62015-08-26 23:46:52 -0700565static struct rtable *geneve_get_rt(struct sk_buff *skb,
566 struct net_device *dev,
567 struct flowi4 *fl4,
568 struct ip_tunnel_info *info)
569{
570 struct geneve_dev *geneve = netdev_priv(dev);
571 struct rtable *rt = NULL;
572 __u8 tos;
573
574 memset(fl4, 0, sizeof(*fl4));
575 fl4->flowi4_mark = skb->mark;
576 fl4->flowi4_proto = IPPROTO_UDP;
577
578 if (info) {
579 fl4->daddr = info->key.u.ipv4.dst;
580 fl4->saddr = info->key.u.ipv4.src;
581 fl4->flowi4_tos = RT_TOS(info->key.tos);
582 } else {
583 tos = geneve->tos;
584 if (tos == 1) {
585 const struct iphdr *iip = ip_hdr(skb);
586
587 tos = ip_tunnel_get_dsfield(iip, skb);
588 }
589
590 fl4->flowi4_tos = RT_TOS(tos);
591 fl4->daddr = geneve->remote.sin_addr.s_addr;
592 }
593
594 rt = ip_route_output_key(geneve->net, fl4);
595 if (IS_ERR(rt)) {
596 netdev_dbg(dev, "no route to %pI4\n", &fl4->daddr);
597 dev->stats.tx_carrier_errors++;
598 return rt;
599 }
600 if (rt->dst.dev == dev) { /* is this necessary? */
601 netdev_dbg(dev, "circular route to %pI4\n", &fl4->daddr);
602 dev->stats.collisions++;
603 ip_rt_put(rt);
604 return ERR_PTR(-EINVAL);
605 }
Pravin B Shelare305ac62015-08-26 23:46:52 -0700606 return rt;
607}
608
609/* Convert 64 bit tunnel ID to 24 bit VNI. */
610static void tunnel_id_to_vni(__be64 tun_id, __u8 *vni)
611{
612#ifdef __BIG_ENDIAN
613 vni[0] = (__force __u8)(tun_id >> 16);
614 vni[1] = (__force __u8)(tun_id >> 8);
615 vni[2] = (__force __u8)tun_id;
616#else
617 vni[0] = (__force __u8)((__force u64)tun_id >> 40);
618 vni[1] = (__force __u8)((__force u64)tun_id >> 48);
619 vni[2] = (__force __u8)((__force u64)tun_id >> 56);
620#endif
621}
622
John W. Linville2d07dc72015-05-13 12:57:30 -0400623static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
624{
625 struct geneve_dev *geneve = netdev_priv(dev);
626 struct geneve_sock *gs = geneve->sock;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700627 struct ip_tunnel_info *info = NULL;
John W. Linville2d07dc72015-05-13 12:57:30 -0400628 struct rtable *rt = NULL;
John W. Linville08399ef2015-09-21 10:29:09 -0400629 const struct iphdr *iip; /* interior IP header */
John W. Linville2d07dc72015-05-13 12:57:30 -0400630 struct flowi4 fl4;
John W. Linville8760ce52015-06-01 15:51:34 -0400631 __u8 tos, ttl;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700632 __be16 sport;
Pravin B Shelar371bd102015-08-26 23:46:54 -0700633 bool udp_csum;
634 __be16 df;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700635 int err;
John W. Linville2d07dc72015-05-13 12:57:30 -0400636
Pravin B Shelare305ac62015-08-26 23:46:52 -0700637 if (geneve->collect_md) {
638 info = skb_tunnel_info(skb);
Jiri Benc46fa0622015-08-28 20:48:19 +0200639 if (unlikely(info && !(info->mode & IP_TUNNEL_INFO_TX))) {
Pravin B Shelare305ac62015-08-26 23:46:52 -0700640 netdev_dbg(dev, "no tunnel metadata\n");
641 goto tx_error;
642 }
Jiri Benc7f9562a2015-08-28 20:48:20 +0200643 if (info && ip_tunnel_info_af(info) != AF_INET)
644 goto tx_error;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700645 }
John W. Linville2d07dc72015-05-13 12:57:30 -0400646
Pravin B Shelare305ac62015-08-26 23:46:52 -0700647 rt = geneve_get_rt(skb, dev, &fl4, info);
John W. Linville2d07dc72015-05-13 12:57:30 -0400648 if (IS_ERR(rt)) {
649 netdev_dbg(dev, "no route to %pI4\n", &fl4.daddr);
650 dev->stats.tx_carrier_errors++;
651 goto tx_error;
652 }
Pravin B Shelar371bd102015-08-26 23:46:54 -0700653
654 sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700655 skb_reset_mac_header(skb);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700656
John W. Linville08399ef2015-09-21 10:29:09 -0400657 iip = ip_hdr(skb);
658
Pravin B Shelare305ac62015-08-26 23:46:52 -0700659 if (info) {
660 const struct ip_tunnel_key *key = &info->key;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700661 u8 *opts = NULL;
662 u8 vni[3];
Pravin B Shelare305ac62015-08-26 23:46:52 -0700663
664 tunnel_id_to_vni(key->tun_id, vni);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700665 if (key->tun_flags & TUNNEL_GENEVE_OPT)
Pravin B Shelar4c222792015-08-30 18:09:38 -0700666 opts = ip_tunnel_info_opts(info);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700667
Pravin B Shelar371bd102015-08-26 23:46:54 -0700668 udp_csum = !!(key->tun_flags & TUNNEL_CSUM);
669 err = geneve_build_skb(rt, skb, key->tun_flags, vni,
670 info->options_len, opts, udp_csum);
671 if (unlikely(err))
672 goto err;
673
John W. Linville08399ef2015-09-21 10:29:09 -0400674 tos = ip_tunnel_ecn_encap(key->tos, iip, skb);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700675 ttl = key->ttl;
676 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700677 } else {
Pravin B Shelar371bd102015-08-26 23:46:54 -0700678 udp_csum = false;
679 err = geneve_build_skb(rt, skb, 0, geneve->vni,
680 0, NULL, udp_csum);
681 if (unlikely(err))
682 goto err;
683
Pravin B Shelare305ac62015-08-26 23:46:52 -0700684 tos = ip_tunnel_ecn_encap(fl4.flowi4_tos, iip, skb);
Pravin B Shelare305ac62015-08-26 23:46:52 -0700685 ttl = geneve->ttl;
686 if (!ttl && IN_MULTICAST(ntohl(fl4.daddr)))
687 ttl = 1;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700688 ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700689 df = 0;
John W. Linville2d07dc72015-05-13 12:57:30 -0400690 }
Pravin B Shelar371bd102015-08-26 23:46:54 -0700691 err = udp_tunnel_xmit_skb(rt, gs->sock->sk, skb, fl4.saddr, fl4.daddr,
692 tos, ttl, df, sport, geneve->dst_port,
693 !net_eq(geneve->net, dev_net(geneve->dev)),
694 !udp_csum);
John W. Linville2d07dc72015-05-13 12:57:30 -0400695
696 iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
John W. Linville2d07dc72015-05-13 12:57:30 -0400697 return NETDEV_TX_OK;
698
John W. Linville2d07dc72015-05-13 12:57:30 -0400699tx_error:
John W. Linville2d07dc72015-05-13 12:57:30 -0400700 dev_kfree_skb(skb);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700701err:
702 dev->stats.tx_errors++;
John W. Linville2d07dc72015-05-13 12:57:30 -0400703 return NETDEV_TX_OK;
704}
705
706static const struct net_device_ops geneve_netdev_ops = {
707 .ndo_init = geneve_init,
708 .ndo_uninit = geneve_uninit,
709 .ndo_open = geneve_open,
710 .ndo_stop = geneve_stop,
711 .ndo_start_xmit = geneve_xmit,
712 .ndo_get_stats64 = ip_tunnel_get_stats64,
713 .ndo_change_mtu = eth_change_mtu,
714 .ndo_validate_addr = eth_validate_addr,
715 .ndo_set_mac_address = eth_mac_addr,
716};
717
718static void geneve_get_drvinfo(struct net_device *dev,
719 struct ethtool_drvinfo *drvinfo)
720{
721 strlcpy(drvinfo->version, GENEVE_NETDEV_VER, sizeof(drvinfo->version));
722 strlcpy(drvinfo->driver, "geneve", sizeof(drvinfo->driver));
723}
724
725static const struct ethtool_ops geneve_ethtool_ops = {
726 .get_drvinfo = geneve_get_drvinfo,
727 .get_link = ethtool_op_get_link,
728};
729
730/* Info for udev, that this is a virtual tunnel endpoint */
731static struct device_type geneve_type = {
732 .name = "geneve",
733};
734
735/* Initialize the device structure. */
736static void geneve_setup(struct net_device *dev)
737{
738 ether_setup(dev);
739
740 dev->netdev_ops = &geneve_netdev_ops;
741 dev->ethtool_ops = &geneve_ethtool_ops;
742 dev->destructor = free_netdev;
743
744 SET_NETDEV_DEVTYPE(dev, &geneve_type);
745
John W. Linville2d07dc72015-05-13 12:57:30 -0400746 dev->features |= NETIF_F_LLTX;
747 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
748 dev->features |= NETIF_F_RXCSUM;
749 dev->features |= NETIF_F_GSO_SOFTWARE;
750
John W. Linville2d07dc72015-05-13 12:57:30 -0400751 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
752 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
John W. Linville2d07dc72015-05-13 12:57:30 -0400753
754 netif_keep_dst(dev);
Phil Suttered961ac2015-08-18 10:30:31 +0200755 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_NO_QUEUE;
Pravin B Shelar87cd3dc2015-08-26 23:46:48 -0700756 eth_hw_addr_random(dev);
John W. Linville2d07dc72015-05-13 12:57:30 -0400757}
758
759static const struct nla_policy geneve_policy[IFLA_GENEVE_MAX + 1] = {
760 [IFLA_GENEVE_ID] = { .type = NLA_U32 },
761 [IFLA_GENEVE_REMOTE] = { .len = FIELD_SIZEOF(struct iphdr, daddr) },
John W. Linville8760ce52015-06-01 15:51:34 -0400762 [IFLA_GENEVE_TTL] = { .type = NLA_U8 },
John W. Linvilled8951122015-06-01 15:51:35 -0400763 [IFLA_GENEVE_TOS] = { .type = NLA_U8 },
Pravin B Shelarcd7918b2015-08-26 23:46:51 -0700764 [IFLA_GENEVE_PORT] = { .type = NLA_U16 },
Pravin B Shelare305ac62015-08-26 23:46:52 -0700765 [IFLA_GENEVE_COLLECT_METADATA] = { .type = NLA_FLAG },
John W. Linville2d07dc72015-05-13 12:57:30 -0400766};
767
768static int geneve_validate(struct nlattr *tb[], struct nlattr *data[])
769{
770 if (tb[IFLA_ADDRESS]) {
771 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
772 return -EINVAL;
773
774 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
775 return -EADDRNOTAVAIL;
776 }
777
778 if (!data)
779 return -EINVAL;
780
781 if (data[IFLA_GENEVE_ID]) {
782 __u32 vni = nla_get_u32(data[IFLA_GENEVE_ID]);
783
784 if (vni >= GENEVE_VID_MASK)
785 return -ERANGE;
786 }
787
788 return 0;
789}
790
Pravin B Shelar371bd102015-08-26 23:46:54 -0700791static struct geneve_dev *geneve_find_dev(struct geneve_net *gn,
792 __be16 dst_port,
793 __be32 rem_addr,
794 u8 vni[],
795 bool *tun_on_same_port,
796 bool *tun_collect_md)
797{
798 struct geneve_dev *geneve, *t;
799
800 *tun_on_same_port = false;
801 *tun_collect_md = false;
802 t = NULL;
803 list_for_each_entry(geneve, &gn->geneve_list, next) {
804 if (geneve->dst_port == dst_port) {
805 *tun_collect_md = geneve->collect_md;
806 *tun_on_same_port = true;
807 }
808 if (!memcmp(vni, geneve->vni, sizeof(geneve->vni)) &&
809 rem_addr == geneve->remote.sin_addr.s_addr &&
810 dst_port == geneve->dst_port)
811 t = geneve;
812 }
813 return t;
814}
815
Pravin B Shelare305ac62015-08-26 23:46:52 -0700816static int geneve_configure(struct net *net, struct net_device *dev,
817 __be32 rem_addr, __u32 vni, __u8 ttl, __u8 tos,
818 __u16 dst_port, bool metadata)
John W. Linville2d07dc72015-05-13 12:57:30 -0400819{
820 struct geneve_net *gn = net_generic(net, geneve_net_id);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700821 struct geneve_dev *t, *geneve = netdev_priv(dev);
822 bool tun_collect_md, tun_on_same_port;
John W. Linville2d07dc72015-05-13 12:57:30 -0400823 int err;
824
Pravin B Shelare305ac62015-08-26 23:46:52 -0700825 if (metadata) {
Pravin B Shelar371bd102015-08-26 23:46:54 -0700826 if (rem_addr || vni || tos || ttl)
827 return -EINVAL;
Pravin B Shelare305ac62015-08-26 23:46:52 -0700828 }
John W. Linville2d07dc72015-05-13 12:57:30 -0400829
830 geneve->net = net;
831 geneve->dev = dev;
832
John W. Linville2d07dc72015-05-13 12:57:30 -0400833 geneve->vni[0] = (vni & 0x00ff0000) >> 16;
834 geneve->vni[1] = (vni & 0x0000ff00) >> 8;
835 geneve->vni[2] = vni & 0x000000ff;
836
Pravin B Shelare305ac62015-08-26 23:46:52 -0700837 geneve->remote.sin_addr.s_addr = rem_addr;
John W. Linville2d07dc72015-05-13 12:57:30 -0400838 if (IN_MULTICAST(ntohl(geneve->remote.sin_addr.s_addr)))
839 return -EINVAL;
840
Pravin B Shelare305ac62015-08-26 23:46:52 -0700841 geneve->ttl = ttl;
842 geneve->tos = tos;
843 geneve->dst_port = htons(dst_port);
844 geneve->collect_md = metadata;
845
Pravin B Shelar371bd102015-08-26 23:46:54 -0700846 t = geneve_find_dev(gn, htons(dst_port), rem_addr, geneve->vni,
847 &tun_on_same_port, &tun_collect_md);
848 if (t)
849 return -EBUSY;
850
851 if (metadata) {
852 if (tun_on_same_port)
853 return -EPERM;
854 } else {
855 if (tun_collect_md)
856 return -EPERM;
857 }
858
John W. Linville2d07dc72015-05-13 12:57:30 -0400859 err = register_netdevice(dev);
860 if (err)
861 return err;
862
863 list_add(&geneve->next, &gn->geneve_list);
John W. Linville2d07dc72015-05-13 12:57:30 -0400864 return 0;
865}
866
Pravin B Shelare305ac62015-08-26 23:46:52 -0700867static int geneve_newlink(struct net *net, struct net_device *dev,
868 struct nlattr *tb[], struct nlattr *data[])
869{
870 __u16 dst_port = GENEVE_UDP_PORT;
871 __u8 ttl = 0, tos = 0;
872 bool metadata = false;
873 __be32 rem_addr;
874 __u32 vni;
875
876 if (!data[IFLA_GENEVE_ID] || !data[IFLA_GENEVE_REMOTE])
877 return -EINVAL;
878
879 vni = nla_get_u32(data[IFLA_GENEVE_ID]);
880 rem_addr = nla_get_in_addr(data[IFLA_GENEVE_REMOTE]);
881
882 if (data[IFLA_GENEVE_TTL])
883 ttl = nla_get_u8(data[IFLA_GENEVE_TTL]);
884
885 if (data[IFLA_GENEVE_TOS])
886 tos = nla_get_u8(data[IFLA_GENEVE_TOS]);
887
888 if (data[IFLA_GENEVE_PORT])
889 dst_port = nla_get_u16(data[IFLA_GENEVE_PORT]);
890
891 if (data[IFLA_GENEVE_COLLECT_METADATA])
892 metadata = true;
893
894 return geneve_configure(net, dev, rem_addr, vni,
895 ttl, tos, dst_port, metadata);
896}
897
John W. Linville2d07dc72015-05-13 12:57:30 -0400898static void geneve_dellink(struct net_device *dev, struct list_head *head)
899{
900 struct geneve_dev *geneve = netdev_priv(dev);
901
John W. Linville2d07dc72015-05-13 12:57:30 -0400902 list_del(&geneve->next);
903 unregister_netdevice_queue(dev, head);
904}
905
906static size_t geneve_get_size(const struct net_device *dev)
907{
908 return nla_total_size(sizeof(__u32)) + /* IFLA_GENEVE_ID */
909 nla_total_size(sizeof(struct in_addr)) + /* IFLA_GENEVE_REMOTE */
John W. Linville8760ce52015-06-01 15:51:34 -0400910 nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TTL */
John W. Linvilled8951122015-06-01 15:51:35 -0400911 nla_total_size(sizeof(__u8)) + /* IFLA_GENEVE_TOS */
Pravin B Shelarcd7918b2015-08-26 23:46:51 -0700912 nla_total_size(sizeof(__u16)) + /* IFLA_GENEVE_PORT */
Pravin B Shelare305ac62015-08-26 23:46:52 -0700913 nla_total_size(0) + /* IFLA_GENEVE_COLLECT_METADATA */
John W. Linville2d07dc72015-05-13 12:57:30 -0400914 0;
915}
916
917static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
918{
919 struct geneve_dev *geneve = netdev_priv(dev);
920 __u32 vni;
921
922 vni = (geneve->vni[0] << 16) | (geneve->vni[1] << 8) | geneve->vni[2];
923 if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))
924 goto nla_put_failure;
925
926 if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,
927 geneve->remote.sin_addr.s_addr))
928 goto nla_put_failure;
929
John W. Linvilled8951122015-06-01 15:51:35 -0400930 if (nla_put_u8(skb, IFLA_GENEVE_TTL, geneve->ttl) ||
931 nla_put_u8(skb, IFLA_GENEVE_TOS, geneve->tos))
John W. Linville8760ce52015-06-01 15:51:34 -0400932 goto nla_put_failure;
933
Pravin B Shelarcd7918b2015-08-26 23:46:51 -0700934 if (nla_put_u16(skb, IFLA_GENEVE_PORT, ntohs(geneve->dst_port)))
935 goto nla_put_failure;
936
Pravin B Shelare305ac62015-08-26 23:46:52 -0700937 if (geneve->collect_md) {
938 if (nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
939 goto nla_put_failure;
940 }
941
John W. Linville2d07dc72015-05-13 12:57:30 -0400942 return 0;
943
944nla_put_failure:
945 return -EMSGSIZE;
946}
947
948static struct rtnl_link_ops geneve_link_ops __read_mostly = {
949 .kind = "geneve",
950 .maxtype = IFLA_GENEVE_MAX,
951 .policy = geneve_policy,
952 .priv_size = sizeof(struct geneve_dev),
953 .setup = geneve_setup,
954 .validate = geneve_validate,
955 .newlink = geneve_newlink,
956 .dellink = geneve_dellink,
957 .get_size = geneve_get_size,
958 .fill_info = geneve_fill_info,
959};
960
Pravin B Shelare305ac62015-08-26 23:46:52 -0700961struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
962 u8 name_assign_type, u16 dst_port)
963{
964 struct nlattr *tb[IFLA_MAX + 1];
965 struct net_device *dev;
966 int err;
967
968 memset(tb, 0, sizeof(tb));
969 dev = rtnl_create_link(net, name, name_assign_type,
970 &geneve_link_ops, tb);
971 if (IS_ERR(dev))
972 return dev;
973
974 err = geneve_configure(net, dev, 0, 0, 0, 0, dst_port, true);
975 if (err) {
976 free_netdev(dev);
977 return ERR_PTR(err);
978 }
979 return dev;
980}
981EXPORT_SYMBOL_GPL(geneve_dev_create_fb);
982
John W. Linville2d07dc72015-05-13 12:57:30 -0400983static __net_init int geneve_init_net(struct net *net)
984{
985 struct geneve_net *gn = net_generic(net, geneve_net_id);
John W. Linville2d07dc72015-05-13 12:57:30 -0400986
987 INIT_LIST_HEAD(&gn->geneve_list);
Pravin B Shelar371bd102015-08-26 23:46:54 -0700988 INIT_LIST_HEAD(&gn->sock_list);
John W. Linville2d07dc72015-05-13 12:57:30 -0400989 return 0;
990}
991
992static void __net_exit geneve_exit_net(struct net *net)
993{
994 struct geneve_net *gn = net_generic(net, geneve_net_id);
995 struct geneve_dev *geneve, *next;
996 struct net_device *dev, *aux;
997 LIST_HEAD(list);
998
999 rtnl_lock();
1000
1001 /* gather any geneve devices that were moved into this ns */
1002 for_each_netdev_safe(net, dev, aux)
1003 if (dev->rtnl_link_ops == &geneve_link_ops)
1004 unregister_netdevice_queue(dev, &list);
1005
1006 /* now gather any other geneve devices that were created in this ns */
1007 list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) {
1008 /* If geneve->dev is in the same netns, it was already added
1009 * to the list by the previous loop.
1010 */
1011 if (!net_eq(dev_net(geneve->dev), net))
1012 unregister_netdevice_queue(geneve->dev, &list);
1013 }
1014
1015 /* unregister the devices gathered above */
1016 unregister_netdevice_many(&list);
1017 rtnl_unlock();
1018}
1019
1020static struct pernet_operations geneve_net_ops = {
1021 .init = geneve_init_net,
1022 .exit = geneve_exit_net,
1023 .id = &geneve_net_id,
1024 .size = sizeof(struct geneve_net),
1025};
1026
1027static int __init geneve_init_module(void)
1028{
1029 int rc;
1030
1031 rc = register_pernet_subsys(&geneve_net_ops);
1032 if (rc)
1033 goto out1;
1034
1035 rc = rtnl_link_register(&geneve_link_ops);
1036 if (rc)
1037 goto out2;
1038
1039 return 0;
1040out2:
1041 unregister_pernet_subsys(&geneve_net_ops);
1042out1:
1043 return rc;
1044}
1045late_initcall(geneve_init_module);
1046
1047static void __exit geneve_cleanup_module(void)
1048{
1049 rtnl_link_unregister(&geneve_link_ops);
1050 unregister_pernet_subsys(&geneve_net_ops);
1051}
1052module_exit(geneve_cleanup_module);
1053
1054MODULE_LICENSE("GPL");
1055MODULE_VERSION(GENEVE_NETDEV_VER);
1056MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>");
1057MODULE_DESCRIPTION("Interface driver for GENEVE encapsulated traffic");
1058MODULE_ALIAS_RTNL_LINK("geneve");