From: Renato Westphal Date: Fri, 3 Mar 2017 20:50:22 +0000 (-0300) Subject: ldpd: add missing htonl and ntohl in PF_KEY code X-Git-Tag: frr-3.0-branchpoint~12^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F249%2Fhead;p=mirror%2Ffrr.git ldpd: add missing htonl and ntohl in PF_KEY code Signed-off-by: Renato Westphal --- diff --git a/ldpd/pfkey.c b/ldpd/pfkey.c index 29f763e6a6..88a778cccc 100644 --- a/ldpd/pfkey.c +++ b/ldpd/pfkey.c @@ -131,7 +131,7 @@ pfkey_send(int sd, uint8_t satype, uint8_t mtype, uint8_t dir, sa.sadb_sa_exttype = SADB_EXT_SA; sa.sadb_sa_len = sizeof(sa) / 8; sa.sadb_sa_replay = 0; - sa.sadb_sa_spi = spi; + sa.sadb_sa_spi = htonl(spi); sa.sadb_sa_state = SADB_SASTATE_MATURE; break; } @@ -280,7 +280,7 @@ pfkey_read(int sd, struct sadb_msg *h) } static int -pfkey_reply(int sd, uint32_t *spip) +pfkey_reply(int sd, uint32_t *spi) { struct sadb_msg hdr, *msg; struct sadb_ext *ext; @@ -317,7 +317,7 @@ pfkey_reply(int sd, uint32_t *spip) } if (hdr.sadb_msg_type == SADB_GETSPI) { - if (spip == NULL) { + if (spi == NULL) { explicit_bzero(data, len); free(data); return (0); @@ -331,7 +331,7 @@ pfkey_reply(int sd, uint32_t *spip) ext->sadb_ext_len * PFKEY2_CHUNK)) { if (ext->sadb_ext_type == SADB_EXT_SA) { sa = (struct sadb_sa *) ext; - *spip = sa->sadb_sa_spi; + *spi = ntohl(sa->sadb_sa_spi); break; } }