summaryrefslogtreecommitdiffstats
path: root/tcpip/rip98d.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcpip/rip98d.c')
-rw-r--r--tcpip/rip98d.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tcpip/rip98d.c b/tcpip/rip98d.c
index 8688177..9ea3dd2 100644
--- a/tcpip/rip98d.c
+++ b/tcpip/rip98d.c
@@ -83,14 +83,14 @@ static void terminate(int sig)
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
-
+
exit(0);
}
unsigned int mask2bits(unsigned long int mask)
{
struct mask_struct *t;
-
+
for (t = mask_table; t->mask != 0; t++)
if (mask == t->mask)
return t->bits;
@@ -101,7 +101,7 @@ unsigned int mask2bits(unsigned long int mask)
unsigned long int bits2mask(unsigned int bits)
{
struct mask_struct *t;
-
+
for (t = mask_table; t->mask != 0; t++)
if (bits == t->bits)
return htonl(t->mask);
@@ -168,7 +168,7 @@ static int read_routes(void)
if (first_route != NULL) {
route = first_route;
-
+
while (route != NULL) {
temp = route->next;
free(route);
@@ -177,7 +177,7 @@ static int read_routes(void)
first_route = NULL;
}
-
+
if ((fp = fopen(PROC_IP_ROUTE_FILE, "r")) == NULL) {
if (logging)
syslog(LOG_ERR, "error cannot open %s\n", PROC_IP_ROUTE_FILE);
@@ -196,7 +196,7 @@ static int read_routes(void)
netmask = mask2bits(hex2intrev(mask_addr));
network = inet_netof(address);
-
+
if (network == 0 || network == 127) {
if (debug && logging)
syslog(LOG_DEBUG, "rejecting route to %s/%ld - should not be propogated\n", inet_ntoa(address), netmask);
@@ -225,9 +225,9 @@ static int read_routes(void)
route->next = first_route;
first_route = route;
}
-
+
fclose(fp);
-
+
return TRUE;
}
@@ -236,12 +236,12 @@ static int load_dests(void)
struct hostent *host;
char buffer[255], *s;
FILE *fp;
-
+
if ((fp = fopen(CONF_RIP98D_FILE, "r")) == NULL) {
fprintf(stderr, "rip98d: cannot open config file\n");
return FALSE;
}
-
+
while (fgets(buffer, 255, fp) != NULL) {
if ((s = strchr(buffer, '\n')) != NULL) *s = '\0';
@@ -254,12 +254,12 @@ static int load_dests(void)
memcpy((char *)&dest_list[dest_count].dest_addr, host->h_addr, host->h_length);
dest_count++;
}
-
+
fclose(fp);
if (dest_count == 0)
return FALSE;
-
+
return TRUE;
}
@@ -287,7 +287,7 @@ int main(int argc, char **argv)
break;
case 'r':
route_restrict = TRUE;
- break;
+ break;
case 't':
interval = atoi(optarg) * 60;
if (interval < 60 || interval > 7200) {
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
memset((char *)&loc_addr, 0, sizeof(loc_addr));
loc_addr.sin_family = AF_INET;
loc_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- loc_addr.sin_port = htons(RIP_PORT);
+ loc_addr.sin_port = htons(RIP_PORT);
if (bind(s, (struct sockaddr *)&loc_addr, sizeof(loc_addr)) < 0) {
perror("rip98d: bind");
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
timeout.tv_sec = 60;
timeout.tv_usec = 0;
-
+
select(s + 1, &fdset, NULL, NULL, &timeout);
if (!read_routes()) {