2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 05:47:55 +00:00

19 Commits

Author SHA1 Message Date
Ben Pfaff
e4426e3457 ovn-controller: Introduce helpers for looking up datapaths.
The new helpers get_local_datapath() and get_patched_datapath() make code
a little shorter and easier to read.  They also avoid a pitfall that was
present in at least a few of the instances: CONTAINER_OF is not safe on a
null pointer, because it does a raw pointer subtraction and will change
NULL to something else.  This wasn't actually a problem in these particular
cases because the value it was subtracting was zero (although arguably it
is still undefined behavior because the compiler is allowed to assume that
a pointer on which arithmetic is performed is nonnull).

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
2016-04-12 10:33:32 -07:00
Ben Pfaff
0c0afad722 binding: Track local datapaths even when no transaction is possible.
Plenty of other code depends on the set of local datapaths.  Most notably,
the lflow code will drop logical flows when their logical datapaths aren't
present locally.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
2016-03-07 14:56:58 -08:00
Han Zhou
6e6c3f9188 ovn: Connect to remote lports through localnet port.
Before this patch, inter-chassis communication between VIFs of same
lswitch will always go through tunnel, which end up of modeling a
single physical network with many lswitches and pairs of lports, and
complexity in CMS like OpenStack neutron to manage the lswitches and
lports.

With this patch, inter-chassis communication can go through physical
networks via localnet port with a 1:1 mapping between lswitches and
physical networks. The pipeline becomes:

Ingress -> Egress (local) -> Ingress (remote) -> Egress

The original tunneling mechanism will still be used if there is no
localnet port configured on the lswitch.

Signed-off-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Russell Bryant <russell@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-02-26 16:25:03 -08:00
Ben Pfaff
aef5f4316d ovn: Support ingress policing settings for VIFs.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Co-authored-by: Babu Shanmugam <bschanmu@redhat.com>
Signed-off-by: Babu Shanmugam <bschanmu@redhat.com>
2016-02-10 11:09:25 -08:00
Russell Bryant
5a4bee8a02 ovn-controller: Allocate ct zones for localnet ports.
Previously, all ct() actions applied to localnet ports used the default
conntrack zone.  We should allocate a ct zone ID for all localnet ports
just like we do for all local VIFs so that none of our connection
tracking interferes with any base system connection tracking in the
default zone.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-02-03 09:25:56 -05:00
Russell Bryant
bda5a056ba ovn-controller: Move local_datapaths calculation.
Before this patch, physical.c build up the set of local datapaths for
its own use.  I'd like to use it in another module in a later patch, so
pull it out of physical.  It's now populated by the bindings module,
since that seems like a more appropriate place to do it, and it's also
done much earlier in the main loop, making it easier to re-use.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Han Zhou <zhouhan@gmail.com>
Acked-by: Ben Pfaff <blp@ovn.org>
2016-02-03 09:22:30 -05:00
Justin Pettit
7eccc74104 ovn-controller: Add clarifying comment about main loop in binding_run().
Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
2015-12-11 09:41:50 -08:00
Russell Bryant
f057f2f1b4 ovn: Fix ACLs for child logical ports.
The physical input flows for child logical ports (for the
container-in-a-VM use case, for example) did not set a conntrack zone
ID.  The previous code only allocated a zone ID for local VIFs and
missed doing it for child ports.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
2015-12-11 11:58:00 -05:00
Justin Pettit
78aab811be ovn: Add stateful ACL support.
Add support for the "allow-related" ACL action.  This is dependent on
the OVS conntrack functionality, which is not available on all platforms
or kernel versions.

Here is a sample policy that will allow all tenants in logical switch
"ls0" to SSH to each other.  Anyone can make an HTTP request to "lp0".
All other IP traffic is dropped:

  ovn-nbctl acl-add ls0 from-lport 100 ip allow-related
  ovn-nbctl acl-add ls0 to-lport 100 tcp.dst==22 allow-related
  ovn-nbctl acl-add ls0 to-lport 100 "outport == \"lp0\" \
            && tcp.dst==80" allow-related
  ovn-nbctl acl-add ls0 to-lport 1 ip drop

Note: Kernel conntrack support is checked into the mainline Linux
kernel, but hasn't been backported to the main OVS repo yet.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-10-16 00:23:45 -07:00
Ben Pfaff
2ddf7558f2 ovn-controller: Un-inline get_chassis_by_name().
I don't know of any reason to inline this.

Also rename for consistency with get_bridge().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-10-15 21:27:46 -07:00
Ben Pfaff
dcda6e0d6c ovn: Rename Binding table to Port_Binding.
An upcoming patch will add a Datapath_Binding table, so clarifying the
name seems useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-08-03 10:17:55 -07:00
Ben Pfaff
4a5a9e0640 ovn-controller: Rename init functions that just register IDL columns.
The generic *_init() names for these functions made it sounds like they
do something more than just register IDL columns, even though that's all
they do.  Also, the controller_ctx that was passed into each of them was
only used to get the IDL handle.  This commit renames them and changes
their parameter type to simplify and make all of this clearer.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-07-30 10:11:53 -07:00
Ben Pfaff
30a4256fd0 ovn-controller: Tolerate missing 'chassis_id'.
Until now, if the chassis id was missing, ovn-controller exited.  This
commit makes ovn-controller wait for it to return.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-07-30 10:11:53 -07:00
Ben Pfaff
37c7a69437 ovn-controller: Tolerate missing integration bridge.
Until now, if the integration bridge was missing, ovn-controller exited.
This commit makes it wait until the integration bridge is created.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-07-30 10:11:53 -07:00
Ben Pfaff
4acc496ecd ovn-controller: Pass 'chassis_id' explicitly to functions that need it.
I found it otherwise difficult to see what code depended on this.  When
later commits make it possible for ovn-controller to handle changes in
chassis ID, this will become important (the code should determine the
current chassis ID before trying to use it).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-07-30 10:11:45 -07:00
Ben Pfaff
422a9f73d3 ovn-controller: Pass 'br_int' explicitly to functions that need it.
I found it hard otherwise to see what code depended on this.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
2015-07-28 11:06:51 -07:00
Ben Pfaff
f1fd765733 ovn-controller: Avoid blocking to commit OVSDB transactions.
Until now, ovn-controller has been full of loops that commit a transaction
to the OVS or OVN Southbound database.  These blocking loops delay other
work within ovn-controller.  They also make it unsafe to keep pointers to
database records within a single ovn-controller main loop, since calls
to ovsdb_idl_run() can cause IDL records to be destroyed.  This commit
drops all of the blocking calls, instead doing a single commit to the
databases at the end of each main loop.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Russell Bryant <rbryant@redhat.com>
2015-07-28 11:06:47 -07:00
Alex Wang
713322317c ovn: Change type of 'chassis' column in 'Binding' table.
This commit changes the type of 'chassis' column in 'Binding' table
from string to weak reference of 'Chassis' table entry.  This will
make accessing the chassis from binding more efficient.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2015-05-22 13:39:47 -07:00
Ben Pfaff
e387e3e885 ovn: Adopt consistent naming, by renaming "Bindings" to "Binding".
The convention in OVSDB is to use singular names for database tables,
but Bindings was plural.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
2015-05-07 16:29:46 -07:00