2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00
Commit Graph

15244 Commits

Author SHA1 Message Date
Matteo Croce
dbb5ecb4be ovs-lib: dont't purge corrupted DB
In ovs-lib there is a function named upgrade_db which tries to convert a
database after OVS {up,down}grades. This function uses ovsdb-tool to
check if the DB needs to be upgraded. If the upgrade fails,
it purges the DB and create an empty one.
ovsdb-tool returns "yes" or "no" to indicate if the DB needs upgrading,
but if the DB is corrupted it returns a list of errors.
Change a condition from "!= no" to "= yes" because in case of DB
corruption upgrade_db would purge the existing DB without writing
anything in the logs.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
2017-11-03 14:49:27 -07:00
antonio.fischetti@intel.com
ac81c218bf dpctl: Comment functions retrieving the datapath name.
Add a comment to functions retrieving the datapath name.

CC: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 14:46:17 -07:00
Guoshuai Li
03b85a584f ovn: Fix remote not receive GARP, when localnet Port has vlan tag.
When sending a localnet port with vlan, the GARP packet needs push_vlan.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 14:40:03 -07:00
Guoshuai Li
3f9d3836d6 dpif-netdev: Set MAX_RECIRC_DEPTH to 6.
In an ovn gateway node with DPDK, the RECIRC_DEPTH may be greater than 5.

Scenes:
VM ping self floating IP, or
VM ping Floating IP of VMs with the same network.

It need process UNDNAT SNAT in LRouter egress and
UNSNAT DNAT in LRouter ingress, and
output to geneve tunnel also need recirc.

This has an WARN:
dpif_netdev(pmd36)|WARN|Packet dropped. Max recirculation depth exceeded.

Signed-off-by: Guoshuai Li <ligs@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 14:29:39 -07:00
Bhanuprakash Bodireddy
a0a4f2a5d3 ovsdb: Remove break after OVS_NOT_REACHED.
The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:38:00 -07:00
Bhanuprakash Bodireddy
36ef6dfd04 ofp-actions: Remove return after OVS_NOT_REACHED.
The return statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:37:47 -07:00
Bhanuprakash Bodireddy
4a67ca44f1 ofproto: Remove break after OVS_NOT_REACHED.
The break statement would never be executed as OVS_NOT_REACHED()
internally invokes abort() and causes process termination.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:37:22 -07:00
Bhanuprakash Bodireddy
23d4d53f14 netdev-dpdk: Refactor netdev_dpdk structure.
This commit introduces below changes to netdev_dpdk structure.

- Mark cachelines and reorder few member variables.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes where ever appropriate, so
  new members can be introduced in the future to fill the gaps.

  Below is how this structure looks with this commit.

                  Member                    size

         OVS_CACHE_LINE_MARKER cacheline0;
             dpdk_port_t port_id;            1
             bool attached;                  1
             ...

         OVS_CACHE_LINE_MARKER cacheline1;
             struct ovs_mutex;              48
             struct dpdk_mp *dpdk_mp;        8
             ...

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:36:53 -07:00
Bhanuprakash Bodireddy
a807c15796 dpif_netdev: Refactor dp_netdev_pmd_thread structure.
This commit introduces below changes to dp_netdev_pmd_thread
structure.

- Mark cachelines and in this process reorder few members to avoid
  holes.
- Align emc_cache to a cacheline.
- Maintain the grouping of related member variables.
- Add comment on the information on pad bytes whereever appropriate so
  that new member variables may be introduced to fill the holes in future.

  Below is how the structure looks with this commit.

              Member                    size

     OVS_CACHE_LINE_MARKER cacheline0;
         struct dp_netdev * dp;          8
         struct cmap_node node;          8
         pthread_cond_t cond;           48

     OVS_CACHE_LINE_MARKER cacheline1;
         struct ovs_mutex cond_mutex;   48
         pthread_t  thread;              8
         unsigned int core_id;           4
         int        numa_id;             4

     OVS_CACHE_LINE_MARKER cacheline2;
         struct emc_cache flow_cache;   4849672

     ###cachelineX: 64 bytes, 0 pad bytes####
         struct cmap flow_table;         8
         ....

     ###cachelineY: 59 bytes, 5 pad bytes####
       struct dp_netdev_pmd_stats stats 40
         ....

     ###cachelineZ: 48 bytes, 16 pad bytes###
         struct ovs_mutex port_mutex;   48
         ....

This change also improve the performance marginally.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:36:14 -07:00
Bhanuprakash Bodireddy
82f197ca5a cmap: Use PADDED_MEMBERS_CACHELINE_MARKER in cmap_impl.
Instead of explicitly adding the pad bytes to force the structure an
exact multiple of cacheline size, let the macro do the job. This way
the pad bytes will be auto adjusted when the new members get introduced
in to the structure.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:35:51 -07:00
Bhanuprakash Bodireddy
6be7aa7d54 ccmap: Use PADDED_MEMBERS macro in ccmap_impl structure.
Instead of explicitly adding the pad bytes to force the structure an exact
multiple of cacheline size, let the PADDED_MEMBERS macro do the job.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:33:05 -07:00
Bhanuprakash Bodireddy
95e620b48c odp-execute: Use const qualifer for batch size.
It is recommended to use const qualifer for 'num' that tracks the
packet batch count. This way 'num' can't be modified by iterator.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:22:00 -07:00
Bhanuprakash Bodireddy
e0a00cee33 netdev-linux: Clean up netdev_linux_sock_batch_send().
Use DP_PACKET_BATCH_FOR_EACH macro and dp_packet_batch_size() API
in netdev_linux_sock_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:22:00 -07:00
Bhanuprakash Bodireddy
13708b2183 netdev-linux: Use DP_PACKET_BATCH_FOR_EACH in netdev_linux_tap_batch_send.
Use DP_PACKET_BATCH_FOR_EACH macro in netdev_linux_tap_batch_send().

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 13:20:22 -07:00
Bhanuprakash Bodireddy
ee42dd70dc dpif-netdev: Reorder elements in dp_netdev_rxq structure.
By reordering elements in dp_netdev_rxq structure, pad bytes and a hole
can be removed.

Before: structure size: 104, sum holes: 1, sum padbytes:4, cachelines:2
After : structure size:  96, sum holes: 0, sum padbytes:0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:56:22 -07:00
Bhanuprakash Bodireddy
85e16a45ea netdev-provider: Reorder elements in netdev structure.
By reordering elements in netdev structure, holes can be removed.

Before: structure size: 88, sum holes: 10, cachelines:2
After : structure size: 80, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:56:06 -07:00
Bhanuprakash Bodireddy
0d9bdf2e22 netdev-provider: Reorder element in netdev_flow_dump structure.
By reordering bool in netdev_flow_dump structure, pad bytes can be
reduced.

Before: structure size: 32, sum holes: 4, sum padbytes:7, cachelines:1
After : structure size: 24, sum holes: 3, sum padbytes:0, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:55:03 -07:00
Bhanuprakash Bodireddy
fea6740fe2 netdev: Reorder elements in netdev_tunnel_config structure.
By reordering elements in netdev_tunnel_config structure, sum holes and
pad bytes can be reduced.

Before: structure size: 96, sum holes: 17, pad bytes: 4, cachelines:2
After : structure size: 80, sum holes:  5, pad bytes: 0, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:54:28 -07:00
Bhanuprakash Bodireddy
7a385993a6 netdev-dummy: Reorder elements in dummy_packet_stream structure.
By reordering elements in dummy_packet_stream structure, sum holes
can be reduced, thus saving a cache line.

Before: structure size: 784, sum holes: 56, cachelines:13
After : structure size: 768, sum holes: 40, cachelines:12

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:52:09 -07:00
Bhanuprakash Bodireddy
69a723150f tun-metadata: Reorder elements in tun_meta_entry structure.
By reordering elements in tun_meta_entry structure, sum holes and pad
bytes can be reduced there by reducing the tun_table size.

Before: structure size: 56, sum holes: 4, pad bytes: 7  cachelines:1
After : structure size: 48, sum holes: 0, pad bytes: 3, cachelines:1

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:48:14 -07:00
Bhanuprakash Bodireddy
abec9228f1 bond: Reorder elements in bond_slave structure.
By reordering elements in bond_slave structure, holes can be removed and
saves a cache line.

Before: structure size: 136, sum holes: 10, cachelines:3
After : structure size: 128, sum holes:  2, cachelines:2

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:41:41 -07:00
Duan Jiong
afea2e89b9 ofproto-dpif: Put bundle_lookup ahead to simplify the code.
Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2017-11-03 12:24:49 -07:00
Ben Pfaff
a209f13da5 AUTHORS: Add Duan Jiong.
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:24:13 -07:00
Duan Jiong
31f4a577fc ofproto-dpif: Fix comment in struct ofbundle.
The ovs_list ports should contain struct ofport_dpif.

Signed-off-by: Duan Jiong <djduanjiong@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 12:19:36 -07:00
Timothy Redaelli
28c6fbc5c9 lib: Remove lib/pool-loop.h from lib_libopenvswitch_la_SOURCES
lib/pool-loop.h is moved to to include/openvswitch, but lib/pool-loop.h
is still used in lib_libopenvswitch_la_SOURCES.

This commit removes lib/pool-loop.h from lib_libopenvswitch_la_SOURCES.

CC: Xiao Liang <shaw.leon@gmail.com>
Fixes: fd016ae3fb ("lib: Move lib/poll-loop.h to include/openvswitch")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 11:30:01 -07:00
Xiao Liang
fd016ae3fb lib: Move lib/poll-loop.h to include/openvswitch
Poll-loop is the core to implement main loop. It should be available in
libopenvswitch.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 10:47:55 -07:00
Yi-Hung Wei
3efd46c8ea meta-flow: Fix format in documentation.
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 10:44:37 -07:00
Ben Pfaff
cd738eefbf ofp-util: Update OpenFlow 1.6 port support to track latest proposal.
The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type
fields from ofp_port and ofp_port_mod.  This commit updates the OVS
prototype to match the updated proposal.

ONF-JIRA: EXT-566
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
2017-11-03 10:35:42 -07:00
wei
25d6792997 ovn-northd.8: Fix wrong description
Signed-off-by: wei <liw@dtdream.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 10:34:29 -07:00
Numan Siddique
d601127b0c NEWS: Add recently added OVN IPv6 features
OVN now supports sending IPv6 RA packet in response to the RS packet
and resolves the unknown next hop MACs by generating a NS packet.

Mention this in the NEWS.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-03 10:32:49 -07:00
Ben Pfaff
45c2f69a30 Documentation: Add the Open vSwitch project charter.
It always seems odd that this isn't in the repo, so this adds it, with
internal links properly directed.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
2017-11-02 15:03:56 -07:00
Joe Stringer
a1d6cce780 ofproto-dpif-upcall: Transition ukey on dp_ops error.
In most situations, we don't expect that a flow we've successfully
dumped, which we intend to delete, cannot be deleted. However, to make
this code more resilient to ensure that ukeys *will* transition in all
cases (including an error at this stage), grab the lock and transition
this ukey forward to the evicted state, effectively treating a failure
to delete as "this flow is already gone".

If we subsequently find out that it wasn't deleted, then that's ok - we
will re-dump, and validate at that stage, which should lead to creating
a new ukey or deleting the datapath flow when that happens.

Signed-off-by: Joe Stringer <joe@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
2017-11-02 15:01:26 -07:00
William Tu
c848e1cdb8 dpif-netlink-rtnl: Fix ovs_geneve probing after restart.
When using the out-of-tree (openvswitch compat) geneve module,
the first time oot tunnel probing returns true (correct).
Without unloading the geneve module, if the userspace ovs-vswitchd
restarts, because the 'geneve_sys_6081' still exists, the probing
incorrectly returns false and loads the in-tree (upstream kernel)
geneve module.

The patch fixes it by querying the geneve device's kind when exists.
The out-of-tree modules uses kind string as 'ovs_geneve', while the
in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> /etc/init.d/openvswitch-switch start
> creat a bridge and attach a geneve port using out-of-tree geneve
> /etc/init.d/openvswitch-switch restart

Fixes: 921c370a9d ("dpif-netlink: Probe for out-of-tree tunnels, decides used interface")
Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Eric Garver <e@erig.me>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
2017-11-02 04:10:12 -07:00
Yifeng Sun
ed9d4380e9 ovsdb-server: Fix memory leak
Valgrind testcase 2349 (ovn -- DSCP marking check) reports the leak below:
21 bytes in 21 blocks are definitely lost in loss record 24 of 362
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x436FD4: xmalloc (util.c:120)
    by 0x437044: xmemdup0 (util.c:150)
    by 0x408C97: add_manager_options (ovsdb-server.c:709)
    by 0x408C97: query_db_remotes (ovsdb-server.c:765)
    by 0x408C97: reconfigure_remotes (ovsdb-server.c:926)
    by 0x406273: main_loop (ovsdb-server.c:194)
    by 0x406273: main (ovsdb-server.c:434)

When options are freed, options->role need to be freed explicitly.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 14:20:58 -07:00
Yifeng Sun
ee816a9ccf test-ovsdb: Fix memory leak
Valgrind testcase 1465 (integer atom enum from string) reports the leak below:
16 bytes in 1 blocks are definitely lost in loss record 2 of 5
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x43F5F4: xmalloc (util.c:120)
    by 0x424AC6: alloc_default_atoms (ovsdb-data.c:315)
    by 0x4271E0: ovsdb_atom_from_string__ (ovsdb-data.c:508)
    by 0x4271E0: ovsdb_atom_from_string (ovsdb-data.c:632)
    by 0x40ADCC: do_parse_atom_strings (test-ovsdb.c:566)
    by 0x41BA73: ovs_cmdl_run_command__ (command-line.c:115)
    by 0x4051C9: main (test-ovsdb.c:72)

range_end_atom is allocated in ovsdb_atom_from_string__() and no one is
holding a reference to it at the end of do_parse_atom_strings(). It should
be freed here, as also pointed out by ovsdb_atom_destroy().

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 14:20:55 -07:00
Yifeng Sun
17b85cd9b3 ovsdb-idl: Fix memory leak
Valgrind testcase 2339 (ovn -- ipam connectivity) reports the leak below:
45 (32 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 83
    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4A6D64: xmalloc (util.c:120)
    by 0x49C847: shash_add_nocopy__ (shash.c:109)
    by 0x49C847: shash_add_nocopy (shash.c:121)
    by 0x49CA85: shash_add (shash.c:129)
    by 0x49CA85: shash_add_once (shash.c:136)
    by 0x4914B5: ovsdb_idl_create_index (ovsdb-idl.c:2067)
    by 0x406C98: create_ovnsb_indexes (ovn-controller.c:568)
    by 0x406C98: main (ovn-controller.c:619)

The leak happens when vsdb_idl_table is freed but its indexes are not freed.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 14:17:20 -07:00
Yifeng Sun
dac0fb811e netdev-dummy: Avoid double-free in netdev_dummy_ip4addr().
netdev_dummy_ip6addr() calls netdev_close() twice though it increases
netdev's reference only once from netdev_from_name(). As a result, Valgrind
test 788 (tunnel_push_pop - action) reports the error below:

==20465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 Invalid read of size 8
    at 0x493FE0: netdev_get_name (netdev.c:911)
    by 0x5125D3: tnl_port_map_delete_ipdev (tnl-ports.c:470)
    by 0x4E551C: __rt_entry_delete (ovs-router.c:252)
    by 0x4E64AA: ovs_router_flush (ovs-router.c:478)
    by 0x475CA8: call_hooks.part.2 (fatal-signal.c:254)
    by 0x5E53FF7: __run_exit_handlers (exit.c:82)
    by 0x5E54044: exit (exit.c:104)
    by 0x5E3A836: (below main) (libc-start.c:325)
  Address 0x65ea680 is 0 bytes inside a block of size 640 free'd
    at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x492BA2: netdev_unref (netdev.c:572)
    by 0x41646E: ofport_destroy__ (ofproto.c:2516)
    by 0x41FD58: ofproto_destroy (ofproto.c:1645)
    by 0x40B96B: bridge_destroy (bridge.c:3273)
    by 0x410238: bridge_exit (bridge.c:506)
    by 0x40700E: main (ovs-vswitchd.c:135)
  Block was alloc'd at
    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x516A82: xcalloc (util.c:103)
    by 0x48D74D: netdev_dummy_alloc (netdev-dummy.c:661)
    by 0x4931D1: netdev_open.part.12 (netdev.c:406)
    by 0x40A985: iface_do_create (bridge.c:1784)
    by 0x40A985: iface_create (bridge.c:1837)
    by 0x40A985: bridge_add_ports__ (bridge.c:931)
    by 0x40C7EA: bridge_add_ports (bridge.c:947)
    by 0x40C7EA: bridge_reconfigure (bridge.c:663)
    by 0x410485: bridge_run (bridge.c:2998)
    by 0x406F64: main (ovs-vswitchd.c:119)

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 13:55:51 -07:00
Numan Siddique
b1a3a6a405 ovn: Generate Neighbor Solicitation packet for unknown MAC IPv6 packets
In the router ingress pipeline, if the destination mac is unresolved
by the time the packet reaches the ARP_REQUEST stage, OVN should generate an
IPv6 Neighbor Solicitation packet to learn the MAC address. This feature is
presently missing. This patch adds this feature.  A new action "nd_ns" is
added  which replaces an IPv6 packet being processed with an IPv6 Neighbor
Solicitation packet. ovn-northd adds a flow in the ARP_REQUEST router ingress
pipeline stage if the eth.dst is zero which applies this action. This action is
similar to the IPv4 counterpart "arp" action.

OVN already has the support to learn the MAC from the IPv6 Neighbor Advertisement
packets and storing in the south bound MAC_Binding table.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 13:39:14 -07:00
Zongkai LI
4364646c6e ovn-northd: Add logical flows to support native IPv6 RA
This patch adds logical flows which sends IPv6 Router Advertisement
packet in response to the IPv6 Router Solicitation request. It uses
the actions "put_nd_ra_opts" to transform the RS packet to RA packet
in the newly added ingress stage "lr_in_nd_ra_options" in router
pipeline. If the action "put_nd_ra_opts" is successful, it sends the
RA packet back to the originating port in the next ingress stage
"lr_in_nd_ra_response".

A new column "ipv6_ra_configs" is added in the Logical_Router_Port
table, which the CMS is expected to configure IPv6 RA
configurations - "address_mode" and "mtu" for adding these flows.

Co-authored-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 13:39:14 -07:00
Numan Siddique
52ed5fcc5d ovn-controller: Add a new action - 'put_nd_ra_opts'
This patch adds a new OVN action 'put_nd_ra_opts' to support native
IPv6 Router Advertisement in OVN. This action can be used to respond
to the IPv6 Router Solicitation requests.

ovn-controller parses this action and adds a NXT_PACKET_IN2 OF flow
with 'pause' flag set and the RA options stored in 'userdata' field.
This action is similar to 'put_dhcp_opts' and 'put_dhcpv6_opts'.

When a valid IPv6 RS packet is received by the pinctrl module of
ovn-controller, it frames a new RA packet and sets the RA options
from the 'userdata' field and resumes the packet storing 1 in the
1-bit result sub-field. If the packet is invalid, it resumes the
packet without any modifications storing 0 in the 1-bit result
sub-field.

Eg. reg0[5] = put_nd_ra_opts(address_mode = "slaac", mtu = 1450,
                             slla = 01:02:03:04:05:06, prefix = aef0::/64)

Note that unlike DHCPv4/v6, a new table to store the supported IPv6 ND RA
options is not added in SB DB since there are only 3 ND RA options.

Co-authored-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Zongkai LI <zealokii@gmail.com>
Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 13:39:14 -07:00
Numan Siddique
16936e4d6e ovn util: Refactor dhcp_opts_map to make it generic
Renamed 'struct dhcp_opts_map' to 'struct gen_opts_map' and
renamed ovn-dhcp.h to ovn-l7.h. An upcoming commit to support IPv6
Router Advertisement, will make use of the refactored code to store
the IPv6 ND RA options in 'struct gen_opts_map'.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:42:33 -07:00
Kaige Fu
214117fdbd netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.
When max-rate is less than 8bit, the hc->max_rate will be set
as htb->max_rate mistakenly instead of mtu of netdev.

Fixes: 13c1637 ("smap: New function smap_get_ullong().")
Signed-off-by: Kaige Fu <fukaige@huawei.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:32:21 -07:00
Yi-Hung Wei
274cd1f188 packets: Fix C++ compilation issues when include packets.h
This patch fixes three C++ compilation errors when it includes
"lib/packets.h".

1) Fix in "include/openvswitch/util.h" is to avoid duplicated
named_member__ in struct pkt_metadata.

2) Fix in "lib/packets.h" is because designated initializers are not
implemented in GNU C++ [1].

3) Fix in "lib/util.h" is because __builtin_types_compatible_p and
__builtin_choose_expr are only supported in GCC. I use one solution
for C++ that is type-safe and works at compile time from [2].

[1]: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
[2]: https://goo.gl/xNe48A

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:23:38 -07:00
Yi-Hung Wei
36e6714054 ofproto/trace: Fix memory leak in oftrace_push_ct_state()
Free the allocated memory in the pop function.

Fixes: 0f2f05bbcf ("ofproto/trace: Add --ct-next option to ofproto/trace")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:21:41 -07:00
Ben Pfaff
d2cb0218d0 ofproto-dpif-upcall: Fix null pointer dereference on exit.
When revalidation occurs at the same time that a bridge is being removed
or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
the ofproto.  This caused a null pointer dereference if revalidation lost
the race.  This commit fixes the problem.

Reported-by: Jakub Sitnicki <jkbs@redhat.com>
Tested-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:13:24 -07:00
Mark Michelson
c19105a093 ovn: Add IPv6 capability to ovn-nbctl lb-add
ovn-nbctl will now accept IPv6 addresses for load balancer VIPs and
desetination addresses.

In addition, the ovn-nbctl lb-list, lr-lb-list, and ls-lb-list have been
modified to be able to fit IPv6 addresses on screen.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 11:10:08 -07:00
Mark Michelson
485d373bf6 ovn: Allow northd to install IPv6 ct_lb logical flows.
For this commit, ovn-northd will now accept both IPv4 and IPv6 addresses
in the northbound database for a load balancer VIP or destination
addresses. For IPv4, the behavior remains the same. For IPv6, the
following logical flows will be added to the southbound database:

* An ND_NA response for incoming ND_NS requests for the load balancer
  VIP.
* A ct_lb flow with the configured IPv6 addresses.

The ovn-northd manpage has been updated to indicate what flows are
added for load balancers with IPv6 VIPs.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 10:52:26 -07:00
Mark Michelson
9d236afafb ovn: Allow ct_lb actions to take IPv6 address arguments.
The ct_lb action previously assumed that any address arguments were
IPv4. This patch expands the parsing, formatting, and encoding of ct_lb
to be amenable to IPv6 addresses as well.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 10:49:54 -07:00
Mark Michelson
e463f310b1 Add general-purpose IP/port parsing function.
OVS has functions for parsing IPv4 addresses, parsing IPv4 addresses
with a port, and parsing IPv6 addresses. What is lacking though is a
function that can take an IPv4 or IPv6 address, with or without a port.

This commit adds ipv46_parse(), which breaks the given input string into
its component parts and stores them in a sockaddr_storage structure. The
function accepts flags that determine how it should behave if a port is
present in the input string.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-02 10:48:56 -07:00
Mark Michelson
7b997d4f3d OVN: Don't let peers be set to "<error>" on port bindings.
There are a couple of places in ovn-northd that set the "peer" option on
certain ports to "<error>" in certain cases. In every case where a peer is
looked up on a port binding, the code performs a NULL check in order to
ensure a peer exists. None check for the "<error>" string. They assume that the
presence of a peer string means a peer is defined and all is well.

In the past (OVS 2.6 series), this sometimes led to patch ports being created
in ovs that had names like "patch-ro-to-<error>". This particular problem
resolved itself in OVS 2.7 since such patch ports were no longer automatically
created. However, by naming the peer "<error>" the seeds are still sown for
similar issues to occur.

The solution this patch suggests is to no longer set the "peer" option
on a port binding to "<error>". Instead, if no peer can be set, then we
set no peer. Since other code is already equipped to deal with this,
this poses no problem.

Signed-off-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2017-11-01 14:39:22 -07:00