summaryrefslogtreecommitdiffstats
path: root/src/socket.c
Commit message (Collapse)AuthorAgeFilesLines
* src: cleanup function definitionsPablo Neira Ayuso2016-07-011-4/+4
| | | | | | | Place the returned value, function name and parameters (as many as can fit) in the same line. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* Move declaration of visibility attributes before definition.Peter Foley2016-07-011-11/+11
| | | | | | | | | | | | | | | | | | | | When compiling with clang, the visibility attributes are ignored since they are after the definition of the exported function. Fix this by moving the attribute declaration before the function. attr.c:439:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes] EXPORT_SYMBOL(mnl_attr_put_u8); ^ ./internal.h:7:41: note: expanded from macro 'EXPORT_SYMBOL' ^ ./internal.h:6:35: note: expanded from macro '__visible' ^ attr.c:435:6: note: previous definition is here void mnl_attr_put_u8(struct nlmsghdr *nlh, uint16_t type, uint8_t data) ^ Signed-off-by: Peter Foley <pefoley2@pefoley.com>
* socket: introduce mnl_socket_open2()Guillaume Nault2015-10-041-9/+32
| | | | | | | | Define mnl_socket_open2() so that user can pass a set of SOCK_* flags at socket creation time. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: creating a struct mnl_socket from a pre-existing socketKen-ichirou MATSUZAWA2014-09-251-0/+34
| | | | | | | | | This patch defines a new function mnl_socket_fdopen() which creates a struct mnl_socket object from a pre-existing socket like obtained from other process and different domain/type from the same prodess. Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: calloc expects struct size as second parameterPablo Neira Ayuso2014-09-241-1/+1
| | | | | | | The parameters where accidentally swapped. Reported-by: Chris Rapier <rapier@psc.edu> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* doc: mnl_socket_open returns NULL on errorShawn Landden2013-12-071-1/+1
| | | | Signed-off-by: Florian Westphal <fw@strlen.de>
* doc: don't show up EXPORT_SYMBOL in doxygenPablo Neira Ayuso2011-02-031-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Patrick reports that the doxygen output shows up EXPORT_SYMBOL and tells how to fix this: > I just noticed the EXPORT_SYMBOLs in libmnl showing up in > the doxygen output. Just in case you want to avoid this, > what I'm doing in libdect is (besides the appopriate linker > flags): > > #define __visible __attribute__((visibility("default"))) > > #define EXPORT_SYMBOL(x) typeof(x) (x) __visible > > > This allows to use EXPORT_SYMBOL as in the kernel, IOW > after the function definition. This patch also removes -Wredundant-decls to avoid a warning in every single use of this new approach. Now, this looks more like the Linux kernel way of exporting symbols. Reported-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* doc: add new website at netfilter.org to doxygenPablo Neira Ayuso2010-12-171-2/+2
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* build: tag function headers rather than decls as exportedJan Engelhardt2010-11-191-13/+15
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* license: change licensing terms from GPLv2+ to LGPLv2.1+Pablo Neira Ayuso2010-11-191-2/+5
| | | | | | | | | | Existing contributors ACK'ed the license change via email: * Jozsef Kadlecsik * Jan Engelhardt * Cristian Rodríguez Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: propagate sendto/recvmsg's return typesJan Engelhardt2010-11-161-3/+5
| | | | | | | sendto/recvfrom return ssize_t, so libmnl should not truncate the result range. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* socket: constify a struct sockaddr_nlJan Engelhardt2010-11-111-1/+1
| | | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: use more appropriate types for mnl_socket_bindJan Engelhardt2010-10-221-1/+1
| | | | | | | groups, being a bitmask, should be unsigned; and let's also use pid_t for pid. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* doc: documentation updatesJan Engelhardt2010-10-221-9/+9
| | | | | | Spelling, grammer, and synchronization of the readme. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* socket: remove statement with no effectJan Engelhardt2010-10-221-1/+0
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* src: remove redundant castsJan Engelhardt2010-10-221-1/+1
| | | | Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
* doc: git tree update (now at netfilter.org) and fix listing in doxygenPablo Neira Ayuso2010-10-211-7/+7
| | | | | | | | This patch update the git tree address (now at netfilter.org) and it also fixes a minor problem with the doxygen output in one of the socket helpers. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* src: define MNL_SOCKET_BUFFER_SIZE to 8192ULPablo Neira Ayuso2010-10-211-2/+5
| | | | | | | | | | | | | | | | 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 quote from Thoureau to documentationPablo Neira Ayuso2010-10-101-0/+4
| | | | | | I like this quote. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* doxygen documentationPablo Neira Ayuso2010-09-081-21/+73
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* socket: remove mnl_socket_sendmsg() and mnl_socket_recvmsg()Pablo Neira Ayuso2010-06-251-30/+0
| | | | | | | | These functions are too simple wrappers that bloat the library. We can use mnl_socket_get_fd() to obtain the file descriptor and invoke message-oriented system call instead. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* update socket helper documentationPablo Neira Ayuso2010-04-121-5/+6
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* constify several mnl_socket_* parameters and use size_t instead of intPablo Neira Ayuso2010-04-031-8/+8
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix mnl_socket_bind() to support the selection of the netlink portIDPablo Neira Ayuso2010-03-281-0/+1
|
* add COPYING filePablo Neira Ayuso2010-03-261-2/+4
| | | | | | This library is distributed under GPLv2+. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* fix leak in mnl_socket_open()Pablo Neira Ayuso2010-03-191-1/+3
|
* initial libmnl importPablo Neira Ayuso2010-03-191-0/+255