flow: create nl interface to wrap low level flow msg details
Subsystems (2)
PATCH 1/8 flow: create nl interface to wrap low level flow msg details
From: John Fastabend <[email protected]>
Some low-level functions that can be used to interface with API from other programs without having to invoke NETLINK primitives.
--- include/flowlib_nl.h | 75 ++++++ lib/Makefile.am | 2 lib/flowlib_nl.c | 657 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/flow.c | 266 +++----------------- 4 files changed, 773 insertions(+), 227 deletions(-) create mode 100644 include/flowlib_nl.h create mode 100644 lib/flowlib_nl.c
include/flowlib_nl.h new file +75 -0
@@ -0,0 +1,75 @@ +/******************************************************************************* + +Flow Library - Helpers for working on Flow API +Copyright(c) 2014 Intel Corporation. + +This program is free software; you can redistribute it and/or modify it +under the terms and conditions of the GNU General Public License, +version 2, as published by the Free Software Foundation. + +This program is distributed in the hope it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +The full GNU General Public License is included in this distribution in +the file called "COPYING". + +Author: John Fastabend <[email protected]> + +*******************************************************************************/ +#ifndef _FLOWLIB_NL_H +#define _FLOWLIB_NL_H +struct flow_msg { +void *msg; +struct nl_msg *nlbuf; +uint32_t seq; +}; + +struct nl_sock *flow_nl_get_socket (void ); + +struct net_flow_hdr *flow_nl_get_headers (struct nl_sock *nsd,uint32_t pid, +unsigned int ifindex,int family); +struct net_flow_action *flow_nl_get_actions (struct nl_sock *nsd,uint32_t pid, +unsigned int ifindex,int family); +struct net_flow_tbl *flow_nl_get_tables (struct nl_sock *nsd,uint32_t pid, +unsigned int ifindex,int family); +struct net_flow_hdr_node *flow_nl_get_hdr_graph (struct nl_sock *nsd, +uint32_t pid, +unsigned int ifindex, +int family); +struct net_flow_tbl_node *flow_nl_get_tbl_graph (struct nl_sock *nsd, +uint32_t pid, +unsigned int ifindex, +int family); + +int flow_nl_set_flows (struct nl_sock *nsd,uint32_t pid, +unsigned int ifindex,int family, +struct net_flow_flow *flow); +int flow_nl_create_table (struct nl_sock *nsd,uint32_t pid, +unsigned int ifindex,int family, +struct net_flow_tbl *table); + +uint32_t flow_nl_find_header (struct net_flow_hdr *hdr, +struct net_flow_hdr *search); +uint32_t flow_nl_find_action_by_name (char *name, +struct net_flow_action *action); +uint32_t flow_nl_find_instance (struct net_flow_hdr_node *graph, +uint32_t uid,uint32_t next); +uint32_t flow_nl_find_table_with_action (struct net_flow_tbl *tbls, +uint32_t action,uint32_t next); + +void flow_nl_free_msg (struct flow_msg *msg); +struct flow_msg *flow_nl_wrap_msg (struct nlmsghdr *buf); +struct flow_msg *flow_nl_recv_msg (struct nl_sock *nsd,int *err); +int flow_nl_table_cmd_to_type (FILE *fp,bool print,int valid, +struct nlattr *tb[]); +struct flow_msg *flow_nl_alloc_msg (uint8_t type,uint32_t pid,int flags, +int size,int family); +struct flow_msg *flow_nl_get_msg (struct nl_sock *nsd,uint8_t cmd,uint32_t pid, +unsigned int ifindex,int family); +#endif
lib/Makefile.am +1 -1
@@ -36,7 +36,7 @@ libflowies_la_CFLAGS = $(AM_CFLAGS) $(IES_CFLAGS) $(CFLAGS) libflowies_la_LDFLAGS = -release @FLOW_API_VERSION@ lib_LTLIBRARIES += libflow.la -libflow_la_SOURCES = flowlib.c +libflow_la_SOURCES = flowlib_nl.c flowlib.c libflow_la_LDFLAGS = -release @FLOW_API_VERSION@ lib_LTLIBRARIES += libflowd.la
lib/flowlib_nl.c new file +657 -0
657 lines not on this page · raw message
src/flow.c +40 -226
519 lines not on this page · raw message
PATCH 1/8 flow: create nl interface to wrap low level flow msg details
Quoted 7 lines · John Fastabend
From: John Fastabend <[email protected]>
Some low-level functions that can be used to interface with API from other programs without having to invoke NETLINK primitives.
Signed-off-by John Fastabend <[email protected]>
Quoted 9 lines
--- include/flowlib_nl.h | 75 ++++++ lib/Makefile.am | 2 lib/flowlib_nl.c | 657 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/flow.c | 266 +++----------------- 4 files changed, 773 insertions(+), 227 deletions(-) create mode 100644 include/flowlib_nl.h create mode 100644 lib/flowlib_nl.c
Will the other 7 patches be posted as well? :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150518/6e3b451d/attachment.asc>
PATCH 1/8 flow: create nl interface to wrap low level flow msg details
Quoted 18 lines · Jeff Kirsher
Quoted 7 lines · John Fastabend
From: John Fastabend <[email protected]>
Some low-level functions that can be used to interface with API from other programs without having to invoke NETLINK primitives.
Signed-off-by John Fastabend <[email protected]>Quoted 9 lines
--- include/flowlib_nl.h | 75 ++++++ lib/Makefile.am | 2 lib/flowlib_nl.c | 657 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/flow.c | 266 +++----------------- 4 files changed, 773 insertions(+), 227 deletions(-) create mode 100644 include/flowlib_nl.h create mode 100644 lib/flowlib_nl.c
Quoted 2 lines
Will the other 7 patches be posted as well? :-)
Ah dang failed to hit Ctl-C quickly enough... Sorry this is against a different repository. The danger of having multiple terminals open and using Ctl-r for shortcuts.
So just drop it. :)
Thanks and sorry for the noise.