On Tue, Aug 06, 2013 at 10:14:10AM +0900, YAMAMOTO Takashi wrote:
> > On Mon, 5 Aug 2013 07:29:51 +0900 (JST)
> > [email protected] (YAMAMOTO Takashi) wrote:
> >
> >>> On Fri, 2 Aug 2013 16:36:29 +0900
> >>> YAMAMOTO Takashi <[email protected]> wrote:
> >>>
> >>>>
> >>>> Signed-off-by: YAMAMOTO Takashi <[email protected]>
> >>>> ---
> >>>> ryu/lib/packet/vrrp.py | 2 +-
> >>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/ryu/lib/packet/vrrp.py b/ryu/lib/packet/vrrp.py
> >>>> index 772d913..747d0c4 100644
> >>>> --- a/ryu/lib/packet/vrrp.py
> >>>> +++ b/ryu/lib/packet/vrrp.py
> >>>> @@ -215,7 +215,7 @@ class vrrp(packet_base.PacketBase):
> >>>>
> >>>> try:
> >>>> may_ip, may_vrrp = protocols[-2], protocols[-1]
> >>>> - if isinstance(may_vrrp, bytearray):
> >>>> + if isinstance(may_vrrp, bytearray): # padding?
> >>>> may_ip, may_vrrp = protocols[-3], protocols[-2]
> >>>> except IndexError:
> >>>> return None, None
> >>>
> >>> What the purpose is this function? Just getting ipv4(or v6) header and
> >>> vrrp content? Then why we can't do simply in the following way instead
> >>> of searching in the 'try and error' manner?
> >>
> >> it looks like a matter of preference to me.
> >> the current code ensures the order of headers, though.
> >
> > If we need to do so, I prefer something like the following.
>
> either is fine for me. yamahata-san?
Either way is fine by me. It's matter of detailed coding.
Some nit pick below.
>
> YAMAMOTO Takashi
>
> >
> >
> > diff --git a/ryu/lib/packet/vrrp.py b/ryu/lib/packet/vrrp.py
> > index 772d913..ab544e7 100644
> > --- a/ryu/lib/packet/vrrp.py
> > +++ b/ryu/lib/packet/vrrp.py
> > @@ -211,21 +211,25 @@ class vrrp(packet_base.PacketBase):
> >
> > @staticmethod
> > def get_payload(packet_):
> > - protocols = packet_.protocols
> > -
> > - try:
> > - may_ip, may_vrrp = protocols[-2], protocols[-1]
> > - if isinstance(may_vrrp, bytearray):
> > - may_ip, may_vrrp = protocols[-3], protocols[-2]
> > - except IndexError:
> > - return None, None
> > -
> > - if (not isinstance(may_ip, ipv4.ipv4) and
> > - not isinstance(may_ip, ipv6.ipv6)):
> > - return None, None
> > - if not isinstance(may_vrrp, vrrp):
> > + may_ip = None
> > + may_vrrp = None
> > +
> > + idx = 0
> > + for protocol in packet_:
for idx, protocol in enumerate(packet_):
> > + if isinstance(protocol, ipv4.ipv4) or isinstance(protocol,
> > + ipv6.ipv6):
> > + may_ip = protocol
> > + try:
> > + if isinstance(packet_.protocols[idx + 1], vrrp):
> > + may_vrrp = packet_.protocols[idx + 1]
IndexError should be caught? Does finally do it?
> > + finally:
> > + break
> > + idx += 1
> > +
> > + if may_ip and may_vrrp:
> > + return may_ip, may_vrrp
> > + else:
> > return None, None
> > - return may_ip, may_vrrp
> >
> > @classmethod
> > def register_vrrp_version(cls, version,
> >
> > ------------------------------------------------------------------------------
> > Get your SQL database under version control now!
> > Version control is standard for application code, but databases havent
> > caught up. So what steps can you take to put your SQL databases under
> > version control? Why should you start doing it? Read more to find out.
> > http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Ryu-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
> ------------------------------------------------------------------------------
> Get your SQL database under version control now!
> Version control is standard for application code, but databases havent
> caught up. So what steps can you take to put your SQL databases under
> version control? Why should you start doing it? Read more to find out.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
--
yamahata
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel