This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patch to rtsold that runs a script upon recieving a router advert…
…isement. Also teach a -p for specifying pid
- Loading branch information
Ermal
committed
Mar 19, 2013
1 parent
f760897
commit 2a78e64
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
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,69 @@ | ||
diff -ur ../rtsold.old/rtsol.c ./rtsol.c | ||
--- ../rtsold.old/rtsol.c 2013-03-19 16:31:23.000000000 +0100 | ||
+++ ./rtsol.c 2013-03-19 16:34:35.000000000 +0100 | ||
@@ -75,7 +75,7 @@ | ||
static struct sockaddr_in6 sin6_allrouters = | ||
{sizeof(sin6_allrouters), AF_INET6}; | ||
|
||
-static void call_script(char *, char *); | ||
+static void call_script(char *, char *, u_char *); | ||
static int safefile(const char *); | ||
|
||
int | ||
@@ -351,8 +351,8 @@ | ||
warnmsg(LOG_DEBUG, __func__, | ||
"OtherConfigFlag on %s is turned on", ifi->ifname); | ||
ifi->otherconfig = 1; | ||
- call_script(otherconf_script, ifi->ifname); | ||
} | ||
+ call_script(otherconf_script, ifi->ifname, ntopbuf); | ||
|
||
ifi->racnt++; | ||
|
||
@@ -369,7 +369,7 @@ | ||
} | ||
|
||
static void | ||
-call_script(char *scriptpath, char *ifname) | ||
+call_script(char *scriptpath, char *ifname, u_char *inetv6addr) | ||
{ | ||
pid_t pid, wpid; | ||
|
||
@@ -397,12 +397,13 @@ | ||
"script \"%s\" terminated", scriptpath); | ||
} | ||
} else { | ||
- char *argv[3]; | ||
+ char *argv[4]; | ||
int fd; | ||
|
||
argv[0] = scriptpath; | ||
argv[1] = ifname; | ||
- argv[2] = NULL; | ||
+ argv[2] = inetv6addr; | ||
+ argv[3] = NULL; | ||
|
||
if (safefile(scriptpath)) { | ||
warnmsg(LOG_ERR, __func__, | ||
diff -ur ../rtsold.old/rtsold.c ./rtsold.c | ||
--- ../rtsold.old/rtsold.c 2013-03-19 16:31:23.000000000 +0100 | ||
+++ ./rtsold.c 2013-03-19 16:32:09.000000000 +0100 | ||
@@ -134,7 +134,7 @@ | ||
once = 1; | ||
opts = "adDFO:"; | ||
} else | ||
- opts = "adDfFm1O:"; | ||
+ opts = "adDfFm1O:p:"; | ||
|
||
while ((ch = getopt(argc, argv, opts)) != -1) { | ||
switch (ch) { | ||
@@ -162,6 +162,9 @@ | ||
case 'O': | ||
otherconf_script = optarg; | ||
break; | ||
+ case 'p': | ||
+ pidfilename = optarg; | ||
+ break; | ||
default: | ||
usage(argv0); | ||
/*NOTREACHED*/ |