mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
*: fix 1/4 remaining aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
12ca080a1c
commit
36659fda1f
@ -23,7 +23,7 @@
|
||||
#define IFF_LOWER_UP 0x10000 /* driver signals L1 up*/
|
||||
#endif
|
||||
|
||||
typedef struct filter_t {
|
||||
struct filter_t {
|
||||
char *label;
|
||||
char *flushb;
|
||||
struct rtnl_handle *rth;
|
||||
@ -38,7 +38,8 @@ typedef struct filter_t {
|
||||
smallint up;
|
||||
smallint flushed;
|
||||
inet_prefix pfx;
|
||||
} filter_t;
|
||||
} FIX_ALIASING;
|
||||
typedef struct filter_t filter_t;
|
||||
|
||||
#define G_filter (*(filter_t*)&bb_common_bufsiz1)
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct filter_t {
|
||||
struct filter_t {
|
||||
int tb;
|
||||
smallint flushed;
|
||||
char *flushb;
|
||||
@ -43,7 +43,8 @@ typedef struct filter_t {
|
||||
inet_prefix mdst;
|
||||
inet_prefix rsrc;
|
||||
inet_prefix msrc;
|
||||
} filter_t;
|
||||
} FIX_ALIASING;
|
||||
typedef struct filter_t filter_t;
|
||||
|
||||
#define G_filter (*(filter_t*)&bb_common_bufsiz1)
|
||||
|
||||
|
@ -107,7 +107,6 @@ typedef enum {
|
||||
#define PRINT_NET_CONN_WIDE "%s %6ld %6ld %-51s %-51s %-12s"
|
||||
#define PRINT_NET_CONN_HEADER_WIDE "\nProto Recv-Q Send-Q %-51s %-51s State "
|
||||
|
||||
|
||||
#define PROGNAME_WIDTH 20
|
||||
#define PROGNAME_WIDTH_STR "20"
|
||||
/* PROGNAME_WIDTH chars: 12345678901234567890 */
|
||||
@ -121,7 +120,6 @@ struct prg_node {
|
||||
|
||||
#define PRG_HASH_SIZE 211
|
||||
|
||||
|
||||
struct globals {
|
||||
const char *net_conn_line;
|
||||
smallint flags;
|
||||
@ -311,21 +309,16 @@ static void build_ipv6_addr(char* local_addr, struct sockaddr_in6* localaddr)
|
||||
&in6.s6_addr32[0], &in6.s6_addr32[1],
|
||||
&in6.s6_addr32[2], &in6.s6_addr32[3]);
|
||||
inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6));
|
||||
inet_pton(AF_INET6, addr6, (struct sockaddr *) &localaddr->sin6_addr);
|
||||
inet_pton(AF_INET6, addr6, &localaddr->sin6_addr);
|
||||
|
||||
localaddr->sin6_family = AF_INET6;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
static void build_ipv4_addr(char* local_addr, struct sockaddr_in6* localaddr)
|
||||
#else
|
||||
static void build_ipv4_addr(char* local_addr, struct sockaddr_in* localaddr)
|
||||
#endif
|
||||
{
|
||||
sscanf(local_addr, "%X",
|
||||
&((struct sockaddr_in *) localaddr)->sin_addr.s_addr);
|
||||
((struct sockaddr *) localaddr)->sa_family = AF_INET;
|
||||
sscanf(local_addr, "%X", &localaddr->sin_addr.s_addr);
|
||||
localaddr->sin_family = AF_INET;
|
||||
}
|
||||
|
||||
static const char *get_sname(int port, const char *proto, int numeric)
|
||||
@ -358,11 +351,13 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int
|
||||
|
||||
struct inet_params {
|
||||
int local_port, rem_port, state, uid;
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sin;
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
struct sockaddr_in6 localaddr, remaddr;
|
||||
#else
|
||||
struct sockaddr_in localaddr, remaddr;
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
} localaddr, remaddr;
|
||||
unsigned long rxq, txq, inode;
|
||||
};
|
||||
|
||||
@ -386,12 +381,12 @@ static int scan_inet_proc_line(struct inet_params *param, char *line)
|
||||
|
||||
if (strlen(local_addr) > 8) {
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
build_ipv6_addr(local_addr, ¶m->localaddr);
|
||||
build_ipv6_addr(rem_addr, ¶m->remaddr);
|
||||
build_ipv6_addr(local_addr, ¶m->localaddr.sin6);
|
||||
build_ipv6_addr(rem_addr, ¶m->remaddr.sin6);
|
||||
#endif
|
||||
} else {
|
||||
build_ipv4_addr(local_addr, ¶m->localaddr);
|
||||
build_ipv4_addr(rem_addr, ¶m->remaddr);
|
||||
build_ipv4_addr(local_addr, ¶m->localaddr.sin);
|
||||
build_ipv4_addr(rem_addr, ¶m->remaddr.sin);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -403,10 +398,10 @@ static void print_inet_line(struct inet_params *param,
|
||||
|| (!is_connected && (flags & NETSTAT_LISTENING))
|
||||
) {
|
||||
char *l = ip_port_str(
|
||||
(struct sockaddr *) ¶m->localaddr, param->local_port,
|
||||
¶m->localaddr.sa, param->local_port,
|
||||
proto, flags & NETSTAT_NUMERIC);
|
||||
char *r = ip_port_str(
|
||||
(struct sockaddr *) ¶m->remaddr, param->rem_port,
|
||||
¶m->remaddr.sa, param->rem_port,
|
||||
proto, flags & NETSTAT_NUMERIC);
|
||||
printf(net_conn_line,
|
||||
proto, param->rxq, param->txq, l, r, state_str);
|
||||
@ -432,17 +427,17 @@ static int FAST_FUNC tcp_do_one(char *line)
|
||||
}
|
||||
|
||||
#if ENABLE_FEATURE_IPV6
|
||||
# define notnull(A) ( \
|
||||
( (A.sin6_family == AF_INET6) \
|
||||
&& (A.sin6_addr.s6_addr32[0] | A.sin6_addr.s6_addr32[1] | \
|
||||
A.sin6_addr.s6_addr32[2] | A.sin6_addr.s6_addr32[3]) \
|
||||
) || ( \
|
||||
(A.sin6_family == AF_INET) \
|
||||
&& ((struct sockaddr_in*)&A)->sin_addr.s_addr \
|
||||
) \
|
||||
# define NOT_NULL_ADDR(A) ( \
|
||||
( (A.sa.sa_family == AF_INET6) \
|
||||
&& (A.sin6.sin6_addr.s6_addr32[0] | A.sin6.sin6_addr.s6_addr32[1] | \
|
||||
A.sin6.sin6_addr.s6_addr32[2] | A.sin6.sin6_addr.s6_addr32[3]) \
|
||||
) || ( \
|
||||
(A.sa.sa_family == AF_INET) \
|
||||
&& A.sin.sin_addr.s_addr != 0 \
|
||||
) \
|
||||
)
|
||||
#else
|
||||
# define notnull(A) (A.sin_addr.s_addr)
|
||||
# define NOT_NULL_ADDR(A) (A.sin_addr.s_addr)
|
||||
#endif
|
||||
|
||||
static int FAST_FUNC udp_do_one(char *line)
|
||||
@ -464,7 +459,7 @@ static int FAST_FUNC udp_do_one(char *line)
|
||||
break;
|
||||
}
|
||||
|
||||
have_remaddr = notnull(param.remaddr);
|
||||
have_remaddr = NOT_NULL_ADDR(param.remaddr);
|
||||
print_inet_line(¶m, state_str, "udp", have_remaddr);
|
||||
return 0;
|
||||
}
|
||||
@ -477,7 +472,7 @@ static int FAST_FUNC raw_do_one(char *line)
|
||||
if (scan_inet_proc_line(¶m, line))
|
||||
return 1;
|
||||
|
||||
have_remaddr = notnull(param.remaddr);
|
||||
have_remaddr = NOT_NULL_ADDR(param.remaddr);
|
||||
print_inet_line(¶m, itoa(param.state), "raw", have_remaddr);
|
||||
return 0;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ write_sector(sector_t secno, const void *buf)
|
||||
|
||||
#include "fdisk_aix.c"
|
||||
|
||||
typedef struct {
|
||||
struct sun_partition {
|
||||
unsigned char info[128]; /* Informative text string */
|
||||
unsigned char spare0[14];
|
||||
struct sun_info {
|
||||
@ -651,7 +651,8 @@ typedef struct {
|
||||
} partitions[8];
|
||||
unsigned short magic; /* Magic number */
|
||||
unsigned short csum; /* Label xor'd checksum */
|
||||
} sun_partition;
|
||||
} FIX_ALIASING;
|
||||
typedef struct sun_partition sun_partition;
|
||||
#define sunlabel ((sun_partition *)MBRbuffer)
|
||||
STATIC_OSF void bsd_select(void);
|
||||
STATIC_OSF void xbsd_print_disklabel(int);
|
||||
|
Loading…
Reference in New Issue
Block a user