| @@ -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 | |
| | | 53 | int lineno; |
| | | 54 | |
| | | 55 | struct pfioc_states* states; |
| | | 56 | size_t allocated; |
| | | 57 | |
53 | // XXX it is really correct ? | | 58 | // XXX it is really correct ? |
54 | extern const char * const tcpstates[]; | | 59 | extern const char * const tcpstates[]; |
55 | | | 60 | |
56 | | | 61 | |
57 | struct pfsync_state global_state; | | 62 | struct pfsync_state global_state; |
58 | struct pfsync_state_peer *src_peer, *dst_peer; | | 63 | struct pfsync_state_peer *src_peer, *dst_peer; |
59 | struct pfsync_state_peer current_peer; | | 64 | struct pfsync_state_peer current_peer; |
60 | | | 65 | |
61 | static void parse_init(void); | | 66 | static void parse_init(void); |
62 | static void add_state(void); | | 67 | static void add_state(void); |
63 | static bool get_pfsync_host(const char*, struct pfsync_state_host*, sa_family_t*); | | 68 | static bool get_pfsync_host(const char*, struct pfsync_state_host*, sa_family_t*); |
64 | static uint8_t retrieve_peer_state(const char*, int); | | 69 | static uint8_t retrieve_peer_state(const char*, int); |
65 | static bool retrieve_seq(const char*, struct pfsync_state_peer*); | | 70 | static bool retrieve_seq(const char*, struct pfsync_state_peer*); |