summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2013-06-16 23:25:16 +0200
committerRalf Baechle <ralf@linux-mips.org>2013-06-16 23:25:16 +0200
commita592305fa91c43607db20a672903d971f465972b (patch)
treeab74d1eee1b137f1c918d57acb821a55754fc3d2
parent890a82fe2b717702edaaabf9aba2e90497a23927 (diff)
ax25ipd: Fix metric butload of type aliasing bugs.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--ax25ipd/routing.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ax25ipd/routing.c b/ax25ipd/routing.c
index 8519b0c..3107065 100644
--- a/ax25ipd/routing.c
+++ b/ax25ipd/routing.c
@@ -18,7 +18,10 @@
struct route_table_entry {
unsigned char callsign[7]; /* the callsign and ssid */
unsigned char padcall; /* always set to zero */
- unsigned char ip_addr[4]; /* the IP address */
+ union {
+ unsigned char ip_addr[4]; /* the IP address */
+ struct in_addr ip_addr_in;
+ };
unsigned short udp_port; /* the port number if udp */
unsigned char pad1;
unsigned char pad2;
@@ -94,7 +97,7 @@ void route_add(unsigned char *ip, unsigned char *call, int udpport,
/* Log this entry ... */
LOGL4("added route: %s %s %s %d %d\n",
call_to_a(rn->callsign),
- (char *) inet_ntoa(*(struct in_addr *) rn->ip_addr),
+ (char *) inet_ntoa(rn->ip_addr_in),
rn->udp_port ? "udp" : "ip", ntohs(rn->udp_port), flags);
return;
@@ -161,8 +164,7 @@ unsigned char *call_to_ip(unsigned char *call)
while (rp) {
if (addrmatch(mycall, rp->callsign)) {
LOGL4("found ip addr %s\n",
- (char *) inet_ntoa(*(struct in_addr *)
- rp->ip_addr));
+ (char *) inet_ntoa(rp->ip_addr_in));
return rp->ip_addr;
}
rp = rp->next;
@@ -174,8 +176,7 @@ unsigned char *call_to_ip(unsigned char *call)
*/
if (default_route) {
LOGL4("failed, using default ip addr %s\n",
- (char *) inet_ntoa(*(struct in_addr *)
- default_route->ip_addr));
+ (char *) inet_ntoa(default_route->ip_addr_in));
return default_route->ip_addr;
}
@@ -244,7 +245,7 @@ void dump_routes(void)
while (rp) {
LOGL1(" %s\t%s\t%s\t%d\t%d\n",
call_to_a(rp->callsign),
- (char *) inet_ntoa(*(struct in_addr *) rp->ip_addr),
+ (char *) inet_ntoa(rp->ip_addr_in),
rp->udp_port ? "udp" : "ip",
ntohs(rp->udp_port), rp->flags);
rp = rp->next;