diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2022-06-24 16:48:06 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-06-27 12:55:08 +0200 |
commit | a2c937f66f8a450edf605123850d5567f72579f4 (patch) | |
tree | 2f42f04257d21de2d41c87b12f741b4e11801328 | |
parent | e4f75b330fe99e3680c65223d0223a389babddc1 (diff) | |
download | openvswitch-a2c937f66f8a450edf605123850d5567f72579f4.tar.gz |
conntrack: Fix incorrect bit shift while hashing nat range.
'max_port' is 16bit field, shift expands it to 'int', not unsigned int.
lib/conntrack.c:2245:41: runtime error:
left shift of 34568 by 16 places cannot be represented in type 'int'.
0 0xec45f4 in nat_range_hash lib/conntrack.c:2245:41
1 0xec45f4 in nat_get_unique_tuple lib/conntrack.c:2422:21
2 0xec45f4 in conn_not_found lib/conntrack.c:1035:32
3 0xeaf0a5 in process_one lib/conntrack.c:1407:20
4 0xea9390 in conntrack_execute lib/conntrack.c:1465:13
5 0x839530 in dp_execute_cb lib/dpif-netdev.c:9060:9
6 0x9909cc in odp_execute_actions lib/odp-execute.c:868:17
7 0x830946 in dp_netdev_execute_actions lib/dpif-netdev.c:9106:5
8 0x830946 in handle_packet_upcall lib/dpif-netdev.c:8294:5
9 0x82ea5e in fast_path_processing lib/dpif-netdev.c:8390:25
10 0x7ed87f in dp_netdev_input__ lib/dpif-netdev.c:8479:9
11 0x7eb5fc in dp_netdev_input lib/dpif-netdev.c:8517:5
12 0x81dada in dp_netdev_process_rxq_port lib/dpif-netdev.c:5329:19
13 0x7f0063 in dpif_netdev_run lib/dpif-netdev.c:6664:25
14 0x85f036 in dpif_run lib/dpif.c:467:16
15 0x61833a in type_run ofproto/ofproto-dpif.c:366:9
16 0x5c210e in ofproto_type_run ofproto/ofproto.c:1822:31
17 0x565db2 in bridge_run__ vswitchd/bridge.c:3245:9
18 0x562f82 in bridge_run vswitchd/bridge.c:3310:5
19 0x59a98c in main vswitchd/ovs-vswitchd.c:129:9
20 0x7f8864c3acf2 in __libc_start_main (/lib64/libc.so.6+0x3acf2)
21 0x47e60d in _start (vswitchd/ovs-vswitchd+0x47e60d)
Fixes: 92edd073ce6c ("conntrack: Hash entire NAT data structure in nat_range_hash().")
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/conntrack.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/conntrack.c b/lib/conntrack.c index 99ea29d94..78885c763 100644 --- a/lib/conntrack.c +++ b/lib/conntrack.c @@ -2205,7 +2205,7 @@ nat_range_hash(const struct conn *conn, uint32_t basis) hash = ct_addr_hash_add(hash, &conn->nat_info->min_addr); hash = ct_addr_hash_add(hash, &conn->nat_info->max_addr); hash = hash_add(hash, - (conn->nat_info->max_port << 16) + ((uint32_t) conn->nat_info->max_port << 16) | conn->nat_info->min_port); hash = ct_endpoint_hash_add(hash, &conn->key.src); hash = ct_endpoint_hash_add(hash, &conn->key.dst); |