netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libnftables PATCH] rule: Add a function to get rule's family
@ 2013-01-10 14:29 Tomasz Bursztyka
  2013-01-13 19:08 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Bursztyka @ 2013-01-10 14:29 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Tomasz Bursztyka

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 include/libnftables/rule.h | 2 ++
 src/libnftables.map        | 1 +
 src/rule.c                 | 6 ++++++
 3 files changed, 9 insertions(+)

diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
index a944c00..310262a 100644
--- a/include/libnftables/rule.h
+++ b/include/libnftables/rule.h
@@ -28,6 +28,8 @@ void *nft_rule_attr_get(struct nft_rule *r, uint16_t attr);
 const char *nft_rule_attr_get_str(struct nft_rule *r, uint16_t attr);
 uint64_t nft_rule_attr_get_u64(struct nft_rule *r, uint16_t attr);
 
+uint8_t nft_rule_get_family(struct nft_rule *r);
+
 void nft_rule_add_expr(struct nft_rule *r, struct nft_rule_expr *expr);
 
 void nft_rule_nlmsg_build_payload(struct nlmsghdr *nlh, struct nft_rule *t);
diff --git a/src/libnftables.map b/src/libnftables.map
index a62f200..3dad5fa 100644
--- a/src/libnftables.map
+++ b/src/libnftables.map
@@ -47,6 +47,7 @@ global:
   nft_rule_attr_get;
   nft_rule_attr_get_u64;
   nft_rule_attr_get_str;
+  nft_rule_get_family;
   nft_rule_snprintf;
   nft_rule_nlmsg_build_hdr;
   nft_rule_nlmsg_build_payload;
diff --git a/src/rule.c b/src/rule.c
index dd05412..0bbeeb2 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -140,6 +140,12 @@ uint64_t nft_rule_attr_get_u64(struct nft_rule *r, uint16_t attr)
 }
 EXPORT_SYMBOL(nft_rule_attr_get_u64);
 
+uint8_t nft_rule_get_family(struct nft_rule *r)
+{
+	return r->family;
+}
+EXPORT_SYMBOL(nft_rule_get_family);
+
 struct nlmsghdr *
 nft_rule_nlmsg_build_hdr(char *buf, uint16_t cmd, uint16_t family,
 			  uint16_t type, uint32_t seq)
-- 
1.8.0.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libnftables PATCH] rule: Add a function to get rule's family
  2013-01-10 14:29 [libnftables PATCH] rule: Add a function to get rule's family Tomasz Bursztyka
@ 2013-01-13 19:08 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-01-13 19:08 UTC (permalink / raw)
  To: Tomasz Bursztyka; +Cc: netfilter-devel

On Thu, Jan 10, 2013 at 04:29:05PM +0200, Tomasz Bursztyka wrote:
> diff --git a/include/libnftables/rule.h b/include/libnftables/rule.h
> index a944c00..310262a 100644
> --- a/include/libnftables/rule.h
> +++ b/include/libnftables/rule.h
> @@ -28,6 +28,8 @@ void *nft_rule_attr_get(struct nft_rule *r, uint16_t attr);
>  const char *nft_rule_attr_get_str(struct nft_rule *r, uint16_t attr);
>  uint64_t nft_rule_attr_get_u64(struct nft_rule *r, uint16_t attr);
>  
> +uint8_t nft_rule_get_family(struct nft_rule *r);

I have applied this with a little modification, the new interface is
nft_rule_attr_get_u8 so you can retrieve the family via
NFT_RULE_ATTR_FAMILY.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-13 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 14:29 [libnftables PATCH] rule: Add a function to get rule's family Tomasz Bursztyka
2013-01-13 19:08 ` 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).