From e83250c0381bbff232011b67c87a5b9f3a0de09a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 20 Feb 2009 20:42:22 +0100 Subject: src: remove obsolete debug() and debug_ct() calls This patch removes debug() and debug_ct(), I haven't use the debugging information that these functions provide in years. Signed-off-by: Pablo Neira Ayuso --- src/cache_timer.c | 2 -- src/mcast.c | 17 ----------------- src/netlink.c | 1 - src/network.c | 1 - src/stats-mode.c | 8 ++------ src/sync-alarm.c | 3 --- src/sync-ftfw.c | 1 - src/sync-mode.c | 26 ++++++-------------------- src/sync-notrack.c | 1 - 9 files changed, 8 insertions(+), 52 deletions(-) diff --git a/src/cache_timer.c b/src/cache_timer.c index a9e3e3d..5881236 100644 --- a/src/cache_timer.c +++ b/src/cache_timer.c @@ -19,7 +19,6 @@ #include "cache.h" #include "conntrackd.h" #include "alarm.h" -#include "debug.h" #include @@ -27,7 +26,6 @@ static void timeout(struct alarm_block *a, void *data) { struct cache_object *obj = data; - debug_ct(obj->ct, "expired timeout"); cache_del(obj->cache, obj); cache_object_free(obj); } diff --git a/src/mcast.c b/src/mcast.c index 70205d8..bc530d3 100644 --- a/src/mcast.c +++ b/src/mcast.c @@ -19,7 +19,6 @@ */ #include "mcast.h" -#include "debug.h" #include #include @@ -73,7 +72,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) } if ((m->fd = socket(conf->ipproto, SOCK_DGRAM, 0)) == -1) { - debug("mcast_sock_server_create:socket"); free(m); return NULL; } @@ -84,7 +82,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) strncpy(ifr.ifr_name, conf->iface, sizeof(ifr.ifr_name)); if (ioctl(m->fd, SIOCGIFMTU, &ifr) == -1) { - debug("ioctl"); close(m->fd); free(m); return NULL; @@ -94,7 +91,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) if (setsockopt(m->fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) { - debug("mcast_sock_server_create:setsockopt1"); close(m->fd); free(m); return NULL; @@ -109,7 +105,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) sizeof(int)) == -1) { /* not supported in linux kernel < 2.6.14 */ if (errno != ENOPROTOOPT) { - debug("mcast_sock_server_create:setsockopt2"); close(m->fd); free(m); return NULL; @@ -119,7 +114,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) getsockopt(m->fd, SOL_SOCKET, SO_RCVBUF, &conf->rcvbuf, &socklen); if (bind(m->fd, (struct sockaddr *) &m->addr, m->sockaddr_len) == -1) { - debug("mcast_sock_server_create:bind"); close(m->fd); free(m); return NULL; @@ -129,7 +123,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) case AF_INET: if (setsockopt(m->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq.ipv4, sizeof(mreq.ipv4)) < 0) { - debug("mcast_sock_server_create:setsockopt2"); close(m->fd); free(m); return NULL; @@ -138,7 +131,6 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf) case AF_INET6: if (setsockopt(m->fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq.ipv6, sizeof(mreq.ipv6)) < 0) { - debug("mcast_sock_server_create:setsockopt2"); close(m->fd); free(m); return NULL; @@ -207,7 +199,6 @@ __mcast_client_create_ipv4(struct mcast_sock *m, struct mcast_conf *conf) if (setsockopt(m->fd, IPPROTO_IP, IP_MULTICAST_LOOP, &no, sizeof(int)) < 0) { - debug("mcast_sock_client_create:setsockopt2"); close(m->fd); return -1; } @@ -215,7 +206,6 @@ __mcast_client_create_ipv4(struct mcast_sock *m, struct mcast_conf *conf) if (setsockopt(m->fd, IPPROTO_IP, IP_MULTICAST_IF, &conf->ifa.interface_addr, sizeof(struct in_addr)) == -1) { - debug("mcast_sock_client_create:setsockopt3"); close(m->fd); return -1; } @@ -237,7 +227,6 @@ __mcast_client_create_ipv6(struct mcast_sock *m, struct mcast_conf *conf) if (setsockopt(m->fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &no, sizeof(int)) < 0) { - debug("mcast_sock_client_create:setsockopt2"); close(m->fd); return -1; } @@ -245,7 +234,6 @@ __mcast_client_create_ipv6(struct mcast_sock *m, struct mcast_conf *conf) if (setsockopt(m->fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, &conf->ifa.interface_index6, sizeof(unsigned int)) == -1) { - debug("mcast_sock_client_create:setsockopt3"); close(m->fd); return -1; } @@ -267,14 +255,12 @@ struct mcast_sock *mcast_client_create(struct mcast_conf *conf) m->interface_idx = conf->interface_idx; if ((m->fd = socket(conf->ipproto, SOCK_DGRAM, 0)) == -1) { - debug("mcast_sock_client_create:socket"); free(m); return NULL; } if (setsockopt(m->fd, SOL_SOCKET, SO_NO_CHECK, &conf->checksum, sizeof(int)) == -1) { - debug("mcast_sock_client_create:setsockopt1"); close(m->fd); free(m); return NULL; @@ -289,7 +275,6 @@ struct mcast_sock *mcast_client_create(struct mcast_conf *conf) sizeof(int)) == -1) { /* not supported in linux kernel < 2.6.14 */ if (errno != ENOPROTOOPT) { - debug("mcast_sock_server_create:setsockopt2"); close(m->fd); free(m); return NULL; @@ -376,7 +361,6 @@ ssize_t mcast_send(struct mcast_sock *m, void *data, int size) (struct sockaddr *) &m->addr, m->sockaddr_len); if (ret == -1) { - debug("mcast_sock_send"); m->stats.error++; return ret; } @@ -399,7 +383,6 @@ ssize_t mcast_recv(struct mcast_sock *m, void *data, int size) (struct sockaddr *)&m->addr, &sin_size); if (ret == -1) { - debug("mcast_sock_recv"); m->stats.error++; return ret; } diff --git a/src/netlink.c b/src/netlink.c index 78cc466..ef729c1 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -20,7 +20,6 @@ #include "conntrackd.h" #include "filter.h" #include "log.h" -#include "debug.h" #include #include diff --git a/src/network.c b/src/network.c index f71aef0..690b28e 100644 --- a/src/network.c +++ b/src/network.c @@ -19,7 +19,6 @@ #include "conntrackd.h" #include "network.h" #include "log.h" -#include "debug.h" #include #include diff --git a/src/stats-mode.c b/src/stats-mode.c index 94fc45b..af1c136 100644 --- a/src/stats-mode.c +++ b/src/stats-mode.c @@ -18,7 +18,6 @@ #include "netlink.h" #include "traffic_stats.h" -#include "debug.h" #include "cache.h" #include "log.h" #include "conntrackd.h" @@ -97,8 +96,7 @@ static void dump_stats(struct nf_conntrack *ct) nfct_attr_unset(ct, ATTR_TIMEOUT); nfct_attr_unset(ct, ATTR_USE); - if (cache_update_force(STATE_STATS(cache), ct)) - debug_ct(ct, "resync entry"); + cache_update_force(STATE_STATS(cache), ct); } static int resync_stats(enum nf_conntrack_msg_type type, @@ -116,8 +114,7 @@ static int resync_stats(enum nf_conntrack_msg_type type, nfct_attr_unset(ct, ATTR_REPL_COUNTER_PACKETS); nfct_attr_unset(ct, ATTR_USE); - if (!cache_update_force(STATE_STATS(cache), ct)) - debug_ct(ct, "stats resync"); + cache_update_force(STATE_STATS(cache), ct); return NFCT_CB_CONTINUE; } @@ -129,7 +126,6 @@ static int purge_step(void *data1, void *data2) STATE(get_retval) = 0; nl_get_conntrack(STATE(get), obj->ct); /* modifies STATE(get_retval) */ if (!STATE(get_retval)) { - debug_ct(obj->ct, "purge stats"); cache_del(STATE_STATS(cache), obj); dlog_ct(STATE(stats_log), obj->ct, NFCT_O_PLAIN); cache_object_free(obj); diff --git a/src/sync-alarm.c b/src/sync-alarm.c index 1815447..a59ae11 100644 --- a/src/sync-alarm.c +++ b/src/sync-alarm.c @@ -22,7 +22,6 @@ #include "alarm.h" #include "cache.h" #include "queue.h" -#include "debug.h" #include #include @@ -38,8 +37,6 @@ static void refresher(struct alarm_block *a, void *data) { struct cache_object *obj = data; - debug_ct(obj->ct, "persistence update"); - add_alarm(a, random() % CONFIG(refresh) + 1, ((random() % 5 + 1) * 200000) - 1); diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index 91ce25d..d608e5b 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -19,7 +19,6 @@ #include "conntrackd.h" #include "sync.h" #include "queue.h" -#include "debug.h" #include "network.h" #include "alarm.h" #include "log.h" diff --git a/src/sync-mode.c b/src/sync-mode.c index 02a5a46..d1a941b 100644 --- a/src/sync-mode.c +++ b/src/sync-mode.c @@ -25,7 +25,6 @@ #include "network.h" #include "fds.h" #include "event.h" -#include "debug.h" #include "queue.h" #include @@ -166,10 +165,6 @@ static void mcast_handler(struct mcast_sock *m, int if_idx) } } - debug("recv sq: %u fl:%u len:%u (rem:%d)\n", - ntohl(net->seq), net->flags, - ntohs(net->len), remain); - HDR_NETWORK2HOST(net); do_mcast_handler_step(if_idx, net, remain); @@ -531,8 +526,7 @@ static void dump_sync(struct nf_conntrack *ct) nfct_attr_unset(ct, ATTR_REPL_COUNTER_PACKETS); nfct_attr_unset(ct, ATTR_USE); - if (cache_update_force(STATE_SYNC(internal), ct)) - debug_ct(ct, "dump"); + cache_update_force(STATE_SYNC(internal), ct); } static int purge_step(void *data1, void *data2) @@ -542,7 +536,6 @@ static int purge_step(void *data1, void *data2) STATE(get_retval) = 0; nl_get_conntrack(STATE(get), obj->ct); /* modifies STATE(get_reval) */ if (!STATE(get_retval)) { - debug_ct(obj->ct, "purge resync"); if (obj->status != C_OBJ_DEAD) { cache_object_set_status(obj, C_OBJ_DEAD); mcast_send_sync(obj, NET_T_STATE_DEL); @@ -582,11 +575,9 @@ static int resync_sync(enum nf_conntrack_msg_type type, switch (obj->status) { case C_OBJ_NEW: - debug_ct(ct, "resync"); mcast_send_sync(obj, NET_T_STATE_NEW); break; case C_OBJ_ALIVE: - debug_ct(ct, "resync"); mcast_send_sync(obj, NET_T_STATE_UPD); break; } @@ -615,11 +606,9 @@ retry: return; } mcast_send_sync(obj, NET_T_STATE_NEW); - debug_ct(obj->ct, "internal new"); } else { cache_del(STATE_SYNC(internal), obj); cache_object_free(obj); - debug_ct(ct, "can't add"); goto retry; } } @@ -628,11 +617,10 @@ static void event_update_sync(struct nf_conntrack *ct) { struct cache_object *obj; - if ((obj = cache_update_force(STATE_SYNC(internal), ct)) == NULL) { - debug_ct(ct, "can't update"); + obj = cache_update_force(STATE_SYNC(internal), ct); + if (obj == NULL) return; - } - debug_ct(obj->ct, "internal update"); + mcast_send_sync(obj, NET_T_STATE_UPD); } @@ -642,16 +630,14 @@ static int event_destroy_sync(struct nf_conntrack *ct) int id; obj = cache_find(STATE_SYNC(internal), ct, &id); - if (obj == NULL) { - debug_ct(ct, "can't destroy"); + if (obj == NULL) return 0; - } + if (obj->status != C_OBJ_DEAD) { cache_object_set_status(obj, C_OBJ_DEAD); mcast_send_sync(obj, NET_T_STATE_DEL); cache_object_put(obj); } - debug_ct(ct, "internal destroy"); return 1; } diff --git a/src/sync-notrack.c b/src/sync-notrack.c index 7bd4351..57c3368 100644 --- a/src/sync-notrack.c +++ b/src/sync-notrack.c @@ -19,7 +19,6 @@ #include "conntrackd.h" #include "sync.h" #include "queue.h" -#include "debug.h" #include "network.h" #include "log.h" #include "cache.h" -- cgit v1.2.3