ip6_tunnel.c (71930d61025e7d0254f3c682cb1b5242e0499cf3) ip6_tunnel.c (b51cd7c834dba0ec9300337e16e5aa5bf65bd04c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * IPv6 tunneling device
4 * Linux INET6 implementation
5 *
6 * Authors:
7 * Ville Nuorvala <vnuorval@tcs.hut.fi>
8 * Yasuyuki Kozakai <kozakai@linux-ipv6.org>

--- 110 unchanged lines hidden (view full) ---

119 }
120 dev->stats.rx_packets = sum.rx_packets;
121 dev->stats.rx_bytes = sum.rx_bytes;
122 dev->stats.tx_packets = sum.tx_packets;
123 dev->stats.tx_bytes = sum.tx_bytes;
124 return &dev->stats;
125}
126
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * IPv6 tunneling device
4 * Linux INET6 implementation
5 *
6 * Authors:
7 * Ville Nuorvala <vnuorval@tcs.hut.fi>
8 * Yasuyuki Kozakai <kozakai@linux-ipv6.org>

--- 110 unchanged lines hidden (view full) ---

119 }
120 dev->stats.rx_packets = sum.rx_packets;
121 dev->stats.rx_bytes = sum.rx_bytes;
122 dev->stats.tx_packets = sum.tx_packets;
123 dev->stats.tx_bytes = sum.tx_bytes;
124 return &dev->stats;
125}
126
127#define for_each_ip6_tunnel_rcu(start) \
128 for (t = rcu_dereference(start); t; t = rcu_dereference(t->next))
129
127/**
128 * ip6_tnl_lookup - fetch tunnel matching the end-point addresses
130/**
131 * ip6_tnl_lookup - fetch tunnel matching the end-point addresses
132 * @net: network namespace
129 * @link: ifindex of underlying interface
130 * @remote: the address of the tunnel exit-point
131 * @local: the address of the tunnel entry-point
132 *
133 * Return:
134 * tunnel matching given end-points if found,
135 * else fallback tunnel if its device is up,
136 * else %NULL
137 **/
138
133 * @link: ifindex of underlying interface
134 * @remote: the address of the tunnel exit-point
135 * @local: the address of the tunnel entry-point
136 *
137 * Return:
138 * tunnel matching given end-points if found,
139 * else fallback tunnel if its device is up,
140 * else %NULL
141 **/
142
139#define for_each_ip6_tunnel_rcu(start) \
140 for (t = rcu_dereference(start); t; t = rcu_dereference(t->next))
141
142static struct ip6_tnl *
143ip6_tnl_lookup(struct net *net, int link,
144 const struct in6_addr *remote, const struct in6_addr *local)
145{
146 unsigned int hash = HASH(remote, local);
147 struct ip6_tnl *t, *cand = NULL;
148 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
149 struct in6_addr any;

--- 147 unchanged lines hidden (view full) ---

297 return 0;
298
299out:
300 return err;
301}
302
303/**
304 * ip6_tnl_create - create a new tunnel
143static struct ip6_tnl *
144ip6_tnl_lookup(struct net *net, int link,
145 const struct in6_addr *remote, const struct in6_addr *local)
146{
147 unsigned int hash = HASH(remote, local);
148 struct ip6_tnl *t, *cand = NULL;
149 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
150 struct in6_addr any;

--- 147 unchanged lines hidden (view full) ---

298 return 0;
299
300out:
301 return err;
302}
303
304/**
305 * ip6_tnl_create - create a new tunnel
306 * @net: network namespace
305 * @p: tunnel parameters
307 * @p: tunnel parameters
306 * @pt: pointer to new tunnel
307 *
308 * Description:
309 * Create tunnel matching given parameters.
310 *
311 * Return:
312 * created tunnel or error pointer
313 **/
314

--- 31 unchanged lines hidden (view full) ---

346failed_free:
347 free_netdev(dev);
348failed:
349 return ERR_PTR(err);
350}
351
352/**
353 * ip6_tnl_locate - find or create tunnel matching given parameters
308 *
309 * Description:
310 * Create tunnel matching given parameters.
311 *
312 * Return:
313 * created tunnel or error pointer
314 **/
315

--- 31 unchanged lines hidden (view full) ---

347failed_free:
348 free_netdev(dev);
349failed:
350 return ERR_PTR(err);
351}
352
353/**
354 * ip6_tnl_locate - find or create tunnel matching given parameters
355 * @net: network namespace
354 * @p: tunnel parameters
355 * @create: != 0 if allowed to create new tunnel if no match found
356 *
357 * Description:
358 * ip6_tnl_locate() first tries to locate an existing tunnel
359 * based on @parms. If this is unsuccessful, but @create is set a new
360 * tunnel device is created and registered for use.
361 *

--- 2047 unchanged lines hidden ---
356 * @p: tunnel parameters
357 * @create: != 0 if allowed to create new tunnel if no match found
358 *
359 * Description:
360 * ip6_tnl_locate() first tries to locate an existing tunnel
361 * based on @parms. If this is unsuccessful, but @create is set a new
362 * tunnel device is created and registered for use.
363 *

--- 2047 unchanged lines hidden ---