Skip to content

Commit

Permalink
Remove old (now unused) md_log() framework, use logit() instead
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Nilsson <[email protected]>
  • Loading branch information
troglobit committed Feb 13, 2020
1 parent 5d55c31 commit 4159022
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 43 deletions.
2 changes: 1 addition & 1 deletion src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef void (*ihfunc_t) (int);
#define EQUAL(s1, s2) (strcmp((s1), (s2)) == 0)
#define ARRAY_LEN(a) (sizeof((a)) / sizeof((a)[0]))

#define TIMER_INTERVAL ROUTE_MAX_REPORT_DELAY
#define TIMER_INTERVAL 2

#define PROTOCOL_VERSION 3 /* increment when packet format/content changes */
#define MROUTED_VERSION 9 /* not in DVMRP packets at all */
Expand Down
12 changes: 0 additions & 12 deletions src/kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ void k_add_rg(uint32_t origin, struct gtable *g)
struct mfcctl mc;
vifi_t i;

#ifdef DEBUG_MFC
md_log(MD_ADD, origin, g->gt_mcastgrp);
#endif
/* copy table values so that setsockopt can process it */
memset(&mc, 0, sizeof(mc));
mc.mfcc_origin.s_addr = origin;
Expand All @@ -250,9 +247,6 @@ void k_add_rg(uint32_t origin, struct gtable *g)

/* write to kernel space */
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_ADD_MFC, (char *)&mc, sizeof(mc)) < 0) {
#ifdef DEBUG_MFC
md_log(MD_ADD_FAIL, origin, g->gt_mcastgrp);
#endif
logit(LOG_WARNING, errno, "setsockopt MRT_ADD_MFC (%s, %s)",
inet_fmt(origin, s1, sizeof(s1)), inet_fmt(g->gt_mcastgrp, s2, sizeof(s2)));
}
Expand All @@ -266,19 +260,13 @@ int k_del_rg(uint32_t origin, struct gtable *g)
{
struct mfcctl mc;

#ifdef DEBUG_MFC
md_log(MD_DEL, origin, g->gt_mcastgrp);
#endif
/* copy table values so that setsockopt can process it */
memset(&mc, 0, sizeof(mc));
mc.mfcc_origin.s_addr = origin;
mc.mfcc_mcastgrp.s_addr = g->gt_mcastgrp;

/* write to kernel space */
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_DEL_MFC, (char *)&mc, sizeof(mc)) < 0) {
#ifdef DEBUG_MFC
md_log(MD_DEL_FAIL, origin, g->gt_mcastgrp);
#endif
logit(LOG_WARNING, errno, "setsockopt MRT_DEL_MFC of (%s %s)",
inet_fmt(origin, s1, sizeof(s1)), inet_fmt(g->gt_mcastgrp, s2, sizeof(s2)));

Expand Down
23 changes: 0 additions & 23 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,29 +174,6 @@ void logit(int severity, int syserr, const char *format, ...)
exit(1);
}

#ifdef DEBUG_MFC
void md_log(int what, uint32_t origin, uint32_t mcastgrp)
{
static FILE *f = NULL;
struct timeval tv;
uint32_t buf[4];

if (!f) {
if ((f = fopen("/tmp/mrouted.clog", "w")) == NULL) {
logit(LOG_ERR, errno, "open /tmp/mrouted.clog");
}
}

gettimeofday(&tv, NULL);
buf[0] = tv.tv_sec;
buf[1] = what;
buf[2] = origin;
buf[3] = mcastgrp;

fwrite(buf, sizeof(uint32_t), 4, f);
}
#endif

/**
* Local Variables:
* indent-tabs-mode: t
Expand Down
7 changes: 0 additions & 7 deletions src/prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,6 @@ void add_table_entry(uint32_t origin, uint32_t mcastgrp)
return;
}

#ifdef DEBUG_MFC
md_log(MD_MISS, origin, mcastgrp);
#endif

r = determine_route(origin);
prev_gt = NULL;
if (r == NULL) {
Expand Down Expand Up @@ -676,9 +672,6 @@ void add_table_entry(uint32_t origin, uint32_t mcastgrp)
/* An old source which we're keeping around for statistics */
time(&st->st_ctime);
} else {
#ifdef DEBUG_MFC
md_log(MD_DUPE, origin, mcastgrp);
#endif
/* Ignore kernel->mrouted retransmissions */
if (time(0) - st->st_ctime > 5)
logit(LOG_WARNING, 0, "Kernel entry already exists for (%s %s)",
Expand Down

0 comments on commit 4159022

Please sign in to comment.