diff options
author | Florin Coras <fcoras@cisco.com> | 2024-12-07 17:28:46 -0500 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-12-08 21:32:39 +0000 |
commit | 4c1f178063124644e7a88089e22dccd796682f10 (patch) | |
tree | 41ee2038532404f41a16ba844fe50b30e5506292 /src | |
parent | 4e271dda7b7177e73199b0ccdbf047c0bb55714d (diff) |
vcl: fix ldp getsockopt tcp_info length check
netinet/tcp.h and linux/tcp.h have different lenghts but overlap. LDP
uses the former while iperf the latter. Accept both lengths for now as
we do not support exposing tcp metrics via ldp.
Type: improvement
Change-Id: I13a149d68715ed9451773630a3595c09c421aa29
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vcl/ldp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index e1046441968..023a0eb0184 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -2020,10 +2020,14 @@ getsockopt (int fd, int level, int optname, optval, optlen); break; case TCP_INFO: - if (optval && optlen && (*optlen == sizeof (struct tcp_info))) + /* Note: tcp_info in netinet/tcp.h and linux/tcp.h have + * different lenghts but overlap. Accept both for now */ + if (optval && optlen) { - LDBG (1, "fd %d: vlsh %u SOL_TCP, TCP_INFO, optval %p, " - "optlen %d: #LDP-NOP#", fd, vlsh, optval, *optlen); + LDBG (1, + "fd %d: vlsh %u SOL_TCP, TCP_INFO, optval %p, " + "optlen %d: #LDP-NOP#", + fd, vlsh, optval, *optlen); memset (optval, 0, *optlen); rv = VPPCOM_OK; } |