[ovs-dev] [PATCH] Fix bug in parsing large datapath IDs.

Ben Pfaff blp at nicira.com
Thu Oct 21 17:41:12 UTC 2010


Sure, good idea.  I made that change and pushed this out.

On Thu, Oct 21, 2010 at 10:30:40AM -0700, Justin Pettit wrote:
> Looks good.  It may be worth noting that the datapath ID can't be 0 in
> a comment describing dpid_from_string().
> 
> --Justin
> 
> 
> On Oct 21, 2010, at 10:21 AM, Ben Pfaff wrote:
> 
> > Datapath IDs are unsigned, but dpid_from_string() was parsing them as
> > signed integers, which caused high values to be capped at INT64_MAX.
> > 
> > Also, document that datapath IDs may not be all-zero.
> > 
> > Reported-by: Pankaj Thakkar <thakkar at nicira.com>
> > Reported-by: Teemu Koponen <koponen at nicira.com>
> > ---
> > AUTHORS                      |    1 +
> > lib/packets.c                |    4 ++--
> > utilities/ovs-openflowd.8.in |    3 ++-
> > vswitchd/vswitch.xml         |    2 +-
> > 4 files changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/AUTHORS b/AUTHORS
> > index 9adaa6d..6a81668 100644
> > --- a/AUTHORS
> > +++ b/AUTHORS
> > @@ -49,6 +49,7 @@ Joan Cirer              joan at ev0.net
> > John Galgay             john at galgay.net
> > Luiz Henrique Ozaki     luiz.ozaki at gmail.com
> > Michael Mao             mmao at nicira.com
> > +Pankaj Thakkar          thakkar at nicira.com
> > Paulo Cravero           pcravero at as2594.net
> > Peter Balland           peter at nicira.com
> > Ram Jothikumar          rjothikumar at nicira.com
> > diff --git a/lib/packets.c b/lib/packets.c
> > index 5c51feb..6d44012 100644
> > --- a/lib/packets.c
> > +++ b/lib/packets.c
> > @@ -1,5 +1,5 @@
> > /*
> > - * Copyright (c) 2009 Nicira Networks.
> > + * Copyright (c) 2009, 2010 Nicira Networks.
> >  *
> >  * Licensed under the Apache License, Version 2.0 (the "License");
> >  * you may not use this file except in compliance with the License.
> > @@ -24,7 +24,7 @@ bool
> > dpid_from_string(const char *s, uint64_t *dpidp)
> > {
> >     *dpidp = (strlen(s) == 16 && strspn(s, "0123456789abcdefABCDEF") == 16
> > -              ? strtoll(s, NULL, 16)
> > +              ? strtoull(s, NULL, 16)
> >               : 0);
> >     return *dpidp != 0;
> > }
> > diff --git a/utilities/ovs-openflowd.8.in b/utilities/ovs-openflowd.8.in
> > index 30b3705..176459c 100644
> > --- a/utilities/ovs-openflowd.8.in
> > +++ b/utilities/ovs-openflowd.8.in
> > @@ -173,7 +173,8 @@ the local port network device, and start the DHCP client afterward.
> > .SS "OpenFlow Options"
> > .TP
> > \fB\-\-datapath\-id=\fIdpid\fR
> > -Sets \fIdpid\fR, which must consist of exactly 16 hexadecimal digits,
> > +Sets \fIdpid\fR, which must consist of exactly 16 hexadecimal digits
> > +and may not be all-zero,
> > as the datapath ID that the switch will use to identify itself to
> > OpenFlow controllers.
> > .IP
> > diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
> > index 74ac277..c9a6e57 100644
> > --- a/vswitchd/vswitch.xml
> > +++ b/vswitchd/vswitch.xml
> > @@ -329,7 +329,7 @@
> >           <dt><code>datapath-id</code></dt>
> >           <dd>Exactly 16 hex
> >             digits to set the OpenFlow datapath ID to a specific
> > -            value.</dd>
> > +            value.  May not be all-zero.</dd>
> >           <dt><code>disable-in-band</code></dt>
> >           <dd>If set to <code>true</code>, disable in-band control on 
> >             the bridge regardless of controller and manager settings.</dd>
> > -- 
> > 1.7.1
> > 
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
> 




More information about the dev mailing list