Commit 9d28026b7ec0f3e2a407d5c03fcb37d0b59d1add
Committed by
David S. Miller
1 parent
c07bc1ffbd
Exists in
master
and in
4 other branches
[NETFILTER]: Remove unused function from NAT protocol helpers
->print and ->print_range are not used (and apparently never were). Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 6 changed files with 0 additions and 167 deletions Side-by-side Diff
include/linux/netfilter_ipv4/ip_nat_protocol.h
| ... | ... | @@ -42,13 +42,6 @@ |
| 42 | 42 | enum ip_nat_manip_type maniptype, |
| 43 | 43 | const struct ip_conntrack *conntrack); |
| 44 | 44 | |
| 45 | - unsigned int (*print)(char *buffer, | |
| 46 | - const struct ip_conntrack_tuple *match, | |
| 47 | - const struct ip_conntrack_tuple *mask); | |
| 48 | - | |
| 49 | - unsigned int (*print_range)(char *buffer, | |
| 50 | - const struct ip_nat_range *range); | |
| 51 | - | |
| 52 | 45 | int (*range_to_nfattr)(struct sk_buff *skb, |
| 53 | 46 | const struct ip_nat_range *range); |
| 54 | 47 |
net/ipv4/netfilter/ip_nat_proto_gre.c
| ... | ... | @@ -151,42 +151,6 @@ |
| 151 | 151 | return 1; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -/* print out a nat tuple */ | |
| 155 | -static unsigned int | |
| 156 | -gre_print(char *buffer, | |
| 157 | - const struct ip_conntrack_tuple *match, | |
| 158 | - const struct ip_conntrack_tuple *mask) | |
| 159 | -{ | |
| 160 | - unsigned int len = 0; | |
| 161 | - | |
| 162 | - if (mask->src.u.gre.key) | |
| 163 | - len += sprintf(buffer + len, "srckey=0x%x ", | |
| 164 | - ntohl(match->src.u.gre.key)); | |
| 165 | - | |
| 166 | - if (mask->dst.u.gre.key) | |
| 167 | - len += sprintf(buffer + len, "dstkey=0x%x ", | |
| 168 | - ntohl(match->src.u.gre.key)); | |
| 169 | - | |
| 170 | - return len; | |
| 171 | -} | |
| 172 | - | |
| 173 | -/* print a range of keys */ | |
| 174 | -static unsigned int | |
| 175 | -gre_print_range(char *buffer, const struct ip_nat_range *range) | |
| 176 | -{ | |
| 177 | - if (range->min.gre.key != 0 | |
| 178 | - || range->max.gre.key != 0xFFFF) { | |
| 179 | - if (range->min.gre.key == range->max.gre.key) | |
| 180 | - return sprintf(buffer, "key 0x%x ", | |
| 181 | - ntohl(range->min.gre.key)); | |
| 182 | - else | |
| 183 | - return sprintf(buffer, "keys 0x%u-0x%u ", | |
| 184 | - ntohl(range->min.gre.key), | |
| 185 | - ntohl(range->max.gre.key)); | |
| 186 | - } else | |
| 187 | - return 0; | |
| 188 | -} | |
| 189 | - | |
| 190 | 154 | /* nat helper struct */ |
| 191 | 155 | static struct ip_nat_protocol gre = { |
| 192 | 156 | .name = "GRE", |
| ... | ... | @@ -194,8 +158,6 @@ |
| 194 | 158 | .manip_pkt = gre_manip_pkt, |
| 195 | 159 | .in_range = gre_in_range, |
| 196 | 160 | .unique_tuple = gre_unique_tuple, |
| 197 | - .print = gre_print, | |
| 198 | - .print_range = gre_print_range, | |
| 199 | 161 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ |
| 200 | 162 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) |
| 201 | 163 | .range_to_nfattr = ip_nat_port_range_to_nfattr, |
net/ipv4/netfilter/ip_nat_proto_icmp.c
| ... | ... | @@ -74,38 +74,6 @@ |
| 74 | 74 | return 1; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -static unsigned int | |
| 78 | -icmp_print(char *buffer, | |
| 79 | - const struct ip_conntrack_tuple *match, | |
| 80 | - const struct ip_conntrack_tuple *mask) | |
| 81 | -{ | |
| 82 | - unsigned int len = 0; | |
| 83 | - | |
| 84 | - if (mask->src.u.icmp.id) | |
| 85 | - len += sprintf(buffer + len, "id=%u ", | |
| 86 | - ntohs(match->src.u.icmp.id)); | |
| 87 | - | |
| 88 | - if (mask->dst.u.icmp.type) | |
| 89 | - len += sprintf(buffer + len, "type=%u ", | |
| 90 | - ntohs(match->dst.u.icmp.type)); | |
| 91 | - | |
| 92 | - if (mask->dst.u.icmp.code) | |
| 93 | - len += sprintf(buffer + len, "code=%u ", | |
| 94 | - ntohs(match->dst.u.icmp.code)); | |
| 95 | - | |
| 96 | - return len; | |
| 97 | -} | |
| 98 | - | |
| 99 | -static unsigned int | |
| 100 | -icmp_print_range(char *buffer, const struct ip_nat_range *range) | |
| 101 | -{ | |
| 102 | - if (range->min.icmp.id != 0 || range->max.icmp.id != 0xFFFF) | |
| 103 | - return sprintf(buffer, "id %u-%u ", | |
| 104 | - ntohs(range->min.icmp.id), | |
| 105 | - ntohs(range->max.icmp.id)); | |
| 106 | - else return 0; | |
| 107 | -} | |
| 108 | - | |
| 109 | 77 | struct ip_nat_protocol ip_nat_protocol_icmp = { |
| 110 | 78 | .name = "ICMP", |
| 111 | 79 | .protonum = IPPROTO_ICMP, |
| ... | ... | @@ -113,8 +81,6 @@ |
| 113 | 81 | .manip_pkt = icmp_manip_pkt, |
| 114 | 82 | .in_range = icmp_in_range, |
| 115 | 83 | .unique_tuple = icmp_unique_tuple, |
| 116 | - .print = icmp_print, | |
| 117 | - .print_range = icmp_print_range, | |
| 118 | 84 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ |
| 119 | 85 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) |
| 120 | 86 | .range_to_nfattr = ip_nat_port_range_to_nfattr, |
net/ipv4/netfilter/ip_nat_proto_tcp.c
| ... | ... | @@ -136,40 +136,6 @@ |
| 136 | 136 | return 1; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | -static unsigned int | |
| 140 | -tcp_print(char *buffer, | |
| 141 | - const struct ip_conntrack_tuple *match, | |
| 142 | - const struct ip_conntrack_tuple *mask) | |
| 143 | -{ | |
| 144 | - unsigned int len = 0; | |
| 145 | - | |
| 146 | - if (mask->src.u.tcp.port) | |
| 147 | - len += sprintf(buffer + len, "srcpt=%u ", | |
| 148 | - ntohs(match->src.u.tcp.port)); | |
| 149 | - | |
| 150 | - | |
| 151 | - if (mask->dst.u.tcp.port) | |
| 152 | - len += sprintf(buffer + len, "dstpt=%u ", | |
| 153 | - ntohs(match->dst.u.tcp.port)); | |
| 154 | - | |
| 155 | - return len; | |
| 156 | -} | |
| 157 | - | |
| 158 | -static unsigned int | |
| 159 | -tcp_print_range(char *buffer, const struct ip_nat_range *range) | |
| 160 | -{ | |
| 161 | - if (range->min.tcp.port != 0 || range->max.tcp.port != 0xFFFF) { | |
| 162 | - if (range->min.tcp.port == range->max.tcp.port) | |
| 163 | - return sprintf(buffer, "port %u ", | |
| 164 | - ntohs(range->min.tcp.port)); | |
| 165 | - else | |
| 166 | - return sprintf(buffer, "ports %u-%u ", | |
| 167 | - ntohs(range->min.tcp.port), | |
| 168 | - ntohs(range->max.tcp.port)); | |
| 169 | - } | |
| 170 | - else return 0; | |
| 171 | -} | |
| 172 | - | |
| 173 | 139 | struct ip_nat_protocol ip_nat_protocol_tcp = { |
| 174 | 140 | .name = "TCP", |
| 175 | 141 | .protonum = IPPROTO_TCP, |
| ... | ... | @@ -177,8 +143,6 @@ |
| 177 | 143 | .manip_pkt = tcp_manip_pkt, |
| 178 | 144 | .in_range = tcp_in_range, |
| 179 | 145 | .unique_tuple = tcp_unique_tuple, |
| 180 | - .print = tcp_print, | |
| 181 | - .print_range = tcp_print_range, | |
| 182 | 146 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ |
| 183 | 147 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) |
| 184 | 148 | .range_to_nfattr = ip_nat_port_range_to_nfattr, |
net/ipv4/netfilter/ip_nat_proto_udp.c
| ... | ... | @@ -122,40 +122,6 @@ |
| 122 | 122 | return 1; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -static unsigned int | |
| 126 | -udp_print(char *buffer, | |
| 127 | - const struct ip_conntrack_tuple *match, | |
| 128 | - const struct ip_conntrack_tuple *mask) | |
| 129 | -{ | |
| 130 | - unsigned int len = 0; | |
| 131 | - | |
| 132 | - if (mask->src.u.udp.port) | |
| 133 | - len += sprintf(buffer + len, "srcpt=%u ", | |
| 134 | - ntohs(match->src.u.udp.port)); | |
| 135 | - | |
| 136 | - | |
| 137 | - if (mask->dst.u.udp.port) | |
| 138 | - len += sprintf(buffer + len, "dstpt=%u ", | |
| 139 | - ntohs(match->dst.u.udp.port)); | |
| 140 | - | |
| 141 | - return len; | |
| 142 | -} | |
| 143 | - | |
| 144 | -static unsigned int | |
| 145 | -udp_print_range(char *buffer, const struct ip_nat_range *range) | |
| 146 | -{ | |
| 147 | - if (range->min.udp.port != 0 || range->max.udp.port != 0xFFFF) { | |
| 148 | - if (range->min.udp.port == range->max.udp.port) | |
| 149 | - return sprintf(buffer, "port %u ", | |
| 150 | - ntohs(range->min.udp.port)); | |
| 151 | - else | |
| 152 | - return sprintf(buffer, "ports %u-%u ", | |
| 153 | - ntohs(range->min.udp.port), | |
| 154 | - ntohs(range->max.udp.port)); | |
| 155 | - } | |
| 156 | - else return 0; | |
| 157 | -} | |
| 158 | - | |
| 159 | 125 | struct ip_nat_protocol ip_nat_protocol_udp = { |
| 160 | 126 | .name = "UDP", |
| 161 | 127 | .protonum = IPPROTO_UDP, |
| ... | ... | @@ -163,8 +129,6 @@ |
| 163 | 129 | .manip_pkt = udp_manip_pkt, |
| 164 | 130 | .in_range = udp_in_range, |
| 165 | 131 | .unique_tuple = udp_unique_tuple, |
| 166 | - .print = udp_print, | |
| 167 | - .print_range = udp_print_range, | |
| 168 | 132 | #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ |
| 169 | 133 | defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) |
| 170 | 134 | .range_to_nfattr = ip_nat_port_range_to_nfattr, |
net/ipv4/netfilter/ip_nat_proto_unknown.c
| ... | ... | @@ -46,27 +46,11 @@ |
| 46 | 46 | return 1; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -static unsigned int | |
| 50 | -unknown_print(char *buffer, | |
| 51 | - const struct ip_conntrack_tuple *match, | |
| 52 | - const struct ip_conntrack_tuple *mask) | |
| 53 | -{ | |
| 54 | - return 0; | |
| 55 | -} | |
| 56 | - | |
| 57 | -static unsigned int | |
| 58 | -unknown_print_range(char *buffer, const struct ip_nat_range *range) | |
| 59 | -{ | |
| 60 | - return 0; | |
| 61 | -} | |
| 62 | - | |
| 63 | 49 | struct ip_nat_protocol ip_nat_unknown_protocol = { |
| 64 | 50 | .name = "unknown", |
| 65 | 51 | /* .me isn't set: getting a ref to this cannot fail. */ |
| 66 | 52 | .manip_pkt = unknown_manip_pkt, |
| 67 | 53 | .in_range = unknown_in_range, |
| 68 | 54 | .unique_tuple = unknown_unique_tuple, |
| 69 | - .print = unknown_print, | |
| 70 | - .print_range = unknown_print_range | |
| 71 | 55 | }; |