Bug #2403
Charon doesn't detect interface up event of a renamed interface (and charon.interfaces_use is set)
Start date:
14.08.2017
Due date:
Estimated time:
Affected version:
5.5.3
Resolution:
Fixed
Description
I am using strongswan on a linux host that is using pppoe on a wan interface (interface name is pppoe-wan). I have also set
interfaces_use=pppoe-wanin charon.conf. If the pppoe connection is dropped for one reason or another, charon correctly detects it and deactivates and deletes interface and its address:
2017-08-12T11:52:01.384013+02:00 swan pppd[14026]: Terminating on signal 15 2017-08-12T11:52:01.384155+02:00 swan pppd[14026]: Connect time 1238.5 minutes. 2017-08-12T11:52:01.384204+02:00 swan pppd[14026]: Sent 3975626 bytes, received 1742734 bytes. 2017-08-12T11:52:01.385009+02:00 swan charon: 01[KNL] interface pppoe-wan deactivated 2017-08-12T11:52:01.391010+02:00 swan charon: 08[KNL] 10.201.0.209 disappeared from pppoe-wan 2017-08-12T11:52:01.398327+02:00 swan pppd[14026]: Connection terminated. 2017-08-12T11:52:01.399265+02:00 swan charon: 13[KNL] interface pppoe-wan deleted 2017-08-12T11:52:01.445182+02:00 swan pppd[14026]: Sent PADT 2017-08-12T11:52:01.465524+02:00 swan pppd[14026]: Exit.
However later, when the connection is reestablished charon doesn't detect it and IKE communication is not reestablised:
2017-08-12T11:52:39.536333+02:00 swan pppd[3315]: Plugin rp-pppoe.so loaded. 2017-08-12T11:52:39.536550+02:00 swan pppd[3315]: RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7 2017-08-12T11:52:39.653610+02:00 swan pppd[3315]: pppd 2.4.7 started by root, uid 0 2017-08-12T11:52:44.696467+02:00 swan pppd[3315]: PPP session is 3 2017-08-12T11:52:44.696552+02:00 swan pppd[3315]: Connected to 6c:3b:7e:62:a9:dc via interface eth0 2017-08-12T11:52:44.714735+02:00 swan kernel: [79025.853112] pppoe-wan: renamed from ppp0 2017-08-12T11:52:44.745002+02:00 swan pppd[3315]: Using interface pppoe-wan 2017-08-12T11:52:44.745224+02:00 swan pppd[3315]: Connect: pppoe-wan <--> eth0 2017-08-12T11:52:44.856800+02:00 swan pppd[3315]: CHAP authentication succeeded: Welcome. 2017-08-12T11:52:44.856867+02:00 swan pppd[3315]: CHAP authentication succeeded 2017-08-12T11:52:44.856913+02:00 swan pppd[3315]: peer from calling number 6C:3B:6B:62:A9:DC authorized 2017-08-12T11:52:44.884029+02:00 swan pppd[3315]: local IP address 10.201.0.209 2017-08-12T11:52:44.884087+02:00 swan pppd[3315]: remote IP address 10.201.0.210
This happens because kernel_netlink first receives RTM_NEWLINK message for ppp0 interface and since it is not in a charon.interfaces_use list marks it as not usable. Later RTM_NEWLINK messages with a new/renamed name (pppoe-wan) are ignored as interface already exists in ifaces list (but is marked as not usable).
The solution is to set usable flag in each RTM_NEWLINK message processing:
--- a/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c
@@ -1192,6 +1192,8 @@
}
strncpy(entry->ifname, name, IFNAMSIZ);
entry->ifname[IFNAMSIZ-1] = '\0';
+ if (!entry->usable)
+ entry->usable = charon->kernel->is_interface_usable(charon->kernel, name);
if (event && entry->usable)
{
if (!(entry->flags & IFF_UP) && (msg->ifi_flags & IFF_UP))
After applying the patch, charon correctly detects interface up event:
2017-08-12T22:23:24.662697+02:00 swan pppd[4022]: Plugin rp-pppoe.so loaded. 2017-08-12T22:23:24.662928+02:00 swan pppd[4022]: RP-PPPoE plugin version 3.8p compiled against pppd 2.4.7 2017-08-12T22:23:24.768112+02:00 swan pppd[4022]: pppd 2.4.7 started by root, uid 0 2017-08-12T22:23:29.796954+02:00 swan pppd[4022]: PPP session is 41 2017-08-12T22:23:29.797044+02:00 swan pppd[4022]: Connected to 6c:3b:7e:62:a9:dc via interface eth0 2017-08-12T22:23:29.819532+02:00 swan kernel: [ 320.251407] pppoe-wan: renamed from ppp0 2017-08-12T22:23:29.850067+02:00 swan pppd[4022]: Using interface pppoe-wan 2017-08-12T22:23:29.850283+02:00 swan pppd[4022]: Connect: pppoe-wan <--> eth0 2017-08-12T22:23:29.958745+02:00 swan pppd[4022]: CHAP authentication succeeded: Welcome. 2017-08-12T22:23:29.958822+02:00 swan pppd[4022]: CHAP authentication succeeded 2017-08-12T22:23:29.958871+02:00 swan pppd[4022]: peer from calling number 6C:3B:6B:62:A9:DC authorized 2017-08-12T22:23:29.983180+02:00 swan pppd[4022]: local IP address 10.201.0.209 2017-08-12T22:23:29.983641+02:00 swan pppd[4022]: remote IP address 10.201.0.210 2017-08-12T22:23:29.983699+02:00 swan charon: 13[KNL] 10.201.0.209 appeared on pppoe-wan 2017-08-12T22:23:29.984411+02:00 swan charon: 12[KNL] 10.201.0.209 disappeared from pppoe-wan 2017-08-12T22:23:29.984992+02:00 swan charon: 14[KNL] 10.201.0.209 appeared on pppoe-wan 2017-08-12T22:23:29.985683+02:00 swan charon: 04[KNL] interface pppoe-wan activated
History
#1 Updated by Tobias Brunner about 8 years ago
- Category set to kernel-interface
- Status changed from New to Feedback
- Assignee set to Tobias Brunner
- Target version set to 5.6.1
Thanks for the detailed report. Makes sense, I've pushed a fix to the 2403-kernel-netlink-iface-rename branch.
#2 Updated by Luka Logar about 8 years ago
The patch is working as expected. I guess, you can mark this bug fixed/closed...
#3 Updated by Tobias Brunner about 8 years ago
- Status changed from Feedback to Closed
- Resolution set to Fixed
Applied to master.