zcip: fix unaligned trap on ARM
authorDenis Vlasenko <vda.linux@googlemail.com>
Thu, 27 Sep 2007 11:15:42 +0000 (11:15 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Thu, 27 Sep 2007 11:15:42 +0000 (11:15 -0000)
networking/zcip.c

index 63846ebeffdda7c32b524c9f0a658729a0e13193..62350c640d7872ce3cab58d5013d9ece1d707635 100644 (file)
@@ -160,7 +160,8 @@ int zcip_main(int argc, char **argv);
 int zcip_main(int argc, char **argv)
 {
        int state = PROBE;
-       struct ether_addr eth_addr;
+       /* Prevent unaligned traps for ARM (see srand() below) */
+       struct ether_addr eth_addr __attribute__(( aligned(sizeof(unsigned)) ));
        const char *why;
        int fd;
        char *r_opt;
@@ -252,7 +253,7 @@ int zcip_main(int argc, char **argv)
        // the hardware address or else the last address we used.
        // NOTE: the sequence of addresses we try changes only
        // depending on when we detect conflicts.
-       srand(*(unsigned*)&ifr.ifr_hwaddr.sa_data);
+       srand(*(unsigned*)&eth_addr);
        if (ip.s_addr == 0)
                pick(&ip);