Do not allow mtu manipulation anymore

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-12-31 19:30:49 +00:00
parent 5f72198a96
commit c75f5d5620
3 changed files with 1 additions and 32 deletions

View File

@@ -91,7 +91,7 @@ gt_setup_mtu(struct mud *mud, size_t old, const char *tun_name)
{ {
size_t mtu = mud_get_mtu(mud); size_t mtu = mud_get_mtu(mud);
if (mtu == old) if (!mtu || mtu == old)
return mtu; return mtu;
if (iface_set_mtu(tun_name, mtu) == -1) if (iface_set_mtu(tun_name, mtu) == -1)
@@ -351,10 +351,6 @@ gt_bind(int argc, char **argv)
res.ret = 0; res.ret = 0;
} }
break; break;
case CTL_MTU:
mud_set_mtu(mud, req.mtu);
res.mtu = mtu = gt_setup_mtu(mud, mtu, tun_name);
break;
case CTL_TC: case CTL_TC:
if (mud_set_tc(mud, req.tc)) if (mud_set_tc(mud, req.tc))
res.ret = errno; res.ret = errno;

View File

@@ -11,7 +11,6 @@ enum ctl_type {
CTL_NONE = 0, CTL_NONE = 0,
CTL_STATE, CTL_STATE,
CTL_STATUS, CTL_STATUS,
CTL_MTU,
CTL_TC, CTL_TC,
CTL_KXTIMEOUT, CTL_KXTIMEOUT,
CTL_TIMETOLERANCE, CTL_TIMETOLERANCE,
@@ -40,7 +39,6 @@ struct ctl_msg {
struct sockaddr_storage peer; struct sockaddr_storage peer;
} status; } status;
struct mud_bad bad; struct mud_bad bad;
size_t mtu;
int tc; int tc;
unsigned long ms; unsigned long ms;
unsigned percent; unsigned percent;

View File

@@ -7,26 +7,6 @@
#include "../argz/argz.h" #include "../argz/argz.h"
static int
gt_set_mtu(int fd, size_t mtu)
{
struct ctl_msg res, req = {
.type = CTL_MTU,
.mtu = mtu,
};
int ret = ctl_reply(fd, &res, &req);
if (ret) {
perror("set mtu");
return 1;
}
printf("mtu set to %zu\n", res.mtu);
return 0;
}
static int static int
gt_set_kxtimeout(int fd, unsigned long ms) gt_set_kxtimeout(int fd, unsigned long ms)
{ {
@@ -129,7 +109,6 @@ int
gt_set(int argc, char **argv) gt_set(int argc, char **argv)
{ {
const char *dev = NULL; const char *dev = NULL;
size_t mtu;
int tc; int tc;
unsigned long kxtimeout; unsigned long kxtimeout;
unsigned long timetolerance; unsigned long timetolerance;
@@ -137,7 +116,6 @@ gt_set(int argc, char **argv)
struct argz pathz[] = { struct argz pathz[] = {
{"dev", "NAME", &dev, argz_str}, {"dev", "NAME", &dev, argz_str},
{"mtu", "BYTES", &mtu, argz_bytes},
{"tc", "CS|AF|EF", &tc, gt_argz_tc}, {"tc", "CS|AF|EF", &tc, gt_argz_tc},
{"kxtimeout", "SECONDS", &kxtimeout, argz_time}, {"kxtimeout", "SECONDS", &kxtimeout, argz_time},
{"timetolerance", "SECONDS", &timetolerance, argz_time}, {"timetolerance", "SECONDS", &timetolerance, argz_time},
@@ -168,9 +146,6 @@ gt_set(int argc, char **argv)
int ret = 0; int ret = 0;
if (argz_is_set(pathz, "mtu"))
ret |= gt_set_mtu(fd, mtu);
if (argz_is_set(pathz, "tc")) if (argz_is_set(pathz, "tc"))
ret |= gt_set_tc(fd, tc); ret |= gt_set_tc(fd, tc);