From 24ba8cd8e4cebb0faeddff68498b5fdad7f1dd6b Mon Sep 17 00:00:00 2001 From: Duncan Roe Date: Tue, 8 Oct 2019 11:49:45 +1100 Subject: src: Enable clang build Modify the definition and use of EXPORT_SYMBOL as was done for libmnl in commit 444d6dc9. Additionally, avoid generating long (>80ch) lines when inserting EXPORT_SYMBOL. Finally, re-align multi-line parameter blocks with opening parenthesis. [ I have mangled the original patch to not split the function definition and its return value. --pablo ] Signed-off-by: Duncan Roe Signed-off-by: Pablo Neira Ayuso --- src/extra/tcp.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/extra/tcp.c') diff --git a/src/extra/tcp.c b/src/extra/tcp.c index a66f392..136d7ea 100644 --- a/src/extra/tcp.c +++ b/src/extra/tcp.c @@ -40,6 +40,7 @@ * \note You have to call nfq_ip_set_transport_header or * nfq_ip6_set_transport_header first to access the TCP header. */ +EXPORT_SYMBOL struct tcphdr *nfq_tcp_get_hdr(struct pkt_buff *pktb) { if (pktb->transport_header == NULL) @@ -51,13 +52,13 @@ struct tcphdr *nfq_tcp_get_hdr(struct pkt_buff *pktb) return (struct tcphdr *)pktb->transport_header; } -EXPORT_SYMBOL(nfq_tcp_get_hdr); /** * nfq_tcp_get_payload - get the TCP packet payload * \param tcph: pointer to the TCP header * \param pktb: pointer to user-space network packet buffer */ +EXPORT_SYMBOL void *nfq_tcp_get_payload(struct tcphdr *tcph, struct pkt_buff *pktb) { unsigned int len = tcph->doff * 4; @@ -72,47 +73,43 @@ void *nfq_tcp_get_payload(struct tcphdr *tcph, struct pkt_buff *pktb) return pktb->transport_header + len; } -EXPORT_SYMBOL(nfq_tcp_get_payload); /** * nfq_tcp_get_payload_len - get the tcp packet payload * \param tcph: pointer to the TCP header * \param pktb: pointer to user-space network packet buffer */ -unsigned int -nfq_tcp_get_payload_len(struct tcphdr *tcph, struct pkt_buff *pktb) +EXPORT_SYMBOL +unsigned int nfq_tcp_get_payload_len(struct tcphdr *tcph, struct pkt_buff *pktb) { return pktb->tail - pktb->transport_header; } -EXPORT_SYMBOL(nfq_tcp_get_payload_len); /** * nfq_tcp_set_checksum_ipv4 - computes IPv4/TCP packet checksum * \param tcph: pointer to the TCP header * \param iph: pointer to the IPv4 header */ -void -nfq_tcp_compute_checksum_ipv4(struct tcphdr *tcph, struct iphdr *iph) +EXPORT_SYMBOL +void nfq_tcp_compute_checksum_ipv4(struct tcphdr *tcph, struct iphdr *iph) { /* checksum field in header needs to be zero for calculation. */ tcph->check = 0; tcph->check = nfq_checksum_tcpudp_ipv4(iph, IPPROTO_TCP); } -EXPORT_SYMBOL(nfq_tcp_compute_checksum_ipv4); /** * nfq_tcp_set_checksum_ipv6 - computes IPv6/TCP packet checksum * \param tcph: pointer to the TCP header * \param iph: pointer to the IPv6 header */ -void -nfq_tcp_compute_checksum_ipv6(struct tcphdr *tcph, struct ip6_hdr *ip6h) +EXPORT_SYMBOL +void nfq_tcp_compute_checksum_ipv6(struct tcphdr *tcph, struct ip6_hdr *ip6h) { /* checksum field in header needs to be zero for calculation. */ tcph->check = 0; tcph->check = nfq_checksum_tcpudp_ipv6(ip6h, tcph, IPPROTO_TCP); } -EXPORT_SYMBOL(nfq_tcp_compute_checksum_ipv6); /* * The union cast uses a gcc extension to avoid aliasing problems @@ -134,6 +131,7 @@ union tcp_word_hdr { * \param tcp: pointer to a valid tcp header. * */ +EXPORT_SYMBOL int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph) { int ret, len = 0; @@ -177,7 +175,6 @@ int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph) return ret; } -EXPORT_SYMBOL(nfq_tcp_snprintf); /** * nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer @@ -189,10 +186,10 @@ EXPORT_SYMBOL(nfq_tcp_snprintf); * * \note This function recalculates the IPv4 and TCP checksums for you. */ -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) +EXPORT_SYMBOL +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) { struct iphdr *iph; struct tcphdr *tcph; @@ -208,7 +205,6 @@ nfq_tcp_mangle_ipv4(struct pkt_buff *pkt, return 1; } -EXPORT_SYMBOL(nfq_tcp_mangle_ipv4); /** * @} -- cgit v1.2.3