From: Vince Busam <vbusam@xxxxxxxxxx> Add support for IPv6 entry output to ip_vs_conn_seq_show() and ip_vs_conn_sync_seq_show() proc/net file handlers. Signed-off-by: Vince Busam <vbusam@xxxxxxxxxx> 1 files changed, 35 insertions(+), 10 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c index 30e1ad2..ea0fd77 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -1032,14 +1032,26 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v) else { const struct ip_vs_conn *cp = v; - seq_printf(seq, - "%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n", + if (cp->af == AF_INET) + seq_printf(seq, + "%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n", ip_vs_proto_name(cp->protocol), - ntohl(cp->caddr), ntohs(cp->cport), - ntohl(cp->vaddr), ntohs(cp->vport), - ntohl(cp->daddr), ntohs(cp->dport), + ntohl(cp->caddr.v4), ntohs(cp->cport), + ntohl(cp->vaddr.v4), ntohs(cp->vport), + ntohl(cp->daddr.v4), ntohs(cp->dport), ip_vs_state_name(cp->protocol, cp->state), (cp->timer.expires-jiffies)/HZ); +#ifdef CONFIG_IP_VS_IPV6 + else + seq_printf(seq, + "%-3s " NIP6_FMT " %04X " NIP6_FMT " %04X " NIP6_FMT " %04X %-11s %7lu\n", + ip_vs_proto_name(cp->protocol), + NIP6(cp->caddr.v6), ntohs(cp->cport), + NIP6(cp->vaddr.v6), ntohs(cp->vport), + NIP6(cp->daddr.v6), ntohs(cp->dport), + ip_vs_state_name(cp->protocol, cp->state), + (cp->timer.expires-jiffies)/HZ); +#endif } return 0; } @@ -1081,15 +1093,28 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v) else { const struct ip_vs_conn *cp = v; - seq_printf(seq, - "%-3s %08X %04X %08X %04X %08X %04X %-11s %-6s %7lu\n", + if (cp->af == AF_INET) + seq_printf(seq, + "%-3s %08X %04X %08X %04X %08X %04X %-11s %-6s %7lu\n", ip_vs_proto_name(cp->protocol), - ntohl(cp->caddr), ntohs(cp->cport), - ntohl(cp->vaddr), ntohs(cp->vport), - ntohl(cp->daddr), ntohs(cp->dport), + ntohl(cp->caddr.v4), ntohs(cp->cport), + ntohl(cp->vaddr.v4), ntohs(cp->vport), + ntohl(cp->daddr.v4), ntohs(cp->dport), ip_vs_state_name(cp->protocol, cp->state), ip_vs_origin_name(cp->flags), (cp->timer.expires-jiffies)/HZ); +#ifdef CONFIG_IP_VS_IPV6 + else + seq_printf(seq, + "%-3s " NIP6_FMT " %04X " NIP6_FMT " %04X " NIP6_FMT " %04X %-11s %-6s %7lu\n", + ip_vs_proto_name(cp->protocol), + NIP6(cp->caddr.v6), ntohs(cp->cport), + NIP6(cp->vaddr.v6), ntohs(cp->vport), + NIP6(cp->daddr.v6), ntohs(cp->dport), + ip_vs_state_name(cp->protocol, cp->state), + ip_vs_origin_name(cp->flags), + (cp->timer.expires-jiffies)/HZ); +#endif } return 0; } -- 1.5.3.6 -- To unsubscribe from this list: send the line "unsubscribe lvs-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html