Skip to contentSkip to conversation

Minimally resurrect doxygen documentation

PATCH Superseded Duncan Roe 3 participants 21 messages Oct 14, 2019 – Nov 4, 2019 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

cover Minimally resurrect doxygen documentation

libnfnetlink has good doxygen documentation but there was no output when doxygen was run.

Patch 1/1 fixes that,
but on rebuilding there were a number warnings of the form:

right-hand operand of comma expression has no effect [-Wunused-value]

*This was not introduced by patch 1/1*

Instead, it is caused by the definition of "prefetch" in include/linux_list.h:

#define prefetch(x) 1

the Linux kernel has:

#define prefetch(x) __builtin_prefetch(x)

I see 3 ways to get back to a clean compile:

1. Suppress the warnings with a pragma

2. Reinstate the Linux definition of prefetch

3. Expunge prefetch from the header file

I have made all 3, please indicate which one you'd like.

1. & 2. are 1-liners while 3. is multiline.

3. allows of extra simplifications, such as defining a macro in a single line or fewer lines than before. In some places I could also delete the fragment "&& ({ 1;})".

Duncan Roe (1):
src: Minimally resurrect doxygen documentation

 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |   9 +++
 src/libnfnetlink.c   |  17 ++++-
 5 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
Signature · 1 line
2.14.5
author
#1 lore raw

PATCH 1/1 src: Minimally resurrect doxygen documentation

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

---
 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |   9 +++
 src/libnfnetlink.c   |  17 ++++-
 5 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
configure.ac +1 -1
index b979772..922ec09 100644
@@ -28,6 +28,6 @@ dnl--------------------------------
 
 
 dnl Output the makefile
-AC_CONFIG_FILES([Makefile src/Makefile include/Makefile
+AC_CONFIG_FILES([Makefile src/Makefile include/Makefile doxygen.cfg
 	include/libnfnetlink/Makefile utils/Makefile libnfnetlink.pc])
 AC_OUTPUT
doxygen.cfg.in new file +180 -0

180 lines not on this page · raw message

include/linux_list.h +9 -0
index de182a4..d296cfa 100644
@@ -3,6 +3,11 @@
 
 #include <stddef.h>
 
+/**
+ * \defgroup linux_list Items defined in linux_list.h
+ * @{
+ */
+
 #undef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
@@ -724,4 +729,8 @@ static inline void hlist_add_after(struct hlist_node *n,
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next, ({ smp_read_barrier_depends(); 0; }) )
 
+/**
+ * @}
+ */
+
 #endif
src/iftable.c +9 -0
index 157f97b..6d1d135 100644
@@ -24,6 +24,11 @@
 #include "rtnl.h"
 #include "linux_list.h"
 
+/**
+ * \defgroup iftable Functions in iftable.c
+ * @{
+ */
+
 struct ifindex_node {
 	struct list_head head;
 
@@ -333,3 +338,7 @@ int nlif_fd(struct nlif_handle *h)
 
 	return -1;
 }
+
+/**
+ * @}
+ */
src/libnfnetlink.c +16 -1
index df57533..3db21e0 100644
@@ -52,6 +52,18 @@
 
 #include <libnfnetlink/libnfnetlink.h>
 
+/**
+ * \mainpage
+ *
+ * libnfnetlink is the bottom-level communication between the kernel and
+ * userspace
+ */
+
+/**
+ * \defgroup libnfnetlink Functions in libnfnetlink.c
+ * @{
+ */
+
 #ifndef NETLINK_ADD_MEMBERSHIP
 #define NETLINK_ADD_MEMBERSHIP 1
 #endif
@@ -60,7 +72,6 @@
 #define SOL_NETLINK 270
 #endif
 
-
 #define nfnl_error(format, args...) \
 	fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## args)
 
@@ -1572,3 +1583,7 @@ int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh)
 
 	return nfnl_catch(h);
 }
+
+/**
+ * @}
+ */
Signature · 1 line
2.14.5
#2 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Quoted 12 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

Quoted 7 lines

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

Did you already queue patches to make documentation for libnfnetlink locally there? I would like not to discourage you in your efforts to help us improve documentation, which is always extremely useful for everyone.

Let me know, thanks.

author
#3 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Quoted 26 lines · Pablo Neira Ayuso
Quoted 12 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

Quoted 7 lines

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

Quoted 6 lines

Did you already queue patches to make documentation for libnfnetlink locally there? I would like not to discourage you in your efforts to help us improve documentation, which is always extremely useful for everyone.

Let me know, thanks.

Very timely of you to ask.

Just this morning I was going to get back into libnetfilter_queue documentation, starting with the other 2 verdict helpers.

But I ran into a conundrum with nfq_nlmsg_verdict_put_mark (the one I didn't use). It's a 1-liner (in src/nlmsg.c):

Quoted 1 line

56 mnl_attr_put_u32(nlh, NFQA_MARK, htonl(mark));

But examples/nf-queue.c has an example to set the connmark which doesn't use nfq_nlmsg_verdict_put_mark()

Instead it has this line:

Quoted 1 line

52 mnl_attr_put_u32(nlh, CTA_MARK, htonl(42));

The trouble is, NFQA_MARK *is different from* CTA_MARK. NFQA_MARK is 3, while CTA_MARK is 8.

At this point, I felt I did not understand the software well enough to be able to document it further. If you could shed some light on this apparent disrcepancy, it might restore my self-confidence sufficiently that I can continue documenting.

Cheers ... Duncan.

#4 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Quoted 15 lines · Duncan Roe

Just this morning I was going to get back into libnetfilter_queue documentation, starting with the other 2 verdict helpers.

But I ran into a conundrum with nfq_nlmsg_verdict_put_mark (the one I didn't use). It's a 1-liner (in src/nlmsg.c):

Quoted 1 line

56 mnl_attr_put_u32(nlh, NFQA_MARK, htonl(mark));

But examples/nf-queue.c has an example to set the connmark which doesn't use nfq_nlmsg_verdict_put_mark()

Instead it has this line:

Quoted 1 line

52 mnl_attr_put_u32(nlh, CTA_MARK, htonl(42));

Quoted 7 lines

The trouble is, NFQA_MARK *is different from* CTA_MARK. NFQA_MARK is 3, while CTA_MARK is 8.

At this point, I felt I did not understand the software well enough to be able to document it further. If you could shed some light on this apparent disrcepancy, it might restore my self-confidence sufficiently that I can continue documenting.

NFQA_MARK is used for setting the nfmark; CTA_MARK is used for setting the ctmark. Here are the relevant stanzas from the NF Kconfig:

config NETFILTER_XT_MARK
tristate 'nfmark target and match support' default m if NETFILTER_ADVANCED=n ---help---
This option adds the "MARK" target and "mark" match.

Netfilter mark matching allows you to match packets based on the "nfmark" value in the packet.
The target allows you to create rules in the "mangle" table which alter the netfilter mark (nfmark) field associated with the packet.

Prior to routing, the nfmark can influence the routing method and can also be used by other subsystems to change their behavior.

config NETFILTER_XT_CONNMARK
tristate 'ctmark target and match support'
depends on NF_CONNTRACK
depends on NETFILTER_ADVANCED
select NF_CONNTRACK_MARK
---help---
This option adds the "CONNMARK" target and "connmark" match.

Netfilter allows you to store a mark value per connection (a.k.a. ctmark), similarly to the packet mark (nfmark). Using this target and match, you can set and match on this mark.

nfq_nlmsg_verdict_put_mark sets an nfmark whereas the example is setting a ctmark.

J.

#5 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

In reply to Duncan Roe
Quoted 51 lines · Duncan Roe
Quoted 26 lines · Pablo Neira Ayuso
Quoted 12 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

Quoted 7 lines

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

Quoted 6 lines

Did you already queue patches to make documentation for libnfnetlink locally there? I would like not to discourage you in your efforts to help us improve documentation, which is always extremely useful for everyone.

Let me know, thanks.

Very timely of you to ask.

Just this morning I was going to get back into libnetfilter_queue documentation, starting with the other 2 verdict helpers.

But I ran into a conundrum with nfq_nlmsg_verdict_put_mark (the one I didn't use). It's a 1-liner (in src/nlmsg.c):

Quoted 1 line

56 mnl_attr_put_u32(nlh, NFQA_MARK, htonl(mark));

But examples/nf-queue.c has an example to set the connmark which doesn't use nfq_nlmsg_verdict_put_mark()

Instead it has this line:

Quoted 1 line

52 mnl_attr_put_u32(nlh, CTA_MARK, htonl(42));

Quoted 7 lines

The trouble is, NFQA_MARK *is different from* CTA_MARK. NFQA_MARK is 3, while CTA_MARK is 8.

At this point, I felt I did not understand the software well enough to be able to document it further. If you could shed some light on this apparent disrcepancy, it might restore my self-confidence sufficiently that I can continue documenting.

The idea is that the new libnetfilter_queue API provides a set of helpers for libmnl. Hence, you have access to the netlink socket API and you use the helpers to build the netlink message.

The netlink sockets allows you to communicate userspace with the corresponding kernel subsystem. The message you send to the kernel is composed of two headers, one is the struct nlmsghdr (netlink header) and then it follows the nfnl header. The payload of the netlink message is composite of Type-Length-Value (TLV) attributes.

Therefore:

        mnl_attr_put_u32(nlh, CTA_MARK, htonl(42));

is adding the TLV that represents the conntrack mark.

The value is in network-byte-order for historical reasons, there were an original effort to place netlink message on the network wire, but at the end of the day this was not used in practise.

So the new libnetfilter_queue API is more low-level, in the sense that you have more control on netlink aspects, such as the socket initialization and the message building / parsing.

author
#6 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

In reply to Pablo Neira Ayuso
Quoted 5 lines · Pablo Neira Ayuso
Quoted 4 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

[...]

Quoted 7 lines
Quoted 1 line

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

The thing is, the Deprecated functions in libnetfilter_queue are much better documented than the newer functions and that documentation refers to libnfnetlink functions.

So I think that while the deprecated functions are documented, you should really have documentation for the old library they use.

BTW, ldd of my app shows libnfnetlink.so although it doesn't use any deprecated functions. Is that expected?

Cheers ... Duncan.

#7 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Quoted 9 lines · Duncan Roe
Quoted 5 lines · Pablo Neira Ayuso
Quoted 4 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

[...]

Quoted 2 lines
Quoted 1 line
Quoted 8 lines
Quoted 5 lines

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

The thing is, the Deprecated functions in libnetfilter_queue are much better documented than the newer functions and that documentation refers to libnfnetlink functions.

Would you help me get better the documentation for the new libnetfilter_queue API? I'll be trying to address your questions timely in case you decide to enroll in such endeavor.

Quoted 2 lines

So I think that while the deprecated functions are documented, you should really have documentation for the old library they use.

Are you refering to libnfnetlink or libnetfilter_queue in this case? If you insist on documenting libnfnetlink, I'll be fine with it, no worries.

Quoted 2 lines

BTW, ldd of my app shows libnfnetlink.so although it doesn't use any deprecated functions. Is that expected?

Yes, there is still code in the libraries that refer to libnfnetlink. Replacing some of that code should be feasible via libmnl, it is a task that has been in my TODO list for long time. There's always something with more priority in the queue.

author
#8 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Hi Pablo,

Quoted 15 lines · Pablo Neira Ayuso
Quoted 14 lines · Duncan Roe
Quoted 5 lines · Pablo Neira Ayuso
Quoted 4 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

[...]

Quoted 7 lines
Quoted 1 line

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

Quoted 7 lines
Quoted 3 lines

The thing is, the Deprecated functions in libnetfilter_queue are much better documented than the newer functions and that documentation refers to libnfnetlink functions.

Would you help me get better the documentation for the new libnetfilter_queue API? I'll be trying to address your questions timely in case you decide to enroll in such endeavor.

OK I will take that on as a project.

Quoted 5 lines
Quoted 3 lines

So I think that while the deprecated functions are documented, you should really have documentation for the old library they use.

Are you refering to libnfnetlink or libnetfilter_queue in this case?

libnetfilter_queue

Quoted 2 lines

If you insist on documenting libnfnetlink, I'll be fine with it, no worries.

Yes I insist. LMK which compiler warning fix you'd like (if any)

Quoted 8 lines
Quoted 3 lines

BTW, ldd of my app shows libnfnetlink.so although it doesn't use any deprecated functions. Is that expected?

Yes, there is still code in the libraries that refer to libnfnetlink. Replacing some of that code should be feasible via libmnl, it is a task that has been in my TODO list for long time. There's always something with more priority in the queue.

Cheers ... Duncan.

author
#9 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

In reply to Pablo Neira Ayuso
Quoted 8 lines · Pablo Neira Ayuso
Quoted 2 lines · Duncan Roe

BTW, ldd of my app shows libnfnetlink.so although it doesn't use any deprecated functions. Is that expected?

Yes, there is still code in the libraries that refer to libnfnetlink. Replacing some of that code should be feasible via libmnl, it is a task that has been in my TODO list for long time. There's always something with more priority in the queue.

Using *nm -D* (dynamic symbols) I see
- libmnl.so: no U (undefined) symbols satisfied by libnfnetlink.so
- nfq (my app): no U symbols satisfied by libnfnetlink.so
- libnetfilter_queue.so: many U symbols satisfied by libnfnetlink.so
Only way to tell whether the libnfnetlink.so references in libnetfilter_queue.so are confined to the deprecated functions would be to do a build without them. If that eliminates libnfnetlink references, then maybe we could think about a configure option to not build them (also excluding them from the doco). But that's for another day - I'll get back to libnetfilter_queue doco for now.

Cheers ... Duncan.

#10 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

Quoted 10 lines · Duncan Roe
Quoted 8 lines · Pablo Neira Ayuso
Quoted 2 lines · Duncan Roe

BTW, ldd of my app shows libnfnetlink.so although it doesn't use any deprecated functions. Is that expected?

Yes, there is still code in the libraries that refer to libnfnetlink. Replacing some of that code should be feasible via libmnl, it is a task that has been in my TODO list for long time. There's always something with more priority in the queue.

Quoted 8 lines

Using *nm -D* (dynamic symbols) I see
- libmnl.so: no U (undefined) symbols satisfied by libnfnetlink.so
- nfq (my app): no U symbols satisfied by libnfnetlink.so
- libnetfilter_queue.so: many U symbols satisfied by libnfnetlink.so
Only way to tell whether the libnfnetlink.so references in libnetfilter_queue.so are confined to the deprecated functions would be to do a build without them. If that eliminates libnfnetlink references, then maybe we could think about a configure option to not build them (also excluding them from the doco).

Apparently, there are many people using this old libnetfilter_queue API, we cannot get rid of it. We could though explore using libmnl instead of libnfnetlink from the old libnetfilter_queue API implementation.

Quoted 1 line

But that's for another day - I'll get back to libnetfilter_queue doco for now.

Agreed.

author
#11 lore raw

Re: [PATCH libnfnetlink 1/1] src: Minimally resurrect doxygen documentation

In reply to Pablo Neira Ayuso
Quoted 7 lines · Pablo Neira Ayuso
Quoted 6 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

[...]

Quoted 5 lines

I'm ambivalent about this, it's been up on the table for a while.

This library is rather old, and new applications should probably be based instead used libmnl, which is a better choice.

I'm sending a v2 which makes this abundantly clear

Quoted 5 lines

Did you already queue patches to make documentation for libnfnetlink locally there? I would like not to discourage you in your efforts to help us improve documentation, which is always extremely useful for everyone.

No, I'm concentrating on libnetfilter_queue from now on.

Cheers ... Duncan.

author
#12 lore raw

v2 cover Minimally resurrect doxygen documentation

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

--
v2: main page and function pages make it clear to use libmnl for new apps

Duncan Roe (2):
Minimally resurrect doxygen documentation
Make it clear that this library is deprecated

 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |  13 ++++
 src/libnfnetlink.c   |  28 +++++++-
 5 files changed, 230 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
Signature · 1 line
2.14.5
author
#13 lore raw

PATCH v2 1/2 Minimally resurrect doxygen documentation

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

---
 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |   9 +++
 src/libnfnetlink.c   |  17 ++++-
 5 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
configure.ac +1 -1
index b979772..922ec09 100644
@@ -28,6 +28,6 @@ dnl--------------------------------
 
 
 dnl Output the makefile
-AC_CONFIG_FILES([Makefile src/Makefile include/Makefile
+AC_CONFIG_FILES([Makefile src/Makefile include/Makefile doxygen.cfg
 	include/libnfnetlink/Makefile utils/Makefile libnfnetlink.pc])
 AC_OUTPUT
doxygen.cfg.in new file +180 -0

180 lines not on this page · raw message

include/linux_list.h +9 -0
index de182a4..d296cfa 100644
@@ -3,6 +3,11 @@
 
 #include <stddef.h>
 
+/**
+ * \defgroup linux_list Items defined in linux_list.h
+ * @{
+ */
+
 #undef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
@@ -724,4 +729,8 @@ static inline void hlist_add_after(struct hlist_node *n,
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next, ({ smp_read_barrier_depends(); 0; }) )
 
+/**
+ * @}
+ */
+
 #endif
src/iftable.c +9 -0
index 157f97b..6d1d135 100644
@@ -24,6 +24,11 @@
 #include "rtnl.h"
 #include "linux_list.h"
 
+/**
+ * \defgroup iftable Functions in iftable.c
+ * @{
+ */
+
 struct ifindex_node {
 	struct list_head head;
 
@@ -333,3 +338,7 @@ int nlif_fd(struct nlif_handle *h)
 
 	return -1;
 }
+
+/**
+ * @}
+ */
src/libnfnetlink.c +16 -1
index df57533..3db21e0 100644
@@ -52,6 +52,18 @@
 
 #include <libnfnetlink/libnfnetlink.h>
 
+/**
+ * \mainpage
+ *
+ * libnfnetlink is the bottom-level communication between the kernel and
+ * userspace
+ */
+
+/**
+ * \defgroup libnfnetlink Functions in libnfnetlink.c
+ * @{
+ */
+
 #ifndef NETLINK_ADD_MEMBERSHIP
 #define NETLINK_ADD_MEMBERSHIP 1
 #endif
@@ -60,7 +72,6 @@
 #define SOL_NETLINK 270
 #endif
 
-
 #define nfnl_error(format, args...) \
 	fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## args)
 
@@ -1572,3 +1583,7 @@ int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh)
 
 	return nfnl_catch(h);
 }
+
+/**
+ * @}
+ */
Signature · 1 line
2.14.5
author
#14 lore raw

PATCH v2 2/2 Make it clear that this library is deprecated

In reply to Duncan Roe

src/iftable.c: Update group description

src/libnfnetlink.c: - Re-work main page (which was based on the misconception
that this library always gets used)
- Update group description

---
 src/iftable.c      |  6 +++++-
 src/libnfnetlink.c | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)
src/iftable.c +5 -1
index 6d1d135..aab59b3 100644
@@ -25,7 +25,11 @@
 #include "linux_list.h"
 
 /**
- * \defgroup iftable Functions in iftable.c
+ * \defgroup iftable Functions in iftable.c [DEPRECATED]
+ * This documentation is provided for the benefit of maintainers of legacy code.
+ *
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
  * @{
  */
 
src/libnfnetlink.c +14 -3
index 3db21e0..1cb6a82 100644
@@ -55,12 +55,23 @@
 /**
  * \mainpage
  *
- * libnfnetlink is the bottom-level communication between the kernel and
- * userspace
+ * Deprecated
+ * ---
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
+ *
+ * [libnetfilter_queue]
+ * (https://netfilter.org/projects/libnetfilter_queue/doxygen/html/)
+ * now provides a set of helpers for libmnl, in addition to those it provides
+ * for libnfnetlink (which are now deprecated).
  */
 
 /**
- * \defgroup libnfnetlink Functions in libnfnetlink.c
+ * \defgroup libnfnetlink Functions in libnfnetlink.c [DEPRECATED]
+ * This documentation is provided for the benefit of maintainers of legacy code.
+ *
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
  * @{
  */
 
Signature · 1 line
2.14.5
author
#15 lore raw

v3 cover Minimally resurrect doxygen documentation

In reply to Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

--
v2: main page and function pages make it clear to use libmnl for new apps
v3: add Signed-off-by

Duncan Roe (2):
Minimally resurrect doxygen documentation
Make it clear that this library is deprecated

 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |  13 ++++
 src/libnfnetlink.c   |  28 +++++++-
 5 files changed, 230 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
Signature · 1 line
2.14.5
author
#16 lore raw

PATCH v3 1/2 Minimally resurrect doxygen documentation

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

---
 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |   9 +++
 src/libnfnetlink.c   |  17 ++++-
 5 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
configure.ac +1 -1
index b979772..922ec09 100644
@@ -28,6 +28,6 @@ dnl--------------------------------
 
 
 dnl Output the makefile
-AC_CONFIG_FILES([Makefile src/Makefile include/Makefile
+AC_CONFIG_FILES([Makefile src/Makefile include/Makefile doxygen.cfg
 	include/libnfnetlink/Makefile utils/Makefile libnfnetlink.pc])
 AC_OUTPUT
doxygen.cfg.in new file +180 -0

180 lines not on this page · raw message

include/linux_list.h +9 -0
index de182a4..d296cfa 100644
@@ -3,6 +3,11 @@
 
 #include <stddef.h>
 
+/**
+ * \defgroup linux_list Items defined in linux_list.h
+ * @{
+ */
+
 #undef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
@@ -724,4 +729,8 @@ static inline void hlist_add_after(struct hlist_node *n,
 		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
 	     pos = pos->next, ({ smp_read_barrier_depends(); 0; }) )
 
+/**
+ * @}
+ */
+
 #endif
src/iftable.c +9 -0
index 157f97b..6d1d135 100644
@@ -24,6 +24,11 @@
 #include "rtnl.h"
 #include "linux_list.h"
 
+/**
+ * \defgroup iftable Functions in iftable.c
+ * @{
+ */
+
 struct ifindex_node {
 	struct list_head head;
 
@@ -333,3 +338,7 @@ int nlif_fd(struct nlif_handle *h)
 
 	return -1;
 }
+
+/**
+ * @}
+ */
src/libnfnetlink.c +16 -1
index df57533..3db21e0 100644
@@ -52,6 +52,18 @@
 
 #include <libnfnetlink/libnfnetlink.h>
 
+/**
+ * \mainpage
+ *
+ * libnfnetlink is the bottom-level communication between the kernel and
+ * userspace
+ */
+
+/**
+ * \defgroup libnfnetlink Functions in libnfnetlink.c
+ * @{
+ */
+
 #ifndef NETLINK_ADD_MEMBERSHIP
 #define NETLINK_ADD_MEMBERSHIP 1
 #endif
@@ -60,7 +72,6 @@
 #define SOL_NETLINK 270
 #endif
 
-
 #define nfnl_error(format, args...) \
 	fprintf(stderr, "%s: " format "\n", __FUNCTION__, ## args)
 
@@ -1572,3 +1583,7 @@ int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh)
 
 	return nfnl_catch(h);
 }
+
+/**
+ * @}
+ */
Signature · 1 line
2.14.5
maintainer Applied
#17 lore raw
Quoted 12 lines · Duncan Roe

The documentation was written in the days before doxygen required groups or even doxygen.cfg, so create doxygen.cfg.in and introduce one \defgroup per source file, encompassing pretty-much the whole file.

Also add a tiny \mainpage.

Added:

doxygen.cfg.in: Same as for libmnl except FILE_PATTERNS = *.c linux_list.h

Updated:

Quoted 7 lines

configure.ac: Create doxygen.cfg

include/linux_list.h: Add defgroup

src/iftable.c: Add defgroup

src/libnfnetlink.c: Add mainpage and defgroup

Applied, thanks.

I have kept back include/linux_list.h, although this is offering the linux list API in libnfnetlink, this was never intended to be the purpose of this library, so I removed that part before applying.

author
#18 lore raw

PATCH v3 2/2 Make it clear that this library is deprecated

In reply to Duncan Roe

src/iftable.c: Update group description

src/libnfnetlink.c: - Re-work main page (which was based on the misconception
that this library always gets used)
- Update group description

---
 src/iftable.c      |  6 +++++-
 src/libnfnetlink.c | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)
src/iftable.c +5 -1
index 6d1d135..aab59b3 100644
@@ -25,7 +25,11 @@
 #include "linux_list.h"
 
 /**
- * \defgroup iftable Functions in iftable.c
+ * \defgroup iftable Functions in iftable.c [DEPRECATED]
+ * This documentation is provided for the benefit of maintainers of legacy code.
+ *
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
  * @{
  */
 
src/libnfnetlink.c +14 -3
index 3db21e0..1cb6a82 100644
@@ -55,12 +55,23 @@
 /**
  * \mainpage
  *
- * libnfnetlink is the bottom-level communication between the kernel and
- * userspace
+ * Deprecated
+ * ---
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
+ *
+ * [libnetfilter_queue]
+ * (https://netfilter.org/projects/libnetfilter_queue/doxygen/html/)
+ * now provides a set of helpers for libmnl, in addition to those it provides
+ * for libnfnetlink (which are now deprecated).
  */
 
 /**
- * \defgroup libnfnetlink Functions in libnfnetlink.c
+ * \defgroup libnfnetlink Functions in libnfnetlink.c [DEPRECATED]
+ * This documentation is provided for the benefit of maintainers of legacy code.
+ *
+ * New applications should use
+ * [libmnl](https://netfilter.org/projects/libmnl/doxygen/html/).
  * @{
  */
 
Signature · 1 line
2.14.5
maintainer Applied
#19 lore raw

Re: [PATCH libnfnetlink v3 2/2] Make it clear that this library is deprecated

Quoted 5 lines · Duncan Roe

src/iftable.c: Update group description

src/libnfnetlink.c: - Re-work main page (which was based on the misconception
that this library always gets used)
- Update group description

Applied, thanks Duncan.

author
#20 lore raw
In reply to Duncan Roe

Hi Pablo,

Quoted 46 lines · Duncan Roe

libnfnetlink has good doxygen documentation but there was no output when doxygen was run.

Patch 1/1 fixes that,
but on rebuilding there were a number warnings of the form:

right-hand operand of comma expression has no effect [-Wunused-value]

*This was not introduced by patch 1/1*

Instead, it is caused by the definition of "prefetch" in include/linux_list.h:

#define prefetch(x) 1

the Linux kernel has:

#define prefetch(x) __builtin_prefetch(x)

I see 3 ways to get back to a clean compile:

1. Suppress the warnings with a pragma

2. Reinstate the Linux definition of prefetch

3. Expunge prefetch from the header file

I have made all 3, please indicate which one you'd like.

1. & 2. are 1-liners while 3. is multiline.

3. allows of extra simplifications, such as defining a macro in a single line or fewer lines than before. In some places I could also delete the fragment "&& ({ 1;})".

Duncan Roe (1):
src: Minimally resurrect doxygen documentation

 configure.ac         |   2 +-
 doxygen.cfg.in       | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux_list.h |   9 +++
 src/iftable.c        |   9 +++
 src/libnfnetlink.c   |  17 ++++-
 5 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 doxygen.cfg.in
Quoted 3 lines

--
2.14.5

Any feedback on this?

Exposing the documentation would be uncontroversial surely?

In regard to compiler warnings, alternative 1 entails least effort to review, since the code remains unchanged.

Cheers ... Duncan.