Added libnl

This commit is contained in:
Ella-0 2021-04-09 20:31:08 +01:00
parent 030af0be13
commit 081b9378c1
4 changed files with 159 additions and 0 deletions

41
pkgs/libnl/build.sh Normal file
View file

@ -0,0 +1,41 @@
pkgname=libnl
pkgver=3.5.0
fetch() {
curl -L "https://github.com/thom311/libnl/releases/download/libnl3_5_0/libnl-3.5.0.tar.gz" -o $pkgname-$pkgver.tar.xz
tar -xf $pkgname-$pkgver.tar.xz
cp ../byacc-p-makefile.patch .
cp ../byacc-syntax.patch .
cp ../byacc-comment-defines.patch .
cd $pkgname-$pkgver
patch -p1 < ../byacc-syntax.patch
}
build() {
cd $pkgname-$pkgver
YACC=byacc ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--build=x86_64-unknown-linux-musl \
--host=x86_64-unknown-linux-musl
patch -p1 < ../byacc-p-makefile.patch
gmake
patch -p1 < ../byacc-comment-defines.patch
gmake
}
package() {
cd $pkgname-$pkgver
make install DESTDIR=$pkgdir
}
license() {
cd $pkgname-$pkgver
cat LICENSE
# cat COPYING
}

View file

@ -0,0 +1,34 @@
--- a/lib/route/cls/ematch_syntax.c
+++ b/lib/route/cls/ematch_syntax.c
@@ -218,12 +218,12 @@
#define KW_CLOSE 265
#define KW_PLUS 266
#define KW_MASK 267
-#define mask 268
+// #define mask 268
#define KW_SHIFT 269
#define KW_AT 271
#define at 272
#define EMATCH_CMP 273
-#define cmp 274
+// #define cmp 274
#define EMATCH_NBYTE 275
#define pattern 276
#define EMATCH_TEXT 277
--- a/lib/route/cls/ematch_syntax.h
+++ b/lib/route/cls/ematch_syntax.h
@@ -12,12 +12,12 @@
#define KW_CLOSE 265
#define KW_PLUS 266
#define KW_MASK 267
-#define mask 268
+// #define mask 268
#define KW_SHIFT 269
#define KW_AT 271
#define at 272
#define EMATCH_CMP 273
-#define cmp 274
+// #define cmp 274
#define EMATCH_NBYTE 275
#define pattern 276
#define EMATCH_TEXT 277

View file

@ -0,0 +1,20 @@
--- a/Makefile
+++ b/Makefile
@@ -7619,7 +7619,7 @@
@true
lib/route/pktloc_syntax.c: lib/route/pktloc_syntax.y lib/route/.dirstamp
- $(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $<
+ $(AM_V_GEN) $(YACC) -p pktloc_ -d $(YFLAGS) -o $@ $<
lib/route/cls/ematch_grammar.h: lib/route/cls/ematch_grammar.c
@true
@@ -7631,7 +7631,7 @@
@true
lib/route/cls/ematch_syntax.c: lib/route/cls/ematch_syntax.y lib/route/cls/.dirstamp
- $(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $<
+ $(AM_V_GEN) $(YACC) -p ematch_ -d $(YFLAGS) -o $@ $<
$(lib_libnl_route_3_la_OBJECTS): $(grammar_files_headers)

View file

@ -0,0 +1,64 @@
--- a/lib/route/cls/ematch_syntax.y
+++ b/lib/route/cls/ematch_syntax.y
@@ -30,8 +30,9 @@
%}
%error-verbose
-%define api.pure
-%name-prefix "ematch_"
+%pure-parser
+//%define api.pure
+//%name-prefix "ematch_"
%parse-param {void *scanner}
%parse-param {char **errp}
--- a/lib/route/pktloc_syntax.y
+++ b/lib/route/pktloc_syntax.y
@@ -6,10 +6,22 @@
#include <netlink/route/pktloc.h>
%}
+%{
+struct YYLTYPE;
+union YYSTYPE;
+extern int pktloc_lex(union YYSTYPE *, struct YYLTYPE *, void *);
+
+static void yyerror(struct YYLTYPE *locp, void *scanner, const char *msg)
+{
+ NL_DBG(1, "Error while parsing packet location file: %s\n", msg);
+}
+%}
+
%locations
%error-verbose
-%define api.pure
-%name-prefix "pktloc_"
+//%define api.pure
+%pure-parser
+//%name-prefix "pktloc_"
%parse-param {void *scanner}
%lex-param {void *scanner}
@@ -21,15 +33,6 @@
char *s;
}
-%{
-extern int pktloc_lex(YYSTYPE *, YYLTYPE *, void *);
-
-static void yyerror(YYLTYPE *locp, void *scanner, const char *msg)
-{
- NL_DBG(1, "Error while parsing packet location file: %s\n", msg);
-}
-%}
-
%token <i> ERROR NUMBER LAYER ALIGN
%token <s> NAME
@@ -101,3 +104,6 @@
| NUMBER
{ $$ = $1; }
;
+
+%%
+