* [libnftnl PATCH] expr: Introduce nftnl_expr_fprintf()
@ 2017-10-04 21:36 Phil Sutter
2017-10-17 11:05 ` Pablo Neira Ayuso
0 siblings, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2017-10-04 21:36 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Implement expression printing into a FILE pointer analogous to
nftnl_rule_fprintf().
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
include/libnftnl/expr.h | 1 +
src/expr.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h
index 76f28fee7b5f7..f37f50963d6c3 100644
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
@@ -39,6 +39,7 @@ const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type);
bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2);
int nftnl_expr_snprintf(char *buf, size_t buflen, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
enum {
NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,
diff --git a/src/expr.c b/src/expr.c
index c5fcf06492ae2..1eae70787209d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -293,3 +293,17 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr,
return offset;
}
EXPORT_SYMBOL(nftnl_expr_snprintf);
+
+static int nftnl_expr_do_snprintf(char *buf, size_t size, const void *e,
+ uint32_t cmd, uint32_t type, uint32_t flags)
+{
+ return nftnl_expr_snprintf(buf, size, e, type, flags);
+}
+
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type,
+ uint32_t flags)
+{
+ return nftnl_fprintf(fp, expr, NFTNL_CMD_UNSPEC, type, flags,
+ nftnl_expr_do_snprintf);
+}
+EXPORT_SYMBOL(nftnl_expr_fprintf);
--
2.13.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH] expr: Introduce nftnl_expr_fprintf()
2017-10-04 21:36 [libnftnl PATCH] expr: Introduce nftnl_expr_fprintf() Phil Sutter
@ 2017-10-17 11:05 ` Pablo Neira Ayuso
2017-10-17 11:22 ` [libnftnl PATCH v2] " Phil Sutter
0 siblings, 1 reply; 9+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-17 11:05 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel
Hi Phil,
On Wed, Oct 04, 2017 at 11:36:40PM +0200, Phil Sutter wrote:
> Implement expression printing into a FILE pointer analogous to
> nftnl_rule_fprintf().
src/libnftnl.map needs to be updated. I can do it here myself, no
problem, or feel free to send v2, as you prefer.
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
> include/libnftnl/expr.h | 1 +
> src/expr.c | 14 ++++++++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h
> index 76f28fee7b5f7..f37f50963d6c3 100644
> --- a/include/libnftnl/expr.h
> +++ b/include/libnftnl/expr.h
> @@ -39,6 +39,7 @@ const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type);
> bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2);
>
> int nftnl_expr_snprintf(char *buf, size_t buflen, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
> +int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
>
> enum {
> NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,
> diff --git a/src/expr.c b/src/expr.c
> index c5fcf06492ae2..1eae70787209d 100644
> --- a/src/expr.c
> +++ b/src/expr.c
> @@ -293,3 +293,17 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr,
> return offset;
> }
> EXPORT_SYMBOL(nftnl_expr_snprintf);
> +
> +static int nftnl_expr_do_snprintf(char *buf, size_t size, const void *e,
> + uint32_t cmd, uint32_t type, uint32_t flags)
> +{
> + return nftnl_expr_snprintf(buf, size, e, type, flags);
> +}
> +
> +int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type,
> + uint32_t flags)
> +{
> + return nftnl_fprintf(fp, expr, NFTNL_CMD_UNSPEC, type, flags,
> + nftnl_expr_do_snprintf);
> +}
> +EXPORT_SYMBOL(nftnl_expr_fprintf);
> --
> 2.13.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [libnftnl PATCH v2] expr: Introduce nftnl_expr_fprintf()
2017-10-17 11:05 ` Pablo Neira Ayuso
@ 2017-10-17 11:22 ` Phil Sutter
2017-10-17 11:31 ` Pablo Neira Ayuso
0 siblings, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2017-10-17 11:22 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Implement expression printing into a FILE pointer analogous to
nftnl_rule_fprintf().
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Update src/libnftnl.map
---
include/libnftnl/expr.h | 1 +
src/expr.c | 14 ++++++++++++++
src/libnftnl.map | 1 +
3 files changed, 16 insertions(+)
diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h
index 76f28fee7b5f7..f37f50963d6c3 100644
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
@@ -39,6 +39,7 @@ const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type);
bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2);
int nftnl_expr_snprintf(char *buf, size_t buflen, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
enum {
NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,
diff --git a/src/expr.c b/src/expr.c
index c5fcf06492ae2..1eae70787209d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -293,3 +293,17 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr,
return offset;
}
EXPORT_SYMBOL(nftnl_expr_snprintf);
+
+static int nftnl_expr_do_snprintf(char *buf, size_t size, const void *e,
+ uint32_t cmd, uint32_t type, uint32_t flags)
+{
+ return nftnl_expr_snprintf(buf, size, e, type, flags);
+}
+
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type,
+ uint32_t flags)
+{
+ return nftnl_fprintf(fp, expr, NFTNL_CMD_UNSPEC, type, flags,
+ nftnl_expr_do_snprintf);
+}
+EXPORT_SYMBOL(nftnl_expr_fprintf);
diff --git a/src/libnftnl.map b/src/libnftnl.map
index 1892c983eb504..a01a6599a9750 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -103,6 +103,7 @@ global:
nftnl_expr_get_u64;
nftnl_expr_get_str;
nftnl_expr_snprintf;
+ nftnl_expr_fprintf;
nftnl_expr_free;
nftnl_rule_list_alloc;
--
2.13.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH v2] expr: Introduce nftnl_expr_fprintf()
2017-10-17 11:22 ` [libnftnl PATCH v2] " Phil Sutter
@ 2017-10-17 11:31 ` Pablo Neira Ayuso
2017-10-17 11:54 ` Phil Sutter
2017-10-17 12:02 ` Phil Sutter
0 siblings, 2 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-17 11:31 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
On Tue, Oct 17, 2017 at 01:22:18PM +0200, Phil Sutter wrote:
> Implement expression printing into a FILE pointer analogous to
> nftnl_rule_fprintf().
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
> Changes since v1:
> - Update src/libnftnl.map
Thanks Phil.
I think we need to collapse this change to your patch.
[-- Attachment #2: x.patch --]
[-- Type: text/x-diff, Size: 401 bytes --]
diff --git a/src/libnftnl.map b/src/libnftnl.map
index a01a6599a975..74f33c438a16 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -103,7 +103,6 @@ global:
nftnl_expr_get_u64;
nftnl_expr_get_str;
nftnl_expr_snprintf;
- nftnl_expr_fprintf;
nftnl_expr_free;
nftnl_rule_list_alloc;
@@ -308,3 +307,7 @@ global:
local: *;
};
+
+LIBNFTNL_6 {
+ nftnl_expr_fprintf;
+} LIBMNL_5;
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH v2] expr: Introduce nftnl_expr_fprintf()
2017-10-17 11:31 ` Pablo Neira Ayuso
@ 2017-10-17 11:54 ` Phil Sutter
2017-10-17 12:02 ` Phil Sutter
1 sibling, 0 replies; 9+ messages in thread
From: Phil Sutter @ 2017-10-17 11:54 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Tue, Oct 17, 2017 at 01:31:50PM +0200, Pablo Neira Ayuso wrote:
> On Tue, Oct 17, 2017 at 01:22:18PM +0200, Phil Sutter wrote:
> > Implement expression printing into a FILE pointer analogous to
> > nftnl_rule_fprintf().
> >
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> > Changes since v1:
> > - Update src/libnftnl.map
>
> Thanks Phil.
>
> I think we need to collapse this change to your patch.
Ah, so that is because LIBNFTNL_5 is already released in 1.0.8, right?
Do I have to adjust the respective nftables patch for backwards
compatibility? If so, in which way?
Thanks, Phil
PS: V3 follows in a few seconds.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH v2] expr: Introduce nftnl_expr_fprintf()
2017-10-17 11:31 ` Pablo Neira Ayuso
2017-10-17 11:54 ` Phil Sutter
@ 2017-10-17 12:02 ` Phil Sutter
2017-10-17 12:11 ` Pablo Neira Ayuso
1 sibling, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2017-10-17 12:02 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Hi,
Actually, I don't quite get the suggested change:
On Tue, Oct 17, 2017 at 01:31:50PM +0200, Pablo Neira Ayuso wrote:
> @@ -308,3 +307,7 @@ global:
>
> local: *;
> };
> +
> +LIBNFTNL_6 {
> + nftnl_expr_fprintf;
> +} LIBMNL_5;
Why LIBMNL_5? Shouldn't this be LIBNFTNL_5?
Cheers, Phil
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH v2] expr: Introduce nftnl_expr_fprintf()
2017-10-17 12:02 ` Phil Sutter
@ 2017-10-17 12:11 ` Pablo Neira Ayuso
2017-10-17 13:17 ` [libnftnl PATCH v3] " Phil Sutter
0 siblings, 1 reply; 9+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-17 12:11 UTC (permalink / raw)
To: Phil Sutter, netfilter-devel
On Tue, Oct 17, 2017 at 02:02:22PM +0200, Phil Sutter wrote:
> Hi,
>
> Actually, I don't quite get the suggested change:
>
> On Tue, Oct 17, 2017 at 01:31:50PM +0200, Pablo Neira Ayuso wrote:
> > @@ -308,3 +307,7 @@ global:
> >
> > local: *;
> > };
> > +
> > +LIBNFTNL_6 {
> > + nftnl_expr_fprintf;
> > +} LIBMNL_5;
>
> Why LIBMNL_5? Shouldn't this be LIBNFTNL_5?
Oh right :-)
Neurons rollerskating here, sorry.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [libnftnl PATCH v3] expr: Introduce nftnl_expr_fprintf()
2017-10-17 12:11 ` Pablo Neira Ayuso
@ 2017-10-17 13:17 ` Phil Sutter
2017-10-17 13:19 ` Pablo Neira Ayuso
0 siblings, 1 reply; 9+ messages in thread
From: Phil Sutter @ 2017-10-17 13:17 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Implement expression printing into a FILE pointer analogous to
nftnl_rule_fprintf().
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v2:
- Fix src/libnftnl.map update.
Changes since v1:
- Update src/libnftnl.map.
---
include/libnftnl/expr.h | 1 +
src/expr.c | 14 ++++++++++++++
src/libnftnl.map | 4 ++++
3 files changed, 19 insertions(+)
diff --git a/include/libnftnl/expr.h b/include/libnftnl/expr.h
index 76f28fee7b5f7..f37f50963d6c3 100644
--- a/include/libnftnl/expr.h
+++ b/include/libnftnl/expr.h
@@ -39,6 +39,7 @@ const char *nftnl_expr_get_str(const struct nftnl_expr *expr, uint16_t type);
bool nftnl_expr_cmp(const struct nftnl_expr *e1, const struct nftnl_expr *e2);
int nftnl_expr_snprintf(char *buf, size_t buflen, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type, uint32_t flags);
enum {
NFTNL_EXPR_PAYLOAD_DREG = NFTNL_EXPR_BASE,
diff --git a/src/expr.c b/src/expr.c
index c5fcf06492ae2..1eae70787209d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -293,3 +293,17 @@ int nftnl_expr_snprintf(char *buf, size_t size, const struct nftnl_expr *expr,
return offset;
}
EXPORT_SYMBOL(nftnl_expr_snprintf);
+
+static int nftnl_expr_do_snprintf(char *buf, size_t size, const void *e,
+ uint32_t cmd, uint32_t type, uint32_t flags)
+{
+ return nftnl_expr_snprintf(buf, size, e, type, flags);
+}
+
+int nftnl_expr_fprintf(FILE *fp, const struct nftnl_expr *expr, uint32_t type,
+ uint32_t flags)
+{
+ return nftnl_fprintf(fp, expr, NFTNL_CMD_UNSPEC, type, flags,
+ nftnl_expr_do_snprintf);
+}
+EXPORT_SYMBOL(nftnl_expr_fprintf);
diff --git a/src/libnftnl.map b/src/libnftnl.map
index 1892c983eb504..d59e80269604c 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -307,3 +307,7 @@ global:
local: *;
};
+
+LIBNFTNL_6 {
+ nftnl_expr_fprintf;
+} LIBNFTNL_5;
--
2.13.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [libnftnl PATCH v3] expr: Introduce nftnl_expr_fprintf()
2017-10-17 13:17 ` [libnftnl PATCH v3] " Phil Sutter
@ 2017-10-17 13:19 ` Pablo Neira Ayuso
0 siblings, 0 replies; 9+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-17 13:19 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel
On Tue, Oct 17, 2017 at 03:17:41PM +0200, Phil Sutter wrote:
> Implement expression printing into a FILE pointer analogous to
> nftnl_rule_fprintf().
Applied, thanks Phil!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-10-17 13:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-04 21:36 [libnftnl PATCH] expr: Introduce nftnl_expr_fprintf() Phil Sutter
2017-10-17 11:05 ` Pablo Neira Ayuso
2017-10-17 11:22 ` [libnftnl PATCH v2] " Phil Sutter
2017-10-17 11:31 ` Pablo Neira Ayuso
2017-10-17 11:54 ` Phil Sutter
2017-10-17 12:02 ` Phil Sutter
2017-10-17 12:11 ` Pablo Neira Ayuso
2017-10-17 13:17 ` [libnftnl PATCH v3] " Phil Sutter
2017-10-17 13:19 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).