Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2015 23:14:36 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279029 - head/contrib/ipfilter
Message-ID:  <201502192314.t1JNEaxn060505@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Feb 19 23:14:35 2015
New Revision: 279029
URL: https://svnweb.freebsd.org/changeset/base/279029

Log:
  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.

Modified:
  head/contrib/ipfilter/ip_fil.c
  head/contrib/ipfilter/ipf.h

Modified: head/contrib/ipfilter/ip_fil.c
==============================================================================
--- head/contrib/ipfilter/ip_fil.c	Thu Feb 19 22:42:33 2015	(r279028)
+++ head/contrib/ipfilter/ip_fil.c	Thu Feb 19 23:14:35 2015	(r279029)
@@ -44,6 +44,9 @@ static int	write_output __P((struct ifne
 # endif
 #endif
 
+struct ifaddr {
+	struct sockaddr_storage ifa_addr;
+};
 
 int
 ipfattach(softc)

Modified: head/contrib/ipfilter/ipf.h
==============================================================================
--- head/contrib/ipfilter/ipf.h	Thu Feb 19 22:42:33 2015	(r279028)
+++ head/contrib/ipfilter/ipf.h	Thu Feb 19 23:14:35 2015	(r279029)
@@ -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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502192314.t1JNEaxn060505>