]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove unneeded '&' when getting a pointer to a nd_ipv4 type
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 31 Jan 2018 13:31:20 +0000 (14:31 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 31 Jan 2018 15:43:50 +0000 (16:43 +0100)
print-isakmp.c
print-nfs.c
print-ospf.c
print-rx.c
print-tcp.c

index b13aff118bd562397984c53a7759cea8f5d128cd..7777b2ab4b80234591a333e61e485165a840a304 100644 (file)
@@ -780,8 +780,10 @@ cookie_record(const cookie_t *in, const u_char *bp2)
        switch (IP_V(ip)) {
        case 4:
                cookiecache[ninitiator].version = 4;
-               UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4, &ip->ip_src, sizeof(nd_ipv4));
-               UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4, &ip->ip_dst, sizeof(nd_ipv4));
+               UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4,
+                                ip->ip_src, sizeof(nd_ipv4));
+               UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4,
+                                ip->ip_dst, sizeof(nd_ipv4));
                break;
        case 6:
                ip6 = (const struct ip6_hdr *)bp2;
@@ -810,10 +812,10 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
                if (cookiecache[i].version != 4)
                        return 0;
                if (initiator) {
-                       if (UNALIGNED_MEMCMP(&ip->ip_src, &cookiecache[i].iaddr.in4, sizeof(nd_ipv4)) == 0)
+                       if (UNALIGNED_MEMCMP(ip->ip_src, &cookiecache[i].iaddr.in4, sizeof(nd_ipv4)) == 0)
                                return 1;
                } else {
-                       if (UNALIGNED_MEMCMP(&ip->ip_src, &cookiecache[i].raddr.in4, sizeof(nd_ipv4)) == 0)
+                       if (UNALIGNED_MEMCMP(ip->ip_src, &cookiecache[i].raddr.in4, sizeof(nd_ipv4)) == 0)
                                return 1;
                }
                break;
index d5f9137b20a0837091c9c36d512cdfcaf581098e..22c36c993b878e4fd4346a509ab0a1d7cc9f9ccc 100644 (file)
@@ -920,8 +920,10 @@ xid_map_enter(netdissect_options *ndo,
        UNALIGNED_MEMCPY(&xmep->xid, &rp->rm_xid, sizeof(xmep->xid));
        if (ip) {
                xmep->ipver = 4;
-               UNALIGNED_MEMCPY(&xmep->client, &ip->ip_src, sizeof(ip->ip_src));
-               UNALIGNED_MEMCPY(&xmep->server, &ip->ip_dst, sizeof(ip->ip_dst));
+               UNALIGNED_MEMCPY(&xmep->client, ip->ip_src,
+                                sizeof(ip->ip_src));
+               UNALIGNED_MEMCPY(&xmep->server, ip->ip_dst,
+                                sizeof(ip->ip_dst));
        }
        else if (ip6) {
                xmep->ipver = 6;
@@ -958,10 +960,10 @@ xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc,
                        goto nextitem;
                switch (xmep->ipver) {
                case 4:
-                       if (UNALIGNED_MEMCMP(&ip->ip_src, &xmep->server,
-                                  sizeof(ip->ip_src)) != 0 ||
-                           UNALIGNED_MEMCMP(&ip->ip_dst, &xmep->client,
-                                  sizeof(ip->ip_dst)) != 0) {
+                       if (UNALIGNED_MEMCMP(ip->ip_src, &xmep->server,
+                                            sizeof(ip->ip_src)) != 0 ||
+                           UNALIGNED_MEMCMP(ip->ip_dst, &xmep->client,
+                                            sizeof(ip->ip_dst)) != 0) {
                                cmp = 0;
                        }
                        break;
index 959df23fbc433683ea8ab1af4eb27d1e7bd339e3..62827ec751a57d269e57540eb3d3ac3196ae1b72 100644 (file)
@@ -692,7 +692,7 @@ ospf_print_lsa(netdissect_options *ndo,
                ND_TCHECK_4(lsap->lsa_un.un_nla.nla_mask);
                ND_PRINT("\n\t    Mask %s\n\t    Connected Routers:",
                    ipaddr_string(ndo, lsap->lsa_un.un_nla.nla_mask));
-               ap = &lsap->lsa_un.un_nla.nla_router[0];
+               ap = lsap->lsa_un.un_nla.nla_router;
                while ((const u_char *)ap < ls_end) {
                        ND_TCHECK_SIZE(ap);
                        ND_PRINT("\n\t      %s", ipaddr_string(ndo, *ap));
index 6e53bdbafccda211cd91e22809cc5be3f243c415..c0ec209f0ce2aeca878a1a2aa5653b35ef694359 100644 (file)
@@ -697,8 +697,8 @@ rx_cache_insert(netdissect_options *ndo,
                rx_cache_next = 0;
 
        rxent->callnum = EXTRACT_BE_U_4(rxh->callNumber);
-       UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t));
-       UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&rxent->client, ip->ip_src, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&rxent->server, ip->ip_dst, sizeof(uint32_t));
        rxent->dport = dport;
        rxent->serviceId = EXTRACT_BE_U_4(rxh->serviceId);
        rxent->opcode = EXTRACT_BE_U_4(bp + sizeof(struct rx_header));
@@ -720,8 +720,8 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
        uint32_t clip;
        uint32_t sip;
 
-       UNALIGNED_MEMCPY(&clip, &ip->ip_dst, sizeof(uint32_t));
-       UNALIGNED_MEMCPY(&sip, &ip->ip_src, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&clip, ip->ip_dst, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&sip, ip->ip_src, sizeof(uint32_t));
 
        /* Start the search where we last left off */
 
index 66579aaba0440a7d56598c32b9b24058ed95b030..6deb97b328eda7e9c10eaac91af49d4ea36e873d 100644 (file)
@@ -318,16 +318,20 @@ tcp_print(netdissect_options *ndo,
                         if (sport > dport)
                                 rev = 1;
                         else if (sport == dport) {
-                                if (UNALIGNED_MEMCMP(&ip->ip_src, &ip->ip_dst, sizeof ip->ip_dst) > 0)
+                                if (UNALIGNED_MEMCMP(ip->ip_src, ip->ip_dst, sizeof ip->ip_dst) > 0)
                                         rev = 1;
                         }
                         if (rev) {
-                                UNALIGNED_MEMCPY(&tha.src, &ip->ip_dst, sizeof ip->ip_dst);
-                                UNALIGNED_MEMCPY(&tha.dst, &ip->ip_src, sizeof ip->ip_src);
+                                UNALIGNED_MEMCPY(&tha.src, ip->ip_dst,
+                                                 sizeof ip->ip_dst);
+                                UNALIGNED_MEMCPY(&tha.dst, ip->ip_src,
+                                                 sizeof ip->ip_src);
                                 tha.port = dport << 16 | sport;
                         } else {
-                                UNALIGNED_MEMCPY(&tha.dst, &ip->ip_dst, sizeof ip->ip_dst);
-                                UNALIGNED_MEMCPY(&tha.src, &ip->ip_src, sizeof ip->ip_src);
+                                UNALIGNED_MEMCPY(&tha.dst, ip->ip_dst,
+                                                 sizeof ip->ip_dst);
+                                UNALIGNED_MEMCPY(&tha.src, ip->ip_src,
+                                                 sizeof ip->ip_src);
                                 tha.port = sport << 16 | dport;
                         }