Change in ...osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. ggsn: More logging from PCO handling (e.g. in case of malconfiguration) Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e --- M ggsn/ggsn.c 1 file changed, 18 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, approved diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index e95471a..968d4dd 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -595,15 +595,19 @@ ptrdiff_t consumed; size_t remain; - if (!peer_v4) + if (!peer_v4) { + LOGPPDP(LOGL_ERROR, pdp, "IPCP but no IPv4 type ?!?\n"); return; + } ipcp = pco_elem->data; consumed = (ipcp - &pdp->pco_req.v[0]); remain = sizeof(pdp->pco_req.v) - consumed; ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */ - if (remain < 0 || remain < ipcp_len) + if (remain < 0 || remain < ipcp_len) { + LOGPPDP(LOGL_ERROR, pdp, "Malformed IPCP, ignoring\n"); return; + } /* Three byte T16L header */ msgb_put_u16(resp, 0x8021); /* IPCP */ @@ -636,6 +640,7 @@ const struct apn_ctx *apn, struct pdp_t *pdp) { unsigned int i; + const uint8_t *tail = resp->tail; for (i = 0; i < ARRAY_SIZE(apn->v6.cfg.dns); i++) { const struct in46_addr *i46a = &apn->v6.cfg.dns[i]; @@ -643,12 +648,15 @@ continue; msgb_t16lv_put(resp, PCO_P_DNS_IPv6_ADDR, i46a->len, i46a->v6.s6_addr); } + if (resp->tail == tail) + LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv6 DNS, but APN has none configured\n"); } static void process_pco_element_dns_ipv4(const struct pco_element *pco_elem, struct msgb *resp, const struct apn_ctx *apn, struct pdp_t *pdp) { unsigned int i; + const uint8_t *tail = resp->tail; for (i = 0; i < ARRAY_SIZE(apn->v4.cfg.dns); i++) { const struct in46_addr *i46a = &apn->v4.cfg.dns[i]; @@ -656,12 +664,17 @@ continue; msgb_t16lv_put(resp, PCO_P_DNS_IPv4_ADDR, i46a->len, (uint8_t *)&i46a->v4); } + if (resp->tail == tail) + LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv4 DNS, but APN has none configured\n"); } static void process_pco_element(const struct pco_element *pco_elem, struct msgb *resp, const struct apn_ctx *apn, struct pdp_t *pdp) { - switch (ntohs(pco_elem->protocol_id)) { + uint16_t protocol_id = ntohs(pco_elem->protocol_id); + + LOGPPDP(LOGL_DEBUG, pdp, "PCO Protocol 0x%04x\n", protocol_id); + switch (protocol_id) { case PCO_P_PAP: process_pco_element_pap(pco_elem, resp, apn, pdp); break; @@ -675,6 +688,8 @@ process_pco_element_dns_ipv4(pco_elem, resp, apn, pdp); break; default: + LOGPPDP(LOGL_INFO, pdp, "Unknown/Unimplemented PCO Protocol 0x%04x: %s\n", + protocol_id, osmo_hexdump_nospc(pco_elem->data, pco_elem->length)); break; } } -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/13609 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 6 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-CC: msuraev Gerrit-MessageType: merged
Change in ...osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/13609 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 5 Gerrit-Owner: laforge Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-CC: msuraev Gerrit-Comment-Date: Fri, 28 Jun 2019 21:12:32 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
Max has posted comments on this change. ( https://gerrit.osmocom.org/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. Patch Set 4: Some comment/reference to what PCO is would be helpful. P. S> Seems like I'm unable to +1 this due to some permissions problem. -- To view, visit https://gerrit.osmocom.org/13609 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: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 4 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Max Gerrit-Comment-Date: Fri, 26 Apr 2019 11:26:23 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. Patch Set 3: (1 comment) https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c File ggsn/ggsn.c: https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c@570 PS3, Line 570: if (!peer_v4) { > Wondering why IPCP is only used in ipv4... because IPCP is specified strictly for IPv4 only. There is no IP6CP (at least not for communicating DNS servers), and as a result, the IPv6 DNS adresses had to be pushed directl into PCO without any IETF format/layer. -- To view, visit https://gerrit.osmocom.org/13609 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: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 3 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Fri, 12 Apr 2019 10:23:57 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. Patch Set 3: Code-Review+2 (1 comment) https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c File ggsn/ggsn.c: https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c@570 PS3, Line 570: if (!peer_v4) { Wondering why IPCP is only used in ipv4... -- To view, visit https://gerrit.osmocom.org/13609 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: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 3 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Thu, 11 Apr 2019 20:01:23 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
Harald Welte has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/13609 ) Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. ggsn: More logging from PCO handling (e.g. in case of malconfiguration) Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e --- M ggsn/ggsn.c 1 file changed, 18 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/09/13609/2 -- To view, visit https://gerrit.osmocom.org/13609 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte
Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)
Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13609 Change subject: ggsn: More logging from PCO handling (e.g. in case of malconfiguration) .. ggsn: More logging from PCO handling (e.g. in case of malconfiguration) Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e --- M ggsn/ggsn.c 1 file changed, 18 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/09/13609/1 diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c index d079efe..45026fe 100644 --- a/ggsn/ggsn.c +++ b/ggsn/ggsn.c @@ -567,15 +567,19 @@ ptrdiff_t consumed; size_t remain; - if (!peer_v4) + if (!peer_v4) { + LOGPPDP(LOGL_ERROR, pdp, "IPCP but no IPv4 type ?!?\n"); return; + } ipcp = pco_elem->data; consumed = (ipcp - &pdp->pco_req.v[0]); remain = sizeof(pdp->pco_req.v) - consumed; ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */ - if (remain < 0 || remain < ipcp_len) + if (remain < 0 || remain < ipcp_len) { + LOGPPDP(LOGL_ERROR, pdp, "Malformed IPCP, ignoring\n"); return; + } /* Three byte T16L header */ msgb_put_u16(resp, 0x8021); /* IPCP */ @@ -608,6 +612,7 @@ const struct apn_ctx *apn, struct pdp_t *pdp) { unsigned int i; + const uint8_t *tail = resp->tail; for (i = 0; i < ARRAY_SIZE(apn->v6.cfg.dns); i++) { const struct in46_addr *i46a = &apn->v6.cfg.dns[i]; @@ -615,12 +620,15 @@ continue; msgb_t16lv_put(resp, PCO_P_DNS_IPv6_ADDR, i46a->len, i46a->v6.s6_addr); } + if (resp->tail == tail) + LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv6 DNS, but APN has none configured\n"); } static void process_pco_element_dns_ipv4(const struct pco_element *pco_elem, struct msgb *resp, const struct apn_ctx *apn, struct pdp_t *pdp) { unsigned int i; + const uint8_t *tail = resp->tail; for (i = 0; i < ARRAY_SIZE(apn->v4.cfg.dns); i++) { const struct in46_addr *i46a = &apn->v4.cfg.dns[i]; @@ -628,12 +636,17 @@ continue; msgb_t16lv_put(resp, PCO_P_DNS_IPv4_ADDR, i46a->len, (uint8_t *)&i46a->v4); } + if (resp->tail == tail) + LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv4 DNS, but APN has none configured\n"); } static void process_pco_element(const struct pco_element *pco_elem, struct msgb *resp, const struct apn_ctx *apn, struct pdp_t *pdp) { - switch (ntohs(pco_elem->protocol_id)) { + uint16_t protocol_id = ntohs(pco_elem->protocol_id); + + LOGPPDP(LOGL_DEBUG, pdp, "PCO Protocol 0x%04x\n", protocol_id); + switch (protocol_id) { case PCO_P_PAP: process_pco_element_pap(pco_elem, resp, apn, pdp); break; @@ -647,6 +660,8 @@ process_pco_element_dns_ipv4(pco_elem, resp, apn, pdp); break; default: + LOGPPDP(LOGL_INFO, pdp, "Unknown/Unimplemented PCO Protocol 0x%04x: %s\n", + protocol_id, osmo_hexdump_nospc(pco_elem->data, pco_elem->length)); break; } } -- To view, visit https://gerrit.osmocom.org/13609 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: I38c2c4178ff4fd795f54638adec63166b1c0838e Gerrit-Change-Number: 13609 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte