MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tlv_check

Function tlv_check

freebsd/net/ieee8023ad_lacp.c:2054–2075  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2052}
2053
2054static int
2055tlv_check(const void *p, size_t size, const struct tlvhdr *tlv,
2056 const struct tlv_template *tmpl, boolean_t check_type)
2057{
2058 while (/* CONSTCOND */ 1) {
2059 if ((const char *)tlv - (const char *)p + sizeof(*tlv) > size) {
2060 return (EINVAL);
2061 }
2062 if ((check_type && tlv->tlv_type != tmpl->tmpl_type) ||
2063 tlv->tlv_length != tmpl->tmpl_length) {
2064 return (EINVAL);
2065 }
2066 if (tmpl->tmpl_type == 0) {
2067 break;
2068 }
2069 tlv = (const struct tlvhdr *)
2070 ((const char *)tlv + tlv->tlv_length);
2071 tmpl++;
2072 }
2073
2074 return (0);
2075}
2076
2077/* Debugging */
2078const char *

Callers 2

lacp_pdu_inputFunction · 0.85
lacp_marker_inputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected