aboutsummaryrefslogtreecommitdiffstats
path: root/net/relayd/files/patch-relayd-parse.y
blob: aef89333a2e2e67afd71dc69c01091917b992667 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
--- relayd.orig/parse.y 2011-05-22 01:06:39.462150204 +0200
+++ relayd/parse.y  2011-05-22 01:06:54.687080706 +0200
@@ -35,7 +35,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
-#include <net/route.h>
+// FreeBSD #include <net/route.h>
 
 #include <ctype.h>
 #include <unistd.h>
@@ -93,8 +93,10 @@
 objid_t             last_host_id = 0;
 objid_t             last_relay_id = 0;
 objid_t             last_proto_id = 0;
+/* FreeBSD exclude
 objid_t             last_rt_id = 0;
 objid_t             last_nr_id = 0;
+*/
 
 static struct rdr  *rdr = NULL;
 static struct table    *table = NULL;
@@ -103,7 +105,9 @@
 struct relaylist    relays;
 static struct protocol *proto = NULL;
 static struct protonode     node;
+/* FreeBSD exclude
 static struct router   *router = NULL;
+*/
 static u_int16_t    label = 0;
 static in_port_t    tableport = 0;
 static int      nodedirection;
@@ -148,12 +152,20 @@
 %token CIPHERS CODE COOKIE DEMOTE DIGEST DISABLE ERROR EXPECT
 %token EXTERNAL FILENAME FILTER FORWARD FROM HASH HEADER HOST ICMP
 %token INCLUDE INET INET6 INTERFACE INTERVAL IP LABEL LISTEN
-%token LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO DESTINATION
-%token NODELAY NOTHING ON PARENT PATH PORT PREFORK PRIORITY PROTO
+// FreeBSD exclude %token  LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO DESTINATION
+%token LOADBALANCE LOG LOOKUP MARK MARKED MODE NAT NO
+// FreeBSD exclude %token  NODELAY NOTHING ON PARENT PATH PORT PREFORK PRIORITY PROTO
+%token NODELAY NOTHING ON PARENT PATH PORT PREFORK PROTO
 %token QUERYSTR REAL REDIRECT RELAY REMOVE REQUEST RESPONSE RETRY
 %token RETURN ROUNDROBIN ROUTE SACK SCRIPT SEND SESSION SOCKET SPLICE
+/* FreeBSD exclude
 %token SSL STICKYADDR STYLE TABLE TAG TCP TIMEOUT TO ROUTER RTLABEL
 %token TRANSPARENT TRAP UPDATES URL VIRTUAL WITH TTL RTABLE MATCH
+*/
+// Start FreeBSD include
+%token SSL STICKYADDR STYLE TABLE TAG TCP TIMEOUT TO
+%token TRANSPARENT TRAP UPDATES URL VIRTUAL WITH TTL
+// End FreeBSD include
 %token <v.string>  STRING
 %token  <v.number> NUMBER
 %type  <v.string>  hostname interface table
@@ -179,7 +191,7 @@
        | grammar tabledef '\n'
        | grammar relay '\n'
        | grammar proto '\n'
-       | grammar router '\n'
+// FreeBSD | grammar router '\n'
        | grammar error '\n'        { file->errors++; }
        ;
 
@@ -363,6 +375,7 @@
            }
            conf->sc_prefork_relay = $2;
        }
+/* FreeBSD exclude
        | DEMOTE STRING     {
            if (loadcfg)
                break;
@@ -386,6 +399,7 @@
                break;
            conf->sc_flags |= F_TRAP;
        }
+*/
        ;
 
 loglevel   : UPDATES       { $$ = RELAYD_OPT_LOGUPDATE; }
@@ -658,6 +672,7 @@
            bcopy(&$2, &table->conf.timeout,
                sizeof(struct timeval));
        }
+/* FreeBSD exclude
        | DEMOTE STRING     {
            table->conf.flags |= F_DEMOTE;
            if (strlcpy(table->conf.demote_group, $2,
@@ -675,6 +690,7 @@
                YYERROR;
            }
        }
+*/
        | INTERVAL NUMBER   {
            if ($2 < conf->sc_interval.tv_sec ||
                $2 % conf->sc_interval.tv_sec) {
@@ -1261,6 +1277,8 @@
                    rlay->rl_conf.name);
                YYERROR;
            }
+           if ((rlay->rl_conf.flags & F_NATLOOK) == 0 &&
+/* FreeBSD exclude 
            if ((rlay->rl_conf.flags & (F_NATLOOK|F_DIVERT)) ==
                (F_NATLOOK|F_DIVERT)) {
                yyerror("relay %s with conflicting nat lookup "
@@ -1268,6 +1286,7 @@
                YYERROR;
            }
            if ((rlay->rl_conf.flags & (F_NATLOOK|F_DIVERT)) == 0 &&
+*/
                rlay->rl_conf.dstss.ss_family == AF_UNSPEC &&
                rlay->rl_conf.dsttable == EMPTY_ID) {
                yyerror("relay %s has no target, rdr, "
@@ -1430,11 +1449,13 @@
            rlay->rl_conf.flags |= F_NATLOOK;
            rlay->rl_conf.dstretry = $3;
        }
+/* FreeBSD exclude
        | DESTINATION retry     {
            conf->sc_flags |= F_NEEDPF;
            rlay->rl_conf.flags |= F_DIVERT;
            rlay->rl_conf.dstretry = $2;
        }
+*/
        | tablespec {
            if (rlay->rl_backuptable) {
                yyerror("only one backup table is allowed");
@@ -1459,6 +1480,7 @@
        | HASH          { $$ = RELAY_DSTMODE_HASH; }
        ;
 
+/* FreeBSD exclude
 router     : ROUTER STRING     {
            struct router *rt = NULL;
 
@@ -1594,7 +1616,7 @@
        | DISABLE       { rlay->rl_conf.flags |= F_DISABLE; }
        | include
        ;
-
+*/
 dstaf      : /* empty */       {
            rlay->rl_conf.dstaf.ss_family = AF_UNSPEC;
        }
@@ -1670,6 +1692,7 @@
            }
            hst->conf.parentid = $2;
        }
+/* FreeBSD exclude
        | PRIORITY NUMBER       {
            if (hst->conf.priority) {
                yyerror("priority already set");
@@ -1681,6 +1704,7 @@
            }
            hst->conf.priority = $2;
        }
+*/
        | IP TTL NUMBER     {
            if (hst->conf.ttl) {
                yyerror("ttl value already set");
@@ -1794,8 +1818,10 @@
        { "ciphers",        CIPHERS },
        { "code",       CODE },
        { "cookie",     COOKIE },
+/* FreeBSD exclude
        { "demote",     DEMOTE },
        { "destination",    DESTINATION },
+*/
        { "digest",     DIGEST },
        { "disable",        DISABLE },
        { "error",      ERROR },
@@ -1833,7 +1859,7 @@
        { "path",       PATH },
        { "port",       PORT },
        { "prefork",        PREFORK },
-       { "priority",       PRIORITY },
+// FreeBSD { "priority",       PRIORITY },
        { "protocol",       PROTO },
        { "query",      QUERYSTR },
        { "real",       REAL },
@@ -1846,9 +1872,11 @@
        { "return",     RETURN },
        { "roundrobin",     ROUNDROBIN },
        { "route",      ROUTE },
+/* FreeBSD exclude
        { "router",     ROUTER },
        { "rtable",     RTABLE },
        { "rtlabel",        RTLABEL },
+*/
        { "sack",       SACK },
        { "script",     SCRIPT },
        { "send",       SEND },
@@ -1864,7 +1892,7 @@
        { "timeout",        TIMEOUT },
        { "to",         TO },
        { "transparent",    TRANSPARENT },
-       { "trap",       TRAP },
+// FreeBSD { "trap",       TRAP },
        { "ttl",        TTL },
        { "updates",        UPDATES },
        { "url",        URL },
@@ -2096,7 +2124,8 @@
    (isalnum(x) || (ispunct(x) && x != '(' && x != ')' && \
    x != '{' && x != '}' && x != '<' && x != '>' && \
    x != '!' && x != '=' && x != '#' && \
-   x != ',' && x != '/'))
+   x != ','))
+// FreeBSD exclude x != ',' && x != '/'))
 
    if (isalnum(c) || c == ':' || c == '_') {
        do {
@@ -2240,13 +2269,14 @@
    loadcfg = 1;
    errors = 0;
    last_host_id = last_table_id = last_rdr_id = last_proto_id =
-       last_relay_id = last_rt_id = last_nr_id = 0;
+// FreeBSD last_relay_id = last_rt_id = last_nr_id = 0;
+       last_relay_id = 0;
 
    rdr = NULL;
    table = NULL;
    rlay = NULL;
    proto = NULL;
-   router = NULL;
+// FreeBSD router = NULL;
 
    if ((file = pushfile(filename, 0)) == NULL)
        return (-1);
@@ -2276,8 +2306,8 @@
    }
 
    if (TAILQ_EMPTY(conf->sc_rdrs) &&
-       TAILQ_EMPTY(conf->sc_relays) &&
-       TAILQ_EMPTY(conf->sc_rts)) {
+       TAILQ_EMPTY(conf->sc_relays) /* FreeBSD exclude &&
+       TAILQ_EMPTY(conf->sc_rts) */ ) {
        log_warnx("no actions, nothing to do");
        errors++;
    }
@@ -2493,7 +2523,8 @@
    hints.ai_family = PF_UNSPEC;
    hints.ai_socktype = SOCK_DGRAM; /* DUMMY */
    error = getaddrinfo(s, NULL, &hints, &res0);
-   if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME)
+// if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME)
+   if (error == EAI_AGAIN || error == EAI_NONAME)
        return (0);
    if (error) {
        log_warnx("%s: could not parse \"%s\": %s", __func__, s,