Merge branch 'mainstream'
[sliver-openvswitch.git] / ofproto / tunnel.c
1 /* Copyright (c) 2013, 2014 Nicira, Inc.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14
15 #include <config.h>
16 #include "tunnel.h"
17
18 #include <errno.h>
19
20 #include "byte-order.h"
21 #include "connectivity.h"
22 #include "dynamic-string.h"
23 #include "hash.h"
24 #include "hmap.h"
25 #include "netdev.h"
26 #include "odp-util.h"
27 #include "packets.h"
28 #include "seq.h"
29 #include "smap.h"
30 #include "socket-util.h"
31 #include "tunnel.h"
32 #include "vlog.h"
33
34 VLOG_DEFINE_THIS_MODULE(tunnel);
35
36 /* skb mark used for IPsec tunnel packets */
37 #define IPSEC_MARK 1
38
39 struct tnl_match {
40     ovs_be64 in_key;
41     ovs_be32 ip_src;
42     ovs_be32 ip_dst;
43     odp_port_t odp_port;
44     uint32_t pkt_mark;
45     bool in_key_flow;
46     bool ip_src_flow;
47     bool ip_dst_flow;
48 };
49
50 struct tnl_port {
51     struct hmap_node ofport_node;
52     struct hmap_node match_node;
53
54     const struct ofport_dpif *ofport;
55     unsigned int change_seq;
56     struct netdev *netdev;
57
58     struct tnl_match match;
59 };
60
61 static struct ovs_rwlock rwlock = OVS_RWLOCK_INITIALIZER;
62
63 /* Tunnel matches.
64  *
65  * This module maps packets received over tunnel protocols to vports.  The
66  * tunnel protocol and, for some protocols, tunnel-specific information (e.g.,
67  * for VXLAN, the UDP destination port number) are always use as part of the
68  * mapping.  Which other fields are used for the mapping depends on the vports
69  * themselves (the parenthesized notations refer to "struct tnl_match" fields):
70  *
71  *     - in_key: A vport may match a specific tunnel ID (in_key_flow == false)
72  *       or arrange for the tunnel ID to be matched as tunnel.tun_id in the
73  *       OpenFlow flow (in_key_flow == true).
74  *
75  *     - ip_dst: A vport may match a specific destination IP address
76  *       (ip_dst_flow == false) or arrange for the destination IP to be matched
77  *       as tunnel.ip_dst in the OpenFlow flow (ip_dst_flow == true).
78  *
79  *     - ip_src: A vport may match a specific IP source address (ip_src_flow ==
80  *       false, ip_src != 0), wildcard all source addresses (ip_src_flow ==
81  *       false, ip_src == 0), or arrange for the IP source address to be
82  *       handled in the OpenFlow flow table (ip_src_flow == true).
83  *
84  * Thus, there are 2 * 2 * 3 == 12 possible ways a vport can match against a
85  * tunnel packet.  We number the possibilities for each field in increasing
86  * order as listed in each bullet above.  We order the 12 overall combinations
87  * in lexicographic order considering in_key first, then ip_dst, then
88  * ip_src. */
89 #define N_MATCH_TYPES (2 * 2 * 3)
90
91 /* The three possibilities (see above) for vport ip_src matches. */
92 enum ip_src_type {
93     IP_SRC_CFG,             /* ip_src must equal configured address. */
94     IP_SRC_ANY,             /* Any ip_src is acceptable. */
95     IP_SRC_FLOW             /* ip_src is handled in flow table. */
96 };
97
98 /* Each hmap contains "struct tnl_port"s.
99  * The index is a combination of how each of the fields listed under "Tunnel
100  * matches" above matches, see the final paragraph for ordering. */
101 static struct hmap *tnl_match_maps[N_MATCH_TYPES] OVS_GUARDED_BY(rwlock);
102 static struct hmap **tnl_match_map(const struct tnl_match *);
103
104 static struct hmap ofport_map__ = HMAP_INITIALIZER(&ofport_map__);
105 static struct hmap *ofport_map OVS_GUARDED_BY(rwlock) = &ofport_map__;
106
107 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
108 static struct vlog_rate_limit dbg_rl = VLOG_RATE_LIMIT_INIT(60, 60);
109
110 static struct tnl_port *tnl_find(const struct flow *) OVS_REQ_RDLOCK(rwlock);
111 static struct tnl_port *tnl_find_exact(struct tnl_match *, struct hmap *)
112     OVS_REQ_RDLOCK(rwlock);
113 static struct tnl_port *tnl_find_ofport(const struct ofport_dpif *)
114     OVS_REQ_RDLOCK(rwlock);
115
116 static uint32_t tnl_hash(struct tnl_match *);
117 static void tnl_match_fmt(const struct tnl_match *, struct ds *);
118 static char *tnl_port_fmt(const struct tnl_port *) OVS_REQ_RDLOCK(rwlock);
119 static void tnl_port_mod_log(const struct tnl_port *, const char *action)
120     OVS_REQ_RDLOCK(rwlock);
121 static const char *tnl_port_get_name(const struct tnl_port *)
122     OVS_REQ_RDLOCK(rwlock);
123 static void tnl_port_del__(const struct ofport_dpif *) OVS_REQ_WRLOCK(rwlock);
124
125 static bool
126 tnl_port_add__(const struct ofport_dpif *ofport, const struct netdev *netdev,
127                odp_port_t odp_port, bool warn)
128     OVS_REQ_WRLOCK(rwlock)
129 {
130     const struct netdev_tunnel_config *cfg;
131     struct tnl_port *existing_port;
132     struct tnl_port *tnl_port;
133     struct hmap **map;
134
135     cfg = netdev_get_tunnel_config(netdev);
136     ovs_assert(cfg);
137
138     tnl_port = xzalloc(sizeof *tnl_port);
139     tnl_port->ofport = ofport;
140     tnl_port->netdev = netdev_ref(netdev);
141     tnl_port->change_seq = seq_read(connectivity_seq_get());
142
143     tnl_port->match.in_key = cfg->in_key;
144     tnl_port->match.ip_src = cfg->ip_src;
145     tnl_port->match.ip_dst = cfg->ip_dst;
146     tnl_port->match.ip_src_flow = cfg->ip_src_flow;
147     tnl_port->match.ip_dst_flow = cfg->ip_dst_flow;
148     tnl_port->match.pkt_mark = cfg->ipsec ? IPSEC_MARK : 0;
149     tnl_port->match.in_key_flow = cfg->in_key_flow;
150     tnl_port->match.odp_port = odp_port;
151
152     map = tnl_match_map(&tnl_port->match);
153     existing_port = tnl_find_exact(&tnl_port->match, *map);
154     if (existing_port) {
155         if (warn) {
156             struct ds ds = DS_EMPTY_INITIALIZER;
157             tnl_match_fmt(&tnl_port->match, &ds);
158             VLOG_WARN("%s: attempting to add tunnel port with same config as "
159                       "port '%s' (%s)", tnl_port_get_name(tnl_port),
160                       tnl_port_get_name(existing_port), ds_cstr(&ds));
161             ds_destroy(&ds);
162             free(tnl_port);
163         }
164         return false;
165     }
166
167     hmap_insert(ofport_map, &tnl_port->ofport_node, hash_pointer(ofport, 0));
168
169     if (!*map) {
170         *map = xmalloc(sizeof **map);
171         hmap_init(*map);
172     }
173     hmap_insert(*map, &tnl_port->match_node, tnl_hash(&tnl_port->match));
174     tnl_port_mod_log(tnl_port, "adding");
175     return true;
176 }
177
178 /* Adds 'ofport' to the module with datapath port number 'odp_port'. 'ofport's
179  * must be added before they can be used by the module. 'ofport' must be a
180  * tunnel. */
181 void
182 tnl_port_add(const struct ofport_dpif *ofport, const struct netdev *netdev,
183              odp_port_t odp_port) OVS_EXCLUDED(rwlock)
184 {
185     ovs_rwlock_wrlock(&rwlock);
186     tnl_port_add__(ofport, netdev, odp_port, true);
187     ovs_rwlock_unlock(&rwlock);
188 }
189
190 /* Checks if the tunnel represented by 'ofport' reconfiguration due to changes
191  * in its netdev_tunnel_config.  If it does, returns true. Otherwise, returns
192  * false.  'ofport' and 'odp_port' should be the same as would be passed to
193  * tnl_port_add(). */
194 bool
195 tnl_port_reconfigure(const struct ofport_dpif *ofport,
196                      const struct netdev *netdev, odp_port_t odp_port)
197     OVS_EXCLUDED(rwlock)
198 {
199     struct tnl_port *tnl_port;
200     bool changed = false;
201
202     ovs_rwlock_wrlock(&rwlock);
203     tnl_port = tnl_find_ofport(ofport);
204     if (!tnl_port) {
205         changed = tnl_port_add__(ofport, netdev, odp_port, false);
206     } else if (tnl_port->netdev != netdev
207                || tnl_port->match.odp_port != odp_port
208                || tnl_port->change_seq != seq_read(connectivity_seq_get())) {
209         VLOG_DBG("reconfiguring %s", tnl_port_get_name(tnl_port));
210         tnl_port_del__(ofport);
211         tnl_port_add__(ofport, netdev, odp_port, true);
212         changed = true;
213     }
214     ovs_rwlock_unlock(&rwlock);
215     return changed;
216 }
217
218 static void
219 tnl_port_del__(const struct ofport_dpif *ofport) OVS_REQ_WRLOCK(rwlock)
220 {
221     struct tnl_port *tnl_port;
222
223     if (!ofport) {
224         return;
225     }
226
227     tnl_port = tnl_find_ofport(ofport);
228     if (tnl_port) {
229         struct hmap **map;
230
231         tnl_port_mod_log(tnl_port, "removing");
232         map = tnl_match_map(&tnl_port->match);
233         hmap_remove(*map, &tnl_port->match_node);
234         if (hmap_is_empty(*map)) {
235             hmap_destroy(*map);
236             free(*map);
237             *map = NULL;
238         }
239         hmap_remove(ofport_map, &tnl_port->ofport_node);
240         netdev_close(tnl_port->netdev);
241         free(tnl_port);
242     }
243 }
244
245 /* Removes 'ofport' from the module. */
246 void
247 tnl_port_del(const struct ofport_dpif *ofport) OVS_EXCLUDED(rwlock)
248 {
249     ovs_rwlock_wrlock(&rwlock);
250     tnl_port_del__(ofport);
251     ovs_rwlock_unlock(&rwlock);
252 }
253
254 /* Looks in the table of tunnels for a tunnel matching the metadata in 'flow'.
255  * Returns the 'ofport' corresponding to the new in_port, or a null pointer if
256  * none is found.
257  *
258  * Callers should verify that 'flow' needs to be received by calling
259  * tnl_port_should_receive() before this function. */
260 const struct ofport_dpif *
261 tnl_port_receive(const struct flow *flow) OVS_EXCLUDED(rwlock)
262 {
263     char *pre_flow_str = NULL;
264     const struct ofport_dpif *ofport;
265     struct tnl_port *tnl_port;
266
267     ovs_rwlock_rdlock(&rwlock);
268     tnl_port = tnl_find(flow);
269     ofport = tnl_port ? tnl_port->ofport : NULL;
270     if (!tnl_port) {
271         char *flow_str = flow_to_string(flow);
272
273         VLOG_WARN_RL(&rl, "receive tunnel port not found (%s)", flow_str);
274         free(flow_str);
275         goto out;
276     }
277
278     if (!VLOG_DROP_DBG(&dbg_rl)) {
279         pre_flow_str = flow_to_string(flow);
280     }
281
282     if (pre_flow_str) {
283         char *post_flow_str = flow_to_string(flow);
284         char *tnl_str = tnl_port_fmt(tnl_port);
285         VLOG_DBG("flow received\n"
286                  "%s"
287                  " pre: %s\n"
288                  "post: %s",
289                  tnl_str, pre_flow_str, post_flow_str);
290         free(tnl_str);
291         free(pre_flow_str);
292         free(post_flow_str);
293     }
294
295 out:
296     ovs_rwlock_unlock(&rwlock);
297     return ofport;
298 }
299
300 static bool
301 tnl_ecn_ok(const struct flow *base_flow, struct flow *flow)
302 {
303     if (is_ip_any(base_flow)
304         && (flow->tunnel.ip_tos & IP_ECN_MASK) == IP_ECN_CE) {
305         if ((base_flow->nw_tos & IP_ECN_MASK) == IP_ECN_NOT_ECT) {
306             VLOG_WARN_RL(&rl, "dropping tunnel packet marked ECN CE"
307                          " but is not ECN capable");
308             return false;
309         } else {
310             /* Set the ECN CE value in the tunneled packet. */
311             flow->nw_tos |= IP_ECN_CE;
312         }
313     }
314
315     return true;
316 }
317
318 /* Should be called at the beginning of action translation to initialize
319  * wildcards and perform any actions based on receiving on tunnel port.
320  *
321  * Returns false if the packet must be dropped. */
322 bool
323 tnl_xlate_init(const struct flow *base_flow, struct flow *flow,
324                struct flow_wildcards *wc)
325 {
326     if (tnl_port_should_receive(flow)) {
327         memset(&wc->masks.tunnel, 0xff, sizeof wc->masks.tunnel);
328         wc->masks.tunnel.flags = (FLOW_TNL_F_DONT_FRAGMENT |
329                                   FLOW_TNL_F_CSUM |
330                                   FLOW_TNL_F_KEY);
331         memset(&wc->masks.pkt_mark, 0xff, sizeof wc->masks.pkt_mark);
332
333         if (!tnl_ecn_ok(base_flow, flow)) {
334             return false;
335         }
336
337         flow->pkt_mark &= ~IPSEC_MARK;
338     }
339
340     return true;
341 }
342
343 /* Given that 'flow' should be output to the ofport corresponding to
344  * 'tnl_port', updates 'flow''s tunnel headers and returns the actual datapath
345  * port that the output should happen on.  May return ODPP_NONE if the output
346  * shouldn't occur. */
347 odp_port_t
348 tnl_port_send(const struct ofport_dpif *ofport, struct flow *flow,
349               struct flow_wildcards *wc) OVS_EXCLUDED(rwlock)
350 {
351     const struct netdev_tunnel_config *cfg;
352     struct tnl_port *tnl_port;
353     char *pre_flow_str = NULL;
354     odp_port_t out_port;
355
356     ovs_rwlock_rdlock(&rwlock);
357     tnl_port = tnl_find_ofport(ofport);
358     out_port = tnl_port ? tnl_port->match.odp_port : ODPP_NONE;
359     if (!tnl_port) {
360         goto out;
361     }
362
363     cfg = netdev_get_tunnel_config(tnl_port->netdev);
364     ovs_assert(cfg);
365
366     if (!VLOG_DROP_DBG(&dbg_rl)) {
367         pre_flow_str = flow_to_string(flow);
368     }
369
370     if (!cfg->ip_src_flow) {
371         flow->tunnel.ip_src = tnl_port->match.ip_src;
372     }
373     if (!cfg->ip_dst_flow) {
374         flow->tunnel.ip_dst = tnl_port->match.ip_dst;
375     }
376     flow->pkt_mark = tnl_port->match.pkt_mark;
377
378     if (!cfg->out_key_flow) {
379         flow->tunnel.tun_id = cfg->out_key;
380     }
381
382     if (cfg->ttl_inherit && is_ip_any(flow)) {
383         wc->masks.nw_ttl = 0xff;
384         flow->tunnel.ip_ttl = flow->nw_ttl;
385     } else {
386         flow->tunnel.ip_ttl = cfg->ttl;
387     }
388
389     if (cfg->tos_inherit && is_ip_any(flow)) {
390         wc->masks.nw_tos = 0xff;
391         flow->tunnel.ip_tos = flow->nw_tos & IP_DSCP_MASK;
392     } else {
393         flow->tunnel.ip_tos = cfg->tos;
394     }
395
396     /* ECN fields are always inherited. */
397     if (is_ip_any(flow)) {
398         wc->masks.nw_tos |= IP_ECN_MASK;
399     }
400
401     if ((flow->nw_tos & IP_ECN_MASK) == IP_ECN_CE) {
402         flow->tunnel.ip_tos |= IP_ECN_ECT_0;
403     } else {
404         flow->tunnel.ip_tos |= flow->nw_tos & IP_ECN_MASK;
405     }
406
407     flow->tunnel.flags = (cfg->dont_fragment ? FLOW_TNL_F_DONT_FRAGMENT : 0)
408         | (cfg->csum ? FLOW_TNL_F_CSUM : 0)
409         | (cfg->out_key_present ? FLOW_TNL_F_KEY : 0);
410
411     if (pre_flow_str) {
412         char *post_flow_str = flow_to_string(flow);
413         char *tnl_str = tnl_port_fmt(tnl_port);
414         VLOG_DBG("flow sent\n"
415                  "%s"
416                  " pre: %s\n"
417                  "post: %s",
418                  tnl_str, pre_flow_str, post_flow_str);
419         free(tnl_str);
420         free(pre_flow_str);
421         free(post_flow_str);
422     }
423
424 out:
425     ovs_rwlock_unlock(&rwlock);
426     return out_port;
427 }
428
429 static uint32_t
430 tnl_hash(struct tnl_match *match)
431 {
432     BUILD_ASSERT_DECL(sizeof *match % sizeof(uint32_t) == 0);
433     return hash_words((uint32_t *) match, sizeof *match / sizeof(uint32_t), 0);
434 }
435
436 static struct tnl_port *
437 tnl_find_ofport(const struct ofport_dpif *ofport) OVS_REQ_RDLOCK(rwlock)
438 {
439     struct tnl_port *tnl_port;
440
441     HMAP_FOR_EACH_IN_BUCKET (tnl_port, ofport_node, hash_pointer(ofport, 0),
442                              ofport_map) {
443         if (tnl_port->ofport == ofport) {
444             return tnl_port;
445         }
446     }
447     return NULL;
448 }
449
450 static struct tnl_port *
451 tnl_find_exact(struct tnl_match *match, struct hmap *map)
452     OVS_REQ_RDLOCK(rwlock)
453 {
454     if (map) {
455         struct tnl_port *tnl_port;
456
457         HMAP_FOR_EACH_WITH_HASH (tnl_port, match_node, tnl_hash(match), map) {
458             if (!memcmp(match, &tnl_port->match, sizeof *match)) {
459                 return tnl_port;
460             }
461         }
462     }
463     return NULL;
464 }
465
466 /* Returns the tnl_port that is the best match for the tunnel data in 'flow',
467  * or NULL if no tnl_port matches 'flow'. */
468 static struct tnl_port *
469 tnl_find(const struct flow *flow) OVS_REQ_RDLOCK(rwlock)
470 {
471     enum ip_src_type ip_src;
472     int in_key_flow;
473     int ip_dst_flow;
474     int i;
475
476     i = 0;
477     for (in_key_flow = 0; in_key_flow < 2; in_key_flow++) {
478         for (ip_dst_flow = 0; ip_dst_flow < 2; ip_dst_flow++) {
479             for (ip_src = 0; ip_src < 3; ip_src++) {
480                 struct hmap *map = tnl_match_maps[i];
481
482                 if (map) {
483                     struct tnl_port *tnl_port;
484                     struct tnl_match match;
485
486                     memset(&match, 0, sizeof match);
487
488                     /* The apparent mix-up of 'ip_dst' and 'ip_src' below is
489                      * correct, because "struct tnl_match" is expressed in
490                      * terms of packets being sent out, but we are using it
491                      * here as a description of how to treat received
492                      * packets. */
493                     match.in_key = in_key_flow ? 0 : flow->tunnel.tun_id;
494                     match.ip_src = (ip_src == IP_SRC_CFG
495                                     ? flow->tunnel.ip_dst
496                                     : 0);
497                     match.ip_dst = ip_dst_flow ? 0 : flow->tunnel.ip_src;
498                     match.odp_port = flow->in_port.odp_port;
499                     match.pkt_mark = flow->pkt_mark;
500                     match.in_key_flow = in_key_flow;
501                     match.ip_dst_flow = ip_dst_flow;
502                     match.ip_src_flow = ip_src == IP_SRC_FLOW;
503
504                     tnl_port = tnl_find_exact(&match, map);
505                     if (tnl_port) {
506                         return tnl_port;
507                     }
508                 }
509
510                 i++;
511             }
512         }
513     }
514
515     return NULL;
516 }
517
518 /* Returns a pointer to the 'tnl_match_maps' element corresponding to 'm''s
519  * matching criteria. */
520 static struct hmap **
521 tnl_match_map(const struct tnl_match *m)
522 {
523     enum ip_src_type ip_src;
524
525     ip_src = (m->ip_src_flow ? IP_SRC_FLOW
526               : m->ip_src ? IP_SRC_CFG
527               : IP_SRC_ANY);
528
529     return &tnl_match_maps[6 * m->in_key_flow + 3 * m->ip_dst_flow + ip_src];
530 }
531
532 static void
533 tnl_match_fmt(const struct tnl_match *match, struct ds *ds)
534     OVS_REQ_RDLOCK(rwlock)
535 {
536     if (!match->ip_dst_flow) {
537         ds_put_format(ds, IP_FMT"->"IP_FMT, IP_ARGS(match->ip_src),
538                       IP_ARGS(match->ip_dst));
539     } else if (!match->ip_src_flow) {
540         ds_put_format(ds, IP_FMT"->flow", IP_ARGS(match->ip_src));
541     } else {
542         ds_put_cstr(ds, "flow->flow");
543     }
544
545     if (match->in_key_flow) {
546         ds_put_cstr(ds, ", key=flow");
547     } else {
548         ds_put_format(ds, ", key=%#"PRIx64, ntohll(match->in_key));
549     }
550
551     ds_put_format(ds, ", dp port=%"PRIu32, match->odp_port);
552     ds_put_format(ds, ", pkt mark=%"PRIu32, match->pkt_mark);
553 }
554
555 static void
556 tnl_port_mod_log(const struct tnl_port *tnl_port, const char *action)
557     OVS_REQ_RDLOCK(rwlock)
558 {
559     if (VLOG_IS_DBG_ENABLED()) {
560         struct ds ds = DS_EMPTY_INITIALIZER;
561
562         tnl_match_fmt(&tnl_port->match, &ds);
563         VLOG_INFO("%s tunnel port %s (%s)", action,
564                   tnl_port_get_name(tnl_port), ds_cstr(&ds));
565         ds_destroy(&ds);
566     }
567 }
568
569 static char *
570 tnl_port_fmt(const struct tnl_port *tnl_port) OVS_REQ_RDLOCK(rwlock)
571 {
572     const struct netdev_tunnel_config *cfg =
573         netdev_get_tunnel_config(tnl_port->netdev);
574     struct ds ds = DS_EMPTY_INITIALIZER;
575
576     ds_put_format(&ds, "port %"PRIu32": %s (%s: ", tnl_port->match.odp_port,
577                   tnl_port_get_name(tnl_port),
578                   netdev_get_type(tnl_port->netdev));
579     tnl_match_fmt(&tnl_port->match, &ds);
580
581     if (cfg->out_key != cfg->in_key ||
582         cfg->out_key_present != cfg->in_key_present ||
583         cfg->out_key_flow != cfg->in_key_flow) {
584         ds_put_cstr(&ds, ", out_key=");
585         if (!cfg->out_key_present) {
586             ds_put_cstr(&ds, "none");
587         } else if (cfg->out_key_flow) {
588             ds_put_cstr(&ds, "flow");
589         } else {
590             ds_put_format(&ds, "%#"PRIx64, ntohll(cfg->out_key));
591         }
592     }
593
594     if (cfg->ttl_inherit) {
595         ds_put_cstr(&ds, ", ttl=inherit");
596     } else {
597         ds_put_format(&ds, ", ttl=%"PRIu8, cfg->ttl);
598     }
599
600     if (cfg->tos_inherit) {
601         ds_put_cstr(&ds, ", tos=inherit");
602     } else if (cfg->tos) {
603         ds_put_format(&ds, ", tos=%#"PRIx8, cfg->tos);
604     }
605
606     if (!cfg->dont_fragment) {
607         ds_put_cstr(&ds, ", df=false");
608     }
609
610     if (cfg->csum) {
611         ds_put_cstr(&ds, ", csum=true");
612     }
613
614     ds_put_cstr(&ds, ")\n");
615
616     return ds_steal_cstr(&ds);
617 }
618
619 static const char *
620 tnl_port_get_name(const struct tnl_port *tnl_port) OVS_REQ_RDLOCK(rwlock)
621 {
622     return netdev_get_name(tnl_port->netdev);
623 }