From: Shyam Saini <mayhs11saini@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Shyam Saini <mayhs11saini@gmail.com>
Subject: [PATCH 1/2] libxtables: xtables: remove unnecessary debug code
Date: Mon, 12 Dec 2016 20:23:56 +0530 [thread overview]
Message-ID: <1481554437-20319-1-git-send-email-mayhs11saini@gmail.com> (raw)
Remove unnecessary debug code
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
libxtables/xtables.c | 33 +++++----------------------------
1 file changed, 5 insertions(+), 28 deletions(-)
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index 921dfe9..6e75c15 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -1366,17 +1366,10 @@ static struct in_addr *host_to_ipaddr(const char *name, unsigned int *naddr)
*naddr = 0;
if ((err = getaddrinfo(name, NULL, &hints, &res)) != 0) {
-#ifdef DEBUG
- fprintf(stderr,"Name2IP: %s\n",gai_strerror(err));
-#endif
return NULL;
} else {
for (p = res; p != NULL; p = p->ai_next)
++*naddr;
-#ifdef DEBUG
- fprintf(stderr, "resolved: len=%d %s ", res->ai_addrlen,
- xtables_ipaddr_to_numeric(&((struct sockaddr_in *)res->ai_addr)->sin_addr));
-#endif
addr = xtables_calloc(*naddr, sizeof(struct in_addr));
for (i = 0, p = res; p != NULL; p = p->ai_next)
memcpy(&addr[i++],
@@ -1576,18 +1569,11 @@ static const char *ip6addr_to_host(const struct in6_addr *addr)
memcpy(&saddr.sin6_addr, addr, sizeof(*addr));
saddr.sin6_family = AF_INET6;
- err = getnameinfo((const void *)&saddr, sizeof(struct sockaddr_in6),
- hostname, sizeof(hostname) - 1, NULL, 0, 0);
- if (err != 0) {
-#ifdef DEBUG
- fprintf(stderr,"IP2Name: %s\n",gai_strerror(err));
-#endif
+ err = getnameinfo((const void *)&saddr, sizeof(struct sockaddr_in6),
+ hostname, sizeof(hostname) - 1, NULL, 0, 0);
+ if (err != 0)
return NULL;
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\naddr2host: %s\n", hostname);
-#endif
+
return hostname;
}
@@ -1650,9 +1636,7 @@ struct in6_addr *xtables_numeric_to_ip6addr(const char *num)
if ((err = inet_pton(AF_INET6, num, &ap)) == 1)
return ≈
-#ifdef DEBUG
- fprintf(stderr, "\nnumeric2addr: %d\n", err);
-#endif
+
return NULL;
}
@@ -1672,18 +1656,11 @@ host_to_ip6addr(const char *name, unsigned int *naddr)
*naddr = 0;
if ((err = getaddrinfo(name, NULL, &hints, &res)) != 0) {
-#ifdef DEBUG
- fprintf(stderr,"Name2IP: %s\n",gai_strerror(err));
-#endif
return NULL;
} else {
/* Find length of address chain */
for (p = res; p != NULL; p = p->ai_next)
++*naddr;
-#ifdef DEBUG
- fprintf(stderr, "resolved: len=%d %s ", res->ai_addrlen,
- xtables_ip6addr_to_numeric(&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr));
-#endif
/* Copy each element of the address chain */
addr = xtables_calloc(*naddr, sizeof(struct in6_addr));
for (i = 0, p = res; p != NULL; p = p->ai_next)
--
2.7.4
next reply other threads:[~2016-12-12 14:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 14:53 Shyam Saini [this message]
2016-12-12 14:53 ` [PATCH 2/2] libxtables: xtables: Use getnameinfo() Shyam Saini
2016-12-19 23:38 ` Pablo Neira Ayuso
2016-12-19 23:37 ` [PATCH 1/2] libxtables: xtables: remove unnecessary debug code Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481554437-20319-1-git-send-email-mayhs11saini@gmail.com \
--to=mayhs11saini@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).