Enforce minimum physical MTU in ifchd.
Skip zero-length commands in execute_buffer().
This commit is contained in:
parent
2bf7306bb9
commit
87db9c70fd
@ -374,8 +374,7 @@ static int execute_buffer(struct ifchd_client *cl, char *newbuf)
|
|||||||
strlcat(buf, cl->ibuf, sizeof buf);
|
strlcat(buf, cl->ibuf, sizeof buf);
|
||||||
strlcat(buf, newbuf, sizeof buf);
|
strlcat(buf, newbuf, sizeof buf);
|
||||||
|
|
||||||
for (;;) {
|
for (endp = p;;p = endp) {
|
||||||
endp = p;
|
|
||||||
if (cl->state == STATE_NOTHING) {
|
if (cl->state == STATE_NOTHING) {
|
||||||
char *colon = strchr(p, ':');
|
char *colon = strchr(p, ':');
|
||||||
if (!colon)
|
if (!colon)
|
||||||
@ -400,6 +399,9 @@ static int execute_buffer(struct ifchd_client *cl, char *newbuf)
|
|||||||
endp = semi + 1;
|
endp = semi + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strlen(p))
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (cl->state) {
|
switch (cl->state) {
|
||||||
case STATE_NOTHING:
|
case STATE_NOTHING:
|
||||||
if (strncmp(p, CMD_INTERFACE, sizeof(CMD_INTERFACE)) == 0)
|
if (strncmp(p, CMD_INTERFACE, sizeof(CMD_INTERFACE)) == 0)
|
||||||
@ -506,7 +508,6 @@ static int execute_buffer(struct ifchd_client *cl, char *newbuf)
|
|||||||
log_line("warning: invalid state in dispatch_work\n");
|
log_line("warning: invalid state in dispatch_work\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p = endp;
|
|
||||||
}
|
}
|
||||||
size_t remsize = strlen(endp);
|
size_t remsize = strlen(endp);
|
||||||
if (remsize > MAX_BUF - 1)
|
if (remsize > MAX_BUF - 1)
|
||||||
|
@ -279,6 +279,9 @@ void perform_mtu(struct ifchd_client *cl, char *str)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mtu = strtol(str, NULL, 10);
|
mtu = strtol(str, NULL, 10);
|
||||||
|
// Minimum MTU for physical IPv4 links is 576 octets.
|
||||||
|
if (mtu < 576)
|
||||||
|
return;
|
||||||
ifrt.ifr_mtu = mtu;
|
ifrt.ifr_mtu = mtu;
|
||||||
strlcpy(ifrt.ifr_name, cl->ifnam, IFNAMSIZ);
|
strlcpy(ifrt.ifr_name, cl->ifnam, IFNAMSIZ);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user