- Remove struct ifinfo *iflist. It is no longer used.

- Suppress warnings about increase of alignment requirement.
This commit is contained in:
hrs 2013-08-17 19:23:35 +00:00
parent 06c57264bc
commit a8298dcc37
7 changed files with 14 additions and 17 deletions

View File

@ -50,8 +50,6 @@
static FILE *fp;
extern struct ifinfo *iflist;
static void dump_interface_status(void);
static const char * const ifstatstr[] = {"IDLE", "DELAY", "PROBE", "DOWN", "TENTATIVE"};

View File

@ -61,7 +61,6 @@
#include <ifaddrs.h>
#include "rtsold.h"
extern int rssock;
static int ifsock;
static int get_llflag(const char *);
@ -304,13 +303,13 @@ if_nametosdl(char *name)
lim = buf + len;
for (next = buf; next < lim; next += ifm->ifm_msglen) {
ifm = (struct if_msghdr *)next;
ifm = (struct if_msghdr *)(void *)next;
if (ifm->ifm_type == RTM_IFINFO) {
sa = (struct sockaddr *)(ifm + 1);
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
if ((sa = rti_info[RTAX_IFP]) != NULL) {
if (sa->sa_family == AF_LINK) {
sdl = (struct sockaddr_dl *)sa;
sdl = (struct sockaddr_dl *)(void *)sa;
if (strlen(name) != sdl->sdl_nlen)
continue; /* not same len */
if (strncmp(&sdl->sdl_data[0],
@ -397,7 +396,7 @@ get_llflag(const char *name)
continue;
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
sin6 = (struct sockaddr_in6 *)(void *)ifa->ifa_addr;
if (!IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
continue;

View File

@ -164,7 +164,7 @@ sendprobe(struct in6_addr *addr, struct ifinfo *ifinfo)
cm->cmsg_level = IPPROTO_IPV6;
cm->cmsg_type = IPV6_PKTINFO;
cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
pi = (struct in6_pktinfo *)CMSG_DATA(cm);
pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm);
memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*XXX*/
pi->ipi6_ifindex = ifindex;

View File

@ -103,7 +103,7 @@ rtsock_input(int s)
lim = msg + n;
for (next = msg; next < lim; next += len) {
rtm = (struct rt_msghdr *)next;
rtm = (struct rt_msghdr *)(void *)next;
if (lim - next < lenlim)
break;
len = rtm->rtm_msglen;
@ -138,7 +138,7 @@ static int
rtsock_input_ifannounce(int s __unused, struct rt_msghdr *rtm, char *lim)
{
struct if_announcemsghdr *ifan;
struct ifinfo *ifinfo;
struct ifinfo *ifi;
ifan = (struct if_announcemsghdr *)rtm;
if ((char *)(ifan + 1) > lim)
@ -158,14 +158,14 @@ rtsock_input_ifannounce(int s __unused, struct rt_msghdr *rtm, char *lim)
case IFAN_DEPARTURE:
warnmsg(LOG_WARNING, __func__,
"interface %s removed", ifan->ifan_name);
ifinfo = find_ifinfo(ifan->ifan_index);
if (ifinfo) {
ifi = find_ifinfo(ifan->ifan_index);
if (ifi) {
if (dflag > 1) {
warnmsg(LOG_INFO, __func__,
"bring interface %s to DOWN state",
ifan->ifan_name);
}
ifinfo->state = IFS_DOWN;
ifi->state = IFS_DOWN;
}
break;
}

View File

@ -205,7 +205,7 @@ sendpacket(struct ifinfo *ifi)
cm->cmsg_level = IPPROTO_IPV6;
cm->cmsg_type = IPV6_PKTINFO;
cm->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
pi = (struct in6_pktinfo *)CMSG_DATA(cm);
pi = (struct in6_pktinfo *)(void *)CMSG_DATA(cm);
memset(&pi->ipi6_addr, 0, sizeof(pi->ipi6_addr)); /*XXX*/
pi->ipi6_ifindex = ifi->sdl->sdl_index;
@ -275,13 +275,13 @@ rtsol_input(int s)
if (cm->cmsg_level == IPPROTO_IPV6 &&
cm->cmsg_type == IPV6_PKTINFO &&
cm->cmsg_len == CMSG_LEN(sizeof(struct in6_pktinfo))) {
pi = (struct in6_pktinfo *)(CMSG_DATA(cm));
pi = (struct in6_pktinfo *)(void *)(CMSG_DATA(cm));
ifindex = pi->ipi6_ifindex;
}
if (cm->cmsg_level == IPPROTO_IPV6 &&
cm->cmsg_type == IPV6_HOPLIMIT &&
cm->cmsg_len == CMSG_LEN(sizeof(int)))
hlimp = (int *)CMSG_DATA(cm);
hlimp = (int *)(void *)CMSG_DATA(cm);
}
if (ifindex == 0) {
@ -417,7 +417,7 @@ rtsol_input(int s)
break;
}
addr = (struct in6_addr *)(raoptp + sizeof(*rdnss));
addr = (struct in6_addr *)(void *)(raoptp + sizeof(*rdnss));
while ((char *)addr < (char *)RA_OPT_NEXT_HDR(raoptp)) {
if (inet_ntop(AF_INET6, addr, ntopbuf,
sizeof(ntopbuf)) == NULL) {

View File

@ -67,7 +67,6 @@
#define RTSOL_DUMPFILE "/var/run/rtsold.dump";
#define RTSOL_PIDFILE "/var/run/rtsold.pid";
struct ifinfo *iflist;
struct timespec tm_max;
static int log_upto = 999;
static int fflag = 0;

View File

@ -176,6 +176,7 @@ extern int getinet6sysctl(int);
extern int setinet6sysctl(int, int);
/* rtsol.c */
extern int rssock;
extern int sockopen(void);
extern void sendpacket(struct ifinfo *);
extern void rtsol_input(int);