ematch_syntax.c 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538
  1. /* A Bison parser, made by GNU Bison 3.5.1. */
  2. /* Bison implementation for Yacc-like parsers in C
  3. Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
  4. Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /* As a special exception, you may create a larger work that contains
  16. part or all of the Bison parser skeleton and distribute that work
  17. under terms of your choice, so long as that work isn't itself a
  18. parser generator using the skeleton or a modified version thereof
  19. as a parser skeleton. Alternatively, if you modify or redistribute
  20. the parser skeleton itself, you may (at your option) remove this
  21. special exception, which will cause the skeleton and the resulting
  22. Bison output files to be licensed under the GNU General Public
  23. License without this special exception.
  24. This special exception was added by the Free Software Foundation in
  25. version 2.2 of Bison. */
  26. /* C LALR(1) parser skeleton written by Richard Stallman, by
  27. simplifying the original so-called "semantic" parser. */
  28. /* All symbols defined below should begin with yy or YY, to avoid
  29. infringing on user name space. This should be done even for local
  30. variables, as they might otherwise be expanded by user macros.
  31. There are some unavoidable exceptions within include files to
  32. define necessary library symbols; they are noted "INFRINGES ON
  33. USER NAME SPACE" below. */
  34. /* Undocumented macros, especially those whose name start with YY_,
  35. are private implementation details. Do not rely on them. */
  36. /* Identify Bison output. */
  37. #define YYBISON 1
  38. /* Bison version. */
  39. #define YYBISON_VERSION "3.5.1"
  40. /* Skeleton name. */
  41. #define YYSKELETON_NAME "yacc.c"
  42. /* Pure parsers. */
  43. #define YYPURE 1
  44. /* Push parsers. */
  45. #define YYPUSH 0
  46. /* Pull parsers. */
  47. #define YYPULL 1
  48. /* Substitute the variable and function names. */
  49. #define yyparse ematch_parse
  50. #define yylex ematch_lex
  51. #define yyerror ematch_error
  52. #define yydebug ematch_debug
  53. #define yynerrs ematch_nerrs
  54. /* First part of user prologue. */
  55. #line 12 "route/cls/ematch_syntax.y"
  56. #include <netlink-private/netlink.h>
  57. #include <netlink-private/tc.h>
  58. #include <netlink/netlink.h>
  59. #include <netlink/utils.h>
  60. #include <netlink/route/pktloc.h>
  61. #include <netlink/route/cls/ematch.h>
  62. #include <netlink/route/cls/ematch/cmp.h>
  63. #include <netlink/route/cls/ematch/nbyte.h>
  64. #include <netlink/route/cls/ematch/text.h>
  65. #include <netlink/route/cls/ematch/meta.h>
  66. #define META_ALLOC rtnl_meta_value_alloc_id
  67. #define META_ID(name) TCF_META_ID_##name
  68. #define META_INT TCF_META_TYPE_INT
  69. #define META_VAR TCF_META_TYPE_VAR
  70. #line 93 "route/cls/ematch_syntax.c"
  71. # ifndef YY_CAST
  72. # ifdef __cplusplus
  73. # define YY_CAST(Type, Val) static_cast<Type> (Val)
  74. # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
  75. # else
  76. # define YY_CAST(Type, Val) ((Type) (Val))
  77. # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
  78. # endif
  79. # endif
  80. # ifndef YY_NULLPTR
  81. # if defined __cplusplus
  82. # if 201103L <= __cplusplus
  83. # define YY_NULLPTR nullptr
  84. # else
  85. # define YY_NULLPTR 0
  86. # endif
  87. # else
  88. # define YY_NULLPTR ((void*)0)
  89. # endif
  90. # endif
  91. /* Enabling verbose error messages. */
  92. #ifdef YYERROR_VERBOSE
  93. # undef YYERROR_VERBOSE
  94. # define YYERROR_VERBOSE 1
  95. #else
  96. # define YYERROR_VERBOSE 1
  97. #endif
  98. /* Use api.header.include to #include this header
  99. instead of duplicating it here. */
  100. #ifndef YY_EMATCH_ROUTE_CLS_EMATCH_SYNTAX_H_INCLUDED
  101. # define YY_EMATCH_ROUTE_CLS_EMATCH_SYNTAX_H_INCLUDED
  102. /* Debug traces. */
  103. #ifndef YYDEBUG
  104. # define YYDEBUG 0
  105. #endif
  106. #if YYDEBUG
  107. extern int ematch_debug;
  108. #endif
  109. /* Token type. */
  110. #ifndef YYTOKENTYPE
  111. # define YYTOKENTYPE
  112. enum yytokentype
  113. {
  114. ERROR = 258,
  115. LOGIC = 259,
  116. NOT = 260,
  117. OPERAND = 261,
  118. NUMBER = 262,
  119. ALIGN = 263,
  120. LAYER = 264,
  121. KW_OPEN = 265,
  122. KW_CLOSE = 266,
  123. KW_PLUS = 267,
  124. KW_MASK = 268,
  125. KW_SHIFT = 269,
  126. KW_AT = 270,
  127. EMATCH_CMP = 271,
  128. EMATCH_NBYTE = 272,
  129. EMATCH_TEXT = 273,
  130. EMATCH_META = 274,
  131. KW_EQ = 275,
  132. KW_GT = 276,
  133. KW_LT = 277,
  134. KW_FROM = 278,
  135. KW_TO = 279,
  136. META_RANDOM = 280,
  137. META_LOADAVG_0 = 281,
  138. META_LOADAVG_1 = 282,
  139. META_LOADAVG_2 = 283,
  140. META_DEV = 284,
  141. META_PRIO = 285,
  142. META_PROTO = 286,
  143. META_PKTTYPE = 287,
  144. META_PKTLEN = 288,
  145. META_DATALEN = 289,
  146. META_MACLEN = 290,
  147. META_MARK = 291,
  148. META_TCINDEX = 292,
  149. META_RTCLASSID = 293,
  150. META_RTIIF = 294,
  151. META_SK_FAMILY = 295,
  152. META_SK_STATE = 296,
  153. META_SK_REUSE = 297,
  154. META_SK_REFCNT = 298,
  155. META_SK_RCVBUF = 299,
  156. META_SK_SNDBUF = 300,
  157. META_SK_SHUTDOWN = 301,
  158. META_SK_PROTO = 302,
  159. META_SK_TYPE = 303,
  160. META_SK_RMEM_ALLOC = 304,
  161. META_SK_WMEM_ALLOC = 305,
  162. META_SK_WMEM_QUEUED = 306,
  163. META_SK_RCV_QLEN = 307,
  164. META_SK_SND_QLEN = 308,
  165. META_SK_ERR_QLEN = 309,
  166. META_SK_FORWARD_ALLOCS = 310,
  167. META_SK_ALLOCS = 311,
  168. META_SK_ROUTE_CAPS = 312,
  169. META_SK_HASH = 313,
  170. META_SK_LINGERTIME = 314,
  171. META_SK_ACK_BACKLOG = 315,
  172. META_SK_MAX_ACK_BACKLOG = 316,
  173. META_SK_PRIO = 317,
  174. META_SK_RCVLOWAT = 318,
  175. META_SK_RCVTIMEO = 319,
  176. META_SK_SNDTIMEO = 320,
  177. META_SK_SENDMSG_OFF = 321,
  178. META_SK_WRITE_PENDING = 322,
  179. META_VLAN = 323,
  180. META_RXHASH = 324,
  181. META_DEVNAME = 325,
  182. META_SK_BOUND_IF = 326,
  183. STR = 327,
  184. QUOTED = 328
  185. };
  186. #endif
  187. /* Tokens. */
  188. #define ERROR 258
  189. #define LOGIC 259
  190. #define NOT 260
  191. #define OPERAND 261
  192. #define NUMBER 262
  193. #define ALIGN 263
  194. #define LAYER 264
  195. #define KW_OPEN 265
  196. #define KW_CLOSE 266
  197. #define KW_PLUS 267
  198. #define KW_MASK 268
  199. #define KW_SHIFT 269
  200. #define KW_AT 270
  201. #define EMATCH_CMP 271
  202. #define EMATCH_NBYTE 272
  203. #define EMATCH_TEXT 273
  204. #define EMATCH_META 274
  205. #define KW_EQ 275
  206. #define KW_GT 276
  207. #define KW_LT 277
  208. #define KW_FROM 278
  209. #define KW_TO 279
  210. #define META_RANDOM 280
  211. #define META_LOADAVG_0 281
  212. #define META_LOADAVG_1 282
  213. #define META_LOADAVG_2 283
  214. #define META_DEV 284
  215. #define META_PRIO 285
  216. #define META_PROTO 286
  217. #define META_PKTTYPE 287
  218. #define META_PKTLEN 288
  219. #define META_DATALEN 289
  220. #define META_MACLEN 290
  221. #define META_MARK 291
  222. #define META_TCINDEX 292
  223. #define META_RTCLASSID 293
  224. #define META_RTIIF 294
  225. #define META_SK_FAMILY 295
  226. #define META_SK_STATE 296
  227. #define META_SK_REUSE 297
  228. #define META_SK_REFCNT 298
  229. #define META_SK_RCVBUF 299
  230. #define META_SK_SNDBUF 300
  231. #define META_SK_SHUTDOWN 301
  232. #define META_SK_PROTO 302
  233. #define META_SK_TYPE 303
  234. #define META_SK_RMEM_ALLOC 304
  235. #define META_SK_WMEM_ALLOC 305
  236. #define META_SK_WMEM_QUEUED 306
  237. #define META_SK_RCV_QLEN 307
  238. #define META_SK_SND_QLEN 308
  239. #define META_SK_ERR_QLEN 309
  240. #define META_SK_FORWARD_ALLOCS 310
  241. #define META_SK_ALLOCS 311
  242. #define META_SK_ROUTE_CAPS 312
  243. #define META_SK_HASH 313
  244. #define META_SK_LINGERTIME 314
  245. #define META_SK_ACK_BACKLOG 315
  246. #define META_SK_MAX_ACK_BACKLOG 316
  247. #define META_SK_PRIO 317
  248. #define META_SK_RCVLOWAT 318
  249. #define META_SK_RCVTIMEO 319
  250. #define META_SK_SNDTIMEO 320
  251. #define META_SK_SENDMSG_OFF 321
  252. #define META_SK_WRITE_PENDING 322
  253. #define META_VLAN 323
  254. #define META_RXHASH 324
  255. #define META_DEVNAME 325
  256. #define META_SK_BOUND_IF 326
  257. #define STR 327
  258. #define QUOTED 328
  259. /* Value type. */
  260. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  261. union YYSTYPE
  262. {
  263. #line 39 "route/cls/ematch_syntax.y"
  264. struct tcf_em_cmp cmp;
  265. struct ematch_quoted q;
  266. struct rtnl_ematch * e;
  267. struct rtnl_pktloc * loc;
  268. struct rtnl_meta_value *mv;
  269. uint32_t i;
  270. uint64_t i64;
  271. char * s;
  272. #line 302 "route/cls/ematch_syntax.c"
  273. };
  274. typedef union YYSTYPE YYSTYPE;
  275. # define YYSTYPE_IS_TRIVIAL 1
  276. # define YYSTYPE_IS_DECLARED 1
  277. #endif
  278. int ematch_parse (void *scanner, char **errp, struct nl_list_head *root);
  279. #endif /* !YY_EMATCH_ROUTE_CLS_EMATCH_SYNTAX_H_INCLUDED */
  280. /* Second part of user prologue. */
  281. #line 50 "route/cls/ematch_syntax.y"
  282. extern int ematch_lex(YYSTYPE *, void *);
  283. static void yyerror(void *scanner, char **errp, struct nl_list_head *root, const char *msg)
  284. {
  285. if (msg)
  286. *errp = strdup(msg);
  287. else
  288. *errp = NULL;
  289. }
  290. #line 329 "route/cls/ematch_syntax.c"
  291. #ifdef short
  292. # undef short
  293. #endif
  294. /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
  295. <limits.h> and (if available) <stdint.h> are included
  296. so that the code can choose integer types of a good width. */
  297. #ifndef __PTRDIFF_MAX__
  298. # include <limits.h> /* INFRINGES ON USER NAME SPACE */
  299. # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  300. # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
  301. # define YY_STDINT_H
  302. # endif
  303. #endif
  304. /* Narrow types that promote to a signed type and that can represent a
  305. signed or unsigned integer of at least N bits. In tables they can
  306. save space and decrease cache pressure. Promoting to a signed type
  307. helps avoid bugs in integer arithmetic. */
  308. #ifdef __INT_LEAST8_MAX__
  309. typedef __INT_LEAST8_TYPE__ yytype_int8;
  310. #elif defined YY_STDINT_H
  311. typedef int_least8_t yytype_int8;
  312. #else
  313. typedef signed char yytype_int8;
  314. #endif
  315. #ifdef __INT_LEAST16_MAX__
  316. typedef __INT_LEAST16_TYPE__ yytype_int16;
  317. #elif defined YY_STDINT_H
  318. typedef int_least16_t yytype_int16;
  319. #else
  320. typedef short yytype_int16;
  321. #endif
  322. #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
  323. typedef __UINT_LEAST8_TYPE__ yytype_uint8;
  324. #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
  325. && UINT_LEAST8_MAX <= INT_MAX)
  326. typedef uint_least8_t yytype_uint8;
  327. #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
  328. typedef unsigned char yytype_uint8;
  329. #else
  330. typedef short yytype_uint8;
  331. #endif
  332. #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
  333. typedef __UINT_LEAST16_TYPE__ yytype_uint16;
  334. #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
  335. && UINT_LEAST16_MAX <= INT_MAX)
  336. typedef uint_least16_t yytype_uint16;
  337. #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
  338. typedef unsigned short yytype_uint16;
  339. #else
  340. typedef int yytype_uint16;
  341. #endif
  342. #ifndef YYPTRDIFF_T
  343. # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
  344. # define YYPTRDIFF_T __PTRDIFF_TYPE__
  345. # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
  346. # elif defined PTRDIFF_MAX
  347. # ifndef ptrdiff_t
  348. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  349. # endif
  350. # define YYPTRDIFF_T ptrdiff_t
  351. # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
  352. # else
  353. # define YYPTRDIFF_T long
  354. # define YYPTRDIFF_MAXIMUM LONG_MAX
  355. # endif
  356. #endif
  357. #ifndef YYSIZE_T
  358. # ifdef __SIZE_TYPE__
  359. # define YYSIZE_T __SIZE_TYPE__
  360. # elif defined size_t
  361. # define YYSIZE_T size_t
  362. # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
  363. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  364. # define YYSIZE_T size_t
  365. # else
  366. # define YYSIZE_T unsigned
  367. # endif
  368. #endif
  369. #define YYSIZE_MAXIMUM \
  370. YY_CAST (YYPTRDIFF_T, \
  371. (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
  372. ? YYPTRDIFF_MAXIMUM \
  373. : YY_CAST (YYSIZE_T, -1)))
  374. #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
  375. /* Stored state numbers (used for stacks). */
  376. typedef yytype_int8 yy_state_t;
  377. /* State numbers in computations. */
  378. typedef int yy_state_fast_t;
  379. #ifndef YY_
  380. # if defined YYENABLE_NLS && YYENABLE_NLS
  381. # if ENABLE_NLS
  382. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  383. # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
  384. # endif
  385. # endif
  386. # ifndef YY_
  387. # define YY_(Msgid) Msgid
  388. # endif
  389. #endif
  390. #ifndef YY_ATTRIBUTE_PURE
  391. # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
  392. # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
  393. # else
  394. # define YY_ATTRIBUTE_PURE
  395. # endif
  396. #endif
  397. #ifndef YY_ATTRIBUTE_UNUSED
  398. # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
  399. # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
  400. # else
  401. # define YY_ATTRIBUTE_UNUSED
  402. # endif
  403. #endif
  404. /* Suppress unused-variable warnings by "using" E. */
  405. #if ! defined lint || defined __GNUC__
  406. # define YYUSE(E) ((void) (E))
  407. #else
  408. # define YYUSE(E) /* empty */
  409. #endif
  410. #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  411. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  412. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  413. _Pragma ("GCC diagnostic push") \
  414. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
  415. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  416. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  417. _Pragma ("GCC diagnostic pop")
  418. #else
  419. # define YY_INITIAL_VALUE(Value) Value
  420. #endif
  421. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  422. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  423. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  424. #endif
  425. #ifndef YY_INITIAL_VALUE
  426. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  427. #endif
  428. #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
  429. # define YY_IGNORE_USELESS_CAST_BEGIN \
  430. _Pragma ("GCC diagnostic push") \
  431. _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
  432. # define YY_IGNORE_USELESS_CAST_END \
  433. _Pragma ("GCC diagnostic pop")
  434. #endif
  435. #ifndef YY_IGNORE_USELESS_CAST_BEGIN
  436. # define YY_IGNORE_USELESS_CAST_BEGIN
  437. # define YY_IGNORE_USELESS_CAST_END
  438. #endif
  439. #define YY_ASSERT(E) ((void) (0 && (E)))
  440. #if ! defined yyoverflow || YYERROR_VERBOSE
  441. /* The parser invokes alloca or malloc; define the necessary symbols. */
  442. # ifdef YYSTACK_USE_ALLOCA
  443. # if YYSTACK_USE_ALLOCA
  444. # ifdef __GNUC__
  445. # define YYSTACK_ALLOC __builtin_alloca
  446. # elif defined __BUILTIN_VA_ARG_INCR
  447. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  448. # elif defined _AIX
  449. # define YYSTACK_ALLOC __alloca
  450. # elif defined _MSC_VER
  451. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  452. # define alloca _alloca
  453. # else
  454. # define YYSTACK_ALLOC alloca
  455. # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
  456. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  457. /* Use EXIT_SUCCESS as a witness for stdlib.h. */
  458. # ifndef EXIT_SUCCESS
  459. # define EXIT_SUCCESS 0
  460. # endif
  461. # endif
  462. # endif
  463. # endif
  464. # endif
  465. # ifdef YYSTACK_ALLOC
  466. /* Pacify GCC's 'empty if-body' warning. */
  467. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  468. # ifndef YYSTACK_ALLOC_MAXIMUM
  469. /* The OS might guarantee only one guard page at the bottom of the stack,
  470. and a page size can be as small as 4096 bytes. So we cannot safely
  471. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  472. to allow for a few compiler-allocated temporary stack slots. */
  473. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  474. # endif
  475. # else
  476. # define YYSTACK_ALLOC YYMALLOC
  477. # define YYSTACK_FREE YYFREE
  478. # ifndef YYSTACK_ALLOC_MAXIMUM
  479. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  480. # endif
  481. # if (defined __cplusplus && ! defined EXIT_SUCCESS \
  482. && ! ((defined YYMALLOC || defined malloc) \
  483. && (defined YYFREE || defined free)))
  484. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  485. # ifndef EXIT_SUCCESS
  486. # define EXIT_SUCCESS 0
  487. # endif
  488. # endif
  489. # ifndef YYMALLOC
  490. # define YYMALLOC malloc
  491. # if ! defined malloc && ! defined EXIT_SUCCESS
  492. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  493. # endif
  494. # endif
  495. # ifndef YYFREE
  496. # define YYFREE free
  497. # if ! defined free && ! defined EXIT_SUCCESS
  498. void free (void *); /* INFRINGES ON USER NAME SPACE */
  499. # endif
  500. # endif
  501. # endif
  502. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  503. #if (! defined yyoverflow \
  504. && (! defined __cplusplus \
  505. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  506. /* A type that is properly aligned for any stack member. */
  507. union yyalloc
  508. {
  509. yy_state_t yyss_alloc;
  510. YYSTYPE yyvs_alloc;
  511. };
  512. /* The size of the maximum gap between one aligned stack and the next. */
  513. # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
  514. /* The size of an array large to enough to hold all stacks, each with
  515. N elements. */
  516. # define YYSTACK_BYTES(N) \
  517. ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
  518. + YYSTACK_GAP_MAXIMUM)
  519. # define YYCOPY_NEEDED 1
  520. /* Relocate STACK from its old location to the new one. The
  521. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  522. elements in the stack, and YYPTR gives the new location of the
  523. stack. Advance YYPTR to a properly aligned location for the next
  524. stack. */
  525. # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
  526. do \
  527. { \
  528. YYPTRDIFF_T yynewbytes; \
  529. YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
  530. Stack = &yyptr->Stack_alloc; \
  531. yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
  532. yyptr += yynewbytes / YYSIZEOF (*yyptr); \
  533. } \
  534. while (0)
  535. #endif
  536. #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
  537. /* Copy COUNT objects from SRC to DST. The source and destination do
  538. not overlap. */
  539. # ifndef YYCOPY
  540. # if defined __GNUC__ && 1 < __GNUC__
  541. # define YYCOPY(Dst, Src, Count) \
  542. __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
  543. # else
  544. # define YYCOPY(Dst, Src, Count) \
  545. do \
  546. { \
  547. YYPTRDIFF_T yyi; \
  548. for (yyi = 0; yyi < (Count); yyi++) \
  549. (Dst)[yyi] = (Src)[yyi]; \
  550. } \
  551. while (0)
  552. # endif
  553. # endif
  554. #endif /* !YYCOPY_NEEDED */
  555. /* YYFINAL -- State number of the termination state. */
  556. #define YYFINAL 26
  557. /* YYLAST -- Last index in YYTABLE. */
  558. #define YYLAST 138
  559. /* YYNTOKENS -- Number of terminals. */
  560. #define YYNTOKENS 74
  561. /* YYNNTS -- Number of nonterminals. */
  562. #define YYNNTS 18
  563. /* YYNRULES -- Number of rules. */
  564. #define YYNRULES 84
  565. /* YYNSTATES -- Number of states. */
  566. #define YYNSTATES 118
  567. #define YYUNDEFTOK 2
  568. #define YYMAXUTOK 328
  569. /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
  570. as returned by yylex, with out-of-bounds checking. */
  571. #define YYTRANSLATE(YYX) \
  572. (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  573. /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
  574. as returned by yylex. */
  575. static const yytype_int8 yytranslate[] =
  576. {
  577. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  578. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  579. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  580. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  581. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  582. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  583. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  584. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  585. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  586. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  587. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  588. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  589. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  590. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  591. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  592. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  593. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  594. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  595. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  596. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  597. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  598. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  599. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  600. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  601. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  602. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  603. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  604. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  605. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  606. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  607. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  608. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  609. 65, 66, 67, 68, 69, 70, 71, 72, 73
  610. };
  611. #if YYDEBUG
  612. /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
  613. static const yytype_int16 yyrline[] =
  614. {
  615. 0, 148, 148, 150, 157, 161, 173, 178, 186, 201,
  616. 219, 246, 265, 293, 295, 300, 321, 322, 328, 329,
  617. 334, 336, 338, 340, 345, 346, 347, 348, 349, 350,
  618. 351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
  619. 361, 362, 363, 364, 365, 366, 367, 368, 369, 370,
  620. 371, 372, 373, 374, 375, 376, 377, 378, 379, 380,
  621. 381, 382, 383, 384, 385, 386, 387, 388, 389, 393,
  622. 394, 401, 405, 434, 447, 473, 474, 476, 482, 483,
  623. 489, 490, 495, 497, 499
  624. };
  625. #endif
  626. #if YYDEBUG || YYERROR_VERBOSE || 1
  627. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  628. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  629. static const char *const yytname[] =
  630. {
  631. "$end", "error", "$undefined", "ERROR", "LOGIC", "NOT", "OPERAND",
  632. "NUMBER", "ALIGN", "LAYER", "\"(\"", "\")\"", "\"+\"", "\"mask\"",
  633. "\">>\"", "\"at\"", "\"cmp\"", "\"pattern\"", "\"text\"", "\"meta\"",
  634. "\"=\"", "\">\"", "\"<\"", "\"from\"", "\"to\"", "\"random\"",
  635. "\"loadavg_0\"", "\"loadavg_1\"", "\"loadavg_2\"", "\"dev\"", "\"prio\"",
  636. "\"proto\"", "\"pkttype\"", "\"pktlen\"", "\"datalen\"", "\"maclen\"",
  637. "\"mark\"", "\"tcindex\"", "\"rtclassid\"", "\"rtiif\"", "\"sk_family\"",
  638. "\"sk_state\"", "\"sk_reuse\"", "\"sk_refcnt\"", "\"sk_rcvbuf\"",
  639. "\"sk_sndbuf\"", "\"sk_shutdown\"", "\"sk_proto\"", "\"sk_type\"",
  640. "\"sk_rmem_alloc\"", "\"sk_wmem_alloc\"", "\"sk_wmem_queued\"",
  641. "\"sk_rcv_qlen\"", "\"sk_snd_qlen\"", "\"sk_err_qlen\"",
  642. "\"sk_forward_allocs\"", "\"sk_allocs\"", "\"sk_route_caps\"",
  643. "\"sk_hash\"", "\"sk_lingertime\"", "\"sk_ack_backlog\"",
  644. "\"sk_max_ack_backlog\"", "\"sk_prio\"", "\"sk_rcvlowat\"",
  645. "\"sk_rcvtimeo\"", "\"sk_sndtimeo\"", "\"sk_sendmsg_off\"",
  646. "\"sk_write_pending\"", "\"vlan\"", "\"rxhash\"", "\"devname\"",
  647. "\"sk_bound_if\"", "STR", "QUOTED", "$accept", "input", "expr", "match",
  648. "ematch", "cmp_match", "cmp_expr", "text_from", "text_to", "meta_value",
  649. "meta_int_id", "meta_var_id", "pattern", "pktloc", "align", "mask",
  650. "shift", "operand", YY_NULLPTR
  651. };
  652. #endif
  653. # ifdef YYPRINT
  654. /* YYTOKNUM[NUM] -- (External) token number corresponding to the
  655. (internal) symbol number NUM (which must be that of a token). */
  656. static const yytype_int16 yytoknum[] =
  657. {
  658. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  659. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  660. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  661. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  662. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  663. 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
  664. 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
  665. 325, 326, 327, 328
  666. };
  667. # endif
  668. #define YYPACT_NINF (-63)
  669. #define yypact_value_is_default(Yyn) \
  670. ((Yyn) == YYPACT_NINF)
  671. #define YYTABLE_NINF (-76)
  672. #define yytable_value_is_error(Yyn) \
  673. 0
  674. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  675. STATE-NUM. */
  676. static const yytype_int8 yypact[] =
  677. {
  678. -4, 15, -13, -8, 11, 10, 14, 25, 29, -63,
  679. 26, -63, 37, -63, -63, -63, 16, 33, -63, -63,
  680. -63, 32, 1, 1, -28, 65, -63, 11, -63, -63,
  681. -63, 38, 34, -63, 36, 28, -24, -63, -63, -63,
  682. -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
  683. -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
  684. -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
  685. -63, -63, -63, -63, -63, -63, -63, -63, -63, -63,
  686. -63, -63, -63, -63, -63, -63, 16, 39, 39, -63,
  687. -63, 43, -63, -62, 31, 65, 44, 42, -63, 42,
  688. -63, -63, 41, 1, 35, 45, -63, 50, -63, -63,
  689. -63, -63, 1, 47, -63, -63, -63, -63
  690. };
  691. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  692. Performed when YYTABLE does not specify something else to do. Zero
  693. means the default is an error. */
  694. static const yytype_int8 yydefact[] =
  695. {
  696. 2, 75, 0, 0, 75, 0, 0, 0, 0, 73,
  697. 0, 3, 4, 7, 8, 14, 0, 0, 6, 77,
  698. 76, 0, 75, 75, 0, 0, 1, 75, 82, 83,
  699. 84, 0, 0, 12, 0, 0, 0, 21, 24, 25,
  700. 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
  701. 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
  702. 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
  703. 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
  704. 66, 67, 68, 69, 70, 20, 0, 80, 80, 5,
  705. 15, 0, 13, 0, 16, 0, 0, 78, 23, 78,
  706. 72, 71, 0, 75, 18, 0, 81, 0, 22, 74,
  707. 9, 17, 75, 0, 11, 79, 19, 10
  708. };
  709. /* YYPGOTO[NTERM-NUM]. */
  710. static const yytype_int8 yypgoto[] =
  711. {
  712. -63, -63, 13, -63, 59, -63, 40, -63, -63, -34,
  713. -63, -63, -63, -23, -63, -36, -22, -21
  714. };
  715. /* YYDEFGOTO[NTERM-NUM]. */
  716. static const yytype_int8 yydefgoto[] =
  717. {
  718. -1, 10, 11, 12, 13, 14, 15, 104, 113, 86,
  719. 87, 88, 102, 16, 17, 108, 97, 31
  720. };
  721. /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  722. positive, shift that token. If negative, reduce the rule whose
  723. number is the opposite. If YYTABLE_NINF, syntax error. */
  724. static const yytype_int8 yytable[] =
  725. {
  726. 35, 1, 19, 2, 3, -75, 4, 20, 2, 3,
  727. 100, 101, 5, 6, 7, 8, 1, 21, 2, 3,
  728. 22, 4, 2, 3, 23, 4, 26, 5, 6, 7,
  729. 8, 5, 6, 7, 8, 24, 28, 29, 30, 25,
  730. 89, 27, 32, 33, 36, 90, 91, 92, 93, 94,
  731. 99, 106, 110, 96, 103, 107, 114, 115, 117, 112,
  732. 18, 105, 34, 109, 0, 95, 98, 0, 9, 0,
  733. 0, 0, 37, 9, 0, 0, 0, 0, 0, 0,
  734. 111, 0, 0, 9, 0, 0, 0, 9, 0, 116,
  735. 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
  736. 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
  737. 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
  738. 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
  739. 78, 79, 80, 81, 82, 83, 84, 0, 85
  740. };
  741. static const yytype_int8 yycheck[] =
  742. {
  743. 23, 5, 15, 7, 8, 9, 10, 15, 7, 8,
  744. 72, 73, 16, 17, 18, 19, 5, 4, 7, 8,
  745. 10, 10, 7, 8, 10, 10, 0, 16, 17, 18,
  746. 19, 16, 17, 18, 19, 10, 20, 21, 22, 10,
  747. 27, 4, 9, 11, 72, 7, 12, 11, 20, 73,
  748. 7, 7, 11, 14, 23, 13, 11, 7, 11, 24,
  749. 1, 95, 22, 99, -1, 86, 88, -1, 72, -1,
  750. -1, -1, 7, 72, -1, -1, -1, -1, -1, -1,
  751. 103, -1, -1, 72, -1, -1, -1, 72, -1, 112,
  752. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  753. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  754. 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
  755. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  756. 65, 66, 67, 68, 69, 70, 71, -1, 73
  757. };
  758. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  759. symbol of state STATE-NUM. */
  760. static const yytype_int8 yystos[] =
  761. {
  762. 0, 5, 7, 8, 10, 16, 17, 18, 19, 72,
  763. 75, 76, 77, 78, 79, 80, 87, 88, 78, 15,
  764. 15, 76, 10, 10, 10, 10, 0, 4, 20, 21,
  765. 22, 91, 9, 11, 80, 87, 72, 7, 25, 26,
  766. 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
  767. 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
  768. 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
  769. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
  770. 67, 68, 69, 70, 71, 73, 83, 84, 85, 76,
  771. 7, 12, 11, 20, 73, 91, 14, 90, 90, 7,
  772. 72, 73, 86, 23, 81, 83, 7, 13, 89, 89,
  773. 11, 87, 24, 82, 11, 7, 87, 11
  774. };
  775. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  776. static const yytype_int8 yyr1[] =
  777. {
  778. 0, 74, 75, 75, 76, 76, 77, 77, 78, 78,
  779. 78, 78, 78, 79, 79, 80, 81, 81, 82, 82,
  780. 83, 83, 83, 83, 84, 84, 84, 84, 84, 84,
  781. 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
  782. 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
  783. 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
  784. 84, 84, 84, 84, 84, 84, 84, 84, 84, 85,
  785. 85, 86, 86, 87, 87, 88, 88, 88, 89, 89,
  786. 90, 90, 91, 91, 91
  787. };
  788. /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
  789. static const yytype_int8 yyr2[] =
  790. {
  791. 0, 2, 0, 1, 1, 3, 2, 1, 1, 6,
  792. 7, 6, 3, 4, 1, 3, 0, 2, 0, 2,
  793. 1, 1, 3, 2, 1, 1, 1, 1, 1, 1,
  794. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  795. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  796. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  797. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  798. 1, 1, 1, 1, 5, 0, 2, 2, 0, 2,
  799. 0, 2, 1, 1, 1
  800. };
  801. #define yyerrok (yyerrstatus = 0)
  802. #define yyclearin (yychar = YYEMPTY)
  803. #define YYEMPTY (-2)
  804. #define YYEOF 0
  805. #define YYACCEPT goto yyacceptlab
  806. #define YYABORT goto yyabortlab
  807. #define YYERROR goto yyerrorlab
  808. #define YYRECOVERING() (!!yyerrstatus)
  809. #define YYBACKUP(Token, Value) \
  810. do \
  811. if (yychar == YYEMPTY) \
  812. { \
  813. yychar = (Token); \
  814. yylval = (Value); \
  815. YYPOPSTACK (yylen); \
  816. yystate = *yyssp; \
  817. goto yybackup; \
  818. } \
  819. else \
  820. { \
  821. yyerror (scanner, errp, root, YY_("syntax error: cannot back up")); \
  822. YYERROR; \
  823. } \
  824. while (0)
  825. /* Error token number */
  826. #define YYTERROR 1
  827. #define YYERRCODE 256
  828. /* Enable debugging if requested. */
  829. #if YYDEBUG
  830. # ifndef YYFPRINTF
  831. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  832. # define YYFPRINTF fprintf
  833. # endif
  834. # define YYDPRINTF(Args) \
  835. do { \
  836. if (yydebug) \
  837. YYFPRINTF Args; \
  838. } while (0)
  839. /* This macro is provided for backward compatibility. */
  840. #ifndef YY_LOCATION_PRINT
  841. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  842. #endif
  843. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  844. do { \
  845. if (yydebug) \
  846. { \
  847. YYFPRINTF (stderr, "%s ", Title); \
  848. yy_symbol_print (stderr, \
  849. Type, Value, scanner, errp, root); \
  850. YYFPRINTF (stderr, "\n"); \
  851. } \
  852. } while (0)
  853. /*-----------------------------------.
  854. | Print this symbol's value on YYO. |
  855. `-----------------------------------*/
  856. static void
  857. yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
  858. {
  859. FILE *yyoutput = yyo;
  860. YYUSE (yyoutput);
  861. YYUSE (scanner);
  862. YYUSE (errp);
  863. YYUSE (root);
  864. if (!yyvaluep)
  865. return;
  866. # ifdef YYPRINT
  867. if (yytype < YYNTOKENS)
  868. YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
  869. # endif
  870. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  871. YYUSE (yytype);
  872. YY_IGNORE_MAYBE_UNINITIALIZED_END
  873. }
  874. /*---------------------------.
  875. | Print this symbol on YYO. |
  876. `---------------------------*/
  877. static void
  878. yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
  879. {
  880. YYFPRINTF (yyo, "%s %s (",
  881. yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
  882. yy_symbol_value_print (yyo, yytype, yyvaluep, scanner, errp, root);
  883. YYFPRINTF (yyo, ")");
  884. }
  885. /*------------------------------------------------------------------.
  886. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  887. | TOP (included). |
  888. `------------------------------------------------------------------*/
  889. static void
  890. yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
  891. {
  892. YYFPRINTF (stderr, "Stack now");
  893. for (; yybottom <= yytop; yybottom++)
  894. {
  895. int yybot = *yybottom;
  896. YYFPRINTF (stderr, " %d", yybot);
  897. }
  898. YYFPRINTF (stderr, "\n");
  899. }
  900. # define YY_STACK_PRINT(Bottom, Top) \
  901. do { \
  902. if (yydebug) \
  903. yy_stack_print ((Bottom), (Top)); \
  904. } while (0)
  905. /*------------------------------------------------.
  906. | Report that the YYRULE is going to be reduced. |
  907. `------------------------------------------------*/
  908. static void
  909. yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, void *scanner, char **errp, struct nl_list_head *root)
  910. {
  911. int yylno = yyrline[yyrule];
  912. int yynrhs = yyr2[yyrule];
  913. int yyi;
  914. YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
  915. yyrule - 1, yylno);
  916. /* The symbols being reduced. */
  917. for (yyi = 0; yyi < yynrhs; yyi++)
  918. {
  919. YYFPRINTF (stderr, " $%d = ", yyi + 1);
  920. yy_symbol_print (stderr,
  921. yystos[+yyssp[yyi + 1 - yynrhs]],
  922. &yyvsp[(yyi + 1) - (yynrhs)]
  923. , scanner, errp, root);
  924. YYFPRINTF (stderr, "\n");
  925. }
  926. }
  927. # define YY_REDUCE_PRINT(Rule) \
  928. do { \
  929. if (yydebug) \
  930. yy_reduce_print (yyssp, yyvsp, Rule, scanner, errp, root); \
  931. } while (0)
  932. /* Nonzero means print parse trace. It is left uninitialized so that
  933. multiple parsers can coexist. */
  934. int yydebug;
  935. #else /* !YYDEBUG */
  936. # define YYDPRINTF(Args)
  937. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  938. # define YY_STACK_PRINT(Bottom, Top)
  939. # define YY_REDUCE_PRINT(Rule)
  940. #endif /* !YYDEBUG */
  941. /* YYINITDEPTH -- initial size of the parser's stacks. */
  942. #ifndef YYINITDEPTH
  943. # define YYINITDEPTH 200
  944. #endif
  945. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  946. if the built-in stack extension method is used).
  947. Do not make this value too large; the results are undefined if
  948. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  949. evaluated with infinite-precision integer arithmetic. */
  950. #ifndef YYMAXDEPTH
  951. # define YYMAXDEPTH 10000
  952. #endif
  953. #if YYERROR_VERBOSE
  954. # ifndef yystrlen
  955. # if defined __GLIBC__ && defined _STRING_H
  956. # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
  957. # else
  958. /* Return the length of YYSTR. */
  959. static YYPTRDIFF_T
  960. yystrlen (const char *yystr)
  961. {
  962. YYPTRDIFF_T yylen;
  963. for (yylen = 0; yystr[yylen]; yylen++)
  964. continue;
  965. return yylen;
  966. }
  967. # endif
  968. # endif
  969. # ifndef yystpcpy
  970. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  971. # define yystpcpy stpcpy
  972. # else
  973. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  974. YYDEST. */
  975. static char *
  976. yystpcpy (char *yydest, const char *yysrc)
  977. {
  978. char *yyd = yydest;
  979. const char *yys = yysrc;
  980. while ((*yyd++ = *yys++) != '\0')
  981. continue;
  982. return yyd - 1;
  983. }
  984. # endif
  985. # endif
  986. # ifndef yytnamerr
  987. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  988. quotes and backslashes, so that it's suitable for yyerror. The
  989. heuristic is that double-quoting is unnecessary unless the string
  990. contains an apostrophe, a comma, or backslash (other than
  991. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  992. null, do not copy; instead, return the length of what the result
  993. would have been. */
  994. static YYPTRDIFF_T
  995. yytnamerr (char *yyres, const char *yystr)
  996. {
  997. if (*yystr == '"')
  998. {
  999. YYPTRDIFF_T yyn = 0;
  1000. char const *yyp = yystr;
  1001. for (;;)
  1002. switch (*++yyp)
  1003. {
  1004. case '\'':
  1005. case ',':
  1006. goto do_not_strip_quotes;
  1007. case '\\':
  1008. if (*++yyp != '\\')
  1009. goto do_not_strip_quotes;
  1010. else
  1011. goto append;
  1012. append:
  1013. default:
  1014. if (yyres)
  1015. yyres[yyn] = *yyp;
  1016. yyn++;
  1017. break;
  1018. case '"':
  1019. if (yyres)
  1020. yyres[yyn] = '\0';
  1021. return yyn;
  1022. }
  1023. do_not_strip_quotes: ;
  1024. }
  1025. if (yyres)
  1026. return yystpcpy (yyres, yystr) - yyres;
  1027. else
  1028. return yystrlen (yystr);
  1029. }
  1030. # endif
  1031. /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
  1032. about the unexpected token YYTOKEN for the state stack whose top is
  1033. YYSSP.
  1034. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
  1035. not large enough to hold the message. In that case, also set
  1036. *YYMSG_ALLOC to the required number of bytes. Return 2 if the
  1037. required number of bytes is too large to store. */
  1038. static int
  1039. yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
  1040. yy_state_t *yyssp, int yytoken)
  1041. {
  1042. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1043. /* Internationalized format string. */
  1044. const char *yyformat = YY_NULLPTR;
  1045. /* Arguments of yyformat: reported tokens (one for the "unexpected",
  1046. one per "expected"). */
  1047. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1048. /* Actual size of YYARG. */
  1049. int yycount = 0;
  1050. /* Cumulated lengths of YYARG. */
  1051. YYPTRDIFF_T yysize = 0;
  1052. /* There are many possibilities here to consider:
  1053. - If this state is a consistent state with a default action, then
  1054. the only way this function was invoked is if the default action
  1055. is an error action. In that case, don't check for expected
  1056. tokens because there are none.
  1057. - The only way there can be no lookahead present (in yychar) is if
  1058. this state is a consistent state with a default action. Thus,
  1059. detecting the absence of a lookahead is sufficient to determine
  1060. that there is no unexpected or expected token to report. In that
  1061. case, just report a simple "syntax error".
  1062. - Don't assume there isn't a lookahead just because this state is a
  1063. consistent state with a default action. There might have been a
  1064. previous inconsistent state, consistent state with a non-default
  1065. action, or user semantic action that manipulated yychar.
  1066. - Of course, the expected token list depends on states to have
  1067. correct lookahead information, and it depends on the parser not
  1068. to perform extra reductions after fetching a lookahead from the
  1069. scanner and before detecting a syntax error. Thus, state merging
  1070. (from LALR or IELR) and default reductions corrupt the expected
  1071. token list. However, the list is correct for canonical LR with
  1072. one exception: it will still contain any token that will not be
  1073. accepted due to an error action in a later state.
  1074. */
  1075. if (yytoken != YYEMPTY)
  1076. {
  1077. int yyn = yypact[+*yyssp];
  1078. YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
  1079. yysize = yysize0;
  1080. yyarg[yycount++] = yytname[yytoken];
  1081. if (!yypact_value_is_default (yyn))
  1082. {
  1083. /* Start YYX at -YYN if negative to avoid negative indexes in
  1084. YYCHECK. In other words, skip the first -YYN actions for
  1085. this state because they are default actions. */
  1086. int yyxbegin = yyn < 0 ? -yyn : 0;
  1087. /* Stay within bounds of both yycheck and yytname. */
  1088. int yychecklim = YYLAST - yyn + 1;
  1089. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1090. int yyx;
  1091. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1092. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
  1093. && !yytable_value_is_error (yytable[yyx + yyn]))
  1094. {
  1095. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1096. {
  1097. yycount = 1;
  1098. yysize = yysize0;
  1099. break;
  1100. }
  1101. yyarg[yycount++] = yytname[yyx];
  1102. {
  1103. YYPTRDIFF_T yysize1
  1104. = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
  1105. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  1106. yysize = yysize1;
  1107. else
  1108. return 2;
  1109. }
  1110. }
  1111. }
  1112. }
  1113. switch (yycount)
  1114. {
  1115. # define YYCASE_(N, S) \
  1116. case N: \
  1117. yyformat = S; \
  1118. break
  1119. default: /* Avoid compiler warnings. */
  1120. YYCASE_(0, YY_("syntax error"));
  1121. YYCASE_(1, YY_("syntax error, unexpected %s"));
  1122. YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
  1123. YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
  1124. YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
  1125. YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
  1126. # undef YYCASE_
  1127. }
  1128. {
  1129. /* Don't count the "%s"s in the final size, but reserve room for
  1130. the terminator. */
  1131. YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
  1132. if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
  1133. yysize = yysize1;
  1134. else
  1135. return 2;
  1136. }
  1137. if (*yymsg_alloc < yysize)
  1138. {
  1139. *yymsg_alloc = 2 * yysize;
  1140. if (! (yysize <= *yymsg_alloc
  1141. && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
  1142. *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
  1143. return 1;
  1144. }
  1145. /* Avoid sprintf, as that infringes on the user's name space.
  1146. Don't have undefined behavior even if the translation
  1147. produced a string with the wrong number of "%s"s. */
  1148. {
  1149. char *yyp = *yymsg;
  1150. int yyi = 0;
  1151. while ((*yyp = *yyformat) != '\0')
  1152. if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
  1153. {
  1154. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1155. yyformat += 2;
  1156. }
  1157. else
  1158. {
  1159. ++yyp;
  1160. ++yyformat;
  1161. }
  1162. }
  1163. return 0;
  1164. }
  1165. #endif /* YYERROR_VERBOSE */
  1166. /*-----------------------------------------------.
  1167. | Release the memory associated to this symbol. |
  1168. `-----------------------------------------------*/
  1169. static void
  1170. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, char **errp, struct nl_list_head *root)
  1171. {
  1172. YYUSE (yyvaluep);
  1173. YYUSE (scanner);
  1174. YYUSE (errp);
  1175. YYUSE (root);
  1176. if (!yymsg)
  1177. yymsg = "Deleting";
  1178. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1179. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1180. switch (yytype)
  1181. {
  1182. case 72: /* STR */
  1183. #line 139 "route/cls/ematch_syntax.y"
  1184. { free(((*yyvaluep).s)); NL_DBG(2, "string destructor\n"); }
  1185. #line 1340 "route/cls/ematch_syntax.c"
  1186. break;
  1187. case 73: /* QUOTED */
  1188. #line 141 "route/cls/ematch_syntax.y"
  1189. { free(((*yyvaluep).q).data); NL_DBG(2, "quoted destructor\n"); }
  1190. #line 1346 "route/cls/ematch_syntax.c"
  1191. break;
  1192. case 81: /* text_from */
  1193. #line 140 "route/cls/ematch_syntax.y"
  1194. { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
  1195. #line 1352 "route/cls/ematch_syntax.c"
  1196. break;
  1197. case 82: /* text_to */
  1198. #line 140 "route/cls/ematch_syntax.y"
  1199. { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
  1200. #line 1358 "route/cls/ematch_syntax.c"
  1201. break;
  1202. case 83: /* meta_value */
  1203. #line 142 "route/cls/ematch_syntax.y"
  1204. { rtnl_meta_value_put(((*yyvaluep).mv)); NL_DBG(2, "meta value destructor\n"); }
  1205. #line 1364 "route/cls/ematch_syntax.c"
  1206. break;
  1207. case 86: /* pattern */
  1208. #line 141 "route/cls/ematch_syntax.y"
  1209. { free(((*yyvaluep).q).data); NL_DBG(2, "quoted destructor\n"); }
  1210. #line 1370 "route/cls/ematch_syntax.c"
  1211. break;
  1212. case 87: /* pktloc */
  1213. #line 140 "route/cls/ematch_syntax.y"
  1214. { rtnl_pktloc_put(((*yyvaluep).loc)); NL_DBG(2, "pktloc destructor\n"); }
  1215. #line 1376 "route/cls/ematch_syntax.c"
  1216. break;
  1217. default:
  1218. break;
  1219. }
  1220. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1221. }
  1222. /*----------.
  1223. | yyparse. |
  1224. `----------*/
  1225. int
  1226. yyparse (void *scanner, char **errp, struct nl_list_head *root)
  1227. {
  1228. /* The lookahead symbol. */
  1229. int yychar;
  1230. /* The semantic value of the lookahead symbol. */
  1231. /* Default value used for initialization, for pacifying older GCCs
  1232. or non-GCC compilers. */
  1233. YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1234. YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1235. /* Number of syntax errors so far. */
  1236. int yynerrs;
  1237. yy_state_fast_t yystate;
  1238. /* Number of tokens to shift before error messages enabled. */
  1239. int yyerrstatus;
  1240. /* The stacks and their tools:
  1241. 'yyss': related to states.
  1242. 'yyvs': related to semantic values.
  1243. Refer to the stacks through separate pointers, to allow yyoverflow
  1244. to reallocate them elsewhere. */
  1245. /* The state stack. */
  1246. yy_state_t yyssa[YYINITDEPTH];
  1247. yy_state_t *yyss;
  1248. yy_state_t *yyssp;
  1249. /* The semantic value stack. */
  1250. YYSTYPE yyvsa[YYINITDEPTH];
  1251. YYSTYPE *yyvs;
  1252. YYSTYPE *yyvsp;
  1253. YYPTRDIFF_T yystacksize;
  1254. int yyn;
  1255. int yyresult;
  1256. /* Lookahead token as an internal (translated) token number. */
  1257. int yytoken = 0;
  1258. /* The variables used to return semantic value and location from the
  1259. action routines. */
  1260. YYSTYPE yyval;
  1261. #if YYERROR_VERBOSE
  1262. /* Buffer for error messages, and its allocated size. */
  1263. char yymsgbuf[128];
  1264. char *yymsg = yymsgbuf;
  1265. YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
  1266. #endif
  1267. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1268. /* The number of symbols on the RHS of the reduced rule.
  1269. Keep to zero when no symbol should be popped. */
  1270. int yylen = 0;
  1271. yyssp = yyss = yyssa;
  1272. yyvsp = yyvs = yyvsa;
  1273. yystacksize = YYINITDEPTH;
  1274. YYDPRINTF ((stderr, "Starting parse\n"));
  1275. yystate = 0;
  1276. yyerrstatus = 0;
  1277. yynerrs = 0;
  1278. yychar = YYEMPTY; /* Cause a token to be read. */
  1279. goto yysetstate;
  1280. /*------------------------------------------------------------.
  1281. | yynewstate -- push a new state, which is found in yystate. |
  1282. `------------------------------------------------------------*/
  1283. yynewstate:
  1284. /* In all cases, when you get here, the value and location stacks
  1285. have just been pushed. So pushing a state here evens the stacks. */
  1286. yyssp++;
  1287. /*--------------------------------------------------------------------.
  1288. | yysetstate -- set current state (the top of the stack) to yystate. |
  1289. `--------------------------------------------------------------------*/
  1290. yysetstate:
  1291. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1292. YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
  1293. YY_IGNORE_USELESS_CAST_BEGIN
  1294. *yyssp = YY_CAST (yy_state_t, yystate);
  1295. YY_IGNORE_USELESS_CAST_END
  1296. if (yyss + yystacksize - 1 <= yyssp)
  1297. #if !defined yyoverflow && !defined YYSTACK_RELOCATE
  1298. goto yyexhaustedlab;
  1299. #else
  1300. {
  1301. /* Get the current used size of the three stacks, in elements. */
  1302. YYPTRDIFF_T yysize = yyssp - yyss + 1;
  1303. # if defined yyoverflow
  1304. {
  1305. /* Give user a chance to reallocate the stack. Use copies of
  1306. these so that the &'s don't force the real ones into
  1307. memory. */
  1308. yy_state_t *yyss1 = yyss;
  1309. YYSTYPE *yyvs1 = yyvs;
  1310. /* Each stack pointer address is followed by the size of the
  1311. data in use in that stack, in bytes. This used to be a
  1312. conditional around just the two extra args, but that might
  1313. be undefined if yyoverflow is a macro. */
  1314. yyoverflow (YY_("memory exhausted"),
  1315. &yyss1, yysize * YYSIZEOF (*yyssp),
  1316. &yyvs1, yysize * YYSIZEOF (*yyvsp),
  1317. &yystacksize);
  1318. yyss = yyss1;
  1319. yyvs = yyvs1;
  1320. }
  1321. # else /* defined YYSTACK_RELOCATE */
  1322. /* Extend the stack our own way. */
  1323. if (YYMAXDEPTH <= yystacksize)
  1324. goto yyexhaustedlab;
  1325. yystacksize *= 2;
  1326. if (YYMAXDEPTH < yystacksize)
  1327. yystacksize = YYMAXDEPTH;
  1328. {
  1329. yy_state_t *yyss1 = yyss;
  1330. union yyalloc *yyptr =
  1331. YY_CAST (union yyalloc *,
  1332. YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
  1333. if (! yyptr)
  1334. goto yyexhaustedlab;
  1335. YYSTACK_RELOCATE (yyss_alloc, yyss);
  1336. YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1337. # undef YYSTACK_RELOCATE
  1338. if (yyss1 != yyssa)
  1339. YYSTACK_FREE (yyss1);
  1340. }
  1341. # endif
  1342. yyssp = yyss + yysize - 1;
  1343. yyvsp = yyvs + yysize - 1;
  1344. YY_IGNORE_USELESS_CAST_BEGIN
  1345. YYDPRINTF ((stderr, "Stack size increased to %ld\n",
  1346. YY_CAST (long, yystacksize)));
  1347. YY_IGNORE_USELESS_CAST_END
  1348. if (yyss + yystacksize - 1 <= yyssp)
  1349. YYABORT;
  1350. }
  1351. #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
  1352. if (yystate == YYFINAL)
  1353. YYACCEPT;
  1354. goto yybackup;
  1355. /*-----------.
  1356. | yybackup. |
  1357. `-----------*/
  1358. yybackup:
  1359. /* Do appropriate processing given the current state. Read a
  1360. lookahead token if we need one and don't already have one. */
  1361. /* First try to decide what to do without reference to lookahead token. */
  1362. yyn = yypact[yystate];
  1363. if (yypact_value_is_default (yyn))
  1364. goto yydefault;
  1365. /* Not known => get a lookahead token if don't already have one. */
  1366. /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
  1367. if (yychar == YYEMPTY)
  1368. {
  1369. YYDPRINTF ((stderr, "Reading a token: "));
  1370. yychar = yylex (&yylval, scanner);
  1371. }
  1372. if (yychar <= YYEOF)
  1373. {
  1374. yychar = yytoken = YYEOF;
  1375. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1376. }
  1377. else
  1378. {
  1379. yytoken = YYTRANSLATE (yychar);
  1380. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1381. }
  1382. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1383. detect an error, take that action. */
  1384. yyn += yytoken;
  1385. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1386. goto yydefault;
  1387. yyn = yytable[yyn];
  1388. if (yyn <= 0)
  1389. {
  1390. if (yytable_value_is_error (yyn))
  1391. goto yyerrlab;
  1392. yyn = -yyn;
  1393. goto yyreduce;
  1394. }
  1395. /* Count tokens shifted since error; after three, turn off error
  1396. status. */
  1397. if (yyerrstatus)
  1398. yyerrstatus--;
  1399. /* Shift the lookahead token. */
  1400. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1401. yystate = yyn;
  1402. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1403. *++yyvsp = yylval;
  1404. YY_IGNORE_MAYBE_UNINITIALIZED_END
  1405. /* Discard the shifted token. */
  1406. yychar = YYEMPTY;
  1407. goto yynewstate;
  1408. /*-----------------------------------------------------------.
  1409. | yydefault -- do the default action for the current state. |
  1410. `-----------------------------------------------------------*/
  1411. yydefault:
  1412. yyn = yydefact[yystate];
  1413. if (yyn == 0)
  1414. goto yyerrlab;
  1415. goto yyreduce;
  1416. /*-----------------------------.
  1417. | yyreduce -- do a reduction. |
  1418. `-----------------------------*/
  1419. yyreduce:
  1420. /* yyn is the number of a rule to reduce with. */
  1421. yylen = yyr2[yyn];
  1422. /* If YYLEN is nonzero, implement the default value of the action:
  1423. '$$ = $1'.
  1424. Otherwise, the following line sets YYVAL to garbage.
  1425. This behavior is undocumented and Bison
  1426. users should not rely upon it. Assigning to YYVAL
  1427. unconditionally makes the parser a bit smaller, and it avoids a
  1428. GCC warning that YYVAL may be used uninitialized. */
  1429. yyval = yyvsp[1-yylen];
  1430. YY_REDUCE_PRINT (yyn);
  1431. switch (yyn)
  1432. {
  1433. case 3:
  1434. #line 151 "route/cls/ematch_syntax.y"
  1435. {
  1436. nl_list_add_tail(root, &(yyvsp[0].e)->e_list);
  1437. }
  1438. #line 1652 "route/cls/ematch_syntax.c"
  1439. break;
  1440. case 4:
  1441. #line 158 "route/cls/ematch_syntax.y"
  1442. {
  1443. (yyval.e) = (yyvsp[0].e);
  1444. }
  1445. #line 1660 "route/cls/ematch_syntax.c"
  1446. break;
  1447. case 5:
  1448. #line 162 "route/cls/ematch_syntax.y"
  1449. {
  1450. rtnl_ematch_set_flags((yyvsp[-2].e), (yyvsp[-1].i));
  1451. /* make ematch new head */
  1452. nl_list_add_tail(&(yyvsp[-2].e)->e_list, &(yyvsp[0].e)->e_list);
  1453. (yyval.e) = (yyvsp[-2].e);
  1454. }
  1455. #line 1673 "route/cls/ematch_syntax.c"
  1456. break;
  1457. case 6:
  1458. #line 174 "route/cls/ematch_syntax.y"
  1459. {
  1460. rtnl_ematch_set_flags((yyvsp[0].e), TCF_EM_INVERT);
  1461. (yyval.e) = (yyvsp[0].e);
  1462. }
  1463. #line 1682 "route/cls/ematch_syntax.c"
  1464. break;
  1465. case 7:
  1466. #line 179 "route/cls/ematch_syntax.y"
  1467. {
  1468. (yyval.e) = (yyvsp[0].e);
  1469. }
  1470. #line 1690 "route/cls/ematch_syntax.c"
  1471. break;
  1472. case 8:
  1473. #line 187 "route/cls/ematch_syntax.y"
  1474. {
  1475. struct rtnl_ematch *e;
  1476. if (!(e = rtnl_ematch_alloc())) {
  1477. *errp = strdup("Unable to allocate ematch object");
  1478. YYABORT;
  1479. }
  1480. if (rtnl_ematch_set_kind(e, TCF_EM_CMP) < 0)
  1481. BUG();
  1482. rtnl_ematch_cmp_set(e, &(yyvsp[0].cmp));
  1483. (yyval.e) = e;
  1484. }
  1485. #line 1709 "route/cls/ematch_syntax.c"
  1486. break;
  1487. case 9:
  1488. #line 202 "route/cls/ematch_syntax.y"
  1489. {
  1490. struct rtnl_ematch *e;
  1491. if (!(e = rtnl_ematch_alloc())) {
  1492. *errp = strdup("Unable to allocate ematch object");
  1493. YYABORT;
  1494. }
  1495. if (rtnl_ematch_set_kind(e, TCF_EM_NBYTE) < 0)
  1496. BUG();
  1497. rtnl_ematch_nbyte_set_offset(e, (yyvsp[-3].loc)->layer, (yyvsp[-3].loc)->offset);
  1498. rtnl_pktloc_put((yyvsp[-3].loc));
  1499. rtnl_ematch_nbyte_set_pattern(e, (uint8_t *) (yyvsp[-1].q).data, (yyvsp[-1].q).index);
  1500. (yyval.e) = e;
  1501. }
  1502. #line 1731 "route/cls/ematch_syntax.c"
  1503. break;
  1504. case 10:
  1505. #line 220 "route/cls/ematch_syntax.y"
  1506. {
  1507. struct rtnl_ematch *e;
  1508. if (!(e = rtnl_ematch_alloc())) {
  1509. *errp = strdup("Unable to allocate ematch object");
  1510. YYABORT;
  1511. }
  1512. if (rtnl_ematch_set_kind(e, TCF_EM_TEXT) < 0)
  1513. BUG();
  1514. rtnl_ematch_text_set_algo(e, (yyvsp[-4].s));
  1515. rtnl_ematch_text_set_pattern(e, (yyvsp[-3].q).data, (yyvsp[-3].q).index);
  1516. if ((yyvsp[-2].loc)) {
  1517. rtnl_ematch_text_set_from(e, (yyvsp[-2].loc)->layer, (yyvsp[-2].loc)->offset);
  1518. rtnl_pktloc_put((yyvsp[-2].loc));
  1519. }
  1520. if ((yyvsp[-1].loc)) {
  1521. rtnl_ematch_text_set_to(e, (yyvsp[-1].loc)->layer, (yyvsp[-1].loc)->offset);
  1522. rtnl_pktloc_put((yyvsp[-1].loc));
  1523. }
  1524. (yyval.e) = e;
  1525. }
  1526. #line 1762 "route/cls/ematch_syntax.c"
  1527. break;
  1528. case 11:
  1529. #line 247 "route/cls/ematch_syntax.y"
  1530. {
  1531. struct rtnl_ematch *e;
  1532. if (!(e = rtnl_ematch_alloc())) {
  1533. *errp = strdup("Unable to allocate ematch object");
  1534. YYABORT;
  1535. }
  1536. if (rtnl_ematch_set_kind(e, TCF_EM_META) < 0)
  1537. BUG();
  1538. rtnl_ematch_meta_set_lvalue(e, (yyvsp[-3].mv));
  1539. rtnl_ematch_meta_set_rvalue(e, (yyvsp[-1].mv));
  1540. rtnl_ematch_meta_set_operand(e, (yyvsp[-2].i));
  1541. (yyval.e) = e;
  1542. }
  1543. #line 1784 "route/cls/ematch_syntax.c"
  1544. break;
  1545. case 12:
  1546. #line 266 "route/cls/ematch_syntax.y"
  1547. {
  1548. struct rtnl_ematch *e;
  1549. if (!(e = rtnl_ematch_alloc())) {
  1550. *errp = strdup("Unable to allocate ematch object");
  1551. YYABORT;
  1552. }
  1553. if (rtnl_ematch_set_kind(e, TCF_EM_CONTAINER) < 0)
  1554. BUG();
  1555. /* Make e->childs the list head of a the ematch sequence */
  1556. nl_list_add_tail(&e->e_childs, &(yyvsp[-1].e)->e_list);
  1557. (yyval.e) = e;
  1558. }
  1559. #line 1805 "route/cls/ematch_syntax.c"
  1560. break;
  1561. case 13:
  1562. #line 294 "route/cls/ematch_syntax.y"
  1563. { (yyval.cmp) = (yyvsp[-1].cmp); }
  1564. #line 1811 "route/cls/ematch_syntax.c"
  1565. break;
  1566. case 14:
  1567. #line 296 "route/cls/ematch_syntax.y"
  1568. { (yyval.cmp) = (yyvsp[0].cmp); }
  1569. #line 1817 "route/cls/ematch_syntax.c"
  1570. break;
  1571. case 15:
  1572. #line 301 "route/cls/ematch_syntax.y"
  1573. {
  1574. if ((yyvsp[-2].loc)->align == TCF_EM_ALIGN_U16 ||
  1575. (yyvsp[-2].loc)->align == TCF_EM_ALIGN_U32)
  1576. (yyval.cmp).flags = TCF_EM_CMP_TRANS;
  1577. memset(&(yyval.cmp), 0, sizeof((yyval.cmp)));
  1578. (yyval.cmp).mask = (yyvsp[-2].loc)->mask;
  1579. (yyval.cmp).off = (yyvsp[-2].loc)->offset;
  1580. (yyval.cmp).align = (yyvsp[-2].loc)->align;
  1581. (yyval.cmp).layer = (yyvsp[-2].loc)->layer;
  1582. (yyval.cmp).opnd = (yyvsp[-1].i);
  1583. (yyval.cmp).val = (yyvsp[0].i);
  1584. rtnl_pktloc_put((yyvsp[-2].loc));
  1585. }
  1586. #line 1838 "route/cls/ematch_syntax.c"
  1587. break;
  1588. case 16:
  1589. #line 321 "route/cls/ematch_syntax.y"
  1590. { (yyval.loc) = NULL; }
  1591. #line 1844 "route/cls/ematch_syntax.c"
  1592. break;
  1593. case 17:
  1594. #line 323 "route/cls/ematch_syntax.y"
  1595. { (yyval.loc) = (yyvsp[0].loc); }
  1596. #line 1850 "route/cls/ematch_syntax.c"
  1597. break;
  1598. case 18:
  1599. #line 328 "route/cls/ematch_syntax.y"
  1600. { (yyval.loc) = NULL; }
  1601. #line 1856 "route/cls/ematch_syntax.c"
  1602. break;
  1603. case 19:
  1604. #line 330 "route/cls/ematch_syntax.y"
  1605. { (yyval.loc) = (yyvsp[0].loc); }
  1606. #line 1862 "route/cls/ematch_syntax.c"
  1607. break;
  1608. case 20:
  1609. #line 335 "route/cls/ematch_syntax.y"
  1610. { (yyval.mv) = rtnl_meta_value_alloc_var((yyvsp[0].q).data, (yyvsp[0].q).len); }
  1611. #line 1868 "route/cls/ematch_syntax.c"
  1612. break;
  1613. case 21:
  1614. #line 337 "route/cls/ematch_syntax.y"
  1615. { (yyval.mv) = rtnl_meta_value_alloc_int((yyvsp[0].i)); }
  1616. #line 1874 "route/cls/ematch_syntax.c"
  1617. break;
  1618. case 22:
  1619. #line 339 "route/cls/ematch_syntax.y"
  1620. { (yyval.mv) = META_ALLOC(META_INT, (yyvsp[-2].i), (yyvsp[-1].i), (yyvsp[0].i64)); }
  1621. #line 1880 "route/cls/ematch_syntax.c"
  1622. break;
  1623. case 23:
  1624. #line 341 "route/cls/ematch_syntax.y"
  1625. { (yyval.mv) = META_ALLOC(META_VAR, (yyvsp[-1].i), (yyvsp[0].i), 0); }
  1626. #line 1886 "route/cls/ematch_syntax.c"
  1627. break;
  1628. case 24:
  1629. #line 345 "route/cls/ematch_syntax.y"
  1630. { (yyval.i) = META_ID(RANDOM); }
  1631. #line 1892 "route/cls/ematch_syntax.c"
  1632. break;
  1633. case 25:
  1634. #line 346 "route/cls/ematch_syntax.y"
  1635. { (yyval.i) = META_ID(LOADAVG_0); }
  1636. #line 1898 "route/cls/ematch_syntax.c"
  1637. break;
  1638. case 26:
  1639. #line 347 "route/cls/ematch_syntax.y"
  1640. { (yyval.i) = META_ID(LOADAVG_1); }
  1641. #line 1904 "route/cls/ematch_syntax.c"
  1642. break;
  1643. case 27:
  1644. #line 348 "route/cls/ematch_syntax.y"
  1645. { (yyval.i) = META_ID(LOADAVG_2); }
  1646. #line 1910 "route/cls/ematch_syntax.c"
  1647. break;
  1648. case 28:
  1649. #line 349 "route/cls/ematch_syntax.y"
  1650. { (yyval.i) = META_ID(DEV); }
  1651. #line 1916 "route/cls/ematch_syntax.c"
  1652. break;
  1653. case 29:
  1654. #line 350 "route/cls/ematch_syntax.y"
  1655. { (yyval.i) = META_ID(PRIORITY); }
  1656. #line 1922 "route/cls/ematch_syntax.c"
  1657. break;
  1658. case 30:
  1659. #line 351 "route/cls/ematch_syntax.y"
  1660. { (yyval.i) = META_ID(PROTOCOL); }
  1661. #line 1928 "route/cls/ematch_syntax.c"
  1662. break;
  1663. case 31:
  1664. #line 352 "route/cls/ematch_syntax.y"
  1665. { (yyval.i) = META_ID(PKTTYPE); }
  1666. #line 1934 "route/cls/ematch_syntax.c"
  1667. break;
  1668. case 32:
  1669. #line 353 "route/cls/ematch_syntax.y"
  1670. { (yyval.i) = META_ID(PKTLEN); }
  1671. #line 1940 "route/cls/ematch_syntax.c"
  1672. break;
  1673. case 33:
  1674. #line 354 "route/cls/ematch_syntax.y"
  1675. { (yyval.i) = META_ID(DATALEN); }
  1676. #line 1946 "route/cls/ematch_syntax.c"
  1677. break;
  1678. case 34:
  1679. #line 355 "route/cls/ematch_syntax.y"
  1680. { (yyval.i) = META_ID(MACLEN); }
  1681. #line 1952 "route/cls/ematch_syntax.c"
  1682. break;
  1683. case 35:
  1684. #line 356 "route/cls/ematch_syntax.y"
  1685. { (yyval.i) = META_ID(NFMARK); }
  1686. #line 1958 "route/cls/ematch_syntax.c"
  1687. break;
  1688. case 36:
  1689. #line 357 "route/cls/ematch_syntax.y"
  1690. { (yyval.i) = META_ID(TCINDEX); }
  1691. #line 1964 "route/cls/ematch_syntax.c"
  1692. break;
  1693. case 37:
  1694. #line 358 "route/cls/ematch_syntax.y"
  1695. { (yyval.i) = META_ID(RTCLASSID); }
  1696. #line 1970 "route/cls/ematch_syntax.c"
  1697. break;
  1698. case 38:
  1699. #line 359 "route/cls/ematch_syntax.y"
  1700. { (yyval.i) = META_ID(RTIIF); }
  1701. #line 1976 "route/cls/ematch_syntax.c"
  1702. break;
  1703. case 39:
  1704. #line 360 "route/cls/ematch_syntax.y"
  1705. { (yyval.i) = META_ID(SK_FAMILY); }
  1706. #line 1982 "route/cls/ematch_syntax.c"
  1707. break;
  1708. case 40:
  1709. #line 361 "route/cls/ematch_syntax.y"
  1710. { (yyval.i) = META_ID(SK_STATE); }
  1711. #line 1988 "route/cls/ematch_syntax.c"
  1712. break;
  1713. case 41:
  1714. #line 362 "route/cls/ematch_syntax.y"
  1715. { (yyval.i) = META_ID(SK_REUSE); }
  1716. #line 1994 "route/cls/ematch_syntax.c"
  1717. break;
  1718. case 42:
  1719. #line 363 "route/cls/ematch_syntax.y"
  1720. { (yyval.i) = META_ID(SK_REFCNT); }
  1721. #line 2000 "route/cls/ematch_syntax.c"
  1722. break;
  1723. case 43:
  1724. #line 364 "route/cls/ematch_syntax.y"
  1725. { (yyval.i) = META_ID(SK_RCVBUF); }
  1726. #line 2006 "route/cls/ematch_syntax.c"
  1727. break;
  1728. case 44:
  1729. #line 365 "route/cls/ematch_syntax.y"
  1730. { (yyval.i) = META_ID(SK_SNDBUF); }
  1731. #line 2012 "route/cls/ematch_syntax.c"
  1732. break;
  1733. case 45:
  1734. #line 366 "route/cls/ematch_syntax.y"
  1735. { (yyval.i) = META_ID(SK_SHUTDOWN); }
  1736. #line 2018 "route/cls/ematch_syntax.c"
  1737. break;
  1738. case 46:
  1739. #line 367 "route/cls/ematch_syntax.y"
  1740. { (yyval.i) = META_ID(SK_PROTO); }
  1741. #line 2024 "route/cls/ematch_syntax.c"
  1742. break;
  1743. case 47:
  1744. #line 368 "route/cls/ematch_syntax.y"
  1745. { (yyval.i) = META_ID(SK_TYPE); }
  1746. #line 2030 "route/cls/ematch_syntax.c"
  1747. break;
  1748. case 48:
  1749. #line 369 "route/cls/ematch_syntax.y"
  1750. { (yyval.i) = META_ID(SK_RMEM_ALLOC); }
  1751. #line 2036 "route/cls/ematch_syntax.c"
  1752. break;
  1753. case 49:
  1754. #line 370 "route/cls/ematch_syntax.y"
  1755. { (yyval.i) = META_ID(SK_WMEM_ALLOC); }
  1756. #line 2042 "route/cls/ematch_syntax.c"
  1757. break;
  1758. case 50:
  1759. #line 371 "route/cls/ematch_syntax.y"
  1760. { (yyval.i) = META_ID(SK_WMEM_QUEUED); }
  1761. #line 2048 "route/cls/ematch_syntax.c"
  1762. break;
  1763. case 51:
  1764. #line 372 "route/cls/ematch_syntax.y"
  1765. { (yyval.i) = META_ID(SK_RCV_QLEN); }
  1766. #line 2054 "route/cls/ematch_syntax.c"
  1767. break;
  1768. case 52:
  1769. #line 373 "route/cls/ematch_syntax.y"
  1770. { (yyval.i) = META_ID(SK_SND_QLEN); }
  1771. #line 2060 "route/cls/ematch_syntax.c"
  1772. break;
  1773. case 53:
  1774. #line 374 "route/cls/ematch_syntax.y"
  1775. { (yyval.i) = META_ID(SK_ERR_QLEN); }
  1776. #line 2066 "route/cls/ematch_syntax.c"
  1777. break;
  1778. case 54:
  1779. #line 375 "route/cls/ematch_syntax.y"
  1780. { (yyval.i) = META_ID(SK_FORWARD_ALLOCS); }
  1781. #line 2072 "route/cls/ematch_syntax.c"
  1782. break;
  1783. case 55:
  1784. #line 376 "route/cls/ematch_syntax.y"
  1785. { (yyval.i) = META_ID(SK_ALLOCS); }
  1786. #line 2078 "route/cls/ematch_syntax.c"
  1787. break;
  1788. case 56:
  1789. #line 377 "route/cls/ematch_syntax.y"
  1790. { (yyval.i) = META_ID(SK_ROUTE_CAPS); }
  1791. #line 2084 "route/cls/ematch_syntax.c"
  1792. break;
  1793. case 57:
  1794. #line 378 "route/cls/ematch_syntax.y"
  1795. { (yyval.i) = META_ID(SK_HASH); }
  1796. #line 2090 "route/cls/ematch_syntax.c"
  1797. break;
  1798. case 58:
  1799. #line 379 "route/cls/ematch_syntax.y"
  1800. { (yyval.i) = META_ID(SK_LINGERTIME); }
  1801. #line 2096 "route/cls/ematch_syntax.c"
  1802. break;
  1803. case 59:
  1804. #line 380 "route/cls/ematch_syntax.y"
  1805. { (yyval.i) = META_ID(SK_ACK_BACKLOG); }
  1806. #line 2102 "route/cls/ematch_syntax.c"
  1807. break;
  1808. case 60:
  1809. #line 381 "route/cls/ematch_syntax.y"
  1810. { (yyval.i) = META_ID(SK_MAX_ACK_BACKLOG); }
  1811. #line 2108 "route/cls/ematch_syntax.c"
  1812. break;
  1813. case 61:
  1814. #line 382 "route/cls/ematch_syntax.y"
  1815. { (yyval.i) = META_ID(SK_PRIO); }
  1816. #line 2114 "route/cls/ematch_syntax.c"
  1817. break;
  1818. case 62:
  1819. #line 383 "route/cls/ematch_syntax.y"
  1820. { (yyval.i) = META_ID(SK_RCVLOWAT); }
  1821. #line 2120 "route/cls/ematch_syntax.c"
  1822. break;
  1823. case 63:
  1824. #line 384 "route/cls/ematch_syntax.y"
  1825. { (yyval.i) = META_ID(SK_RCVTIMEO); }
  1826. #line 2126 "route/cls/ematch_syntax.c"
  1827. break;
  1828. case 64:
  1829. #line 385 "route/cls/ematch_syntax.y"
  1830. { (yyval.i) = META_ID(SK_SNDTIMEO); }
  1831. #line 2132 "route/cls/ematch_syntax.c"
  1832. break;
  1833. case 65:
  1834. #line 386 "route/cls/ematch_syntax.y"
  1835. { (yyval.i) = META_ID(SK_SENDMSG_OFF); }
  1836. #line 2138 "route/cls/ematch_syntax.c"
  1837. break;
  1838. case 66:
  1839. #line 387 "route/cls/ematch_syntax.y"
  1840. { (yyval.i) = META_ID(SK_WRITE_PENDING); }
  1841. #line 2144 "route/cls/ematch_syntax.c"
  1842. break;
  1843. case 67:
  1844. #line 388 "route/cls/ematch_syntax.y"
  1845. { (yyval.i) = META_ID(VLAN_TAG); }
  1846. #line 2150 "route/cls/ematch_syntax.c"
  1847. break;
  1848. case 68:
  1849. #line 389 "route/cls/ematch_syntax.y"
  1850. { (yyval.i) = META_ID(RXHASH); }
  1851. #line 2156 "route/cls/ematch_syntax.c"
  1852. break;
  1853. case 69:
  1854. #line 393 "route/cls/ematch_syntax.y"
  1855. { (yyval.i) = META_ID(DEV); }
  1856. #line 2162 "route/cls/ematch_syntax.c"
  1857. break;
  1858. case 70:
  1859. #line 394 "route/cls/ematch_syntax.y"
  1860. { (yyval.i) = META_ID(SK_BOUND_IF); }
  1861. #line 2168 "route/cls/ematch_syntax.c"
  1862. break;
  1863. case 71:
  1864. #line 402 "route/cls/ematch_syntax.y"
  1865. {
  1866. (yyval.q) = (yyvsp[0].q);
  1867. }
  1868. #line 2176 "route/cls/ematch_syntax.c"
  1869. break;
  1870. case 72:
  1871. #line 406 "route/cls/ematch_syntax.y"
  1872. {
  1873. struct nl_addr *addr;
  1874. if (nl_addr_parse((yyvsp[0].s), AF_UNSPEC, &addr) == 0) {
  1875. (yyval.q).len = nl_addr_get_len(addr);
  1876. (yyval.q).index = min_t(int, (yyval.q).len, nl_addr_get_prefixlen(addr)/8);
  1877. if (!((yyval.q).data = calloc(1, (yyval.q).len))) {
  1878. nl_addr_put(addr);
  1879. YYABORT;
  1880. }
  1881. memcpy((yyval.q).data, nl_addr_get_binary_addr(addr), (yyval.q).len);
  1882. nl_addr_put(addr);
  1883. } else {
  1884. if (asprintf(errp, "invalid pattern \"%s\"", (yyvsp[0].s)) == -1)
  1885. *errp = NULL;
  1886. YYABORT;
  1887. }
  1888. }
  1889. #line 2202 "route/cls/ematch_syntax.c"
  1890. break;
  1891. case 73:
  1892. #line 435 "route/cls/ematch_syntax.y"
  1893. {
  1894. struct rtnl_pktloc *loc;
  1895. if (rtnl_pktloc_lookup((yyvsp[0].s), &loc) < 0) {
  1896. if (asprintf(errp, "Packet location \"%s\" not found", (yyvsp[0].s)) == -1)
  1897. *errp = NULL;
  1898. YYABORT;
  1899. }
  1900. (yyval.loc) = loc;
  1901. }
  1902. #line 2218 "route/cls/ematch_syntax.c"
  1903. break;
  1904. case 74:
  1905. #line 448 "route/cls/ematch_syntax.y"
  1906. {
  1907. struct rtnl_pktloc *loc;
  1908. if ((yyvsp[0].i64) && (!(yyvsp[-4].i) || (yyvsp[-4].i) > TCF_EM_ALIGN_U32)) {
  1909. *errp = strdup("mask only allowed for alignments u8|u16|u32");
  1910. YYABORT;
  1911. }
  1912. if (!(loc = rtnl_pktloc_alloc())) {
  1913. *errp = strdup("Unable to allocate packet location object");
  1914. YYABORT;
  1915. }
  1916. loc->name = strdup("<USER-DEFINED>");
  1917. loc->align = (yyvsp[-4].i);
  1918. loc->layer = (yyvsp[-3].i);
  1919. loc->offset = (yyvsp[-1].i);
  1920. loc->mask = (yyvsp[0].i64);
  1921. (yyval.loc) = loc;
  1922. }
  1923. #line 2244 "route/cls/ematch_syntax.c"
  1924. break;
  1925. case 75:
  1926. #line 473 "route/cls/ematch_syntax.y"
  1927. { (yyval.i) = 0; }
  1928. #line 2250 "route/cls/ematch_syntax.c"
  1929. break;
  1930. case 76:
  1931. #line 475 "route/cls/ematch_syntax.y"
  1932. { (yyval.i) = (yyvsp[-1].i); }
  1933. #line 2256 "route/cls/ematch_syntax.c"
  1934. break;
  1935. case 77:
  1936. #line 477 "route/cls/ematch_syntax.y"
  1937. { (yyval.i) = (yyvsp[-1].i); }
  1938. #line 2262 "route/cls/ematch_syntax.c"
  1939. break;
  1940. case 78:
  1941. #line 482 "route/cls/ematch_syntax.y"
  1942. { (yyval.i64) = 0; }
  1943. #line 2268 "route/cls/ematch_syntax.c"
  1944. break;
  1945. case 79:
  1946. #line 484 "route/cls/ematch_syntax.y"
  1947. { (yyval.i64) = (yyvsp[0].i); }
  1948. #line 2274 "route/cls/ematch_syntax.c"
  1949. break;
  1950. case 80:
  1951. #line 489 "route/cls/ematch_syntax.y"
  1952. { (yyval.i) = 0; }
  1953. #line 2280 "route/cls/ematch_syntax.c"
  1954. break;
  1955. case 81:
  1956. #line 491 "route/cls/ematch_syntax.y"
  1957. { (yyval.i) = (yyvsp[0].i); }
  1958. #line 2286 "route/cls/ematch_syntax.c"
  1959. break;
  1960. case 82:
  1961. #line 496 "route/cls/ematch_syntax.y"
  1962. { (yyval.i) = TCF_EM_OPND_EQ; }
  1963. #line 2292 "route/cls/ematch_syntax.c"
  1964. break;
  1965. case 83:
  1966. #line 498 "route/cls/ematch_syntax.y"
  1967. { (yyval.i) = TCF_EM_OPND_GT; }
  1968. #line 2298 "route/cls/ematch_syntax.c"
  1969. break;
  1970. case 84:
  1971. #line 500 "route/cls/ematch_syntax.y"
  1972. { (yyval.i) = TCF_EM_OPND_LT; }
  1973. #line 2304 "route/cls/ematch_syntax.c"
  1974. break;
  1975. #line 2308 "route/cls/ematch_syntax.c"
  1976. default: break;
  1977. }
  1978. /* User semantic actions sometimes alter yychar, and that requires
  1979. that yytoken be updated with the new translation. We take the
  1980. approach of translating immediately before every use of yytoken.
  1981. One alternative is translating here after every semantic action,
  1982. but that translation would be missed if the semantic action invokes
  1983. YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1984. if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
  1985. incorrect destructor might then be invoked immediately. In the
  1986. case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1987. to an incorrect destructor call or verbose syntax error message
  1988. before the lookahead is translated. */
  1989. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1990. YYPOPSTACK (yylen);
  1991. yylen = 0;
  1992. YY_STACK_PRINT (yyss, yyssp);
  1993. *++yyvsp = yyval;
  1994. /* Now 'shift' the result of the reduction. Determine what state
  1995. that goes to, based on the state we popped back to and the rule
  1996. number reduced by. */
  1997. {
  1998. const int yylhs = yyr1[yyn] - YYNTOKENS;
  1999. const int yyi = yypgoto[yylhs] + *yyssp;
  2000. yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
  2001. ? yytable[yyi]
  2002. : yydefgoto[yylhs]);
  2003. }
  2004. goto yynewstate;
  2005. /*--------------------------------------.
  2006. | yyerrlab -- here on detecting error. |
  2007. `--------------------------------------*/
  2008. yyerrlab:
  2009. /* Make sure we have latest lookahead translation. See comments at
  2010. user semantic actions for why this is necessary. */
  2011. yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  2012. /* If not already recovering from an error, report this error. */
  2013. if (!yyerrstatus)
  2014. {
  2015. ++yynerrs;
  2016. #if ! YYERROR_VERBOSE
  2017. yyerror (scanner, errp, root, YY_("syntax error"));
  2018. #else
  2019. # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  2020. yyssp, yytoken)
  2021. {
  2022. char const *yymsgp = YY_("syntax error");
  2023. int yysyntax_error_status;
  2024. yysyntax_error_status = YYSYNTAX_ERROR;
  2025. if (yysyntax_error_status == 0)
  2026. yymsgp = yymsg;
  2027. else if (yysyntax_error_status == 1)
  2028. {
  2029. if (yymsg != yymsgbuf)
  2030. YYSTACK_FREE (yymsg);
  2031. yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
  2032. if (!yymsg)
  2033. {
  2034. yymsg = yymsgbuf;
  2035. yymsg_alloc = sizeof yymsgbuf;
  2036. yysyntax_error_status = 2;
  2037. }
  2038. else
  2039. {
  2040. yysyntax_error_status = YYSYNTAX_ERROR;
  2041. yymsgp = yymsg;
  2042. }
  2043. }
  2044. yyerror (scanner, errp, root, yymsgp);
  2045. if (yysyntax_error_status == 2)
  2046. goto yyexhaustedlab;
  2047. }
  2048. # undef YYSYNTAX_ERROR
  2049. #endif
  2050. }
  2051. if (yyerrstatus == 3)
  2052. {
  2053. /* If just tried and failed to reuse lookahead token after an
  2054. error, discard it. */
  2055. if (yychar <= YYEOF)
  2056. {
  2057. /* Return failure if at end of input. */
  2058. if (yychar == YYEOF)
  2059. YYABORT;
  2060. }
  2061. else
  2062. {
  2063. yydestruct ("Error: discarding",
  2064. yytoken, &yylval, scanner, errp, root);
  2065. yychar = YYEMPTY;
  2066. }
  2067. }
  2068. /* Else will try to reuse lookahead token after shifting the error
  2069. token. */
  2070. goto yyerrlab1;
  2071. /*---------------------------------------------------.
  2072. | yyerrorlab -- error raised explicitly by YYERROR. |
  2073. `---------------------------------------------------*/
  2074. yyerrorlab:
  2075. /* Pacify compilers when the user code never invokes YYERROR and the
  2076. label yyerrorlab therefore never appears in user code. */
  2077. if (0)
  2078. YYERROR;
  2079. /* Do not reclaim the symbols of the rule whose action triggered
  2080. this YYERROR. */
  2081. YYPOPSTACK (yylen);
  2082. yylen = 0;
  2083. YY_STACK_PRINT (yyss, yyssp);
  2084. yystate = *yyssp;
  2085. goto yyerrlab1;
  2086. /*-------------------------------------------------------------.
  2087. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  2088. `-------------------------------------------------------------*/
  2089. yyerrlab1:
  2090. yyerrstatus = 3; /* Each real token shifted decrements this. */
  2091. for (;;)
  2092. {
  2093. yyn = yypact[yystate];
  2094. if (!yypact_value_is_default (yyn))
  2095. {
  2096. yyn += YYTERROR;
  2097. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  2098. {
  2099. yyn = yytable[yyn];
  2100. if (0 < yyn)
  2101. break;
  2102. }
  2103. }
  2104. /* Pop the current state because it cannot handle the error token. */
  2105. if (yyssp == yyss)
  2106. YYABORT;
  2107. yydestruct ("Error: popping",
  2108. yystos[yystate], yyvsp, scanner, errp, root);
  2109. YYPOPSTACK (1);
  2110. yystate = *yyssp;
  2111. YY_STACK_PRINT (yyss, yyssp);
  2112. }
  2113. YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  2114. *++yyvsp = yylval;
  2115. YY_IGNORE_MAYBE_UNINITIALIZED_END
  2116. /* Shift the error token. */
  2117. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  2118. yystate = yyn;
  2119. goto yynewstate;
  2120. /*-------------------------------------.
  2121. | yyacceptlab -- YYACCEPT comes here. |
  2122. `-------------------------------------*/
  2123. yyacceptlab:
  2124. yyresult = 0;
  2125. goto yyreturn;
  2126. /*-----------------------------------.
  2127. | yyabortlab -- YYABORT comes here. |
  2128. `-----------------------------------*/
  2129. yyabortlab:
  2130. yyresult = 1;
  2131. goto yyreturn;
  2132. #if !defined yyoverflow || YYERROR_VERBOSE
  2133. /*-------------------------------------------------.
  2134. | yyexhaustedlab -- memory exhaustion comes here. |
  2135. `-------------------------------------------------*/
  2136. yyexhaustedlab:
  2137. yyerror (scanner, errp, root, YY_("memory exhausted"));
  2138. yyresult = 2;
  2139. /* Fall through. */
  2140. #endif
  2141. /*-----------------------------------------------------.
  2142. | yyreturn -- parsing is finished, return the result. |
  2143. `-----------------------------------------------------*/
  2144. yyreturn:
  2145. if (yychar != YYEMPTY)
  2146. {
  2147. /* Make sure we have latest lookahead translation. See comments at
  2148. user semantic actions for why this is necessary. */
  2149. yytoken = YYTRANSLATE (yychar);
  2150. yydestruct ("Cleanup: discarding lookahead",
  2151. yytoken, &yylval, scanner, errp, root);
  2152. }
  2153. /* Do not reclaim the symbols of the rule whose action triggered
  2154. this YYABORT or YYACCEPT. */
  2155. YYPOPSTACK (yylen);
  2156. YY_STACK_PRINT (yyss, yyssp);
  2157. while (yyssp != yyss)
  2158. {
  2159. yydestruct ("Cleanup: popping",
  2160. yystos[+*yyssp], yyvsp, scanner, errp, root);
  2161. YYPOPSTACK (1);
  2162. }
  2163. #ifndef yyoverflow
  2164. if (yyss != yyssa)
  2165. YYSTACK_FREE (yyss);
  2166. #endif
  2167. #if YYERROR_VERBOSE
  2168. if (yymsg != yymsgbuf)
  2169. YYSTACK_FREE (yymsg);
  2170. #endif
  2171. return yyresult;
  2172. }