Change in osmo-ggsn[master]: ggsn: Remove magic numbers from pco_contains_proto()

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Apr 11 14:18:00 UTC 2019


Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/13567 )

Change subject: ggsn: Remove magic numbers from pco_contains_proto()
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c@474
PS1, Line 474: 	uint8_t *cur = pco->v + 1 /*length*/ + offset;
I think we can drop cur completely.

struct pco_element *elem = (struct pco_element *) pco->v + 1 /*length*/ + offset;

while (elem + sizeof(*elem) <= pco->v+ pco->l) {
    if (ntohs(elem->protocol_id) == prot && elem->length >= prot_minlen)
        return (uint8_t*) elem;
    elem = elem + elem->length + sizeof(*elem);
    }
return NULL;



-- 
To view, visit https://gerrit.osmocom.org/13567
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: I9871ffced677320aa82438332bfdb951ab129f04
Gerrit-Change-Number: 13567
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:18:00 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190411/5637116e/attachment.html>


More information about the gerrit-log mailing list