The ipftest(1) is a program that emulates ipf(4) operation and tests packets

against rules.  It definitely doesn't need to know about kernel internals,
such as 'struct ifaddr'.  What it does with ifaddr, is that it only takes
ifa_addr member of it, and treats it as sockaddr, while it is only a pointer
to sockaddr.  Fortunately, sizeof(struct ifaddr) > sizeof(struct sockaddr_in6),
so no problems arise.

Fix that declaring a private struct ifaddr in ipftest(1) and stop including
if_var.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
glebius 2015-02-19 23:14:35 +00:00
parent 39824ae151
commit 896e3f467b
2 changed files with 3 additions and 3 deletions

View File

@ -44,6 +44,9 @@ static int write_output __P((struct ifnet *, struct mbuf *,
# endif
#endif
struct ifaddr {
struct sockaddr_storage ifa_addr;
};
int
ipfattach(softc)

View File

@ -43,9 +43,6 @@ struct file;
#include <sys/socket.h>
#include <net/if.h>
#define _WANT_IFADDR
#include <net/if_var.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>