net/tipc/udp_media.c:743: undefined reference to `ipv6_dev_find'

From: kernel test robot
Date: Sun Aug 16 2020 - 04:34:11 EST


Hi Xin,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b6c093e21d36bede0fd88fd0aeb3b03647260e4
commit: 5a6f6f579178dbeb33002d93b4f646c31348fac9 tipc: set ub->ifindex for local ipv6 address
date: 11 days ago
config: parisc-randconfig-r032-20200816 (attached as .config)
compiler: hppa-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=parisc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

hppa-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/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip