mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
pf: Sprinkle const qualifiers in state lookup routines
State keys are trivially const in lookup routines, so annotate them as such. No functional change intended. Reviewed by: kp MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Modirum Differential Revision: https://reviews.freebsd.org/D45671
This commit is contained in:
parent
b75d14d600
commit
66b8cac8d8
@ -2273,9 +2273,11 @@ pf_get_time(void)
|
||||
}
|
||||
|
||||
extern struct pf_kstate *pf_find_state_byid(uint64_t, uint32_t);
|
||||
extern struct pf_kstate *pf_find_state_all(struct pf_state_key_cmp *,
|
||||
extern struct pf_kstate *pf_find_state_all(
|
||||
const struct pf_state_key_cmp *,
|
||||
u_int, int *);
|
||||
extern bool pf_find_state_all_exists(struct pf_state_key_cmp *,
|
||||
extern bool pf_find_state_all_exists(
|
||||
const struct pf_state_key_cmp *,
|
||||
u_int);
|
||||
extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *,
|
||||
struct pf_krule *, sa_family_t,
|
||||
@ -2569,7 +2571,7 @@ struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *,
|
||||
|
||||
struct pf_state_key *pf_state_key_setup(struct pf_pdesc *, struct pf_addr *,
|
||||
struct pf_addr *, u_int16_t, u_int16_t);
|
||||
struct pf_state_key *pf_state_key_clone(struct pf_state_key *);
|
||||
struct pf_state_key *pf_state_key_clone(const struct pf_state_key *);
|
||||
void pf_rule_to_actions(struct pf_krule *,
|
||||
struct pf_rule_actions *);
|
||||
int pf_normalize_mss(struct mbuf *m, int off,
|
||||
|
@ -363,7 +363,7 @@ static void pf_print_state_parts(struct pf_kstate *,
|
||||
static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t,
|
||||
bool, u_int8_t);
|
||||
static struct pf_kstate *pf_find_state(struct pfi_kkif *,
|
||||
struct pf_state_key_cmp *, u_int);
|
||||
const struct pf_state_key_cmp *, u_int);
|
||||
static int pf_src_connlimit(struct pf_kstate **);
|
||||
static void pf_overload_task(void *v, int pending);
|
||||
static u_short pf_insert_src_node(struct pf_ksrc_node **,
|
||||
@ -654,11 +654,11 @@ pf_packet_rework_nat(struct mbuf *m, struct pf_pdesc *pd, int off,
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
pf_hashkey(struct pf_state_key *sk)
|
||||
pf_hashkey(const struct pf_state_key *sk)
|
||||
{
|
||||
uint32_t h;
|
||||
|
||||
h = murmur3_32_hash32((uint32_t *)sk,
|
||||
h = murmur3_32_hash32((const uint32_t *)sk,
|
||||
sizeof(struct pf_state_key_cmp)/sizeof(uint32_t),
|
||||
V_pf_hashseed);
|
||||
|
||||
@ -1506,7 +1506,7 @@ pf_state_key_setup(struct pf_pdesc *pd, struct pf_addr *saddr,
|
||||
}
|
||||
|
||||
struct pf_state_key *
|
||||
pf_state_key_clone(struct pf_state_key *orig)
|
||||
pf_state_key_clone(const struct pf_state_key *orig)
|
||||
{
|
||||
struct pf_state_key *sk;
|
||||
|
||||
@ -1607,7 +1607,8 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid)
|
||||
* Returns with ID hash slot locked on success.
|
||||
*/
|
||||
static struct pf_kstate *
|
||||
pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir)
|
||||
pf_find_state(struct pfi_kkif *kif, const struct pf_state_key_cmp *key,
|
||||
u_int dir)
|
||||
{
|
||||
struct pf_keyhash *kh;
|
||||
struct pf_state_key *sk;
|
||||
@ -1616,7 +1617,7 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir)
|
||||
|
||||
pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1);
|
||||
|
||||
kh = &V_pf_keyhash[pf_hashkey((struct pf_state_key *)key)];
|
||||
kh = &V_pf_keyhash[pf_hashkey((const struct pf_state_key *)key)];
|
||||
|
||||
PF_HASHROW_LOCK(kh);
|
||||
LIST_FOREACH(sk, &kh->keys, entry)
|
||||
@ -1654,7 +1655,7 @@ pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir)
|
||||
* Returns with ID hash slot locked on success.
|
||||
*/
|
||||
struct pf_kstate *
|
||||
pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more)
|
||||
pf_find_state_all(const struct pf_state_key_cmp *key, u_int dir, int *more)
|
||||
{
|
||||
struct pf_keyhash *kh;
|
||||
struct pf_state_key *sk;
|
||||
@ -1663,7 +1664,7 @@ pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more)
|
||||
|
||||
pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1);
|
||||
|
||||
kh = &V_pf_keyhash[pf_hashkey((struct pf_state_key *)key)];
|
||||
kh = &V_pf_keyhash[pf_hashkey((const struct pf_state_key *)key)];
|
||||
|
||||
PF_HASHROW_LOCK(kh);
|
||||
LIST_FOREACH(sk, &kh->keys, entry)
|
||||
@ -1720,7 +1721,7 @@ pf_find_state_all(struct pf_state_key_cmp *key, u_int dir, int *more)
|
||||
* removing it.
|
||||
*/
|
||||
bool
|
||||
pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir)
|
||||
pf_find_state_all_exists(const struct pf_state_key_cmp *key, u_int dir)
|
||||
{
|
||||
struct pf_kstate *s;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user