net: l2: ppp: fix packet length for sending Term-Req and Term-Ack

Each PPP packet sent on wire needs to have at least 4 bytes length. Set
that length for outgoing Term-Req and Term-Ack packets. Also update
length validation to check for at least 4 bytes instead of at least 1
byte.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2020-07-03 15:37:45 +02:00 committed by Carles Cufí
commit 16542e1642

View file

@ -417,13 +417,14 @@ int ppp_send_pkt(struct ppp_fsm *fsm, struct net_if *iface,
case PPP_TERMINATE_REQ:
case PPP_TERMINATE_ACK:
len = sizeof(ppp);
break;
default:
break;
}
if (len == 0) {
if (len < sizeof(ppp)) {
return -EINVAL;
}