summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* examples: fix neigh max attributesLaura Garcia Liebana2018-05-231-2/+2
| | | | | | | | Use NDA_MAX for neigh maximum attributes instead of IFA_MAX, which is only for interfaces. Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: add arp cache dump exampleLaura Garcia Liebana2018-05-182-1/+166
| | | | | | | | | Adding ARP example in order to dump the info in the form: index=<interface> family=<family> dst=<destination ip> lladdr=<mac address> state=<arp status> Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-addr-dump: fix typoStephen Hemminger2018-01-191-1/+1
| | | | | | | | The example about addresses uses link attributes when it meant to use address attributes. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: nfct-daemon: Fix test building on musl libcKylie McClain2016-07-211-0/+1
| | | | | | | On musl libc, sys/select.h is where FD_* definitions are located. Signed-off-by: Kylie McClain <somasis@exherbo.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* example: netfilter: get rid of aligned_be64 definitionsPablo Neira Ayuso2015-05-262-10/+0
| | | | | | | | | | This is defined in <linux/types.h>, which is included by the nfnetlink_* header files. Thus, we can get rid of u_int64_t which causes problems to musl according to Felix Janda. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples/netfilter: Include <endian.h> for be64tohFelix Janda2015-05-252-0/+2
| | | | | Signed-off-by: Felix Janda <felix.janda@posteo.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: use mnl_socket_setsockoptKen-ichirou MATSUZAWA2013-12-071-4/+2
| | | | | | | instead of raw setsockopt() Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: fix display conditionKen-ichirou MATSUZAWA2013-12-071-2/+3
| | | | | Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: made sub functions the sameKen-ichirou MATSUZAWA2013-12-072-6/+17
| | | | | | | show entry in oneline and RTA_PRIORITY Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: use mnl_nlmsg_get_payload()Ken-ichirou MATSUZAWA2013-12-071-1/+1
| | | | | | | not increment (nlmsghdr) pointer Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: fix trivial error messageKen-ichirou MATSUZAWA2013-12-0715-34/+34
| | | | | Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: set attr tableKen-ichirou MATSUZAWA2013-12-072-0/+8
| | | | | | | Florian adviced rtnl-route-event.c has same problem Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
* examples: netfilter: add nfct daemon skeleton codePablo Neira Ayuso2013-07-052-1/+370
| | | | | | | | This patch adds the skeleton code for a daemon that collects statistics via ctnetlink. Consider it a simplified version of ulogd2. It also contains some documentation on several interesting tweaks. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: netfilter: add nfct-dumpPablo Neira Ayuso2013-05-312-0/+322
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: add rtnl-addr-dumpPablo Neira Ayuso2013-05-282-1/+138
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-link-dump: display HW addressPablo Neira Ayuso2013-05-271-1/+19
|
* examples: rtnl-route-dump: display also metric/priorityPablo Neira Ayuso2013-05-021-0/+3
| | | | | | If present in the route message, otherwise simply skip it. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-route-add: fix typo in IPv6 supportPablo Neira Ayuso2013-05-021-1/+1
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-route-event: update Makefile.amPablo Neira Ayuso2013-04-241-1/+5
| | | | | | So you can compile rtnl-route-event via `make check' Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-route-event: add example to listen to IPv4/IPv6 routesPablo Neira Ayuso2013-04-241-0/+330
| | | | | | Derived from rtnl-route-dump.c Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-route-add improvements (including IPv6 support)Pablo Neira Ayuso2013-04-241-24/+57
| | | | | | | | | | | | | | | Now, both IPv4 and IPv6 are supported simultaneously in one single file. While at it: * I moved the declarations to the beginning of the main function. * Renamed mask by prefix, which seems more appropriate to me. * Use RTPROTO_STATIC, as the route has been added by the administrator. * Set NLM_F_ACK, so we get a report from the kernel about our query and treat reply from the kernel. * Stricter argc checking. * Use perror instead of printf for error reporting. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: add kobject-eventPablo Neira Ayuso2013-03-263-1/+56
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: add genl-group-eventsPablo Neira Ayuso2013-03-192-1/+68
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: rtnl-route-dump: add IPv6 supportPhilip Prindeville2012-08-091-5/+108
| | | | | | | | | [ Pablo has modified the original patch modified to fix some compilation warnings with gcc-4.7 and select the protocol family as argument from the command line. ] Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* example: release them in the public domainPablo Neira Ayuso2012-01-0212-72/+12
| | | | | | | | I have decided to release the examples in this library in the public domain. Jan Engelhardt, who has been the sole contributor so far, has agreed with this re-licensing by communication via e-mail. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples/genl: support dumping the genl familiesJan Engelhardt2011-01-081-2/+6
| | | | | | The usage text already specified [family] as optional, now implement it :-) Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* examples/genl: fix newline imbalanceJan Engelhardt2011-01-081-2/+3
| | | | | | Running `genl-family-get VFS_DQUOT` forgets to print a newline. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* examples: fix wrong group mask number in nfct-eventPablo Neira Ayuso2010-12-171-3/+3
| | | | | | | This patch replaces event group numbers NFNLGRP_CONNTRACK_* by the event group mask NF_NETLINK_CONNTRACK_* Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* nlmsg: add new message batching infrastructurePablo Neira Ayuso2010-12-172-1/+197
| | | | | | | | | This patch adds the new message batching infrastructure that allows to store several messages into one single datagram. This patch includes an example for ctnetlink. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Update .gitignoreJan Engelhardt2010-11-161-0/+1
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* nlmsg: rework mnl_nlmsg_fprintfPablo Neira Ayuso2010-11-071-1/+2
| | | | | | | | This patch reworks mnl_nlmsg_fprintf. It breaks backward compatibility of this function, there was no way to improve it without doing so (and we are still in time to break thing, BTW). Signed-off-bu: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: add nflog examplePablo Neira Ayuso2010-11-072-0/+233
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: remove redundant castsJan Engelhardt2010-10-306-11/+11
|
* attr: rename str_null from NULL awayJan Engelhardt2010-10-251-1/+1
| | | | | | | | | | A small little pedantism: NULL (as in, the pointer) isn't NUL (as in, the character with value zero, '\0'). I propose to rename it to strz, for the zero-terminated string (sometimes referred to as ASCIZ string, but of course C isn't tied to ASCII). Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: avoid using deprecated unspecified argument listsJan Engelhardt2010-10-226-6/+6
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* src: define MNL_SOCKET_BUFFER_SIZE to 8192ULPablo Neira Ayuso2010-10-2110-10/+10
| | | | | | | | | | | | | | | | Davem spotted during the Netfilter Workshop that user-space applications should use 8KB buffers for recv(). I accidentally found that NFLOG is not following this approach (in this case we're using 131072 bytes messages), we have to document this. Anyway, according to linux/netlink.h (and to complete this log message): "skb should fit one page. This choice is good for headerless malloc. But we should limit to 8K so that userspace does not have to use enormous buffer sizes on recvmsg() calls just to avoid MSG_TRUNC when PAGE_SIZE is very large." Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Add .gitignore filesJan Engelhardt2010-10-193-0/+10
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* build: remove unneeded -dynamic -ldl -nostartfiles flagsJan Engelhardt2010-10-193-10/+0
| | | | | | | | | Besides that -ldl should be in _LDADD (not _LDFLAGS), I do not see any dlopen calls at all that would make the library a requirement. I also see no reason to use -Wc,-nostartfiles. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* examples: put examples files into specific directoriesPablo Neira Ayuso2010-09-0814-50/+55
| | | | | | | put examples files into specific directories according to the Netlink bus they work with. And minor update in the readme file Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: fix byte-order in nfct-eventPablo Neira Ayuso2010-07-101-8/+11
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* examples: fix rtnl-set-linkPablo Neira Ayuso2010-07-101-9/+12
| | | | | | | This patch fixes the example that allows to set up/down the network interface. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add nfct-event examplePablo Neira Ayuso2010-05-092-1/+248
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix rtnl-link-dump3.cPablo Neira Ayuso2010-05-091-1/+1
| | | | | | | commit a5f25889216411ad7492047fafe6de03b8408440 introduced a minor problem in this example. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* relax mnl_attr_type_valid() checkings and change errno valuePablo Neira Ayuso2010-05-097-40/+31
| | | | | | | | This patch relaxes strict attribute checkings in the example files. I have also changed the errno value, now it's EOPNOTSUPP instead of EINVAL. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* statify function in nf-queue.c examplePablo Neira Ayuso2010-05-041-1/+2
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add nf-queue.c example file for nfnetlink_queuePablo Neira Ayuso2010-05-032-1/+257
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add licensing terms of example filesPablo Neira Ayuso2010-05-038-0/+48
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add rtnl-route-add.c to examplesPablo Neira Ayuso2010-04-232-0/+98
| | | | | | | Heavily based on an example from Alejandro Castaño. Untested. Signed-off-by: Alejandro Castaño <alecastanyo@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix lots of compilation warnings in example filesPablo Neira Ayuso2010-04-227-23/+19
| | | | | | They have been spotted by -Wall -Wextra Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* add mnl_nlmsg_fprintf() function for debugging purposesPablo Neira Ayuso2010-04-191-1/+1
| | | | | | This function is still quite preliminary, comments welcome! Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>