From: Simon Horman <horms@verge.net.au>
To: Julius Volz <juliusv@google.com>
Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org,
kaber@trash.net, vbusam@google.com
Subject: Re: [PATCH RFC 10/24] IPVS: Extend scheduling functions for IPv6 support
Date: Wed, 27 Aug 2008 16:28:23 +1000 [thread overview]
Message-ID: <20080827062822.GC3816@verge.net.au> (raw)
In-Reply-To: <1219248931-15064-11-git-send-email-juliusv@google.com>
On Wed, Aug 20, 2008 at 06:15:17PM +0200, Julius Volz wrote:
> Convert ip_vs_schedule() and ip_vs_sched_persist() to support scheduling
> IPv6 connections.
>
> Signed-off-by: Julius Volz <juliusv@google.com>
>
> 1 files changed, 58 insertions(+), 43 deletions(-)
>
> diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
> index 99e8938..0f9a0a2 100644
> --- a/net/ipv4/ipvs/ip_vs_core.c
> +++ b/net/ipv4/ipvs/ip_vs_core.c
> @@ -183,14 +183,21 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> __be16 ports[2])
> {
> struct ip_vs_conn *cp = NULL;
> - struct iphdr *iph = ip_hdr(skb);
> + struct ip_vs_iphdr iph;
> struct ip_vs_dest *dest;
> struct ip_vs_conn *ct;
> - __be16 dport; /* destination port to forward */
> - __be32 snet; /* source network of the client, after masking */
> + __be16 dport; /* destination port to forward */
> + union nf_inet_addr snet; /* source network of the client, after masking */
Can you break the line above so that it is <= 80 columns wide?
union nf_inet_addr snet; /* source network of the client,
* after masking */
> +
> + ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph);
>
> /* Mask saddr with the netmask to adjust template granularity */
> - snet = iph->saddr & svc->netmask;
> +#ifdef CONFIG_IP_VS_IPV6
> + if (svc->af == AF_INET6)
> + ipv6_addr_prefix(&snet.in6, &iph.saddr.in6, svc->netmask);
> + else
> +#endif
> + snet.ip = iph.saddr.ip & svc->netmask;
>
> IP_VS_DBG_BUF(6, "p-schedule: src %s:%u dest %s:%u "
> "mnet %s\n",
> @@ -214,11 +221,11 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> if (ports[1] == svc->port) {
> /* Check if a template already exists */
> if (svc->port != FTPPORT)
> - ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
> - iph->daddr, ports[1]);
> + ct = ip_vs_ct_in_get(svc->af, iph.protocol, &snet, 0,
> + &iph.daddr, ports[1]);
> else
> - ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
> - iph->daddr, 0);
> + ct = ip_vs_ct_in_get(svc->af, iph.protocol, &snet, 0,
> + &iph.daddr, 0);
>
> if (!ct || !ip_vs_check_template(ct)) {
> /*
> @@ -238,18 +245,18 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> * for ftp service.
> */
> if (svc->port != FTPPORT)
> - ct = ip_vs_conn_new(iph->protocol,
> - snet, 0,
> - iph->daddr,
> + ct = ip_vs_conn_new(svc->af, iph.protocol,
> + &snet, 0,
> + &iph.daddr,
> ports[1],
> - dest->addr, dest->port,
> + &dest->addr, dest->port,
> IP_VS_CONN_F_TEMPLATE,
> dest);
> else
> - ct = ip_vs_conn_new(iph->protocol,
> - snet, 0,
> - iph->daddr, 0,
> - dest->addr, 0,
> + ct = ip_vs_conn_new(svc->af, iph.protocol,
> + &snet, 0,
> + &iph.daddr, 0,
> + &dest->addr, 0,
> IP_VS_CONN_F_TEMPLATE,
> dest);
> if (ct == NULL)
> @@ -268,12 +275,16 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> * fwmark template: <IPPROTO_IP,caddr,0,fwmark,0,daddr,0>
> * port zero template: <protocol,caddr,0,vaddr,0,daddr,0>
> */
> - if (svc->fwmark)
> - ct = ip_vs_ct_in_get(IPPROTO_IP, snet, 0,
> - htonl(svc->fwmark), 0);
> - else
> - ct = ip_vs_ct_in_get(iph->protocol, snet, 0,
> - iph->daddr, 0);
> + if (svc->fwmark) {
> + union nf_inet_addr fwmark = {
> + .all = { 0, 0, 0, htonl(svc->fwmark) }
> + };
> +
> + ct = ip_vs_ct_in_get(svc->af, IPPROTO_IP, &snet, 0,
> + &fwmark, 0);
> + } else
> + ct = ip_vs_ct_in_get(svc->af, iph.protocol, &snet, 0,
> + &iph.daddr, 0);
>
> if (!ct || !ip_vs_check_template(ct)) {
> /*
> @@ -292,18 +303,22 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> /*
> * Create a template according to the service
> */
> - if (svc->fwmark)
> - ct = ip_vs_conn_new(IPPROTO_IP,
> - snet, 0,
> - htonl(svc->fwmark), 0,
> - dest->addr, 0,
> + if (svc->fwmark) {
> + union nf_inet_addr fwmark = {
> + .all = { 0, 0, 0, htonl(svc->fwmark) }
> + };
> +
> + ct = ip_vs_conn_new(svc->af, IPPROTO_IP,
> + &snet, 0,
> + &fwmark, 0,
> + &dest->addr, 0,
> IP_VS_CONN_F_TEMPLATE,
> dest);
> - else
> - ct = ip_vs_conn_new(iph->protocol,
> - snet, 0,
> - iph->daddr, 0,
> - dest->addr, 0,
> + } else
> + ct = ip_vs_conn_new(svc->af, iph.protocol,
> + &snet, 0,
> + &iph.daddr, 0,
> + &dest->addr, 0,
> IP_VS_CONN_F_TEMPLATE,
> dest);
> if (ct == NULL)
> @@ -320,10 +335,10 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
> /*
> * Create a new connection according to the template
> */
> - cp = ip_vs_conn_new(iph->protocol,
> - iph->saddr, ports[0],
> - iph->daddr, ports[1],
> - dest->addr, dport,
> + cp = ip_vs_conn_new(svc->af, iph.protocol,
> + &iph.saddr, ports[0],
> + &iph.daddr, ports[1],
> + &dest->addr, dport,
> 0,
> dest);
> if (cp == NULL) {
> @@ -352,12 +367,12 @@ struct ip_vs_conn *
> ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
> {
> struct ip_vs_conn *cp = NULL;
> - struct iphdr *iph = ip_hdr(skb);
> + struct ip_vs_iphdr iph;
> struct ip_vs_dest *dest;
> __be16 _ports[2], *pptr;
>
> - pptr = skb_header_pointer(skb, iph->ihl*4,
> - sizeof(_ports), _ports);
> + ip_vs_fill_iphdr(svc->af, skb_network_header(skb), &iph);
> + pptr = skb_header_pointer(skb, iph.len, sizeof(_ports), _ports);
> if (pptr == NULL)
> return NULL;
>
> @@ -387,10 +402,10 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
> /*
> * Create a connection entry.
> */
> - cp = ip_vs_conn_new(iph->protocol,
> - iph->saddr, pptr[0],
> - iph->daddr, pptr[1],
> - dest->addr, dest->port?dest->port:pptr[1],
> + cp = ip_vs_conn_new(svc->af, iph.protocol,
> + &iph.saddr, pptr[0],
> + &iph.daddr, pptr[1],
> + &dest->addr, dest->port ? dest->port : pptr[1],
> 0,
> dest);
> if (cp == NULL)
> --
> 1.5.4.5
next prev parent reply other threads:[~2008-08-27 6:28 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 16:15 [PATCH RFC 00/24] IPVS: Add first IPv6 support to IPVS Julius Volz
2008-08-20 16:15 ` [PATCH RFC 01/24] IPVS: Add genetlink interface definitions to ip_vs.h Julius Volz
2008-08-20 16:15 ` [PATCH RFC 02/24] IPVS: Add genetlink interface implementation Julius Volz
2008-08-20 16:15 ` [PATCH RFC 03/24] IPVS: Add CONFIG_IP_VS_IPV6 option for IPv6 support Julius Volz
2008-08-20 16:15 ` [PATCH RFC 04/24] IPVS: Change IPVS data structures to support IPv6 addresses Julius Volz
2008-08-20 16:15 ` [PATCH RFC 05/24] IPVS: Add general v4/v6 helper functions / data structures Julius Volz
2008-08-20 16:15 ` [PATCH RFC 06/24] IPVS: Add debug macros for v4 and v6 address output Julius Volz
2008-08-20 16:15 ` [PATCH RFC 07/24] IPVS: Convert existing debug uses to use new macros Julius Volz
2008-08-20 16:15 ` [PATCH RFC 08/24] IPVS: Make protocol handler functions support IPv6 Julius Volz
2008-08-21 13:29 ` Brian Haley
2008-08-21 13:52 ` Julius Volz
2008-08-21 14:08 ` Brian Haley
2008-08-21 14:55 ` Julius Volz
2008-08-21 15:12 ` Brian Haley
2008-08-21 15:28 ` Julius Volz
2008-08-20 16:15 ` [PATCH RFC 09/24] IPVS: Add IPv6 Netfilter hooks and add/modify support functions Julius Volz
2008-08-20 16:15 ` [PATCH RFC 10/24] IPVS: Extend scheduling functions for IPv6 support Julius Volz
2008-08-27 6:28 ` Simon Horman [this message]
2008-08-27 16:02 ` Julius Volz
2008-08-20 16:15 ` [PATCH RFC 11/24] IPVS: Add IPv6 xmit functions Julius Volz
2008-08-20 16:15 ` [PATCH RFC 12/24] IPVS: Extend functions for getting/creating connections Julius Volz
2008-08-20 16:15 ` [PATCH RFC 13/24] IPVS: Add IPv6 support to ip_vs_conn_hashkey() Julius Volz
2008-08-20 16:15 ` [PATCH RFC 14/24] IPVS: Turn off FTP application helper for IPv6 Julius Volz
2008-08-20 16:15 ` [PATCH RFC 15/24] IPVS: Add support for IPv6 entry output in procfs files Julius Volz
2008-08-20 16:15 ` [PATCH RFC 16/24] IPVS: Add function to determine if IPv6 address is local Julius Volz
2008-08-20 16:15 ` [PATCH RFC 17/24] IPVS: Make proc/net files output IPv6 entries correctly Julius Volz
2008-08-20 16:15 ` [PATCH RFC 18/24] IPVS: Convert dest/service lookup functions Julius Volz
2008-08-20 16:15 ` [PATCH RFC 19/24] IPVS: Add IPv6 support flag to schedulers Julius Volz
2008-08-21 1:48 ` Simon Horman
2008-08-21 10:21 ` Julius Volz
2008-08-21 13:23 ` Simon Horman
2008-08-20 16:15 ` [PATCH RFC 20/24] IPVS: Add validity checks when adding/editing v6 services Julius Volz
2008-08-20 16:15 ` [PATCH RFC 21/24] IPVS: Only expose IPv4 entries through sockopt interface Julius Volz
2008-08-20 16:15 ` [PATCH RFC 22/24] IPVS: Add IPv6 support to genetlink interface Julius Volz
2008-08-20 16:15 ` [PATCH RFC 23/24] IPVS: Small address/af usage fixups Julius Volz
2008-08-20 16:15 ` [PATCH RFC 24/24] IPVS: Add notes about IPv6 changes Julius Volz
2008-08-21 1:17 ` [PATCH RFC 00/24] IPVS: Add first IPv6 support to IPVS Simon Horman
2008-08-21 9:59 ` Julius Volz
2008-08-21 21:29 ` Simon Horman
2008-08-21 22:01 ` Julius Volz
2008-08-27 5:59 ` Simon Horman
2008-08-21 22:05 ` Simon Horman
2008-08-22 9:56 ` Julius Volz
2008-08-22 10:05 ` Graeme Fowler
2008-08-22 10:49 ` Julius Volz
2008-08-22 11:23 ` Sven Wegener
2008-08-22 12:14 ` Julius Volz
2008-08-23 9:20 ` Graeme Fowler
2008-08-23 15:22 ` Joseph Mack NA3T
2008-08-23 16:31 ` Graeme Fowler
2008-08-24 2:13 ` Joseph Mack NA3T
2008-08-23 23:07 ` Julius Volz
2008-08-24 1:40 ` Joseph Mack NA3T
2008-08-27 6:09 ` Simon Horman
2008-08-27 15:24 ` Julius Volz
2008-08-27 23:49 ` Simon Horman
2008-08-27 7:17 ` Simon Horman
2008-08-27 15:09 ` Julius Volz
2008-08-27 23:48 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080827062822.GC3816@verge.net.au \
--to=horms@verge.net.au \
--cc=juliusv@google.com \
--cc=kaber@trash.net \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vbusam@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).