netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_queue 0/2] src: doc: fix remaining doxygen warnings
@ 2019-12-28  1:23 Duncan Roe
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb Duncan Roe
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings Duncan Roe
  0 siblings, 2 replies; 6+ messages in thread
From: Duncan Roe @ 2019-12-28  1:23 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

These 2 patches eliminate the last warnings from "doxygen doxygen.cfg".

I plan 1 more (large-ish) round of documentation polish then move on
to some kind of Library Setup [CURRENT] topic.

Duncan Roe (2):
  src: tcp.c: change 1 remaining pkt formal arg to pktb
  src: tcp.c: fix remaining doxygen warnings

 src/extra/tcp.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--
2.14.5


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

* [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb
  2019-12-28  1:23 [PATCH libnetfilter_queue 0/2] src: doc: fix remaining doxygen warnings Duncan Roe
@ 2019-12-28  1:23 ` Duncan Roe
  2019-12-30 11:53   ` Pablo Neira Ayuso
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings Duncan Roe
  1 sibling, 1 reply; 6+ messages in thread
From: Duncan Roe @ 2019-12-28  1:23 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 src/extra/tcp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index 8119843..2296bef 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -188,17 +188,17 @@ int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph)
  * \note This function recalculates the IPv4 and TCP checksums for you.
  */
 EXPORT_SYMBOL
-int nfq_tcp_mangle_ipv4(struct pkt_buff *pkt,
+int nfq_tcp_mangle_ipv4(struct pkt_buff *pktb,
 			unsigned int match_offset, unsigned int match_len,
 			const char *rep_buffer, unsigned int rep_len)
 {
 	struct iphdr *iph;
 	struct tcphdr *tcph;
 
-	iph = (struct iphdr *)pkt->network_header;
-	tcph = (struct tcphdr *)(pkt->network_header + iph->ihl*4);
+	iph = (struct iphdr *)pktb->network_header;
+	tcph = (struct tcphdr *)(pktb->network_header + iph->ihl*4);
 
-	if (!nfq_ip_mangle(pkt, iph->ihl*4 + tcph->doff*4,
+	if (!nfq_ip_mangle(pktb, iph->ihl*4 + tcph->doff*4,
 				match_offset, match_len, rep_buffer, rep_len))
 		return 0;
 
-- 
2.14.5


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

* [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings
  2019-12-28  1:23 [PATCH libnetfilter_queue 0/2] src: doc: fix remaining doxygen warnings Duncan Roe
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb Duncan Roe
@ 2019-12-28  1:23 ` Duncan Roe
  2019-12-30 11:51   ` Pablo Neira Ayuso
  1 sibling, 1 reply; 6+ messages in thread
From: Duncan Roe @ 2019-12-28  1:23 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 src/extra/tcp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index 2296bef..0f83500 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -87,7 +87,7 @@ unsigned int nfq_tcp_get_payload_len(struct tcphdr *tcph, struct pkt_buff *pktb)
 }
 
 /**
- * nfq_tcp_set_checksum_ipv4 - computes IPv4/TCP packet checksum
+ * nfq_tcp_compute_checksum_ipv4 - computes IPv4/TCP packet checksum
  * \param tcph: pointer to the TCP header
  * \param iph: pointer to the IPv4 header
  */
@@ -100,9 +100,9 @@ void nfq_tcp_compute_checksum_ipv4(struct tcphdr *tcph, struct iphdr *iph)
 }
 
 /**
- * nfq_tcp_set_checksum_ipv6 - computes IPv6/TCP packet checksum
+ * nfq_tcp_compute_checksum_ipv6 - computes IPv6/TCP packet checksum
  * \param tcph: pointer to the TCP header
- * \param iph: pointer to the IPv6 header
+ * \param ip6h: pointer to the IPv6 header
  */
 EXPORT_SYMBOL
 void nfq_tcp_compute_checksum_ipv6(struct tcphdr *tcph, struct ip6_hdr *ip6h)
@@ -129,7 +129,7 @@ union tcp_word_hdr {
  * readable way
  * \param buf: pointer to buffer that is used to print the object
  * \param size: size of the buffer (or remaining room in it).
- * \param tcp: pointer to a valid tcp header.
+ * \param tcph: pointer to a valid tcp header.
  *
  */
 EXPORT_SYMBOL
-- 
2.14.5


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

* Re: [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings Duncan Roe
@ 2019-12-30 11:51   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2019-12-30 11:51 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

Applied, thanks.

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

* Re: [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb
  2019-12-28  1:23 ` [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb Duncan Roe
@ 2019-12-30 11:53   ` Pablo Neira Ayuso
  2019-12-31 11:03     ` [PATCH libnetfilter_queue] src: Always use pktb as formal arg of type struct pkt_buff Duncan Roe
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2019-12-30 11:53 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Sat, Dec 28, 2019 at 12:23:56PM +1100, Duncan Roe wrote:
> Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
> ---
>  src/extra/tcp.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/extra/tcp.c b/src/extra/tcp.c
> index 8119843..2296bef 100644
> --- a/src/extra/tcp.c
> +++ b/src/extra/tcp.c
> @@ -188,17 +188,17 @@ int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph)
>   * \note This function recalculates the IPv4 and TCP checksums for you.
>   */
>  EXPORT_SYMBOL
> -int nfq_tcp_mangle_ipv4(struct pkt_buff *pkt,
> +int nfq_tcp_mangle_ipv4(struct pkt_buff *pktb,

Via git grep I can see more references to pkt instead pktb, if you
prefer pktb for consistency that's fine indeed. I'd suggest you send a
patch to update all the existing references in this tree to use pktb
as you do here.

Thanks.

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

* [PATCH libnetfilter_queue] src: Always use pktb as formal arg of type struct pkt_buff
  2019-12-30 11:53   ` Pablo Neira Ayuso
@ 2019-12-31 11:03     ` Duncan Roe
  0 siblings, 0 replies; 6+ messages in thread
From: Duncan Roe @ 2019-12-31 11:03 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

All remaining instances of pkt refer to something other than a pkt_buff.

In the prototype for nfq_nlmsg_parse, pkt is changed to attr.

Inconsistent whitespace in headers has been left for another day.

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 include/libnetfilter_queue/libnetfilter_queue.h      |  2 +-
 include/libnetfilter_queue/libnetfilter_queue_ipv4.h |  2 +-
 include/libnetfilter_queue/libnetfilter_queue_tcp.h  |  4 ++--
 include/libnetfilter_queue/libnetfilter_queue_udp.h  |  2 +-
 include/libnetfilter_queue/pktbuff.h                 |  2 +-
 src/extra/pktbuff.c                                  | 14 +++++++-------
 src/extra/tcp.c                                      |  8 ++++----
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/libnetfilter_queue/libnetfilter_queue.h b/include/libnetfilter_queue/libnetfilter_queue.h
index 2e38411..092c57d 100644
--- a/include/libnetfilter_queue/libnetfilter_queue.h
+++ b/include/libnetfilter_queue/libnetfilter_queue.h
@@ -148,7 +148,7 @@ void nfq_nlmsg_verdict_put(struct nlmsghdr *nlh, int id, int verdict);
 void nfq_nlmsg_verdict_put_mark(struct nlmsghdr *nlh, uint32_t mark);
 void nfq_nlmsg_verdict_put_pkt(struct nlmsghdr *nlh, const void *pkt, uint32_t pktlen);
 
-int nfq_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr **pkt);
+int nfq_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr **attr);
 
 #ifdef __cplusplus
 } /* extern "C" */
diff --git a/include/libnetfilter_queue/libnetfilter_queue_ipv4.h b/include/libnetfilter_queue/libnetfilter_queue_ipv4.h
index e707f1f..17be93e 100644
--- a/include/libnetfilter_queue/libnetfilter_queue_ipv4.h
+++ b/include/libnetfilter_queue/libnetfilter_queue_ipv4.h
@@ -7,7 +7,7 @@ struct iphdr;
 struct iphdr *nfq_ip_get_hdr(struct pkt_buff *pktb);
 int nfq_ip_set_transport_header(struct pkt_buff *pktb, struct iphdr *iph);
 void nfq_ip_set_checksum(struct iphdr *iph);
-int nfq_ip_mangle(struct pkt_buff *pkt, unsigned int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int nfq_ip_mangle(struct pkt_buff *pktb, unsigned int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 int nfq_ip_snprintf(char *buf, size_t size, const struct iphdr *iph);
 
 #endif
diff --git a/include/libnetfilter_queue/libnetfilter_queue_tcp.h b/include/libnetfilter_queue/libnetfilter_queue_tcp.h
index 997d997..e1b9690 100644
--- a/include/libnetfilter_queue/libnetfilter_queue_tcp.h
+++ b/include/libnetfilter_queue/libnetfilter_queue_tcp.h
@@ -13,8 +13,8 @@ struct ip6_hdr;
 void nfq_tcp_compute_checksum_ipv4(struct tcphdr *tcph, struct iphdr *iph);
 void nfq_tcp_compute_checksum_ipv6(struct tcphdr *tcph, struct ip6_hdr *ip6h);
 
-int nfq_tcp_mangle_ipv4(struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
-int nfq_tcp_mangle_ipv6(struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int nfq_tcp_mangle_ipv4(struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int nfq_tcp_mangle_ipv6(struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 
 int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcp);
 
diff --git a/include/libnetfilter_queue/libnetfilter_queue_udp.h b/include/libnetfilter_queue/libnetfilter_queue_udp.h
index f9fd609..9d594f2 100644
--- a/include/libnetfilter_queue/libnetfilter_queue_udp.h
+++ b/include/libnetfilter_queue/libnetfilter_queue_udp.h
@@ -10,7 +10,7 @@ unsigned int nfq_udp_get_payload_len(struct udphdr *udph, struct pkt_buff *pktb)
 void nfq_udp_compute_checksum_ipv4(struct udphdr *udph, struct iphdr *iph);
 void nfq_udp_compute_checksum_ipv6(struct udphdr *udph, struct ip6_hdr *ip6h);
 
-int nfq_udp_mangle_ipv4(struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int nfq_udp_mangle_ipv4(struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 int nfq_udp_mangle_ipv6(struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 
 int nfq_udp_snprintf(char *buf, size_t size, const struct udphdr *udp);
diff --git a/include/libnetfilter_queue/pktbuff.h b/include/libnetfilter_queue/pktbuff.h
index 5bcc3e5..42bc153 100644
--- a/include/libnetfilter_queue/pktbuff.h
+++ b/include/libnetfilter_queue/pktbuff.h
@@ -19,7 +19,7 @@ uint8_t *pktb_mac_header(struct pkt_buff *pktb);
 uint8_t *pktb_network_header(struct pkt_buff *pktb);
 uint8_t *pktb_transport_header(struct pkt_buff *pktb);
 
-int pktb_mangle(struct pkt_buff *pkt, int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
+int pktb_mangle(struct pkt_buff *pktb, int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len);
 
 bool pktb_mangled(const struct pkt_buff *pktb);
 
diff --git a/src/extra/pktbuff.c b/src/extra/pktbuff.c
index 6250fbf..37f6bc0 100644
--- a/src/extra/pktbuff.c
+++ b/src/extra/pktbuff.c
@@ -271,26 +271,26 @@ uint8_t *pktb_transport_header(struct pkt_buff *pktb)
  * @}
  */
 
-static int pktb_expand_tail(struct pkt_buff *pkt, int extra)
+static int pktb_expand_tail(struct pkt_buff *pktb, int extra)
 {
 	/* No room in packet, cannot mangle it. We don't support dynamic
 	 * reallocation. Instead, increase the size of the extra room in
 	 * the tail in pktb_alloc.
 	 */
-	if (pkt->len + extra > pkt->data_len)
+	if (pktb->len + extra > pktb->data_len)
 		return 0;
 
-	pkt->len += extra;
-	pkt->tail = pkt->tail + extra;
+	pktb->len += extra;
+	pktb->tail = pktb->tail + extra;
 	return 1;
 }
 
-static int enlarge_pkt(struct pkt_buff *pkt, unsigned int extra)
+static int enlarge_pkt(struct pkt_buff *pktb, unsigned int extra)
 {
-	if (pkt->len + extra > 65535)
+	if (pktb->len + extra > 65535)
 		return 0;
 
-	if (!pktb_expand_tail(pkt, extra - pktb_tailroom(pkt)))
+	if (!pktb_expand_tail(pktb, extra - pktb_tailroom(pktb)))
 		return 0;
 
 	return 1;
diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index 64ab85f..0f83500 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -188,17 +188,17 @@ int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph)
  * \note This function recalculates the IPv4 and TCP checksums for you.
  */
 EXPORT_SYMBOL
-int nfq_tcp_mangle_ipv4(struct pkt_buff *pkt,
+int nfq_tcp_mangle_ipv4(struct pkt_buff *pktb,
 			unsigned int match_offset, unsigned int match_len,
 			const char *rep_buffer, unsigned int rep_len)
 {
 	struct iphdr *iph;
 	struct tcphdr *tcph;
 
-	iph = (struct iphdr *)pkt->network_header;
-	tcph = (struct tcphdr *)(pkt->network_header + iph->ihl*4);
+	iph = (struct iphdr *)pktb->network_header;
+	tcph = (struct tcphdr *)(pktb->network_header + iph->ihl*4);
 
-	if (!nfq_ip_mangle(pkt, iph->ihl*4 + tcph->doff*4,
+	if (!nfq_ip_mangle(pktb, iph->ihl*4 + tcph->doff*4,
 				match_offset, match_len, rep_buffer, rep_len))
 		return 0;
 
-- 
2.14.5


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

end of thread, other threads:[~2019-12-31 11:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28  1:23 [PATCH libnetfilter_queue 0/2] src: doc: fix remaining doxygen warnings Duncan Roe
2019-12-28  1:23 ` [PATCH libnetfilter_queue 1/2] src: tcp.c: change 1 remaining pkt formal arg to pktb Duncan Roe
2019-12-30 11:53   ` Pablo Neira Ayuso
2019-12-31 11:03     ` [PATCH libnetfilter_queue] src: Always use pktb as formal arg of type struct pkt_buff Duncan Roe
2019-12-28  1:23 ` [PATCH libnetfilter_queue 2/2] src: doc: tcp.c: fix remaining doxygen warnings Duncan Roe
2019-12-30 11:51   ` 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).