Hi Yi-Hung, Thank you for the patch! Yet something to improve: [auto build test ERROR on nf-next/master] [also build test ERROR on v5.1-rc1 next-20190322] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Yi-Hung-Wei/netfilter-Export-nf_ct_-set-destroy-_timeout/20190323-195349 base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master config: i386-randconfig-n1-201911 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): net/openvswitch/conntrack.o: In function `__ovs_ct_free_action': >> net/openvswitch/conntrack.c:1803: undefined reference to `nf_ct_destroy_timeout' net/openvswitch/conntrack.o: In function `ovs_ct_copy_action': >> net/openvswitch/conntrack.c:1649: undefined reference to `nf_ct_set_timeout' vim +1803 net/openvswitch/conntrack.c 1615 1616 int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, 1617 const struct sw_flow_key *key, 1618 struct sw_flow_actions **sfa, bool log) 1619 { 1620 struct ovs_conntrack_info ct_info; 1621 const char *helper = NULL; 1622 u16 family; 1623 int err; 1624 1625 family = key_to_nfproto(key); 1626 if (family == NFPROTO_UNSPEC) { 1627 OVS_NLERR(log, "ct family unspecified"); 1628 return -EINVAL; 1629 } 1630 1631 memset(&ct_info, 0, sizeof(ct_info)); 1632 ct_info.family = family; 1633 1634 nf_ct_zone_init(&ct_info.zone, NF_CT_DEFAULT_ZONE_ID, 1635 NF_CT_DEFAULT_ZONE_DIR, 0); 1636 1637 err = parse_ct(attr, &ct_info, &helper, log); 1638 if (err) 1639 return err; 1640 1641 /* Set up template for tracking connections in specific zones. */ 1642 ct_info.ct = nf_ct_tmpl_alloc(net, &ct_info.zone, GFP_KERNEL); 1643 if (!ct_info.ct) { 1644 OVS_NLERR(log, "Failed to allocate conntrack template"); 1645 return -ENOMEM; 1646 } 1647 1648 if (ct_info.timeout[0]) { > 1649 if (nf_ct_set_timeout(net, ct_info.ct, family, key->ip.proto, 1650 ct_info.timeout)) 1651 pr_info_ratelimited("Failed to associated timeout " 1652 "policy `%s'\n", ct_info.timeout); 1653 } 1654 1655 if (helper) { 1656 err = ovs_ct_add_helper(&ct_info, helper, key, log); 1657 if (err) 1658 goto err_free_ct; 1659 } 1660 1661 err = ovs_nla_add_action(sfa, OVS_ACTION_ATTR_CT, &ct_info, 1662 sizeof(ct_info), log); 1663 if (err) 1664 goto err_free_ct; 1665 1666 __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); 1667 nf_conntrack_get(&ct_info.ct->ct_general); 1668 return 0; 1669 err_free_ct: 1670 __ovs_ct_free_action(&ct_info); 1671 return err; 1672 } 1673 1674 #ifdef CONFIG_NF_NAT_NEEDED 1675 static bool ovs_ct_nat_to_attr(const struct ovs_conntrack_info *info, 1676 struct sk_buff *skb) 1677 { 1678 struct nlattr *start; 1679 1680 start = nla_nest_start(skb, OVS_CT_ATTR_NAT); 1681 if (!start) 1682 return false; 1683 1684 if (info->nat & OVS_CT_SRC_NAT) { 1685 if (nla_put_flag(skb, OVS_NAT_ATTR_SRC)) 1686 return false; 1687 } else if (info->nat & OVS_CT_DST_NAT) { 1688 if (nla_put_flag(skb, OVS_NAT_ATTR_DST)) 1689 return false; 1690 } else { 1691 goto out; 1692 } 1693 1694 if (info->range.flags & NF_NAT_RANGE_MAP_IPS) { 1695 if (IS_ENABLED(CONFIG_NF_NAT) && 1696 info->family == NFPROTO_IPV4) { 1697 if (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MIN, 1698 info->range.min_addr.ip) || 1699 (info->range.max_addr.ip 1700 != info->range.min_addr.ip && 1701 (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MAX, 1702 info->range.max_addr.ip)))) 1703 return false; 1704 } else if (IS_ENABLED(CONFIG_IPV6) && 1705 info->family == NFPROTO_IPV6) { 1706 if (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MIN, 1707 &info->range.min_addr.in6) || 1708 (memcmp(&info->range.max_addr.in6, 1709 &info->range.min_addr.in6, 1710 sizeof(info->range.max_addr.in6)) && 1711 (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MAX, 1712 &info->range.max_addr.in6)))) 1713 return false; 1714 } else { 1715 return false; 1716 } 1717 } 1718 if (info->range.flags & NF_NAT_RANGE_PROTO_SPECIFIED && 1719 (nla_put_u16(skb, OVS_NAT_ATTR_PROTO_MIN, 1720 ntohs(info->range.min_proto.all)) || 1721 (info->range.max_proto.all != info->range.min_proto.all && 1722 nla_put_u16(skb, OVS_NAT_ATTR_PROTO_MAX, 1723 ntohs(info->range.max_proto.all))))) 1724 return false; 1725 1726 if (info->range.flags & NF_NAT_RANGE_PERSISTENT && 1727 nla_put_flag(skb, OVS_NAT_ATTR_PERSISTENT)) 1728 return false; 1729 if (info->range.flags & NF_NAT_RANGE_PROTO_RANDOM && 1730 nla_put_flag(skb, OVS_NAT_ATTR_PROTO_HASH)) 1731 return false; 1732 if (info->range.flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY && 1733 nla_put_flag(skb, OVS_NAT_ATTR_PROTO_RANDOM)) 1734 return false; 1735 out: 1736 nla_nest_end(skb, start); 1737 1738 return true; 1739 } 1740 #endif 1741 1742 int ovs_ct_action_to_attr(const struct ovs_conntrack_info *ct_info, 1743 struct sk_buff *skb) 1744 { 1745 struct nlattr *start; 1746 1747 start = nla_nest_start(skb, OVS_ACTION_ATTR_CT); 1748 if (!start) 1749 return -EMSGSIZE; 1750 1751 if (ct_info->commit && nla_put_flag(skb, ct_info->force 1752 ? OVS_CT_ATTR_FORCE_COMMIT 1753 : OVS_CT_ATTR_COMMIT)) 1754 return -EMSGSIZE; 1755 if (IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) && 1756 nla_put_u16(skb, OVS_CT_ATTR_ZONE, ct_info->zone.id)) 1757 return -EMSGSIZE; 1758 if (IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) && ct_info->mark.mask && 1759 nla_put(skb, OVS_CT_ATTR_MARK, sizeof(ct_info->mark), 1760 &ct_info->mark)) 1761 return -EMSGSIZE; 1762 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) && 1763 labels_nonzero(&ct_info->labels.mask) && 1764 nla_put(skb, OVS_CT_ATTR_LABELS, sizeof(ct_info->labels), 1765 &ct_info->labels)) 1766 return -EMSGSIZE; 1767 if (ct_info->helper) { 1768 if (nla_put_string(skb, OVS_CT_ATTR_HELPER, 1769 ct_info->helper->name)) 1770 return -EMSGSIZE; 1771 } 1772 if (ct_info->have_eventmask && 1773 nla_put_u32(skb, OVS_CT_ATTR_EVENTMASK, ct_info->eventmask)) 1774 return -EMSGSIZE; 1775 if (ct_info->timeout[0]) { 1776 if (nla_put_string(skb, OVS_CT_ATTR_TIMEOUT, ct_info->timeout)) 1777 return -EMSGSIZE; 1778 } 1779 1780 #ifdef CONFIG_NF_NAT_NEEDED 1781 if (ct_info->nat && !ovs_ct_nat_to_attr(ct_info, skb)) 1782 return -EMSGSIZE; 1783 #endif 1784 nla_nest_end(skb, start); 1785 1786 return 0; 1787 } 1788 1789 void ovs_ct_free_action(const struct nlattr *a) 1790 { 1791 struct ovs_conntrack_info *ct_info = nla_data(a); 1792 1793 __ovs_ct_free_action(ct_info); 1794 } 1795 1796 static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) 1797 { 1798 if (ct_info->helper) 1799 nf_conntrack_helper_put(ct_info->helper); 1800 if (ct_info->ct) { 1801 nf_ct_tmpl_free(ct_info->ct); 1802 if (ct_info->timeout[0]) > 1803 nf_ct_destroy_timeout(ct_info->ct); 1804 } 1805 } 1806 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation