2020-08-11 23:51:04

by kernel test robot

[permalink] [raw]
Subject: net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c636eef2ee3696f261a35f34989842701a107895
commit: 5a6f6f579178dbeb33002d93b4f646c31348fac9 tipc: set ub->ifindex for local ipv6 address
date: 6 days ago
config: ia64-randconfig-r005-20200811 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5a6f6f579178dbeb33002d93b4f646c31348fac9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

ia64-linux-ld: net/tipc/udp_media.o: in function `tipc_udp_enable':
>> net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'

vim +743 net/tipc/udp_media.c

642
643 /**
644 * tipc_udp_enable - callback to create a new udp bearer instance
645 * @net: network namespace
646 * @b: pointer to generic tipc_bearer
647 * @attrs: netlink bearer configuration
648 *
649 * validate the bearer parameters and initialize the udp bearer
650 * rtnl_lock should be held
651 */
652 static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
653 struct nlattr *attrs[])
654 {
655 int err = -EINVAL;
656 struct udp_bearer *ub;
657 struct udp_media_addr remote = {0};
658 struct udp_media_addr local = {0};
659 struct udp_port_cfg udp_conf = {0};
660 struct udp_tunnel_sock_cfg tuncfg = {NULL};
661 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
662 u8 node_id[NODE_ID_LEN] = {0,};
663 int rmcast = 0;
664
665 ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
666 if (!ub)
667 return -ENOMEM;
668
669 INIT_LIST_HEAD(&ub->rcast.list);
670
671 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
672 goto err;
673
674 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL))
675 goto err;
676
677 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
678 pr_err("Invalid UDP bearer configuration");
679 err = -EINVAL;
680 goto err;
681 }
682
683 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
684 &ub->ifindex);
685 if (err)
686 goto err;
687
688 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &remote, NULL);
689 if (err)
690 goto err;
691
692 if (remote.proto != local.proto) {
693 err = -EINVAL;
694 goto err;
695 }
696
697 /* Checking remote ip address */
698 rmcast = tipc_udp_is_mcast_addr(&remote);
699
700 /* Autoconfigure own node identity if needed */
701 if (!tipc_own_id(net)) {
702 memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);
703 tipc_net_init(net, node_id, 0);
704 }
705 if (!tipc_own_id(net)) {
706 pr_warn("Failed to set node id, please configure manually\n");
707 err = -EINVAL;
708 goto err;
709 }
710
711 b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;
712 b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT;
713 rcu_assign_pointer(b->media_ptr, ub);
714 rcu_assign_pointer(ub->bearer, b);
715 tipc_udp_media_addr_set(&b->addr, &local);
716 if (local.proto == htons(ETH_P_IP)) {
717 struct net_device *dev;
718
719 dev = __ip_dev_find(net, local.ipv4.s_addr, false);
720 if (!dev) {
721 err = -ENODEV;
722 goto err;
723 }
724 udp_conf.family = AF_INET;
725
726 /* Switch to use ANY to receive packets from group */
727 if (rmcast)
728 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
729 else
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))) {
735 err = -EINVAL;
736 goto err;
737 }
738 b->mtu = b->media->mtu;
739 #if IS_ENABLED(CONFIG_IPV6)
740 } else if (local.proto == htons(ETH_P_IPV6)) {
741 struct net_device *dev;
742
> 743 dev = ipv6_dev_find(net, &local.ipv6);
744 if (!dev) {
745 err = -ENODEV;
746 goto err;
747 }
748 udp_conf.family = AF_INET6;
749 udp_conf.use_udp6_tx_checksums = true;
750 udp_conf.use_udp6_rx_checksums = true;
751 if (rmcast)
752 udp_conf.local_ip6 = in6addr_any;
753 else
754 udp_conf.local_ip6 = local.ipv6;
755 ub->ifindex = dev->ifindex;
756 b->mtu = 1280;
757 #endif
758 } else {
759 err = -EAFNOSUPPORT;
760 goto err;
761 }
762 udp_conf.local_udp_port = local.port;
763 err = udp_sock_create(net, &udp_conf, &ub->ubsock);
764 if (err)
765 goto err;
766 tuncfg.sk_user_data = ub;
767 tuncfg.encap_type = 1;
768 tuncfg.encap_rcv = tipc_udp_recv;
769 tuncfg.encap_destroy = NULL;
770 setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
771
772 err = dst_cache_init(&ub->rcast.dst_cache, GFP_ATOMIC);
773 if (err)
774 goto free;
775
776 /**
777 * The bcast media address port is used for all peers and the ip
778 * is used if it's a multicast address.
779 */
780 memcpy(&b->bcast_addr.value, &remote, sizeof(remote));
781 if (rmcast)
782 err = enable_mcast(ub, &remote);
783 else
784 err = tipc_udp_rcast_add(b, &remote);
785 if (err)
786 goto free;
787
788 return 0;
789
790 free:
791 dst_cache_destroy(&ub->rcast.dst_cache);
792 udp_tunnel_sock_release(ub->ubsock);
793 err:
794 kfree(ub);
795 return err;
796 }
797

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (6.09 kB)
.config.gz (30.51 kB)
Download all attachments

2020-08-13 09:26:38

by Xin Long

[permalink] [raw]
Subject: Re: net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'

On Wed, Aug 12, 2020 at 7:21 AM kernel test robot <[email protected]> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: c636eef2ee3696f261a35f34989842701a107895
> commit: 5a6f6f579178dbeb33002d93b4f646c31348fac9 tipc: set ub->ifindex for local ipv6 address
> date: 6 days ago
> config: ia64-randconfig-r005-20200811 (attached as .config)
> compiler: ia64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 5a6f6f579178dbeb33002d93b4f646c31348fac9
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
>
> All errors (new ones prefixed by >>):
>
> ia64-linux-ld: net/tipc/udp_media.o: in function `tipc_udp_enable':
> >> net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'
To use some APIs exported from ipv6 code.
We need add this:

--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -6,6 +6,7 @@
menuconfig TIPC
tristate "The TIPC Protocol"
depends on INET
+ depends on IPV6 || IPV6=n

>
> vim +743 net/tipc/udp_media.c
>
> 642
> 643 /**
> 644 * tipc_udp_enable - callback to create a new udp bearer instance
> 645 * @net: network namespace
> 646 * @b: pointer to generic tipc_bearer
> 647 * @attrs: netlink bearer configuration
> 648 *
> 649 * validate the bearer parameters and initialize the udp bearer
> 650 * rtnl_lock should be held
> 651 */
> 652 static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
> 653 struct nlattr *attrs[])
> 654 {
> 655 int err = -EINVAL;
> 656 struct udp_bearer *ub;
> 657 struct udp_media_addr remote = {0};
> 658 struct udp_media_addr local = {0};
> 659 struct udp_port_cfg udp_conf = {0};
> 660 struct udp_tunnel_sock_cfg tuncfg = {NULL};
> 661 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1];
> 662 u8 node_id[NODE_ID_LEN] = {0,};
> 663 int rmcast = 0;
> 664
> 665 ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
> 666 if (!ub)
> 667 return -ENOMEM;
> 668
> 669 INIT_LIST_HEAD(&ub->rcast.list);
> 670
> 671 if (!attrs[TIPC_NLA_BEARER_UDP_OPTS])
> 672 goto err;
> 673
> 674 if (nla_parse_nested_deprecated(opts, TIPC_NLA_UDP_MAX, attrs[TIPC_NLA_BEARER_UDP_OPTS], tipc_nl_udp_policy, NULL))
> 675 goto err;
> 676
> 677 if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
> 678 pr_err("Invalid UDP bearer configuration");
> 679 err = -EINVAL;
> 680 goto err;
> 681 }
> 682
> 683 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
> 684 &ub->ifindex);
> 685 if (err)
> 686 goto err;
> 687
> 688 err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_REMOTE], &remote, NULL);
> 689 if (err)
> 690 goto err;
> 691
> 692 if (remote.proto != local.proto) {
> 693 err = -EINVAL;
> 694 goto err;
> 695 }
> 696
> 697 /* Checking remote ip address */
> 698 rmcast = tipc_udp_is_mcast_addr(&remote);
> 699
> 700 /* Autoconfigure own node identity if needed */
> 701 if (!tipc_own_id(net)) {
> 702 memcpy(node_id, local.ipv6.in6_u.u6_addr8, 16);
> 703 tipc_net_init(net, node_id, 0);
> 704 }
> 705 if (!tipc_own_id(net)) {
> 706 pr_warn("Failed to set node id, please configure manually\n");
> 707 err = -EINVAL;
> 708 goto err;
> 709 }
> 710
> 711 b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP;
> 712 b->bcast_addr.broadcast = TIPC_BROADCAST_SUPPORT;
> 713 rcu_assign_pointer(b->media_ptr, ub);
> 714 rcu_assign_pointer(ub->bearer, b);
> 715 tipc_udp_media_addr_set(&b->addr, &local);
> 716 if (local.proto == htons(ETH_P_IP)) {
> 717 struct net_device *dev;
> 718
> 719 dev = __ip_dev_find(net, local.ipv4.s_addr, false);
> 720 if (!dev) {
> 721 err = -ENODEV;
> 722 goto err;
> 723 }
> 724 udp_conf.family = AF_INET;
> 725
> 726 /* Switch to use ANY to receive packets from group */
> 727 if (rmcast)
> 728 udp_conf.local_ip.s_addr = htonl(INADDR_ANY);
> 729 else
> 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))) {
> 735 err = -EINVAL;
> 736 goto err;
> 737 }
> 738 b->mtu = b->media->mtu;
> 739 #if IS_ENABLED(CONFIG_IPV6)
> 740 } else if (local.proto == htons(ETH_P_IPV6)) {
> 741 struct net_device *dev;
> 742
> > 743 dev = ipv6_dev_find(net, &local.ipv6);
> 744 if (!dev) {
> 745 err = -ENODEV;
> 746 goto err;
> 747 }
> 748 udp_conf.family = AF_INET6;
> 749 udp_conf.use_udp6_tx_checksums = true;
> 750 udp_conf.use_udp6_rx_checksums = true;
> 751 if (rmcast)
> 752 udp_conf.local_ip6 = in6addr_any;
> 753 else
> 754 udp_conf.local_ip6 = local.ipv6;
> 755 ub->ifindex = dev->ifindex;
> 756 b->mtu = 1280;
> 757 #endif
> 758 } else {
> 759 err = -EAFNOSUPPORT;
> 760 goto err;
> 761 }
> 762 udp_conf.local_udp_port = local.port;
> 763 err = udp_sock_create(net, &udp_conf, &ub->ubsock);
> 764 if (err)
> 765 goto err;
> 766 tuncfg.sk_user_data = ub;
> 767 tuncfg.encap_type = 1;
> 768 tuncfg.encap_rcv = tipc_udp_recv;
> 769 tuncfg.encap_destroy = NULL;
> 770 setup_udp_tunnel_sock(net, ub->ubsock, &tuncfg);
> 771
> 772 err = dst_cache_init(&ub->rcast.dst_cache, GFP_ATOMIC);
> 773 if (err)
> 774 goto free;
> 775
> 776 /**
> 777 * The bcast media address port is used for all peers and the ip
> 778 * is used if it's a multicast address.
> 779 */
> 780 memcpy(&b->bcast_addr.value, &remote, sizeof(remote));
> 781 if (rmcast)
> 782 err = enable_mcast(ub, &remote);
> 783 else
> 784 err = tipc_udp_rcast_add(b, &remote);
> 785 if (err)
> 786 goto free;
> 787
> 788 return 0;
> 789
> 790 free:
> 791 dst_cache_destroy(&ub->rcast.dst_cache);
> 792 udp_tunnel_sock_release(ub->ubsock);
> 793 err:
> 794 kfree(ub);
> 795 return err;
> 796 }
> 797
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/[email protected]

2020-08-14 04:23:25

by Randy Dunlap

[permalink] [raw]
Subject: Re: net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'

On 8/13/20 2:35 AM, Xin Long wrote:
> On Wed, Aug 12, 2020 at 7:21 AM kernel test robot <[email protected]> wrote:
>>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: c636eef2ee3696f261a35f34989842701a107895
>> commit: 5a6f6f579178dbeb33002d93b4f646c31348fac9 tipc: set ub->ifindex for local ipv6 address
>> date: 6 days ago
>> config: ia64-randconfig-r005-20200811 (attached as .config)
>> compiler: ia64-linux-gcc (GCC) 9.3.0
>> reproduce (this is a W=1 build):
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> git checkout 5a6f6f579178dbeb33002d93b4f646c31348fac9
>> # save the attached .config to linux build tree
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <[email protected]>
>>
>> All errors (new ones prefixed by >>):
>>
>> ia64-linux-ld: net/tipc/udp_media.o: in function `tipc_udp_enable':
>>>> net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'
> To use some APIs exported from ipv6 code.
> We need add this:
>
> --- a/net/tipc/Kconfig
> +++ b/net/tipc/Kconfig
> @@ -6,6 +6,7 @@
> menuconfig TIPC
> tristate "The TIPC Protocol"
> depends on INET
> + depends on IPV6 || IPV6=n
>

Thanks. Works for me.

Acked-by: Randy Dunlap <[email protected]> # build-tested

Please make a proper patch and send it to the maintainers.
--
~Randy