Skip to content

Commit e3ac529

Browse files
kaberdavem330
authored andcommitted
[NETFILTER]: nf_queue: make queue_handler const
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fb46990 commit e3ac529

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎include/linux/netfilter.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ struct nf_queue_handler {
281281
void *data;
282282
char *name;
283283
};
284-
extern int nf_register_queue_handler(int pf,
285-
struct nf_queue_handler *qh);
284+
extern int nf_register_queue_handler(int pf,
285+
const struct nf_queue_handler *qh);
286286
extern int nf_unregister_queue_handler(int pf,
287-
struct nf_queue_handler *qh);
288-
extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
287+
const struct nf_queue_handler *qh);
288+
extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
289289
extern void nf_reinject(struct sk_buff *skb,
290290
struct nf_info *info,
291291
unsigned int verdict);

‎net/ipv4/netfilter/ip_queue.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ static const struct file_operations ip_queue_proc_fops = {
645645
.owner = THIS_MODULE,
646646
};
647647

648-
static struct nf_queue_handler nfqh = {
648+
static const struct nf_queue_handler nfqh = {
649649
.name = "ip_queue",
650650
.outfn = &ipq_enqueue_packet,
651651
};

‎net/ipv6/netfilter/ip6_queue.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ static const struct file_operations ip6_queue_proc_fops = {
634634
.owner = THIS_MODULE,
635635
};
636636

637-
static struct nf_queue_handler nfqh = {
637+
static const struct nf_queue_handler nfqh = {
638638
.name = "ip6_queue",
639639
.outfn = &ipq_enqueue_packet,
640640
};

‎net/netfilter/nf_queue.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
* long term mutex. The handler must provide an an outfn() to accept packets
1616
* for queueing and must reinject all packets it receives, no matter what.
1717
*/
18-
static struct nf_queue_handler *queue_handler[NPROTO];
18+
static const struct nf_queue_handler *queue_handler[NPROTO];
1919

2020
static DEFINE_MUTEX(queue_handler_mutex);
2121

2222
/* return EBUSY when somebody else is registered, return EEXIST if the
2323
* same handler is registered, return 0 in case of success. */
24-
int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
24+
int nf_register_queue_handler(int pf, const struct nf_queue_handler *qh)
2525
{
2626
int ret;
2727

@@ -44,7 +44,7 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
4444
EXPORT_SYMBOL(nf_register_queue_handler);
4545

4646
/* The caller must flush their queue before this */
47-
int nf_unregister_queue_handler(int pf, struct nf_queue_handler *qh)
47+
int nf_unregister_queue_handler(int pf, const struct nf_queue_handler *qh)
4848
{
4949
if (pf >= NPROTO)
5050
return -EINVAL;
@@ -64,7 +64,7 @@ int nf_unregister_queue_handler(int pf, struct nf_queue_handler *qh)
6464
}
6565
EXPORT_SYMBOL(nf_unregister_queue_handler);
6666

67-
void nf_unregister_queue_handlers(struct nf_queue_handler *qh)
67+
void nf_unregister_queue_handlers(const struct nf_queue_handler *qh)
6868
{
6969
int pf;
7070

@@ -98,7 +98,7 @@ static int __nf_queue(struct sk_buff *skb,
9898
struct net_device *physoutdev = NULL;
9999
#endif
100100
struct nf_afinfo *afinfo;
101-
struct nf_queue_handler *qh;
101+
const struct nf_queue_handler *qh;
102102

103103
/* QUEUE == DROP if noone is waiting, to be safe. */
104104
rcu_read_lock();
@@ -313,7 +313,7 @@ static int seq_show(struct seq_file *s, void *v)
313313
{
314314
int ret;
315315
loff_t *pos = v;
316-
struct nf_queue_handler *qh;
316+
const struct nf_queue_handler *qh;
317317

318318
rcu_read_lock();
319319
qh = rcu_dereference(queue_handler[*pos]);

‎net/netfilter/nfnetlink_queue.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ static const struct nla_policy nfqa_cfg_policy[NFQA_CFG_MAX+1] = {
849849
[NFQA_CFG_PARAMS] = { .len = sizeof(struct nfqnl_msg_config_params) },
850850
};
851851

852-
static struct nf_queue_handler nfqh = {
852+
static const struct nf_queue_handler nfqh = {
853853
.name = "nf_queue",
854854
.outfn = &nfqnl_enqueue_packet,
855855
};

0 commit comments

Comments
 (0)