2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00
Commit Graph

11 Commits

Author SHA1 Message Date
Mike Pattrick
6b09799f03 ofp-prop: Fix unaligned 128 bit access.
When compiling with '-fsanitize=address,undefined', the "ovs-ofctl
ct-flush" test will yield the following undefined behavior flagged by
UBSan. This problem is caused by the fact that 128bit property put/parse
functions weren't adding appropriate padding before writing or reading
the value.

This patch uses get_32aligned_* functions to copy the bytes as they are
aligned.

 lib/ofp-prop.c:277:14: runtime error: load of misaligned address
 0x60600000687c for type 'union ovs_be128', which requires 8 byte
 alignment
 0x60600000687c: note: pointer points here
  00 05 00 14 00 00 00 00  00 00 00 00 00 00 00 00  00 ff ab 00
              ^
    0: in ofpprop_parse_u128 lib/ofp-prop.c:277
    1: in ofp_ct_match_decode lib/ofp-ct.c:525
    2: in ofp_print_nxt_ct_flush lib/ofp-print.c:959
    3: in ofp_to_string__ lib/ofp-print.c:1206
    4: in ofp_to_string lib/ofp-print.c:1264
    5: in ofp_print lib/ofp-print.c:1308
    6: in ofctl_ofp_print utilities/ovs-ofctl.c:4899
    7: in ovs_cmdl_run_command__ lib/command-line.c:247
    8: in ovs_cmdl_run_command lib/command-line.c:278
    9: in main utilities/ovs-ofctl.c:186

Fixes: 62c5d32ad4 ("ofp-prop: Add helper for parsing and storing of ovs_u128.")
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-06-21 18:24:44 +02:00
Ales Musil
62c5d32ad4 ofp-prop: Add helper for parsing and storing of ovs_u128.
Add helper methods that allow us to store and parse the
ovs_u128 type.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-14 22:58:37 +01:00
Ben Warren
66bd43fa50 Move lib/ofp-prop.h to include/openvswitch directory
Signed-off-by: Ben Warren <ben@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-04-14 16:38:31 -07:00
Ben Warren
64c967795b Move lib/ofpbuf.h to include/openvswitch directory
Signed-off-by: Ben Warren <ben@skyportsystems.com>
Acked-by: Ryan Moats <rmoats@us.ibm.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-03-30 13:10:18 -07:00
Ben Warren
e03c096dd0 Move lib/ofp-errors.h to include/openvswitch directory
Signed-off-by: Ben Warren <ben@skyportsystems.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-03-19 09:43:12 -07:00
Ben Pfaff
5d10476a12 ofp-prop: Add support for putting and parsing nested properties.
It hadn't occurred to me before that any special support was actually
necessary or useful for nested properties, but the functions introduced in
this commit are nice wrappers to deal with the extra 4-byte padding that
ensures that the nested properties begin on 8-byte boundaries just like
the outer properties.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-02-19 16:15:45 -08:00
Ben Pfaff
303721ee82 ofp-prop: New function ofpprop_put_zeros().
This will have additional users in later commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-01-20 09:20:08 -08:00
Ben Pfaff
f01c94c598 ofp-prop: Add helpers for u8, be64/u64, flag, and UUID properties.
These will have users in upcoming commits.  Unlike the previously
added helpers, there isn't any existing code that can immediately
use them.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-01-20 09:17:43 -08:00
Ben Pfaff
b611d3acad ofp-prop: Add generic functions for working with 16- and 32-bit properties.
These will see increasing use in upcoming commits.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-01-20 09:06:29 -08:00
Ben Pfaff
34a543e322 ofp-prop: Add support for experimenter properties.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
2016-01-20 09:01:12 -08:00
Ben Pfaff
c5562271fd ofp-prop: New module for working with OpenFlow 1.3+ properties.
Several OpenFlow 1.3+ messages use TLV-based properties that take a
common form.  Until now, ofp-util has had some static functions for
dealing with properties.  Because properties will start to be needed
outside of ofp-util, this commit breaks them out into a new library,
renaming them to begin with ofpprop_.

The following commit will add a few new interfaces that add new
functionality.

Signed-off-by: Ben Pfaff <blp@ovn.org>
2016-01-20 08:27:21 -08:00