diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-06-08 21:10:00 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2002-06-08 21:10:00 +0000 |
commit | 47335f60b8931de610eb88cb28eab399b1510f8c (patch) | |
tree | 6b01007150a6fe2a54471e91956da7486936703e | |
parent | eac8ba49892b02ea015f8bf29bfd48b95d9b9f0e (diff) |
Change remaining read-only lookup tables to const, suggestion drahn@
-rw-r--r-- | sbin/pfctl/parse.y | 14 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 24 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.h | 10 |
3 files changed, 24 insertions, 24 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index a532383706d..c1b0f282b3c 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.85 2002/06/08 20:59:52 itojun Exp $ */ +/* $OpenBSD: parse.y,v 1.86 2002/06/08 21:09:59 dhartmei Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -374,7 +374,7 @@ blockspec : /* empty */ { $$.b2 = 0; $$.w = 0; } $$.b2 = 0; } | RETURNICMP '(' STRING ')' { - struct icmpcodeent *p; + const struct icmpcodeent *p; if ((p = geticmpcodebyname(ICMP_UNREACH, $3, AF_INET)) == NULL) { @@ -389,7 +389,7 @@ blockspec : /* empty */ { $$.b2 = 0; $$.w = 0; } $$.b2 = 0; } | RETURNICMP6 '(' STRING ')' { - struct icmpcodeent *p; + const struct icmpcodeent *p; if ((p = geticmpcodebyname(ICMP6_DST_UNREACH, $3, AF_INET6)) == NULL) { @@ -921,7 +921,7 @@ icmp_item : icmptype { $$->next = NULL; } | icmptype CODE STRING { - struct icmpcodeent *p; + const struct icmpcodeent *p; $$ = malloc(sizeof(struct node_icmp)); if ($$ == NULL) @@ -961,7 +961,7 @@ icmp6_item : icmp6type { $$->next = NULL; } | icmp6type CODE STRING { - struct icmpcodeent *p; + const struct icmpcodeent *p; $$ = malloc(sizeof(struct node_icmp)); if ($$ == NULL) @@ -979,7 +979,7 @@ icmp6_item : icmp6type { ; icmptype : STRING { - struct icmptypeent *p; + const struct icmptypeent *p; if ((p = geticmptypebyname($1, AF_INET)) == NULL) { yyerror("unknown icmp-type %s", $1); @@ -997,7 +997,7 @@ icmptype : STRING { ; icmp6type : STRING { - struct icmptypeent *p; + const struct icmptypeent *p; if ((p = geticmptypebyname($1, AF_INET6)) == NULL) { yyerror("unknown ipv6-icmp-type %s", $1); diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 4be917f3b4b..a5427b4603d 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.81 2002/06/08 16:44:15 drahn Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.82 2002/06/08 21:09:59 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -61,7 +61,7 @@ void print_flags (u_int8_t); char *tcpflags = "FSRPAUEW"; -struct icmptypeent icmp_type[] = { +static const struct icmptypeent icmp_type[] = { { "echoreq", ICMP_ECHO }, { "echorep", ICMP_ECHOREPLY }, { "unreach", ICMP_UNREACH }, @@ -89,7 +89,7 @@ struct icmptypeent icmp_type[] = { { "photuris", ICMP_PHOTURIS } }; -struct icmptypeent icmp6_type[] = { +static const struct icmptypeent icmp6_type[] = { { "unreach", ICMP6_DST_UNREACH }, { "toobig", ICMP6_PACKET_TOO_BIG }, { "timex", ICMP6_TIME_EXCEEDED }, @@ -118,7 +118,7 @@ struct icmptypeent icmp6_type[] = { { "mtrace", MLD6_MTRACE } }; -struct icmpcodeent icmp_code[] = { +static const struct icmpcodeent icmp_code[] = { { "net-unr", ICMP_UNREACH, ICMP_UNREACH_NET }, { "host-unr", ICMP_UNREACH, ICMP_UNREACH_HOST }, { "proto-unr", ICMP_UNREACH, ICMP_UNREACH_PROTOCOL }, @@ -151,7 +151,7 @@ struct icmpcodeent icmp_code[] = { { "decrypt-fail", ICMP_PHOTURIS, ICMP_PHOTURIS_DECRYPT_FAILED } }; -struct icmpcodeent icmp6_code[] = { +static const struct icmpcodeent icmp6_code[] = { { "admin-unr", ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN }, { "noroute-unr", ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOROUTE }, { "notnbr-unr", ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOTNEIGHBOR }, @@ -186,7 +186,7 @@ const struct pf_timeout pf_timeouts[] = { { NULL, 0 } }; -struct icmptypeent * +const struct icmptypeent * geticmptypebynumber(u_int8_t type, u_int8_t af) { unsigned int i; @@ -206,7 +206,7 @@ geticmptypebynumber(u_int8_t type, u_int8_t af) return (NULL); } -struct icmptypeent * +const struct icmptypeent * geticmptypebyname(char *w, u_int8_t af) { unsigned int i; @@ -226,7 +226,7 @@ geticmptypebyname(char *w, u_int8_t af) return (NULL); } -struct icmpcodeent * +const struct icmpcodeent * geticmpcodebynumber(u_int8_t type, u_int8_t code, u_int8_t af) { unsigned int i; @@ -248,7 +248,7 @@ geticmpcodebynumber(u_int8_t type, u_int8_t code, u_int8_t af) return (NULL); } -struct icmpcodeent * +const struct icmpcodeent * geticmpcodebyname(u_long type, char *w, u_int8_t af) { unsigned int i; @@ -563,7 +563,7 @@ print_rule(struct pf_rule *r) else printf("return-rst(ttl %d) ", r->return_ttl); } else if (r->return_icmp) { - struct icmpcodeent *ic; + const struct icmpcodeent *ic; if (r->af != AF_INET6) printf("return-icmp"); @@ -682,7 +682,7 @@ print_rule(struct pf_rule *r) printf(" "); } if (r->type) { - struct icmptypeent *p; + const struct icmptypeent *p; p = geticmptypebynumber(r->type-1, r->af); if (r->af != AF_INET6) @@ -694,7 +694,7 @@ print_rule(struct pf_rule *r) else printf(" %u ", r->type-1); if (r->code) { - struct icmpcodeent *p; + const struct icmpcodeent *p; p = geticmpcodebynumber(r->type-1, r->code-1, r->af); if (p != NULL) diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 807b0a18764..0d1c6e092d7 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.h,v 1.19 2002/06/08 07:58:07 dhartmei Exp $ */ +/* $OpenBSD: pfctl_parser.h,v 1.20 2002/06/08 21:09:59 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -81,10 +81,10 @@ struct icmpcodeent { u_int8_t code; }; -struct icmptypeent *geticmptypebynumber(u_int8_t, u_int8_t); -struct icmptypeent *geticmptypebyname(char *, u_int8_t); -struct icmpcodeent *geticmpcodebynumber(u_int8_t, u_int8_t, u_int8_t); -struct icmpcodeent *geticmpcodebyname(u_long, char *, u_int8_t); +const struct icmptypeent *geticmptypebynumber(u_int8_t, u_int8_t); +const struct icmptypeent *geticmptypebyname(char *, u_int8_t); +const struct icmpcodeent *geticmpcodebynumber(u_int8_t, u_int8_t, u_int8_t); +const struct icmpcodeent *geticmpcodebyname(u_long, char *, u_int8_t); struct pf_timeout { const char *name; |