osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/42942?usp=email )


Change subject: Add missing const for struct hostent *hostent
......................................................................

Add missing const for struct hostent *hostent

The hostent parameter is supposed to be const. This is being enforced in
c-ares 1.34.7, which is why osmo-sgsn currently fails to build in debian
unstable. The c-ares developers are preparing a new release that reverts
this change to avoid breakage with other users of libc-ares, and only
document that this should basically be const. But let's use the API as
intended so the compiler knows that osmo-sgsn is not supposed to modify
the hostent parameter.

Fix for:

  sgsn_ares.c:141:63: error: passing argument 4 of 'ares_gethostbyname' from 
incompatible pointer type [-Wincompatible-pointer-types]
    141 |         ares_gethostbyname(sgsn->ares_channel, name, AF_INET, 
ares_cb, cb_data);
        |                                                               ^~~~~~~
        |                                                               |
        |                                                               void 
(*)(void *, int,  int,  struct hostent *)
  /usr/include/ares.h:881:22: note: expected 'ares_host_callback' {aka 'void 
(*)(void *, int,  int,  const struct hostent *)'} but argument is of type 'void 
(*)(void *, int,  int,  struct hostent *)'

Related: https://github.com/c-ares/c-ares/pull/1060
Related: https://github.com/c-ares/c-ares/pull/1244
Change-Id: Ibe3debc5d3b7af5883001960c40efb296692f93d
---
M src/gprs/sgsn_ares.c
M src/gtphub/gtphub_ares.c
M src/sgsn/gprs_sm.c
3 files changed, 3 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/42/42942/1

diff --git a/src/gprs/sgsn_ares.c b/src/gprs/sgsn_ares.c
index 81ab835..e13a911 100644
--- a/src/gprs/sgsn_ares.c
+++ b/src/gprs/sgsn_ares.c
@@ -35,7 +35,7 @@
 };

 static void osmo_ares_reschedule(struct sgsn_instance *sgsn);
-static void ares_cb(void *_arg, int status, int timeouts, struct hostent 
*hostent)
+static void ares_cb(void *_arg, int status, int timeouts, const struct hostent 
*hostent)
 {
        struct cares_cb_data *arg = _arg;

diff --git a/src/gtphub/gtphub_ares.c b/src/gtphub/gtphub_ares.c
index 774563d..00e590a 100644
--- a/src/gtphub/gtphub_ares.c
+++ b/src/gtphub/gtphub_ares.c
@@ -64,8 +64,7 @@

 static int start_ares_query(struct ggsn_lookup *lookup);

-static void ggsn_lookup_cb(void *arg, int status, int timeouts,
-                          struct hostent *hostent)
+static void ggsn_lookup_cb(void *arg, int status, int timeouts, const struct 
hostent *hostent)
 {
        struct ggsn_lookup *lookup = arg;
        LOGP(DGTPHUB, LOGL_NOTICE, "ggsn_lookup_cb(%p / %p)", lookup,
diff --git a/src/sgsn/gprs_sm.c b/src/sgsn/gprs_sm.c
index acb1579..15c8de6 100644
--- a/src/sgsn/gprs_sm.c
+++ b/src/sgsn/gprs_sm.c
@@ -337,7 +337,7 @@
        return 0;
 }

-static void ggsn_lookup_cb(void *arg, int status, int timeouts, struct hostent 
*hostent)
+static void ggsn_lookup_cb(void *arg, int status, int timeouts, const struct 
hostent *hostent)
 {
        struct sgsn_ggsn_ctx *ggsn;
        struct sgsn_ggsn_lookup *lookup = arg;

--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/42942?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ibe3debc5d3b7af5883001960c40efb296692f93d
Gerrit-Change-Number: 42942
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to