diff options
author | Paul Mackerras <paulus@ozlabs.org> | 2022-09-09 12:07:20 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 12:07:20 +1000 |
commit | 35198adc7f3c1f0c1e3437f983e7f3ac96477997 (patch) | |
tree | f2eb1c5d1688f0f673fbdfcbf345e1eaaba5afcb | |
parent | a14ede90df712b4a0fed82b9a66a81c56e1e97a9 (diff) | |
parent | 089687fbcc6524809ae9f4b2f8145fe3c2a91147 (diff) | |
download | ppp-35198adc7f3c1f0c1e3437f983e7f3ac96477997.tar.gz |
Merge pull request #366 from pali/rtnetlink-register
pppd: Retry registering interface when on rtnetlink -EBUSY error
-rw-r--r-- | pppd/sys-linux.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index dc3b4d6..7beb977 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -864,7 +864,14 @@ static int make_ppp_unit_rtnetlink(void) nlreq.ifli.ifid.ifdata[0].rta.rta_type = IFLA_PPP_DEV_FD; nlreq.ifli.ifid.ifdata[0].ppp.ppp_dev_fd = ppp_dev_fd; - resp = rtnetlink_msg("RTM_NEWLINK/NLM_F_CREATE", NULL, &nlreq, sizeof(nlreq), NULL, NULL, 0); + /* + * See kernel function ppp_nl_newlink(), which may return -EBUSY to prevent + * possible deadlock in kernel and ask userspace to retry request again. + */ + do { + resp = rtnetlink_msg("RTM_NEWLINK/NLM_F_CREATE", NULL, &nlreq, sizeof(nlreq), NULL, NULL, 0); + } while (resp == -EBUSY); + if (resp) { /* * Linux kernel versions prior to 4.7 do not support creating ppp |