freebsd-skq/sbin
ae 749be37c28 Introduce the concept of IPsec security policies scope.
Currently are defined three scopes: global, ifnet, and pcb.
Generic security policies that IKE daemon can add via PF_KEY interface
or an administrator creates with setkey(8) utility have GLOBAL scope.
Such policies can be applied by the kernel to outgoing packets and checked
agains inbound packets after IPsec processing.
Security policies created by if_ipsec(4) interfaces have IFNET scope.
Such policies are applied to packets that are passed through if_ipsec(4)
interface.
And security policies created by application using setsockopt()
IP_IPSEC_POLICY option have PCB scope. Such policies are applied to
packets related to specific socket. Currently there is no way to list
PCB policies via setkey(8) utility.

Modify setkey(8) and libipsec(3) to be able distinguish the scope of
security policies in the `setkey -DP` listing. Add two optional flags:
'-t' to list only policies related to virtual *tunneling* interfaces,
i.e. policies with IFNET scope, and '-g' to list only policies with GLOBAL
scope. By default policies from all scopes are listed.

To implement this PF_KEY's sadb_x_policy structure was modified.
sadb_x_policy_reserved field is used to pass the policy scope from the
kernel to userland. SADB_SPDDUMP message extended to support filtering
by scope: sadb_msg_satype field is used to specify bit mask of requested
scopes.

For IFNET policies the sadb_x_policy_priority field of struct sadb_x_policy
is used to pass if_ipsec's interface if_index to the userland. For GLOBAL
policies sadb_x_policy_priority is used only to manage order of security
policies in the SPDB. For IFNET policies it is not used, so it can be used
to keep if_index.

After this change the output of `setkey -DP` now looks like:
# setkey -DPt
0.0.0.0/0[any] 0.0.0.0/0[any] any
	in ipsec
	esp/tunnel/87.250.242.144-87.250.242.145/unique:145
	spid=7 seq=3 pid=58025 scope=ifnet ifname=ipsec0
	refcnt=1
# setkey -DPg
::/0 ::/0 icmp6 135,0
	out none
	spid=5 seq=1 pid=872 scope=global
	refcnt=1

No objection from:	#network
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D9805
2017-03-07 00:13:53 +00:00
..
adjkerntz
atm sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
badsect Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
bsdlabel sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
camcontrol Add task attribute support to camcontrol(8). 2017-02-17 20:04:22 +00:00
ccdconfig
clri Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
comcontrol
conscontrol
ddb
decryptcore sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
devd Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
devfs
dhclient sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
dmesg Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
dump Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
dumpfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
dumpon Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
etherswitchcfg sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
fdisk sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
ffsinfo sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
fsck Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
fsck_ffs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
fsck_msdosfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
fsdb sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
fsirand prefix UFS symbols with UFS_ to reduce namespace pollution 2017-02-15 19:50:26 +00:00
gbde sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
geom sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
ggate sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
growfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
gvinum sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
hastctl sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
hastd Switch hastctl and hastd to libmd instead of openssl for sha256 2017-02-04 06:12:48 +00:00
ifconfig Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
init sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
ipf sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
ipfw Fix a bug in r272840; given that the optlen parameter of setsockopt(2) 2016-12-28 23:34:28 +00:00
iscontrol sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
kldconfig
kldload Fix the last case when kldload(8) wasn't printing the name of the module 2017-02-18 18:57:29 +00:00
kldstat
kldunload
ldconfig sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
md5 Fix date. 2017-03-02 14:50:01 +00:00
mdconfig Make mdconfig(8) not segfault when the kernel returns garbage data. 2017-02-19 16:08:58 +00:00
mdmfs
mknod Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
mksnap_ffs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
mount_cd9660 sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_fusefs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_msdosfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_nfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_nullfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_udf sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
mount_unionfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
nandfs
natd
newfs sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
newfs_msdos
newfs_nandfs newfs_nandfs: Fix unaligned pointer warning 2017-03-04 16:59:55 +00:00
nfsiod Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
nos-tun
nvmecontrol sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
pfctl sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
pflogd sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
ping Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
ping6 Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
quotacheck sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
rcorder Add rcorder-visualize.sh, which generates graphviz from rc.d scripts 2016-12-06 15:49:39 +00:00
reboot Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
recoverdisk
resolvconf sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
restore sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
route Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
routed Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
rtsol sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
savecore Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sconfig
setkey Introduce the concept of IPsec security policies scope. 2017-03-07 00:13:53 +00:00
shutdown Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
spppcontrol
sunlabel sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
swapon Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
sysctl Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
tests
tunefs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
umount sbin: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:33:01 +00:00
zfsbootcfg
Makefile Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
Makefile.amd64
Makefile.arm
Makefile.i386
Makefile.inc
Makefile.mips
Makefile.sparc64