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

2019-04-25 Thread Harald Welte
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 = >v4.cfg.dns[0];
const struct in46_addr *dns2 = >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 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 


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

2019-04-25 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13568 )

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


Patch Set 2: Code-Review+2


--
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: comment
Gerrit-Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
Gerrit-Change-Number: 13568
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 25 Apr 2019 20:16:39 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13568 )

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


Patch Set 1: Code-Review+2


--
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: comment
Gerrit-Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
Gerrit-Change-Number: 13568
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:19:22 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2019-04-10 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/68/13568/1

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index c31831a..2c0d64e 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 = >v4.cfg.dns[0];
const struct in46_addr *dns2 = >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: newchange
Gerrit-Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
Gerrit-Change-Number: 13568
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte