Skip to content

Commit 0ff0c19

Browse files
committed
ipfilter: Disable ipfs(8) by default
At the moment ipfs(8) is a tool that can be easily abused. Though the concept is sound the implementation needs some work. ipfs(8) should be considered experimental at the moment. This commit also makes ipfs support in the kernel optional. Reviewed by: emaste, glebius MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53787
1 parent d9788ea commit 0ff0c19

File tree

8 files changed

+28
-2
lines changed

8 files changed

+28
-2
lines changed

sbin/ipf/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
.include <src.opts.mk>
2+
13
SUBDIR= libipf .WAIT
2-
SUBDIR+= ipf ipfs ipfstat ipmon ipnat ippool
4+
SUBDIR+= ipf ipfstat ipmon ipnat ippool
5+
.if ${MK_IPFILTER_IPFS} != "no"
6+
SUBDIR+= ipfs
7+
.endif
38
# XXX Temporarily disconnected.
49
# SUBDIR+= ipftest ipresend ipsend
510
SUBDIR_PARALLEL=

share/mk/src.opts.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ __DEFAULT_NO_OPTIONS = \
209209
DTRACE_TESTS \
210210
EXPERIMENTAL \
211211
HESIOD \
212+
IPFILTER_IPFS \
212213
LOADER_VERBOSE \
213214
LOADER_VERIEXEC_PASS_MANIFEST \
214215
LLVM_FULL_DEBUGINFO \

sys/conf/NOTES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ options IPFILTER #ipfilter support
10461046
options IPFILTER_LOG #ipfilter logging
10471047
options IPFILTER_LOOKUP #ipfilter pools
10481048
options IPFILTER_DEFAULT_BLOCK #block all packets by default
1049+
options IPFILTER_IPFS #enable experimental ipfs(8) support
10491050
options IPSTEALTH #support for stealth forwarding
10501051
options PF_DEFAULT_TO_DROP #drop everything by default
10511052
options TCP_BLACKBOX

sys/conf/options

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ IPFILTER opt_ipfilter.h
449449
IPFILTER_DEFAULT_BLOCK opt_ipfilter.h
450450
IPFILTER_LOG opt_ipfilter.h
451451
IPFILTER_LOOKUP opt_ipfilter.h
452+
IPFILTER_IPFS opt_ipfilter.h
452453
IPFIREWALL opt_ipfw.h
453454
IPFIREWALL_DEFAULT_TO_ACCEPT opt_ipfw.h
454455
IPFIREWALL_NAT opt_ipfw.h

sys/modules/ipfilter/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.include <src.opts.mk>
2+
13
.PATH: ${SRCTOP}/sys/netpfil/ipfilter/netinet
24

35
KMOD= ipl
@@ -9,6 +11,11 @@ SRCS+= opt_bpf.h opt_inet6.h opt_kern_tls.h
911

1012
CFLAGS+= -I${SRCTOP}/sys/netpfil/ipfilter
1113
CFLAGS+= -DIPFILTER=1 -DIPFILTER_LKM -DIPFILTER_LOG -DIPFILTER_LOOKUP
14+
15+
.if ${MK_IPFILTER_IPFS} != "no"
16+
CFLAGS+= -DIPFILTER_IPFS
17+
.endif
18+
1219
#
1320
# If you don't want log functionality remove -DIPFILTER_LOG
1421
#

sys/netpfil/ipfilter/netinet/ip_nat.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, caddr_t data, ioctlcmd_t cmd,
13371337
error = ipf_proxy_ioctl(softc, data, cmd, mode, ctx);
13381338
break;
13391339

1340+
#ifdef IPFILTER_IPFS
13401341
case SIOCSTLCK :
13411342
if (!(mode & FWRITE)) {
13421343
IPFERROR(60015);
@@ -1372,6 +1373,7 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, caddr_t data, ioctlcmd_t cmd,
13721373
error = EACCES;
13731374
}
13741375
break;
1376+
#endif /* IPFILTER_IPFS */
13751377

13761378
case SIOCGENITER :
13771379
{
@@ -1679,7 +1681,7 @@ ipf_nat_siocdelnat(ipf_main_softc_t *softc, ipf_nat_softc_t *softn, ipnat_t *n,
16791681
}
16801682
}
16811683

1682-
1684+
#ifdef IPFILTER_IPFS
16831685
/* ------------------------------------------------------------------------ */
16841686
/* Function: ipf_nat_getsz */
16851687
/* Returns: int - 0 == success, != 0 is the error value. */
@@ -2247,6 +2249,7 @@ ipf_nat_putent(ipf_main_softc_t *softc, caddr_t data, int getlock)
22472249
}
22482250
return (error);
22492251
}
2252+
#endif /* IPFILTER_IPFS */
22502253

22512254

22522255
/* ------------------------------------------------------------------------ */

sys/netpfil/ipfilter/netinet/ip_state.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ ipf_state_ioctl(ipf_main_softc_t *softc, caddr_t data, ioctlcmd_t cmd,
709709
IPFOBJ_STATESTAT);
710710
break;
711711

712+
#ifdef IPFILTER_IPFS
712713
/*
713714
* Lock/Unlock the state table. (Locking prevents any changes, which
714715
* means no packets match).
@@ -745,6 +746,7 @@ ipf_state_ioctl(ipf_main_softc_t *softc, caddr_t data, ioctlcmd_t cmd,
745746
}
746747
error = ipf_state_getent(softc, softs, data);
747748
break;
749+
#endif /* IPFILTER_IPFS */
748750

749751
case SIOCGENITER :
750752
{
@@ -801,6 +803,7 @@ ipf_state_ioctl(ipf_main_softc_t *softc, caddr_t data, ioctlcmd_t cmd,
801803
}
802804

803805

806+
#ifdef IPFILTER_IPFS
804807
/* ------------------------------------------------------------------------ */
805808
/* Function: ipf_state_getent */
806809
/* Returns: int - 0 == success, != 0 == failure */
@@ -1005,6 +1008,7 @@ ipf_state_putent(ipf_main_softc_t *softc, ipf_state_softc_t *softs,
10051008

10061009
return (error);
10071010
}
1011+
#endif /* IPFILTER_IPFS */
10081012

10091013

10101014
/* ------------------------------------------------------------------------ */

tools/build/mk/OptionalObsoleteFiles.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,10 @@ OLD_FILES+=usr/share/man/man8/ipnat.8.gz
26272627
OLD_FILES+=usr/share/man/man8/ippool.8.gz
26282628
.endif
26292629

2630+
.if ${MK_IPFILTER_IPFS} == no
2631+
OLD_FILES+=sbin/ipfs
2632+
.endif
2633+
26302634
.if ${MK_IPFW} == no
26312635
OLD_FILES+=etc/rc.d/ipfw
26322636
OLD_FILES+=etc/rc.d/natd

0 commit comments

Comments
 (0)