summaryrefslogtreecommitdiffstats
path: root/src/shell.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-24 03:36:49 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-24 03:36:49 +0100
commit9ef4d441ad91ebcbc68bdae309122f128ed69f56 (patch)
treea3162fd43e77ce9c83eadf8ef4cfb92918df4615 /src/shell.c
parent14a991a1ced945db09e53a1e6dd0a7b2a052cfba (diff)
downloadfastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.tar
fastd-9ef4d441ad91ebcbc68bdae309122f128ed69f56.zip
Add support for defining the MTU per peer
Diffstat (limited to 'src/shell.c')
-rw-r--r--src/shell.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/shell.c b/src/shell.c
index b678ba5..e8d6943 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -77,10 +77,18 @@ void fastd_shell_env_free(fastd_shell_env_t *env) {
/** Adds an interface name to a shell environment */
void fastd_shell_env_set_iface(fastd_shell_env_t *env, const fastd_iface_t *iface) {
- if (iface)
+ if (iface) {
+ char buf[6];
+
fastd_shell_env_set(env, "INTERFACE", iface->name);
- else
+
+ snprintf(buf, sizeof(buf), "%u", iface->mtu);
+ fastd_shell_env_set(env, "INTERFACE_MTU", buf);
+ }
+ else {
fastd_shell_env_set(env, "INTERFACE", NULL);
+ fastd_shell_env_set(env, "INTERFACE_MTU", NULL);
+ }
}
/** Applies a shell environment to the current process */
@@ -92,9 +100,6 @@ static void shell_command_setenv(pid_t pid, const fastd_shell_env_t *env) {
snprintf(buf, sizeof(buf), "%u", (unsigned)pid);
setenv("FASTD_PID", buf, 1);
- snprintf(buf, sizeof(buf), "%u", conf.mtu);
- setenv("INTERFACE_MTU", buf, 1);
-
if (!env)
return;