]> git.puffer.fish Git - mirror/frr.git/commitdiff
ldpd: add missing htonl and ntohl in PF_KEY code 249/head
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 3 Mar 2017 20:50:22 +0000 (17:50 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 3 Mar 2017 20:50:22 +0000 (17:50 -0300)
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/pfkey.c

index 29f763e6a620bda546a6b85e35af0a98d836148e..88a778cccca7de604d798a253bc682b8cf9593c3 100644 (file)
@@ -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;
                        }
                }