conntrack.c (002c6ca75289a4ac4f6738213dd2d258704886e4) | conntrack.c (52d1aa8b8249ff477aaa38b6f74a8ced780d079c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2015 Nicira, Inc. 4 */ 5 6#include <linux/module.h> 7#include <linux/openvswitch.h> 8#include <linux/tcp.h> --- 138 unchanged lines hidden (view full) --- 147 } 148 149 return ct_state; 150} 151 152static u32 ovs_ct_get_mark(const struct nf_conn *ct) 153{ 154#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2015 Nicira, Inc. 4 */ 5 6#include <linux/module.h> 7#include <linux/openvswitch.h> 8#include <linux/tcp.h> --- 138 unchanged lines hidden (view full) --- 147 } 148 149 return ct_state; 150} 151 152static u32 ovs_ct_get_mark(const struct nf_conn *ct) 153{ 154#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) |
155 return ct ? ct->mark : 0; | 155 return ct ? READ_ONCE(ct->mark) : 0; |
156#else 157 return 0; 158#endif 159} 160 161/* Guard against conntrack labels max size shrinking below 128 bits. */ 162#if NF_CT_LABELS_MAX_SIZE < 16 163#error NF_CT_LABELS_MAX_SIZE must be at least 16 bytes --- 171 unchanged lines hidden (view full) --- 335} 336 337static int ovs_ct_set_mark(struct nf_conn *ct, struct sw_flow_key *key, 338 u32 ct_mark, u32 mask) 339{ 340#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) 341 u32 new_mark; 342 | 156#else 157 return 0; 158#endif 159} 160 161/* Guard against conntrack labels max size shrinking below 128 bits. */ 162#if NF_CT_LABELS_MAX_SIZE < 16 163#error NF_CT_LABELS_MAX_SIZE must be at least 16 bytes --- 171 unchanged lines hidden (view full) --- 335} 336 337static int ovs_ct_set_mark(struct nf_conn *ct, struct sw_flow_key *key, 338 u32 ct_mark, u32 mask) 339{ 340#if IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) 341 u32 new_mark; 342 |
343 new_mark = ct_mark | (ct->mark & ~(mask)); 344 if (ct->mark != new_mark) { 345 ct->mark = new_mark; | 343 new_mark = ct_mark | (READ_ONCE(ct->mark) & ~(mask)); 344 if (READ_ONCE(ct->mark) != new_mark) { 345 WRITE_ONCE(ct->mark, new_mark); |
346 if (nf_ct_is_confirmed(ct)) 347 nf_conntrack_event_cache(IPCT_MARK, ct); 348 key->ct.mark = new_mark; 349 } 350 351 return 0; 352#else 353 return -ENOTSUPP; --- 1973 unchanged lines hidden --- | 346 if (nf_ct_is_confirmed(ct)) 347 nf_conntrack_event_cache(IPCT_MARK, ct); 348 key->ct.mark = new_mark; 349 } 350 351 return 0; 352#else 353 return -ENOTSUPP; --- 1973 unchanged lines hidden --- |