Ifchd: Print out log messages when commands are successfully dispatched.
This commit is contained in:
parent
b7e6f59fc7
commit
3640c5bbf0
@ -256,6 +256,7 @@ void perform_dns(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
return;
|
return;
|
||||||
strnkcpy(cl->namesvrs, str, sizeof cl->namesvrs);
|
strnkcpy(cl->namesvrs, str, sizeof cl->namesvrs);
|
||||||
write_resolve_conf(cl);
|
write_resolve_conf(cl);
|
||||||
|
log_line("Added DNS server: '%s'", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates for print daemons are too non-standard to be useful. */
|
/* Updates for print daemons are too non-standard to be useful. */
|
||||||
@ -269,6 +270,8 @@ void perform_hostname(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
return;
|
return;
|
||||||
if (sethostname(str, strlen(str) + 1) == -1)
|
if (sethostname(str, strlen(str) + 1) == -1)
|
||||||
log_line("sethostname returned %s", strerror(errno));
|
log_line("sethostname returned %s", strerror(errno));
|
||||||
|
else
|
||||||
|
log_line("Set hostname: '%s'", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update "domain" and "search" in /etc/resolv.conf */
|
/* update "domain" and "search" in /etc/resolv.conf */
|
||||||
@ -278,6 +281,7 @@ void perform_domain(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
return;
|
return;
|
||||||
strnkcpy(cl->domains, str, sizeof cl->domains);
|
strnkcpy(cl->domains, str, sizeof cl->domains);
|
||||||
write_resolve_conf(cl);
|
write_resolve_conf(cl);
|
||||||
|
log_line("Added DNS domain: '%s'", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I don't think this can be done without a netfilter extension
|
/* I don't think this can be done without a netfilter extension
|
||||||
|
@ -111,6 +111,7 @@ void perform_interface(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
/* Update interface name. */
|
/* Update interface name. */
|
||||||
memset(cl->ifnam, '\0', IFNAMSIZ);
|
memset(cl->ifnam, '\0', IFNAMSIZ);
|
||||||
strnkcpy(cl->ifnam, str, IFNAMSIZ);
|
strnkcpy(cl->ifnam, str, IFNAMSIZ);
|
||||||
|
log_line("Subsequent commands alter interface: '%s'", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_if_flag(struct ifchd_client *cl, short flag)
|
static int set_if_flag(struct ifchd_client *cl, short flag)
|
||||||
@ -182,6 +183,8 @@ void perform_ip(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
if (ioctl(fd, SIOCSIFADDR, &ifrt) < 0)
|
if (ioctl(fd, SIOCSIFADDR, &ifrt) < 0)
|
||||||
log_line("%s: failed to configure IP: %s",
|
log_line("%s: failed to configure IP: %s",
|
||||||
cl->ifnam, strerror(errno));
|
cl->ifnam, strerror(errno));
|
||||||
|
else
|
||||||
|
log_line("Interface IP set to: '%s'", str);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +220,8 @@ void perform_subnet(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
if (ioctl(fd, SIOCSIFNETMASK, &ifrt) < 0)
|
if (ioctl(fd, SIOCSIFNETMASK, &ifrt) < 0)
|
||||||
log_line("%s: failed to configure subnet: %s",
|
log_line("%s: failed to configure subnet: %s",
|
||||||
cl->ifnam, strerror(errno));
|
cl->ifnam, strerror(errno));
|
||||||
}
|
} else
|
||||||
|
log_line("Interface subnet set to: '%s'", str);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +267,8 @@ void perform_router(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
log_line("%s: failed to set route: %s",
|
log_line("%s: failed to set route: %s",
|
||||||
cl->ifnam, strerror(errno));
|
cl->ifnam, strerror(errno));
|
||||||
}
|
} else
|
||||||
|
log_line("Gateway router set to: '%s'", str);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +299,8 @@ void perform_mtu(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
if (ioctl(fd, SIOCSIFMTU, &ifrt) < 0)
|
if (ioctl(fd, SIOCSIFMTU, &ifrt) < 0)
|
||||||
log_line("%s: failed to set MTU (%d): %s", cl->ifnam, mtu,
|
log_line("%s: failed to set MTU (%d): %s", cl->ifnam, mtu,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
else
|
||||||
|
log_line("MTU set to: '%s'", str);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,5 +332,7 @@ void perform_broadcast(struct ifchd_client *cl, const char *str, size_t len)
|
|||||||
if (ioctl(fd, SIOCSIFBRDADDR, &ifrt) < 0)
|
if (ioctl(fd, SIOCSIFBRDADDR, &ifrt) < 0)
|
||||||
log_line("%s: failed to set broadcast: %s",
|
log_line("%s: failed to set broadcast: %s",
|
||||||
cl->ifnam, strerror(errno));
|
cl->ifnam, strerror(errno));
|
||||||
|
else
|
||||||
|
log_line("Broadcast address set to: '%s'", str);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user