conntrack.c (752cfee90d11e280d727617bf8d6df894141e157) conntrack.c (3bf195ae6037e310d693ff3313401cfaf1261b71)
1/*
2 * Copyright (c) 2015 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

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

740 if (maniptype == NF_NAT_MANIP_SRC)
741 hooknum = NF_INET_LOCAL_IN; /* Source NAT */
742 else
743 hooknum = NF_INET_LOCAL_OUT; /* Destination NAT */
744
745 switch (ctinfo) {
746 case IP_CT_RELATED:
747 case IP_CT_RELATED_REPLY:
1/*
2 * Copyright (c) 2015 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but

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

740 if (maniptype == NF_NAT_MANIP_SRC)
741 hooknum = NF_INET_LOCAL_IN; /* Source NAT */
742 else
743 hooknum = NF_INET_LOCAL_OUT; /* Destination NAT */
744
745 switch (ctinfo) {
746 case IP_CT_RELATED:
747 case IP_CT_RELATED_REPLY:
748 if (IS_ENABLED(CONFIG_NF_NAT_IPV4) &&
748 if (IS_ENABLED(CONFIG_NF_NAT) &&
749 skb->protocol == htons(ETH_P_IP) &&
750 ip_hdr(skb)->protocol == IPPROTO_ICMP) {
751 if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
752 hooknum))
753 err = NF_DROP;
754 goto push;
749 skb->protocol == htons(ETH_P_IP) &&
750 ip_hdr(skb)->protocol == IPPROTO_ICMP) {
751 if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
752 hooknum))
753 err = NF_DROP;
754 goto push;
755 } else if (IS_ENABLED(CONFIG_NF_NAT_IPV6) &&
755 } else if (IS_ENABLED(CONFIG_IPV6) &&
756 skb->protocol == htons(ETH_P_IPV6)) {
757 __be16 frag_off;
758 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
759 int hdrlen = ipv6_skip_exthdr(skb,
760 sizeof(struct ipv6hdr),
761 &nexthdr, &frag_off);
762
763 if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) {

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

1668 } else if (info->nat & OVS_CT_DST_NAT) {
1669 if (nla_put_flag(skb, OVS_NAT_ATTR_DST))
1670 return false;
1671 } else {
1672 goto out;
1673 }
1674
1675 if (info->range.flags & NF_NAT_RANGE_MAP_IPS) {
756 skb->protocol == htons(ETH_P_IPV6)) {
757 __be16 frag_off;
758 u8 nexthdr = ipv6_hdr(skb)->nexthdr;
759 int hdrlen = ipv6_skip_exthdr(skb,
760 sizeof(struct ipv6hdr),
761 &nexthdr, &frag_off);
762
763 if (hdrlen >= 0 && nexthdr == IPPROTO_ICMPV6) {

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

1668 } else if (info->nat & OVS_CT_DST_NAT) {
1669 if (nla_put_flag(skb, OVS_NAT_ATTR_DST))
1670 return false;
1671 } else {
1672 goto out;
1673 }
1674
1675 if (info->range.flags & NF_NAT_RANGE_MAP_IPS) {
1676 if (IS_ENABLED(CONFIG_NF_NAT_IPV4) &&
1676 if (IS_ENABLED(CONFIG_NF_NAT) &&
1677 info->family == NFPROTO_IPV4) {
1678 if (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MIN,
1679 info->range.min_addr.ip) ||
1680 (info->range.max_addr.ip
1681 != info->range.min_addr.ip &&
1682 (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MAX,
1683 info->range.max_addr.ip))))
1684 return false;
1677 info->family == NFPROTO_IPV4) {
1678 if (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MIN,
1679 info->range.min_addr.ip) ||
1680 (info->range.max_addr.ip
1681 != info->range.min_addr.ip &&
1682 (nla_put_in_addr(skb, OVS_NAT_ATTR_IP_MAX,
1683 info->range.max_addr.ip))))
1684 return false;
1685 } else if (IS_ENABLED(CONFIG_NF_NAT_IPV6) &&
1685 } else if (IS_ENABLED(CONFIG_IPV6) &&
1686 info->family == NFPROTO_IPV6) {
1687 if (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MIN,
1688 &info->range.min_addr.in6) ||
1689 (memcmp(&info->range.max_addr.in6,
1690 &info->range.min_addr.in6,
1691 sizeof(info->range.max_addr.in6)) &&
1692 (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MAX,
1693 &info->range.max_addr.in6))))

--- 530 unchanged lines hidden ---
1686 info->family == NFPROTO_IPV6) {
1687 if (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MIN,
1688 &info->range.min_addr.in6) ||
1689 (memcmp(&info->range.max_addr.in6,
1690 &info->range.min_addr.in6,
1691 sizeof(info->range.max_addr.in6)) &&
1692 (nla_put_in6_addr(skb, OVS_NAT_ATTR_IP_MAX,
1693 &info->range.max_addr.in6))))

--- 530 unchanged lines hidden ---