Thu Apr 23 00:29:00 2020 UTC ()
lineno, states and allocated should be owned by the parser


(joerg)
diff -r1.2 -r1.3 src/usr.sbin/pf/pfs/parse.y
diff -r1.2 -r1.3 src/usr.sbin/pf/pfs/parser.h

cvs diff -r1.2 -r1.3 src/usr.sbin/pf/pfs/parse.y (expand / switch to unified diff)

--- src/usr.sbin/pf/pfs/parse.y 2013/10/19 17:16:38 1.2
+++ src/usr.sbin/pf/pfs/parse.y 2020/04/23 00:29:00 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: parse.y,v 1.2 2013/10/19 17:16:38 christos Exp $ */ 1/* $NetBSD: parse.y,v 1.3 2020/04/23 00:29:00 joerg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,46 +20,51 @@ @@ -20,46 +20,51 @@
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29%{ 29%{
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31 31
32#ifndef lint 32#ifndef lint
33__RCSID("$NetBSD: parse.y,v 1.2 2013/10/19 17:16:38 christos Exp $"); 33__RCSID("$NetBSD: parse.y,v 1.3 2020/04/23 00:29:00 joerg Exp $");
34#endif 34#endif
35 35
36#include <stdio.h> 36#include <stdio.h>
37#include <stdlib.h> 37#include <stdlib.h>
38#include <string.h> 38#include <string.h>
39#include <stdint.h> 39#include <stdint.h>
40#include <stdbool.h> 40#include <stdbool.h>
41#include <inttypes.h> 41#include <inttypes.h>
42#include <errno.h> 42#include <errno.h>
43 43
44#include <net/if.h> 44#include <net/if.h>
45#include <netinet/in.h> 45#include <netinet/in.h>
46#include <net/pfvar.h> 46#include <net/pfvar.h>
47#include <arpa/inet.h> 47#include <arpa/inet.h>
48#include <netdb.h> 48#include <netdb.h>
49#include <netinet/tcp_fsm.h> 49#include <netinet/tcp_fsm.h>
50 50
51#include "parser.h" 51#include "parser.h"
52 52
 53int lineno;
 54
 55struct pfioc_states* states;
 56size_t allocated;
 57
53// XXX it is really correct ? 58// XXX it is really correct ?
54extern const char * const tcpstates[]; 59extern const char * const tcpstates[];
55 60
56 61
57struct pfsync_state global_state; 62struct pfsync_state global_state;
58struct pfsync_state_peer *src_peer, *dst_peer; 63struct pfsync_state_peer *src_peer, *dst_peer;
59struct pfsync_state_peer current_peer; 64struct pfsync_state_peer current_peer;
60 65
61static void parse_init(void); 66static void parse_init(void);
62static void add_state(void); 67static void add_state(void);
63static bool get_pfsync_host(const char*, struct pfsync_state_host*, sa_family_t*); 68static bool get_pfsync_host(const char*, struct pfsync_state_host*, sa_family_t*);
64static uint8_t retrieve_peer_state(const char*, int); 69static uint8_t retrieve_peer_state(const char*, int);
65static bool retrieve_seq(const char*, struct pfsync_state_peer*); 70static bool retrieve_seq(const char*, struct pfsync_state_peer*);

cvs diff -r1.2 -r1.3 src/usr.sbin/pf/pfs/parser.h (expand / switch to unified diff)

--- src/usr.sbin/pf/pfs/parser.h 2011/08/31 13:32:39 1.2
+++ src/usr.sbin/pf/pfs/parser.h 2020/04/23 00:29:00 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: parser.h,v 1.2 2011/08/31 13:32:39 joerg Exp $ */ 1/* $NetBSD: parser.h,v 1.3 2020/04/23 00:29:00 joerg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,19 +24,19 @@ @@ -24,19 +24,19 @@
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28#ifndef _PARSER_H_ 28#ifndef _PARSER_H_
29#define _PARSER_H_ 29#define _PARSER_H_
30 30
31int yylex(void); 31int yylex(void);
32void yyerror(const char*); 32void yyerror(const char*);
33__dead void yyfatal(const char*); 33__dead void yyfatal(const char*);
34int parse(FILE*, struct pfioc_states*); 34int parse(FILE*, struct pfioc_states*);
35int yyparse(void); 35int yyparse(void);
36 36
37int lineno; 37extern int lineno;
38 38
39struct pfioc_states* states; 39extern struct pfioc_states* states;
40size_t allocated; 40extern size_t allocated;
41 41
42#endif /* _PARSER_H_*/ 42#endif /* _PARSER_H_*/