Don't fork off subprocesses to send to ifchd. Totally unnecessary.
This commit is contained in:
parent
c4f912a525
commit
31d15af0fa
@ -182,7 +182,6 @@ static void deconfig_if(void)
|
|||||||
sockwrite(sockfd, buf, strlen(buf));
|
sockwrite(sockfd, buf, strlen(buf));
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void translate_option(int sockfd, struct dhcpMessage *packet, int opt)
|
static void translate_option(int sockfd, struct dhcpMessage *packet, int opt)
|
||||||
@ -240,18 +239,10 @@ static void bound_if(struct dhcpMessage *packet)
|
|||||||
translate_option(sockfd, packet, 17);
|
translate_option(sockfd, packet, 17);
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_script(struct dhcpMessage *packet, int mode)
|
void run_script(struct dhcpMessage *packet, int mode)
|
||||||
{
|
{
|
||||||
int pid;
|
|
||||||
|
|
||||||
pid = fork();
|
|
||||||
if (pid) {
|
|
||||||
waitpid(pid, NULL, 0);
|
|
||||||
return;
|
|
||||||
} else if (pid == 0) {
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case SCRIPT_DECONFIG:
|
case SCRIPT_DECONFIG:
|
||||||
deconfig_if();
|
deconfig_if();
|
||||||
@ -266,10 +257,8 @@ void run_script(struct dhcpMessage *packet, int mode)
|
|||||||
deconfig_if();
|
deconfig_if();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
|
||||||
}
|
|
||||||
log_error("invalid script mode: %d", mode);
|
log_error("invalid script mode: %d", mode);
|
||||||
exit(EXIT_FAILURE);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user