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, newbuf, sizeof buf);
|
||||
|
||||
for (;;) {
|
||||
endp = p;
|
||||
for (endp = p;;p = endp) {
|
||||
if (cl->state == STATE_NOTHING) {
|
||||
char *colon = strchr(p, ':');
|
||||
if (!colon)
|
||||
@ -400,6 +399,9 @@ static int execute_buffer(struct ifchd_client *cl, char *newbuf)
|
||||
endp = semi + 1;
|
||||
}
|
||||
|
||||
if (!strlen(p))
|
||||
continue;
|
||||
|
||||
switch (cl->state) {
|
||||
case STATE_NOTHING:
|
||||
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");
|
||||
break;
|
||||
}
|
||||
p = endp;
|
||||
}
|
||||
size_t remsize = strlen(endp);
|
||||
if (remsize > MAX_BUF - 1)
|
||||
|
@ -279,6 +279,9 @@ void perform_mtu(struct ifchd_client *cl, char *str)
|
||||
return;
|
||||
|
||||
mtu = strtol(str, NULL, 10);
|
||||
// Minimum MTU for physical IPv4 links is 576 octets.
|
||||
if (mtu < 576)
|
||||
return;
|
||||
ifrt.ifr_mtu = mtu;
|
||||
strlcpy(ifrt.ifr_name, cl->ifnam, IFNAMSIZ);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user