diff options
| author | Julian Anastasov <ja@ssi.bg> | 2014-09-09 19:40:38 -0400 |
|---|---|---|
| committer | Simon Horman <horms@verge.net.au> | 2014-09-17 19:59:28 -0400 |
| commit | f18ae7206eaebfecc2dd8b017b0d6a0950eabf8b (patch) | |
| tree | 5e44aecb953b1721d10d0991c85720857f2e9435 | |
| parent | 4d316f3f9ae3d5fad8d3198eec0a4ef2511471d7 (diff) | |
ipvs: use the new dest addr family field
Use the new address family field cp->daf when printing
cp->daddr in logs or connection listing.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Alex Gartrell <agartrell@fb.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_conn.c | 49 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c | 6 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_sctp.c | 2 | ||||
| -rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_tcp.c | 2 |
4 files changed, 43 insertions, 16 deletions
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 13e9cee02c81..b0f7b626b56d 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
| 29 | #include <linux/in.h> | 29 | #include <linux/in.h> |
| 30 | #include <linux/inet.h> | ||
| 30 | #include <linux/net.h> | 31 | #include <linux/net.h> |
| 31 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
| 32 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| @@ -77,6 +78,13 @@ static unsigned int ip_vs_conn_rnd __read_mostly; | |||
| 77 | #define CT_LOCKARRAY_SIZE (1<<CT_LOCKARRAY_BITS) | 78 | #define CT_LOCKARRAY_SIZE (1<<CT_LOCKARRAY_BITS) |
| 78 | #define CT_LOCKARRAY_MASK (CT_LOCKARRAY_SIZE-1) | 79 | #define CT_LOCKARRAY_MASK (CT_LOCKARRAY_SIZE-1) |
| 79 | 80 | ||
| 81 | /* We need an addrstrlen that works with or without v6 */ | ||
| 82 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 83 | #define IP_VS_ADDRSTRLEN INET6_ADDRSTRLEN | ||
| 84 | #else | ||
| 85 | #define IP_VS_ADDRSTRLEN (8+1) | ||
| 86 | #endif | ||
| 87 | |||
| 80 | struct ip_vs_aligned_lock | 88 | struct ip_vs_aligned_lock |
| 81 | { | 89 | { |
| 82 | spinlock_t l; | 90 | spinlock_t l; |
| @@ -588,7 +596,7 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest) | |||
| 588 | ip_vs_proto_name(cp->protocol), | 596 | ip_vs_proto_name(cp->protocol), |
| 589 | IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport), | 597 | IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport), |
| 590 | IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport), | 598 | IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport), |
| 591 | IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport), | 599 | IP_VS_DBG_ADDR(cp->daf, &cp->daddr), ntohs(cp->dport), |
| 592 | ip_vs_fwd_tag(cp), cp->state, | 600 | ip_vs_fwd_tag(cp), cp->state, |
| 593 | cp->flags, atomic_read(&cp->refcnt), | 601 | cp->flags, atomic_read(&cp->refcnt), |
| 594 | atomic_read(&dest->refcnt)); | 602 | atomic_read(&dest->refcnt)); |
| @@ -685,7 +693,7 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp) | |||
| 685 | ip_vs_proto_name(cp->protocol), | 693 | ip_vs_proto_name(cp->protocol), |
| 686 | IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport), | 694 | IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport), |
| 687 | IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport), | 695 | IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport), |
| 688 | IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport), | 696 | IP_VS_DBG_ADDR(cp->daf, &cp->daddr), ntohs(cp->dport), |
| 689 | ip_vs_fwd_tag(cp), cp->state, | 697 | ip_vs_fwd_tag(cp), cp->state, |
| 690 | cp->flags, atomic_read(&cp->refcnt), | 698 | cp->flags, atomic_read(&cp->refcnt), |
| 691 | atomic_read(&dest->refcnt)); | 699 | atomic_read(&dest->refcnt)); |
| @@ -754,7 +762,7 @@ int ip_vs_check_template(struct ip_vs_conn *ct) | |||
| 754 | ntohs(ct->cport), | 762 | ntohs(ct->cport), |
| 755 | IP_VS_DBG_ADDR(ct->af, &ct->vaddr), | 763 | IP_VS_DBG_ADDR(ct->af, &ct->vaddr), |
| 756 | ntohs(ct->vport), | 764 | ntohs(ct->vport), |
| 757 | IP_VS_DBG_ADDR(ct->af, &ct->daddr), | 765 | IP_VS_DBG_ADDR(ct->daf, &ct->daddr), |
| 758 | ntohs(ct->dport)); | 766 | ntohs(ct->dport)); |
| 759 | 767 | ||
| 760 | /* | 768 | /* |
| @@ -1051,6 +1059,7 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v) | |||
| 1051 | struct net *net = seq_file_net(seq); | 1059 | struct net *net = seq_file_net(seq); |
| 1052 | char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3]; | 1060 | char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3]; |
| 1053 | size_t len = 0; | 1061 | size_t len = 0; |
| 1062 | char dbuf[IP_VS_ADDRSTRLEN]; | ||
| 1054 | 1063 | ||
| 1055 | if (!ip_vs_conn_net_eq(cp, net)) | 1064 | if (!ip_vs_conn_net_eq(cp, net)) |
| 1056 | return 0; | 1065 | return 0; |
| @@ -1065,24 +1074,32 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v) | |||
| 1065 | pe_data[len] = '\0'; | 1074 | pe_data[len] = '\0'; |
| 1066 | 1075 | ||
| 1067 | #ifdef CONFIG_IP_VS_IPV6 | 1076 | #ifdef CONFIG_IP_VS_IPV6 |
| 1077 | if (cp->daf == AF_INET6) | ||
| 1078 | snprintf(dbuf, sizeof(dbuf), "%pI6", &cp->daddr.in6); | ||
| 1079 | else | ||
| 1080 | #endif | ||
| 1081 | snprintf(dbuf, sizeof(dbuf), "%08X", | ||
| 1082 | ntohl(cp->daddr.ip)); | ||
| 1083 | |||
| 1084 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 1068 | if (cp->af == AF_INET6) | 1085 | if (cp->af == AF_INET6) |
| 1069 | seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X " | 1086 | seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X " |
| 1070 | "%pI6 %04X %-11s %7lu%s\n", | 1087 | "%s %04X %-11s %7lu%s\n", |
| 1071 | ip_vs_proto_name(cp->protocol), | 1088 | ip_vs_proto_name(cp->protocol), |
| 1072 | &cp->caddr.in6, ntohs(cp->cport), | 1089 | &cp->caddr.in6, ntohs(cp->cport), |
| 1073 | &cp->vaddr.in6, ntohs(cp->vport), | 1090 | &cp->vaddr.in6, ntohs(cp->vport), |
| 1074 | &cp->daddr.in6, ntohs(cp->dport), | 1091 | dbuf, ntohs(cp->dport), |
| 1075 | ip_vs_state_name(cp->protocol, cp->state), | 1092 | ip_vs_state_name(cp->protocol, cp->state), |
| 1076 | (cp->timer.expires-jiffies)/HZ, pe_data); | 1093 | (cp->timer.expires-jiffies)/HZ, pe_data); |
| 1077 | else | 1094 | else |
| 1078 | #endif | 1095 | #endif |
| 1079 | seq_printf(seq, | 1096 | seq_printf(seq, |
| 1080 | "%-3s %08X %04X %08X %04X" | 1097 | "%-3s %08X %04X %08X %04X" |
| 1081 | " %08X %04X %-11s %7lu%s\n", | 1098 | " %s %04X %-11s %7lu%s\n", |
| 1082 | ip_vs_proto_name(cp->protocol), | 1099 | ip_vs_proto_name(cp->protocol), |
| 1083 | ntohl(cp->caddr.ip), ntohs(cp->cport), | 1100 | ntohl(cp->caddr.ip), ntohs(cp->cport), |
| 1084 | ntohl(cp->vaddr.ip), ntohs(cp->vport), | 1101 | ntohl(cp->vaddr.ip), ntohs(cp->vport), |
| 1085 | ntohl(cp->daddr.ip), ntohs(cp->dport), | 1102 | dbuf, ntohs(cp->dport), |
| 1086 | ip_vs_state_name(cp->protocol, cp->state), | 1103 | ip_vs_state_name(cp->protocol, cp->state), |
| 1087 | (cp->timer.expires-jiffies)/HZ, pe_data); | 1104 | (cp->timer.expires-jiffies)/HZ, pe_data); |
| 1088 | } | 1105 | } |
| @@ -1120,6 +1137,7 @@ static const char *ip_vs_origin_name(unsigned int flags) | |||
| 1120 | 1137 | ||
| 1121 | static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v) | 1138 | static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v) |
| 1122 | { | 1139 | { |
| 1140 | char dbuf[IP_VS_ADDRSTRLEN]; | ||
| 1123 | 1141 | ||
| 1124 | if (v == SEQ_START_TOKEN) | 1142 | if (v == SEQ_START_TOKEN) |
| 1125 | seq_puts(seq, | 1143 | seq_puts(seq, |
| @@ -1132,12 +1150,21 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v) | |||
| 1132 | return 0; | 1150 | return 0; |
| 1133 | 1151 | ||
| 1134 | #ifdef CONFIG_IP_VS_IPV6 | 1152 | #ifdef CONFIG_IP_VS_IPV6 |
| 1153 | if (cp->daf == AF_INET6) | ||
| 1154 | snprintf(dbuf, sizeof(dbuf), "%pI6", &cp->daddr.in6); | ||
| 1155 | else | ||
| 1156 | #endif | ||
| 1157 | snprintf(dbuf, sizeof(dbuf), "%08X", | ||
| 1158 | ntohl(cp->daddr.ip)); | ||
| 1159 | |||
| 1160 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 1135 | if (cp->af == AF_INET6) | 1161 | if (cp->af == AF_INET6) |
| 1136 | seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X %pI6 %04X %-11s %-6s %7lu\n", | 1162 | seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X " |
| 1163 | "%s %04X %-11s %-6s %7lu\n", | ||
| 1137 | ip_vs_proto_name(cp->protocol), | 1164 | ip_vs_proto_name(cp->protocol), |
| 1138 | &cp->caddr.in6, ntohs(cp->cport), | 1165 | &cp->caddr.in6, ntohs(cp->cport), |
| 1139 | &cp->vaddr.in6, ntohs(cp->vport), | 1166 | &cp->vaddr.in6, ntohs(cp->vport), |
| 1140 | &cp->daddr.in6, ntohs(cp->dport), | 1167 | dbuf, ntohs(cp->dport), |
| 1141 | ip_vs_state_name(cp->protocol, cp->state), | 1168 | ip_vs_state_name(cp->protocol, cp->state), |
| 1142 | ip_vs_origin_name(cp->flags), | 1169 | ip_vs_origin_name(cp->flags), |
| 1143 | (cp->timer.expires-jiffies)/HZ); | 1170 | (cp->timer.expires-jiffies)/HZ); |
| @@ -1145,11 +1172,11 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v) | |||
| 1145 | #endif | 1172 | #endif |
| 1146 | seq_printf(seq, | 1173 | seq_printf(seq, |
| 1147 | "%-3s %08X %04X %08X %04X " | 1174 | "%-3s %08X %04X %08X %04X " |
| 1148 | "%08X %04X %-11s %-6s %7lu\n", | 1175 | "%s %04X %-11s %-6s %7lu\n", |
| 1149 | ip_vs_proto_name(cp->protocol), | 1176 | ip_vs_proto_name(cp->protocol), |
| 1150 | ntohl(cp->caddr.ip), ntohs(cp->cport), | 1177 | ntohl(cp->caddr.ip), ntohs(cp->cport), |
| 1151 | ntohl(cp->vaddr.ip), ntohs(cp->vport), | 1178 | ntohl(cp->vaddr.ip), ntohs(cp->vport), |
| 1152 | ntohl(cp->daddr.ip), ntohs(cp->dport), | 1179 | dbuf, ntohs(cp->dport), |
| 1153 | ip_vs_state_name(cp->protocol, cp->state), | 1180 | ip_vs_state_name(cp->protocol, cp->state), |
