Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Taht
committed
Jan 23, 2014
1 parent
75a992a
commit a23a130
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
net/babeld/patches/0001-fixes-to-reload-on-hup-and-dont-use-a-pidfile.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
From 242dc1a62fa0b7542c851a16ce647b7a2ef0be4f Mon Sep 17 00:00:00 2001 | ||
From: Dave Taht <dave.taht@bufferbloat.net> | ||
Date: Thu, 23 Jan 2014 01:08:25 -0500 | ||
Subject: [PATCH] fixes to reload on hup and dont use a pidfile | ||
|
||
procd support requires sane behavior on a hup, and also doesn't | ||
work with pid files. | ||
--- | ||
babeld.c | 16 ++++++++++------ | ||
1 file changed, 10 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/babeld.c b/babeld.c | ||
index 552a54a..b0607cc 100644 | ||
--- a/babeld.c | ||
+++ b/babeld.c | ||
@@ -77,6 +77,7 @@ const unsigned char ones[16] = | ||
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; | ||
|
||
+static int no_pidfile = 0; | ||
int protocol_port; | ||
unsigned char protocol_group[16]; | ||
char allow_generic_redistribution = 0; | ||
@@ -123,7 +124,7 @@ main(int argc, char **argv) | ||
change_smoothing_half_life(4); | ||
|
||
while(1) { | ||
- opt = getopt(argc, argv, "m:p:h:H:i:k:A:sruS:d:g:lwz:M:t:T:c:C:DL:I:"); | ||
+ opt = getopt(argc, argv, "m:p:h:H:i:k:A:sruS:d:g:lwz:M:t:T:c:C:DL:I:N"); | ||
if(opt < 0) | ||
break; | ||
|
||
@@ -170,6 +171,9 @@ main(int argc, char **argv) | ||
if(allow_duplicates < 0 || allow_duplicates > 0xFFFF) | ||
goto usage; | ||
break; | ||
+ case 'N': | ||
+ no_pidfile = 1; | ||
+ break; | ||
case 's': | ||
split_horizon = 0; | ||
break; | ||
@@ -323,7 +327,7 @@ main(int argc, char **argv) | ||
} | ||
} | ||
|
||
- if(pidfile && pidfile[0] != '\0') { | ||
+ if(!no_pidfile && pidfile && pidfile[0] != '\0') { | ||
int pfd, len; | ||
char buf[100]; | ||
|
||
@@ -789,7 +793,7 @@ main(int argc, char **argv) | ||
} | ||
close(fd); | ||
} | ||
- if(pidfile) | ||
+ if(!no_pidfile && pidfile) | ||
unlink(pidfile); | ||
debugf("Done.\n"); | ||
return 0; | ||
@@ -805,7 +809,7 @@ main(int argc, char **argv) | ||
" " | ||
"[-t table] [-T table] [-c file] [-C statement]\n" | ||
" " | ||
- "[-d level] [-D] [-L logfile] [-I pidfile]\n" | ||
+ "[-d level] [-D] [-L logfile] [-I pidfile] [-N]\n" | ||
" " | ||
"[id] interface...\n", | ||
argv[0]); | ||
@@ -820,7 +824,7 @@ main(int argc, char **argv) | ||
kernel_setup_socket(0); | ||
kernel_setup(0); | ||
fail_pid: | ||
- if(pidfile) | ||
+ if(!no_pidfile && pidfile) | ||
unlink(pidfile); | ||
exit(1); | ||
} | ||
@@ -952,7 +956,7 @@ init_signals(void) | ||
sigaction(SIGTERM, &sa, NULL); | ||
|
||
sigemptyset(&ss); | ||
- sa.sa_handler = sigexit; | ||
+ sa.sa_handler = sigreopening; | ||
sa.sa_mask = ss; | ||
sa.sa_flags = 0; | ||
sigaction(SIGHUP, &sa, NULL); | ||
-- | ||
1.8.3.2 | ||
|