* [PATCH 1/2] ipvsadm: restrict different address family
2014-08-30 11:35 [PATCH 0/2] More changes for different address family Julian Anastasov
@ 2014-08-30 11:35 ` Julian Anastasov
2014-08-30 11:35 ` [PATCH 2/2] ipvsadm: allow different address family in connection listing Julian Anastasov
2014-08-30 12:01 ` [PATCH 0/2] More changes for different address family Jesper Dangaard Brouer
2 siblings, 0 replies; 5+ messages in thread
From: Julian Anastasov @ 2014-08-30 11:35 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Simon Horman, lvs-devel, lvs-users, Alex Gartrell, kernel-team
Now real server can have different address family only
for tunneling. For other modes it must match the service.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
ipvsadm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ipvsadm.c b/ipvsadm.c
index d12070e..3000117 100644
--- a/ipvsadm.c
+++ b/ipvsadm.c
@@ -788,6 +788,12 @@ static int process_options(int argc, char **argv, int reading_stdin)
(ce.dest.conn_flags == IP_VS_CONN_F_TUNNEL
|| ce.dest.conn_flags == IP_VS_CONN_F_DROUTE))
ce.dest.port = ce.svc.port;
+
+ /* Tunneling allows different address family */
+ if (ce.dest.af != ce.svc.af &&
+ ce.dest.conn_flags != IP_VS_CONN_F_TUNNEL)
+ fail(2, "Different address family is allowed only "
+ "for tunneling servers");
}
switch (ce.cmd) {
--
1.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] ipvsadm: allow different address family in connection listing
2014-08-30 11:35 [PATCH 0/2] More changes for different address family Julian Anastasov
2014-08-30 11:35 ` [PATCH 1/2] ipvsadm: restrict " Julian Anastasov
@ 2014-08-30 11:35 ` Julian Anastasov
2014-08-30 12:01 ` [PATCH 0/2] More changes for different address family Jesper Dangaard Brouer
2 siblings, 0 replies; 5+ messages in thread
From: Julian Anastasov @ 2014-08-30 11:35 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Simon Horman, lvs-devel, lvs-users, Alex Gartrell, kernel-team
Real server can have different address family, fix it
for connection listing.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
ipvsadm.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/ipvsadm.c b/ipvsadm.c
index 3000117..7263d03 100644
--- a/ipvsadm.c
+++ b/ipvsadm.c
@@ -1296,6 +1296,7 @@ static void print_conn(char *buf, unsigned int format)
char state[16];
unsigned int expires;
unsigned short af = AF_INET;
+ unsigned short daf = AF_INET;
char pe_name[IP_VS_PENAME_MAXLEN];
char pe_data[IP_VS_PEDATA_MAXLEN];
@@ -1320,22 +1321,24 @@ static void print_conn(char *buf, unsigned int format)
if (inet_pton(AF_INET6, temp1, &caddr.in6) > 0) {
inet_pton(AF_INET6, temp2, &vaddr.in6);
- inet_pton(AF_INET6, temp3, &daddr.in6);
af = AF_INET6;
} else if (inet_pton(AF_INET, temp1, &caddr.ip) > 0) {
inet_pton(AF_INET, temp2, &vaddr.ip);
- inet_pton(AF_INET, temp3, &daddr.ip);
} else {
caddr.ip = (__u32) htonl(strtoul(temp1, NULL, 16));
vaddr.ip = (__u32) htonl(strtoul(temp2, NULL, 16));
- daddr.ip = (__u32) htonl(strtoul(temp3, NULL, 16));
}
+ if (inet_pton(AF_INET6, temp3, &daddr.in6) > 0)
+ daf = AF_INET6;
+ else if (inet_pton(AF_INET, temp3, &daddr.ip) <= 0)
+ daddr.ip = (__u32) htonl(strtoul(temp3, NULL, 16));
+
if (!(cname = addrport_to_anyname(af, &caddr, cport, proto, format)))
exit(1);
if (!(vname = addrport_to_anyname(af, &vaddr, vport, proto, format)))
exit(1);
- if (!(dname = addrport_to_anyname(af, &daddr, dport, proto, format)))
+ if (!(dname = addrport_to_anyname(daf, &daddr, dport, proto, format)))
exit(1);
seconds = expires % 60;
--
1.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread