diff options
author | Jason Wang | 2021-04-23 05:18:03 +0200 |
---|---|---|
committer | Peter Maydell | 2021-04-23 12:11:28 +0200 |
commit | bc38e31b4e0366f3a70c0939abde4c3dd6e0fa30 (patch) | |
tree | f8e330e2edb9005a327170cffa51cd0944673806 /include/net/net.h | |
parent | Update version for v6.0.0-rc4 release (diff) | |
download | qemu-bc38e31b4e0366f3a70c0939abde4c3dd6e0fa30.tar.gz qemu-bc38e31b4e0366f3a70c0939abde4c3dd6e0fa30.tar.xz qemu-bc38e31b4e0366f3a70c0939abde4c3dd6e0fa30.zip |
net: check the existence of peer before trying to pad
There could be case that peer is NULL. This can happen when during
network device hot-add where net device needs to be added first. So
the patch check the existence of peer before trying to do the pad.
Fixes: 969e50b61a285 ("net: Pad short frames to minimum size before sending from SLiRP/TAP")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 20210423031803.1479-1-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/net/net.h')
-rw-r--r-- | include/net/net.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/net.h b/include/net/net.h index eff24519d2..1ef536d771 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -241,4 +241,9 @@ uint32_t net_crc32_le(const uint8_t *p, int len); .offset = vmstate_offset_macaddr(_state, _field), \ } +static inline bool net_peer_needs_padding(NetClientState *nc) +{ + return nc->peer && !nc->peer->do_not_pad; +} + #endif |