1 /* net/tipc/udp_media.c: IP bearer support for TIPC
3 * Copyright (c) 2015, Ericsson AB
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the names of the copyright holders nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * Alternatively, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") version 2 as published by the Free
20 * Software Foundation.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
35 #include <linux/socket.h>
37 #include <linux/udp.h>
38 #include <linux/inet.h>
39 #include <linux/inetdevice.h>
40 #include <linux/igmp.h>
41 #include <linux/kernel.h>
42 #include <linux/workqueue.h>
43 #include <linux/list.h>
46 #include <net/udp_tunnel.h>
47 #include <net/ipv6_stubs.h>
48 #include <linux/tipc_netlink.h>
55 #include "udp_media.h"
57 /* IANA assigned UDP port */
58 #define UDP_PORT_DEFAULT 6118
60 #define UDP_MIN_HEADROOM 48
63 * struct udp_media_addr - IP/UDP addressing information
65 * This is the bearer level originating address used in neighbor discovery
66 * messages, and all fields should be in network byte order
68 struct udp_media_addr {
77 /* struct udp_replicast - container for UDP remote addresses */
78 struct udp_replicast {
79 struct udp_media_addr addr;
80 struct dst_cache dst_cache;
82 struct list_head list;
86 * struct udp_bearer - ip/udp bearer data structure
87 * @bearer: associated generic tipc bearer
88 * @ubsock: bearer associated socket
89 * @ifindex: local address scope
90 * @work: used to schedule deferred work on a bearer
93 struct tipc_bearer __rcu *bearer;
94 struct socket *ubsock;
96 struct work_struct work;
97 struct udp_replicast rcast;
100 static int tipc_udp_is_mcast_addr(struct udp_media_addr *addr)
102 if (ntohs(addr->proto) == ETH_P_IP)
103 return ipv4_is_multicast(addr->ipv4.s_addr);
104 #if IS_ENABLED(CONFIG_IPV6)
106 return ipv6_addr_is_multicast(&addr->ipv6);
111 /* udp_media_addr_set - convert a ip/udp address to a TIPC media address */
112 static void tipc_udp_media_addr_set(struct tipc_media_addr *addr,
113 struct udp_media_addr *ua)
115 memset(addr, 0, sizeof(struct tipc_media_addr));
116 addr->media_id = TIPC_MEDIA_TYPE_UDP;
117 memcpy(addr->value, ua, sizeof(struct udp_media_addr));
119 if (tipc_udp_is_mcast_addr(ua))
120 addr->broadcast = TIPC_BROADCAST_SUPPORT;
123 /* tipc_udp_addr2str - convert ip/udp address to string */
124 static int tipc_udp_addr2str(struct tipc_media_addr *a, char *buf, int size)
126 struct udp_media_addr *ua = (struct udp_media_addr *)&a->value;
128 if (ntohs(ua->proto) == ETH_P_IP)
129 snprintf(buf, size, "%pI4:%u", &ua->ipv4, ntohs(ua->port));
130 else if (ntohs(ua->proto) == ETH_P_IPV6)
131 snprintf(buf, size, "%pI6:%u", &ua->ipv6, ntohs(ua->port));
133 pr_err("Invalid UDP media address\n");
137 /* tipc_udp_msg2addr - extract an ip/udp address from a TIPC ndisc message */
138 static int tipc_udp_msg2addr(struct tipc_bearer *b, struct tipc_media_addr *a,
141 struct udp_media_addr *ua;
143 ua = (struct udp_media_addr *) (msg + TIPC_MEDIA_ADDR_OFFSET);
144 if (msg[TIPC_MEDIA_TYPE_OFFSET] != TIPC_MEDIA_TYPE_UDP)
146 tipc_udp_media_addr_set(a, ua);
150 /* tipc_udp_addr2msg - write an ip/udp address to a TIPC ndisc message */
151 static int tipc_udp_addr2msg(char *msg, struct tipc_media_addr *a)
153 memset(msg, 0, TIPC_MEDIA_INFO_SIZE);
154 msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_UDP;
155 memcpy(msg + TIPC_MEDIA_ADDR_OFFSET, a->value,
156 sizeof(struct udp_media_addr));
160 /* tipc_send_msg - enqueue a send request */
161 static int tipc_udp_xmit(struct net *net, struct sk_buff *skb,
162 struct udp_bearer *ub, struct udp_media_addr *src,
163 struct udp_media_addr *dst, struct dst_cache *cache)
165 struct dst_entry *ndst;
169 ndst = dst_cache_get(cache);
170 if (dst->proto == htons(ETH_P_IP)) {
171 struct rtable *rt = (struct rtable *)ndst;
175 .daddr = dst->ipv4.s_addr,
176 .saddr = src->ipv4.s_addr,
177 .flowi4_mark = skb->mark,
178 .flowi4_proto = IPPROTO_UDP
180 rt = ip_route_output_key(net, &fl);
185 dst_cache_set_ip4(cache, &rt->dst, fl.saddr);
188 ttl = ip4_dst_hoplimit(&rt->dst);
189 udp_tunnel_xmit_skb(rt, ub->ubsock->sk, skb, src->ipv4.s_addr,
190 dst->ipv4.s_addr, 0, ttl, 0, src->port,
191 dst->port, false, true);
192 #if IS_ENABLED(CONFIG_IPV6)
195 struct flowi6 fl6 = {
196 .flowi6_oif = ub->ifindex,
199 .flowi6_proto = IPPROTO_UDP
201 ndst = ipv6_stub->ipv6_dst_lookup_flow(net,
208 dst_cache_set_ip6(cache, ndst, &fl6.saddr);
210 ttl = ip6_dst_hoplimit(ndst);
211 err = udp_tunnel6_xmit_skb(ndst, ub->ubsock->sk, skb, NULL,
212 &src->ipv6, &dst->ipv6, 0, ttl, 0,
213 src->port, dst->port, false);
225 static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
226 struct tipc_bearer *b,
227 struct tipc_media_addr *addr)
229 struct udp_media_addr *src = (struct udp_media_addr *)&b->addr.value;
230 struct udp_media_addr *dst = (struct udp_media_addr *)&addr->value;
231 struct udp_replicast *rcast;
232 struct udp_bearer *ub;
235 if (skb_headroom(skb) < UDP_MIN_HEADROOM) {
236 err = pskb_expand_head(skb, UDP_MIN_HEADROOM, 0, GFP_ATOMIC);
241 skb_set_inner_protocol(skb, htons(ETH_P_TIPC));
242 ub = rcu_dereference(b->media_ptr);
248 if (addr->broadcast != TIPC_REPLICAST_SUPPORT)
249 return tipc_udp_xmit(net, skb, ub, src, dst,
250 &ub->rcast.dst_cache);
252 /* Replicast, send an skb to each configured IP address */
253 list_for_each_entry_rcu(rcast, &ub->rcast.list, list) {
254 struct sk_buff *_skb;
256 _skb = pskb_copy(skb, GFP_ATOMIC);
262 err = tipc_udp_xmit(net, _skb, ub, src, &rcast->addr,
273 static bool tipc_udp_is_known_peer(struct tipc_bearer *b,
274 struct udp_media_addr *addr)
276 struct udp_replicast *rcast, *tmp;
277 struct udp_bearer *ub;
279 ub = rcu_dereference_rtnl(b->media_ptr);
281 pr_err_ratelimited("UDP bearer instance not found\n");
285 list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
286 if (!memcmp(&rcast->addr, addr, sizeof(struct udp_media_addr)))
293 static int tipc_udp_rcast_add(struct tipc_bearer *b,
294 struct udp_media_addr *addr)
296 struct udp_replicast *rcast;
297 struct udp_bearer *ub;
299 ub = rcu_dereference_rtnl(b->media_ptr);
303 rcast = kmalloc(sizeof(*rcast), GFP_ATOMIC);
307 if (dst_cache_init(&rcast->dst_cache, GFP_ATOMIC)) {
312 memcpy(&rcast->addr, addr, sizeof(struct udp_media_addr));
314 if (ntohs(addr->proto) == ETH_P_IP)
315 pr_info("New replicast peer: %pI4\n", &rcast->addr.ipv4);
316 #if IS_ENABLED(CONFIG_IPV6)
317 else if (ntohs(addr->proto) == ETH_P_IPV6)
318 pr_info("New replicast peer: %pI6\n", &rcast->addr.ipv6);
320 b->bcast_addr.broadcast = TIPC_REPLICAST_SUPPORT;
321 list_add_rcu(&rcast->list, &ub->rcast.list);
325 static int tipc_udp_rcast_disc(struct tipc_bearer *b, struct sk_buff *skb)
327 struct udp_media_addr src = {0};
328 struct udp_media_addr *dst;
330 dst = (struct udp_media_addr *)&b->bcast_addr.value;
331 if (tipc_udp_is_mcast_addr(dst))
334 src.port = udp_hdr(skb)->source;
336 if (ip_hdr(skb)->version == 4) {
337 struct iphdr *iphdr = ip_hdr(skb);
339 src.proto = htons(ETH_P_IP);
340 src.ipv4.s_addr = iphdr->saddr;
341 if (ipv4_is_multicast(iphdr->daddr))
343 #if IS_ENABLED(CONFIG_IPV6)
344 } else if (ip_hdr(skb)->version == 6) {
345 struct ipv6hdr *iphdr = ipv6_hdr(skb);
347 src.proto = htons(ETH_P_IPV6);
348 src.ipv6 = iphdr->saddr;
349 if (ipv6_addr_is_multicast(&iphdr->daddr))
356 if (likely(tipc_udp_is_known_peer(b, &src)))
359 return tipc_udp_rcast_add(b, &src);
362 /* tipc_udp_recv - read data from bearer socket */
363 static int tipc_udp_recv(struct sock *sk, struct sk_buff *skb)
365 struct udp_bearer *ub;
366 struct tipc_bearer *b;
367 struct tipc_msg *hdr;
370 ub = rcu_dereference_sk_user_data(sk);
372 pr_err_ratelimited("Failed to get UDP bearer reference");
375 skb_pull(skb, sizeof(struct udphdr));
378 b = rcu_dereference(ub->bearer);
382 if (b && test_bit(0, &b->up)) {
383 TIPC_SKB_CB(skb)->flags = 0;
384 tipc_rcv(sock_net(sk), skb, b);
388 if (unlikely(msg_user(hdr) == LINK_CONFIG)) {
389 err = tipc_udp_rcast_disc(b, skb);
399 static int enable_mcast(struct udp_bearer *ub, struct udp_media_addr *remote)
402 struct ip_mreqn mreqn;
403 struct sock *sk = ub->ubsock->sk;
405 if (ntohs(remote->proto) == ETH_P_IP) {
406 mreqn.imr_multiaddr = remote->ipv4;
407 mreqn.imr_ifindex = ub->ifindex;
408 err = ip_mc_join_group(sk, &mreqn);
409 #if IS_ENABLED(CONFIG_IPV6)
411 err = ipv6_stub->ipv6_sock_mc_join(sk, ub->ifindex,
418 static int __tipc_nl_add_udp_addr(struct sk_buff *skb,
419 struct udp_media_addr *addr, int nla_t)
421 if (ntohs(addr->proto) == ETH_P_IP) {
422 struct sockaddr_in ip4;
424 memset(&ip4, 0, sizeof(ip4));
425 ip4.sin_family = AF_INET;
426 ip4.sin_port = addr->port;
427 ip4.sin_addr.s_addr = addr->ipv4.s_addr;
428 if (nla_put(skb, nla_t, sizeof(ip4), &ip4))
431 #if IS_ENABLED(CONFIG_IPV6)
432 } else if (ntohs(addr->proto) == ETH_P_IPV6) {
433 struct sockaddr_in6 ip6;
435 memset(&ip6, 0, sizeof(ip6));
436 ip6.sin6_family = AF_INET6;
437 ip6.sin6_port = addr->port;
438 memcpy(&ip6.sin6_addr, &addr->ipv6, sizeof(struct in6_addr));
439 if (nla_put(skb, nla_t, sizeof(ip6), &ip6))
447 int tipc_udp_nl_dump_remoteip(struct sk_buff *skb, struct netlink_callback *cb)
449 u32 bid = cb->args[0];
450 u32 skip_cnt = cb->args[1];
451 u32 portid = NETLINK_CB(cb->skb).portid;
452 struct udp_replicast *rcast, *tmp;
453 struct tipc_bearer *b;
454 struct udp_bearer *ub;
459 if (!bid && !skip_cnt) {
460 struct nlattr **attrs = genl_dumpit_info(cb)->attrs;
461 struct net *net = sock_net(skb->sk);
462 struct nlattr *battrs[TIPC_NLA_BEARER_MAX + 1];
465 if (!attrs[TIPC_NLA_BEARER])
468 err = nla_parse_nested_deprecated(battrs, TIPC_NLA_BEARER_MAX,
469 attrs[TIPC_NLA_BEARER],
470 tipc_nl_bearer_policy, NULL);
474 if (!battrs[TIPC_NLA_BEARER_NAME])
477 bname = nla_data(battrs[TIPC_NLA_BEARER_NAME]);
480 b = tipc_bearer_find(net, bname);
487 struct net *net = sock_net(skb->sk);
488 struct tipc_net *tn = net_generic(net, tipc_net_id);
491 b = rtnl_dereference(tn->bearer_list[bid]);
498 ub = rtnl_dereference(b->media_ptr);
505 list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
509 hdr = genlmsg_put(skb, portid, cb->nlh->nlmsg_seq,
510 &tipc_genl_family, NLM_F_MULTI,
515 err = __tipc_nl_add_udp_addr(skb, &rcast->addr,
516 TIPC_NLA_UDP_REMOTE);
518 genlmsg_cancel(skb, hdr);
521 genlmsg_end(skb, hdr);
533 int tipc_udp_nl_add_bearer_data(struct tipc_nl_msg *msg, struct tipc_bearer *b)
535 struct udp_media_addr *src = (struct udp_media_addr *)&b->addr.value;
536 struct udp_media_addr *dst;
537 struct udp_bearer *ub;
540 ub = rtnl_dereference(b->media_ptr);
544 nest = nla_nest_start_noflag(msg->skb, TIPC_NLA_BEARER_UDP_OPTS);
548 if (__tipc_nl_add_udp_addr(msg->skb, src, TIPC_NLA_UDP_LOCAL))
551 dst = (struct udp_media_addr *)&b->bcast_addr.value;
552 if (__tipc_nl_add_udp_addr(msg->skb, dst, TIPC_NLA_UDP_REMOTE))
555 if (!list_empty(&ub->rcast.list)) {
556 if (nla_put_flag(msg->skb, TIPC_NLA_UDP_MULTI_REMOTEIP))
560 nla_nest_end(msg->skb, nest);
563 nla_nest_cancel(msg->skb, nest);
568 * tipc_parse_udp_addr - build udp media address from netlink data
569 * @nla: netlink attribute containing sockaddr storage aligned address
570 * @addr: tipc media address to fill with address, port and protocol type
571 * @scope_id: IPv6 scope id pointer, not NULL indicates it's required
574 static int tipc_parse_udp_addr(struct nlattr *nla, struct udp_media_addr *addr,
577 struct sockaddr_storage sa;
579 nla_memcpy(&sa, nla, sizeof(sa));
580 if (sa.ss_family == AF_INET) {
581 struct sockaddr_in *ip4 = (struct sockaddr_in *)&sa;
583 addr->proto = htons(ETH_P_IP);
584 addr->port = ip4->sin_port;
585 addr->ipv4.s_addr = ip4->sin_addr.s_addr;
588 #if IS_ENABLED(CONFIG_IPV6)
589 } else if (sa.ss_family == AF_INET6) {
590 struct sockaddr_in6 *ip6 = (struct sockaddr_in6 *)&sa;
592 addr->proto = htons(ETH_P_IPV6);
593 addr->port = ip6->sin6_port;
594 memcpy(&addr->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr));
596 /* Scope ID is only interesting for local addresses */
600 atype = ipv6_addr_type(&ip6->sin6_addr);
601 if (__ipv6_addr_needs_scope_id(atype) &&
602 !ip6->sin6_scope_id) {
606 *scope_id = ip6->sin6_scope_id ? : 0;
612 return -EADDRNOTAVAIL;
615 int tipc_udp_nl_bearer_add(struct tipc_bearer *b, struct nlattr *attr)
618 struct udp_media_addr addr = {0};
619 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
620 struct udp_media_addr *dst;
622 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attr, tipc_nl_udp_policy, NULL))
625 if (!opts[TIPC_NLA_UDP_REMOTE])
628 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &addr, NULL);
632 dst = (struct udp_media_addr *)&b->bcast_addr.value;
633 if (tipc_udp_is_mcast_addr(dst)) {
634 pr_err("Can't add remote ip to TIPC UDP multicast bearer\n");
638 if (tipc_udp_is_known_peer(b, &addr))
641 return tipc_udp_rcast_add(b, &addr);
645 * tipc_udp_enable - callback to create a new udp bearer instance
646 * @net: network namespace
647 * @b: pointer to generic tipc_bearer
648 * @attrs: netlink bearer configuration
650 * validate the bearer parameters and initialize the udp bearer
651 * rtnl_lock should be held
653 static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
654 struct nlattr *attrs[])
657 struct udp_bearer *ub;
658 struct udp_media_addr remote = {0};
659 struct udp_media_addr local = {0};
660 struct udp_port_cfg udp_conf = {0};
661 struct udp_tunnel_sock_cfg tuncfg = {NULL};
662 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
663 u8 node_id[NODE_ID_LEN] = {0,};
664 struct net_device *dev;
667 ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
671 INIT_LIST_HEAD(&ub->rcast.list);
673 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
676 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL))
679 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
680 pr_err("Invalid UDP bearer configuration");
685 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
690 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &remote, NULL);
694 if (remote.proto != local.proto) {
699 /* Checking remote ip address */
700 rmcast = tipc_udp_is_mcast_addr(&remote);
702 /* Autoconfigure own node identity if needed */
703 if (!tipc_own_id(net)) {
704 memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);
705 tipc_net_init(net, node_id, 0);
707 if (!tipc_own_id(net)) {
708 pr_warn("Failed to set node id, please configure manually\n");
713 b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;
714 b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT;
715 rcu_assign_pointer(b->media_ptr, ub);
716 rcu_assign_pointer(ub->bearer, b);
717 tipc_udp_media_addr_set(&b->addr, &local);
718 if (local.proto == htons(ETH_P_IP)) {
719 dev = __ip_dev_find(net, local.ipv4.s_addr, false);
724 udp_conf.family = AF_INET;
726 /* Switch to use ANY to receive packets from group */
728 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
730 udp_conf.local_ip.s_addr = local.ipv4.s_addr;
731 udp_conf.use_udp_checksums = false;
732 ub->ifindex = dev->ifindex;
733 if (tipc_mtu_bad(dev, sizeof(struct iphdr) +
734 sizeof(struct udphdr))) {
738 b->mtu = b->media->mtu;
739 #if IS_ENABLED(CONFIG_IPV6)
740 } else if (local.proto == htons(ETH_P_IPV6)) {
741 dev = ub->ifindex ? __dev_get_by_index(net, ub->ifindex) : NULL;
742 dev = ipv6_dev_find(net, &local.ipv6, dev);
747 udp_conf.family = AF_INET6;
748 udp_conf.use_udp6_tx_checksums = true;
749 udp_conf.use_udp6_rx_checksums = true;
751 udp_conf.local_ip6 = in6addr_any;
753 udp_conf.local_ip6 = local.ipv6;
754 ub->ifindex = dev->ifindex;
761 udp_conf.local_udp_port = local.port;
762 err = udp_sock_create(net, &udp_conf, &ub->ubsock);
765 tuncfg.sk_user_data = ub;
766 tuncfg.encap_type = 1;
767 tuncfg.encap_rcv = tipc_udp_recv;
768 tuncfg.encap_destroy = NULL;
769 setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
771 err = dst_cache_init(&ub->rcast.dst_cache, GFP_ATOMIC);
776 * The bcast media address port is used for all peers and the ip
777 * is used if it's a multicast address.
779 memcpy(&b->bcast_addr.value, &remote, sizeof(remote));
781 err = enable_mcast(ub, &remote);
783 err = tipc_udp_rcast_add(b, &remote);
790 dst_cache_destroy(&ub->rcast.dst_cache);
791 udp_tunnel_sock_release(ub->ubsock);
797 /* cleanup_bearer - break the socket/bearer association */
798 static void cleanup_bearer(struct work_struct *work)
800 struct udp_bearer *ub = container_of(work, struct udp_bearer, work);
801 struct udp_replicast *rcast, *tmp;
803 list_for_each_entry_safe(rcast, tmp, &ub->rcast.list, list) {
804 dst_cache_destroy(&rcast->dst_cache);
805 list_del_rcu(&rcast->list);
806 kfree_rcu(rcast, rcu);
809 dst_cache_destroy(&ub->rcast.dst_cache);
810 udp_tunnel_sock_release(ub->ubsock);
815 /* tipc_udp_disable - detach bearer from socket */
816 static void tipc_udp_disable(struct tipc_bearer *b)
818 struct udp_bearer *ub;
820 ub = rtnl_dereference(b->media_ptr);
822 pr_err("UDP bearer instance not found\n");
825 sock_set_flag(ub->ubsock->sk, SOCK_DEAD);
826 RCU_INIT_POINTER(ub->bearer, NULL);
828 /* sock_release need to be done outside of rtnl lock */
829 INIT_WORK(&ub->work, cleanup_bearer);
830 schedule_work(&ub->work);
833 struct tipc_media udp_media_info = {
834 .send_msg = tipc_udp_send_msg,
835 .enable_media = tipc_udp_enable,
836 .disable_media = tipc_udp_disable,
837 .addr2str = tipc_udp_addr2str,
838 .addr2msg = tipc_udp_addr2msg,
839 .msg2addr = tipc_udp_msg2addr,
840 .priority = TIPC_DEF_LINK_PRI,
841 .tolerance = TIPC_DEF_LINK_TOL,
842 .min_win = TIPC_DEF_LINK_WIN,
843 .max_win = TIPC_DEF_LINK_WIN,
844 .mtu = TIPC_DEF_LINK_UDP_MTU,
845 .type_id = TIPC_MEDIA_TYPE_UDP,