Change in osmo-ggsn[master]: ggsn: const-ify input / read-only arguments of PCO related functions

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Apr 25 20:17:30 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13568 )

Change subject: ggsn: const-ify input / read-only arguments of PCO related functions
......................................................................

ggsn: const-ify input / read-only arguments of PCO related functions

Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
---
M ggsn/ggsn.c
1 file changed, 8 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 65e15c3..a439d01 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -413,9 +413,10 @@
 } __attribute__ ((packed));
 
 /* determine if IPCP contains given option */
-static uint8_t *ipcp_contains_option(uint8_t *ipcp, size_t ipcp_len, enum ipcp_options opt, size_t opt_minlen)
+static const uint8_t *ipcp_contains_option(const uint8_t *ipcp, size_t ipcp_len,
+					   enum ipcp_options opt, size_t opt_minlen)
 {
-	uint8_t *cur_opt = ipcp + sizeof(struct ipcp_hdr);
+	const uint8_t *cur_opt = ipcp + sizeof(struct ipcp_hdr);
 
 	/* iterate over Options and check if protocol contained */
 	while (cur_opt + 2 <= ipcp + ipcp_len) {
@@ -469,9 +470,10 @@
 } __attribute__((packed));
 
 /* determine if PCO contains given protocol */
-static uint8_t *pco_contains_proto(struct ul255_t *pco, size_t offset, uint16_t prot, size_t prot_minlen)
+static const uint8_t *pco_contains_proto(const struct ul255_t *pco, size_t offset,
+					 uint16_t prot, size_t prot_minlen)
 {
-	uint8_t *cur = pco->v + 1 /*length*/ + offset;
+	const uint8_t *cur = pco->v + 1 /*length*/ + offset;
 
 	/* iterate over PCO and check if protocol contained */
 	while (cur + sizeof(struct pco_element) <= pco->v + pco->l) {
@@ -512,9 +514,9 @@
 {
 	const struct in46_addr *dns1 = &apn->v4.cfg.dns[0];
 	const struct in46_addr *dns2 = &apn->v4.cfg.dns[1];
-	uint8_t *ipcp;
+	const uint8_t *ipcp, *pco_ipcp;
 	uint16_t ipcp_len;
-	uint8_t *len1, *len2, *pco_ipcp;
+	uint8_t *len1, *len2;
 	unsigned int len_appended;
 	ptrdiff_t consumed;
 	size_t remain, offset = 0;

-- 
To view, visit https://gerrit.osmocom.org/13568
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
Gerrit-Change-Number: 13568
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190425/18d1e280/attachment.htm>


More information about the gerrit-log mailing list