pfctl: Use const where possible.

This adds const qualifiers where it is possible.

Submitted by:	Christian Mauderer <christian.mauderer@embedded-brains.de>
This commit is contained in:
kp 2016-08-02 20:32:02 +00:00
parent c11f9ae8f4
commit 119d258974
3 changed files with 14 additions and 14 deletions

View File

@ -100,7 +100,7 @@ int pfctl_ruleset_trans(struct pfctl *, char *, struct pf_anchor *);
int pfctl_load_ruleset(struct pfctl *, char *,
struct pf_ruleset *, int, int);
int pfctl_load_rule(struct pfctl *, char *, struct pf_rule *, int);
const char *pfctl_lookup_option(char *, const char **);
const char *pfctl_lookup_option(char *, const char * const *);
struct pf_anchor_global pf_anchors;
struct pf_anchor pf_main_anchor;
@ -111,7 +111,7 @@ const char *showopt;
const char *debugopt;
char *anchoropt;
const char *optiopt = NULL;
char *pf_device = "/dev/pf";
const char *pf_device = "/dev/pf";
char *ifaceopt;
char *tableopt;
const char *tblcmdopt;
@ -203,27 +203,27 @@ static const struct {
{ NULL, NULL }
};
static const char *clearopt_list[] = {
static const char * const clearopt_list[] = {
"nat", "queue", "rules", "Sources",
"states", "info", "Tables", "osfp", "all", NULL
};
static const char *showopt_list[] = {
static const char * const showopt_list[] = {
"nat", "queue", "rules", "Anchors", "Sources", "states", "info",
"Interfaces", "labels", "timeouts", "memory", "Tables", "osfp",
"all", NULL
};
static const char *tblcmdopt_list[] = {
static const char * const tblcmdopt_list[] = {
"kill", "flush", "add", "delete", "load", "replace", "show",
"test", "zero", "expire", NULL
};
static const char *debugopt_list[] = {
static const char * const debugopt_list[] = {
"none", "urgent", "misc", "loud", NULL
};
static const char *optiopt_list[] = {
static const char * const optiopt_list[] = {
"none", "basic", "profile", NULL
};
@ -1975,7 +1975,7 @@ pfctl_show_anchors(int dev, int opts, char *anchorname)
}
const char *
pfctl_lookup_option(char *cmd, const char **list)
pfctl_lookup_option(char *cmd, const char * const *list)
{
if (cmd != NULL && *cmd)
for (; *list; list++)

View File

@ -76,7 +76,7 @@ struct node_host *host_v4(const char *, int);
struct node_host *host_v6(const char *, int);
struct node_host *host_dns(const char *, int, int);
const char *tcpflags = "FSRPAUEW";
const char * const tcpflags = "FSRPAUEW";
static const struct icmptypeent icmp_type[] = {
{ "echoreq", ICMP_ECHO },
@ -473,10 +473,10 @@ print_pool(struct pf_pool *pool, u_int16_t p1, u_int16_t p2,
printf(" static-port");
}
const char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES;
const char *pf_lcounters[LCNT_MAX+1] = LCNT_NAMES;
const char *pf_fcounters[FCNT_MAX+1] = FCNT_NAMES;
const char *pf_scounters[FCNT_MAX+1] = FCNT_NAMES;
const char * const pf_reasons[PFRES_MAX+1] = PFRES_NAMES;
const char * const pf_lcounters[LCNT_MAX+1] = LCNT_NAMES;
const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES;
const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES;
void
print_status(struct pf_status *s, int opts)

View File

@ -401,7 +401,7 @@ pfi_get_ifaces(const char *filter, struct pfi_kif *buf, int *size)
/* buffer management code */
size_t buf_esize[PFRB_MAX] = { 0,
const size_t buf_esize[PFRB_MAX] = { 0,
sizeof(struct pfr_table), sizeof(struct pfr_tstats),
sizeof(struct pfr_addr), sizeof(struct pfr_astats),
sizeof(struct pfi_kif), sizeof(struct pfioc_trans_e)