Bug 262718 - ipsec.conf failing at boot time
Summary: ipsec.conf failing at boot time
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-22 14:37 UTC by Dirk Meyer
Modified: 2024-10-28 21:34 UTC (History)
3 users (show)

See Also:


Attachments
Suggested patch (268 bytes, patch)
2022-03-22 14:37 UTC, Dirk Meyer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Meyer freebsd_committer freebsd_triage 2022-03-22 14:37:00 UTC
Created attachment 232630 [details]
Suggested patch

Setup:
I run BGP with md5 passwords, using setkey and ipsec.conf.
With FreeBSD-13 this configuration fail to work.


from logfile:
kernel: Feeding entropy: .
kernel: Installing ipsec manual keys/policies.
kernel: The result of line 1: Invalid argument.
kernel: The result of line 2: Invalid argument.
kernel: The result of line 3: Invalid argument.
kernel: The result of line 4: Invalid argument.
kernel: Loading kernel modules:

/etc/ipsec.conf:
add 185.XXX.XXX.15 185.XXX.XXX.130 tcp 0x1000 -A tcp-md5 "password";
add 185.XXX.XXX.130 185.XXX.XXX.15 tcp 0x1000 -A tcp-md5 "password";
add 185.XXX.XXX.15 185.XXX.XXX.129 tcp 0x1000 -A tcp-md5 "password";
add 185.XXX.XXX.129 185.XXX.XXX.15 tcp 0x1000 -A tcp-md5 "password";

/etc/rc.conf:
ipsec_file="/etc/ipsec.conf"
ipsec_enable="YES"
kld_list="netgraph tcpmd5 ng_ether ng_pppoe ng_socket ng_mppc ng_ppp ng_tee ng_tcpmss"

# service -l | egrep 'ipsec|kld'
ipsec
kld
kldxref

Workaround after reboot I run:
# /etc/rc.d/ipsec start

Suggested fix:
Change the Starting order.

Patching /etc/rc.d/ipsec solves the problem:

# rcorder /etc/rc.d/* /usr/local/etc/rc.d/* | egrep 'ipsec|kld'
/etc/rc.d/kldxref
/etc/rc.d/kld
/etc/rc.d/ipsec


start ipsec after
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2022-03-24 17:20:28 UTC
Seems reasonable.  We already set required_modules=ipsec, but that doesn't seem like the right approach for tcp-md5...?