All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Schillstrom <hans.schillstrom@ericsson.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: LVS-Devel <lvs-devel@vger.kernel.org>,
	Simon Horman <horms@verge.net.au>,
	"wensong@linux-vs.org" <wensong@linux-vs.org>,
	"daniel.lezcano@free.fr" <daniel.lezcano@free.fr>
Subject: Re: [v2 PATCH 0/4] IPVS: Backup Adding Ipv6 and Persistence support
Date: Mon, 1 Nov 2010 11:03:40 +0100	[thread overview]
Message-ID: <201011011103.41004.hans.schillstrom@ericsson.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1010301741280.2294@ja.ssi.bg>

Hello,
On Saturday 30 October 2010 16:55:32 Julian Anastasov wrote:
>
>  	Hello,
>
> On Fri, 29 Oct 2010, Hans Schillstrom wrote:
>
> > PATCH STATUS:
> > - Persistence data is not tested.
> >
> >
> > THANKS
> > The Persistence part is based on Simon Hormans Backup RFC
> > Julian for the comments and the Review of the RFC
> >
> > *v2
> > Simlified fwmark handling patch 1/4
> > New handling of optional data patch 2/4
> > Seconds in timeout
> > Basically all changes is based on Julians and Simons comments on the RFC
> > For details see individual patches.
>
> v2 PATCH 1/4
>  	OK
>
> v2 PATCH 2/4
>  	- Do we change the name from "Option" to "Parameter" ?
Sure, why not Optional Parameter

>  	Also, 'Option Length" will be part of the DATA, i.e.
>  	it should be present depending on type, in some cases
>  	it will be implicit, eg. for IPVS_OPT_SEQ_DATA:

No,
I think this is a bad idea.
Commonication protocols/formats should be simple an clean without exceptions.
So in our case Param options should consits of (without exceptions):
 - TYPE and a LENGTH field, followed by data
Where TYPE is 1 byte
and   LENGTH is 1 byte, (value 1-255, 0 is illegal)

>
>  	IPVS_OPT_SEQ_DATA:
>  		- 1 octet IPVS_OPT_SEQ_DATA followed by
>  		struct ip_vs_sync_conn_options
>

No, This breaks the rules.

>  	IPVS_OPT_PE_DATA:
>  		- 1 octet IPVS_OPT_PE_DATA, 1 or 2 octets
>  		for Parameter Length (pe_data_len) followed by
>  		pe_data. If the decision is to support large
>  		data please use 2 octets and get_unaligned_be16
>  		to read it. Other PEs may need it, they can decide
>  		to add many things in PE data, they will not
>  		allocate other cp fields for their data.
>
No,
If you need to send more than 255 bytes of data to identify a call,
then you should go back to the drawing board again.
Remember that we are using "tiny" datagrams.
If we later on needs changes there is a place for that,
 - the version.

>  	IPVS_OPT_PE_NAME:
>  		- 1 octet for IPVS_OPT_PE_NAME, 1 octet
>  		for Parameter Length (pe_name_len) followed by
>  		pe_name

Yes, It is like that now, including a terminating Zero...

>
>  	- struct ip_vs_sync_mesg_v2 with spaces instead of tabs?
>
>  	- can we add check in backup for timeout not to exceed
>  		(MAX_SCHEDULE_TIMEOUT / HZ)
>
>  	For example:
>
>  	if (timeout) {
>  		if (timeout > MAX_SCHEDULE_TIMEOUT / HZ)
>  			timeout = MAX_SCHEDULE_TIMEOUT / HZ;
>  		cp->timeout = timeout * HZ;
>  	} else ...

Yes, Sounds like a good Idea

>
>  	- extra space in protocol:
>  	ip_vs_proc_conn(&param, flags, state, s-> protocol, AF_INET,
>
Ooops, I'll remove that

>  	- lets drop the optional parameters from ip_vs_process_message()?

I guess that you mean ip_vs_sync_conn_options,
in that case I do agree.

>
>  	- ip_vs_process_message: do not use mask: m2->size & SVER_MASK
>  	because the message size has no version.

Ooops again :-)

>
>  	- What is the right thing to do in ip_vs_conn_fill_param_sync
>  	when ip_vs_pe_get() does not find PE? May be to drop
>  	connection? May be in ip_vs_process_message() we should
>  	use one pointer for end of message (it was 'p' before now),
>  	so that we can skip connections, for example, when some
>  	mandatory parameter as PE is not supported. We should not
>  	drop the whole sync message. When message is invalid it
>  	should be dropped but lack of support should not hurt
>  	other connections. In the case for PE may be
>  	ip_vs_conn_fill_param_sync() should return 1 if
>  	PE is unknown (ip_vs_pe_get). Then caller will continue
>  	with next connection if result > 0 or will drop message
>  	if result < 0 as in current patch. May be the pe_name
>  	presence should be the first check in
>  	ip_vs_conn_fill_param_sync.

Yes I'll fix that.

>       Also note that p->pe is
>  	pointer without reference while called in ip_vs_sched_persist.
>  	In our case with ip_vs_conn_fill_param_sync we should
>  	put this reference after calling ip_vs_proc_conn().
>  	May be ip_vs_find_dest should check that p->pe matches
>  	svc->pe. ip_vs_try_bind_dest should provide p->pe too
>  	for this check. But we must somehow ignore new conns
>  	with PE if they don't have cp->dest (service) because
>  	it is risky to attach PE that is not held by svc.
>  	It is bad that the check for p->pe is before
>  	ip_vs_find_dest.

Can we agree upon that Simons patch "IPVS: Add persistence engine to connection entry"
solves this issue ?

The basic principle for param decoding is;
 - Unknown param: skip this entry and continue with next
 - Invalid param length: drop the buffer.
 - Invalid param data: skip this entry and continue with next
   (If possible to check)

There is a violation to this that I will correct:
 Checking for a terminating Zero in pe_name string causes a drop of entire buffer, not just the conn. entry.


>  	Example for parsing:
>
>  	- rename msgEnd/p to 'char *endp;' and move it before loop.
>  	It will have the 'p' role as before: to point to end
>  	of connection.
>
>  	before loop:
>  	endp = buffer + sizeof(struct ip_vs_sync_mesg_v2);
>
>  	In loop:
>
> +		p = endp;
> +		s = (union ip_vs_sync_conn *) endp;
> +		size = ntohs(s->v4.ver_size) & SVER_MASK;
> +		endp = p + size; <--- we are ready for 'continue'
>
>  	By this way endp should point to next connection in case
>  	we want to ignore current one at any time. 'p' will walk
>  	parameters as you do now. After that all checks for p should be
>  	with endp, I mean use 'if (p > endp)' here:
>
> +		if (p > buffer+buflen) {
> +			IP_VS_ERR_RL("bogus conn in sync message\n");
> +			return;
> +		}
>
No problem, a minor adj.

>  	- Note that pe_data is leaked when ip_vs_proc_conn() fails
>  	to create connection. May be PE info for non-templates
>  	should be ignored? And we need a way to know if
>  	ip_vs_proc_conn called ip_vs_conn_new at all and that
>  	it succeeded so that we can safely free pe_data.
>
>  	Simon should tell what happens if some PE updates
>  	ct->pe_data, may be we should replace it too for the
>  	case when ip_vs_proc_conn works with existing template?
>

I will have a look at Simons answer.

> v2 PATCH 4/4
>  	May be we should add configuration option if sync is enabled
>  	to default to version 0 because how we solve the problem if
>  	backup can not be upgraded?

That means that we need to have a "version 0 sending functions" as well.
I think that version 1 should be default, if you ran into problems activate ver 0.

>  	For IPVS_OPT_PE_NAME: because we have length better not to
>  	add zero terminator in sync message. It complicates the
>  	checks in backup. Or backup prefers to check with zero
>  	terminated string directly from message? In this case we
>  	should check for existing terminator.

My hart says, don't use terminating Zeroes when there is a length but:
"Since there is no space to add a trailing Zero in the buffer
 some changes has to be done. (I'm not going to make temp copy!)
 Length param needs to be added to ip_vs_pe_get() and ip_vs_pe_getbyname()
 which affects ip_vs_add_service() and  ip_vs_edit_service()"

Leave it as is or remove the trailing Zero thats the question ?

>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>


--
Regards
Hans Schillstrom <hans.schillstrom@ericsson.com>

  parent reply	other threads:[~2010-11-01 10:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29 12:15 [v2 PATCH 0/4] IPVS: Backup Adding Ipv6 and Persistence support Hans Schillstrom
2010-10-30 14:55 ` Julian Anastasov
2010-10-30 23:16   ` Simon Horman
2010-11-01 10:04     ` Hans Schillstrom
2010-11-01 15:30     ` Hans Schillstrom
2010-11-01 21:56       ` Julian Anastasov
2010-11-03 20:08     ` Hans Schillstrom
2010-11-06  0:56       ` Simon Horman
2010-11-06 10:02         ` Hans Schillstrom
2010-11-06 11:49           ` Simon Horman
2010-11-06 14:07         ` Julian Anastasov
2010-11-06 14:34           ` Simon Horman
2010-11-06 18:57             ` Julian Anastasov
2010-11-08  6:21               ` Simon Horman
2010-11-08  8:51                 ` Julian Anastasov
2010-11-08 11:16                   ` Simon Horman
2010-11-08 15:07                     ` Hans Schillstrom
2010-11-08 21:45                       ` Simon Horman
2010-11-08 20:59                     ` Julian Anastasov
2010-11-08 21:49                       ` Simon Horman
2010-11-08 23:01                         ` Julian Anastasov
2010-11-09  0:43                           ` Simon Horman
2010-11-08 15:15                 ` Hans Schillstrom
2010-11-08 22:00                   ` Simon Horman
2010-11-08 22:23                     ` Hans Schillstrom
2010-11-09  0:39                       ` Simon Horman
2010-11-08 23:19                     ` Julian Anastasov
2010-11-09  0:48                       ` Simon Horman
2010-11-01 10:03   ` Hans Schillstrom [this message]
2010-11-01 21:53     ` Julian Anastasov
2010-11-01 22:47       ` Hans Schillstrom
2010-11-02  0:17         ` Julian Anastasov
2010-11-02  6:13           ` Hans Schillstrom
2010-11-01 12:16   ` [v2 PATCH 0/4] IPVS: Backup Adding Ipv6 and Persistence support -> option_param skip ? Hans Schillstrom

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=201011011103.41004.hans.schillstrom@ericsson.com \
    --to=hans.schillstrom@ericsson.com \
    --cc=daniel.lezcano@free.fr \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=lvs-devel@vger.kernel.org \
    --cc=wensong@linux-vs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.