Global parser functions to return 1 when property unchanged

Currently, wpa_config_set(), the function that sets wpa_supplicant
per-network properties, returns 1 when a property it attempts to set is
unchanged. Its global parallel, wpa_config_process_global(), doesn't do
this even though much of the code is very similar. Change this, and
several of the parser functions, to resemble the per-network parser and
setter functions.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
This commit is contained in:
Matthew Wang 2020-07-15 17:17:41 -07:00 committed by Jouni Malinen
parent a87173b1d1
commit 922fa09972
4 changed files with 80 additions and 7 deletions

View file

@ -70,6 +70,21 @@ static inline size_t wpabuf_tailroom(const struct wpabuf *buf)
return buf->size - buf->used;
}
/**
* wpabuf_cmp - Check if two buffers contain the same data
* @a: wpabuf buffer
* @b: wpabuf buffer
* Returns: 0 if the two buffers contain the same data and non-zero otherwise
*/
static inline int wpabuf_cmp(const struct wpabuf *a, const struct wpabuf *b)
{
if (!a && !b)
return 0;
if (a && b && wpabuf_size(a) == wpabuf_size(b))
return os_memcmp(a->buf, b->buf, wpabuf_size(a));
return -1;
}
/**
* wpabuf_head - Get pointer to the head of the buffer data
* @buf: wpabuf buffer