From 4e1320d480625a79799bcc83657f2f8c0f9700a9 Mon Sep 17 00:00:00 2001 From: Freddie Chopin Date: Sat, 26 Oct 2013 19:27:25 +0200 Subject: [PATCH] SNMP: mib-2.system.sysDescr is read-only, so add const qualifiers to functions and pointers Signed-off-by: Freddie Chopin --- src/core/snmp/mib2.c | 6 +++--- src/include/lwip/snmp.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/snmp/mib2.c b/src/core/snmp/mib2.c index e8c94cc4..fe1bf6d7 100644 --- a/src/core/snmp/mib2.c +++ b/src/core/snmp/mib2.c @@ -772,8 +772,8 @@ static const s32_t sysservices = SNMP_SYSSERVICES; /** mib-2.system.sysDescr */ static const u8_t sysdescr_len_default = 4; static const u8_t sysdescr_default[] = "lwIP"; -static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default; -static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0]; +static const u8_t* sysdescr_len_ptr = &sysdescr_len_default; +static const u8_t* sysdescr_ptr = &sysdescr_default[0]; /** mib-2.system.sysContact */ static const u8_t syscontact_len_default = 0; static const u8_t syscontact_default[] = ""; @@ -933,7 +933,7 @@ void objectidncpy(s32_t *dst, const s32_t *src, u8_t n) * @param str if non-NULL then copy str pointer * @param len points to string length, excluding zero terminator */ -void snmp_set_sysdescr(u8_t *str, u8_t *len) +void snmp_set_sysdescr(const u8_t *str, const u8_t *len) { if (str != NULL) { diff --git a/src/include/lwip/snmp.h b/src/include/lwip/snmp.h index 4c1c9cd4..7844cc11 100644 --- a/src/include/lwip/snmp.h +++ b/src/include/lwip/snmp.h @@ -98,7 +98,7 @@ struct snmp_obj_id }; /* system */ -void snmp_set_sysdescr(u8_t* str, u8_t* len); +void snmp_set_sysdescr(const u8_t* str, const u8_t* len); void snmp_set_sysobjid(struct snmp_obj_id *oid); void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid); void snmp_inc_sysuptime(void);