{"action":"created","issue":{"url":"https://api.github.com/repos/openwrt/openwrt/issues/1017","repository_url":"https://api.github.com/repos/openwrt/openwrt","labels_url":"https://api.github.com/repos/openwrt/openwrt/issues/1017/labels{/name}","comments_url":"https://api.github.com/repos/openwrt/openwrt/issues/1017/comments","events_url":"https://api.github.com/repos/openwrt/openwrt/issues/1017/events","html_url":"https://github.com/openwrt/openwrt/pull/1017","id":330012859,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMTI1Mjgz","number":1017,"title":"udhcpc: no MSG_DONTROUTE when sending packet","user":{"login":"adiov","id":7467822,"node_id":"MDQ6VXNlcjc0Njc4MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/7467822?v=4","gravatar_id":"","url":"https://api.github.com/users/adiov","html_url":"https://github.com/adiov","followers_url":"https://api.github.com/users/adiov/followers","following_url":"https://api.github.com/users/adiov/following{/other_user}","gists_url":"https://api.github.com/users/adiov/gists{/gist_id}","starred_url":"https://api.github.com/users/adiov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adiov/subscriptions","organizations_url":"https://api.github.com/users/adiov/orgs","repos_url":"https://api.github.com/users/adiov/repos","events_url":"https://api.github.com/users/adiov/events{/privacy}","received_events_url":"https://api.github.com/users/adiov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-06T20:04:53Z","updated_at":"2018-06-06T20:10:40Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/openwrt/openwrt/pulls/1017","html_url":"https://github.com/openwrt/openwrt/pull/1017","diff_url":"https://github.com/openwrt/openwrt/pull/1017.diff","patch_url":"https://github.com/openwrt/openwrt/pull/1017.patch"},"body":"**TL;DR** Don't set `MSG_DONTROUTE` when sending packets, otherwise it forces the client into non-compliant behaviour that is rejected by properly configured servers, thus creating unnecessary interruptions and connection breakages.\r\n\r\nThis patch reverts a [change made in Sep 2017 which introduced `MSG_DONTROUTE` flag](http://lists.busybox.net/pipermail/busybox-cvs/2017-September/037402.html) to prevent udhcpc from reaching out to servers on a different subnet. That change violates [RFC2131 ](https://tools.ietf.org/html/rfc2131)by forcing fully configured clients, who got their configurations through an offer relayed by a DHCP relay, from renewing through a unicast request directly to the DHCP server, resulting in the client resorting to boradcasting lease extension requests instead of unicasting them, further breaking [RFC2131](https://tools.ietf.org/html/rfc2131).\r\n\r\nThe problem with `MSG_DONTROUTE` appears when talking to a properly configured DHCP server that rejects non-compliant requests. Such server will reject lease extension attempts sent via broadcast rather than unicast, as is the case with Finnish ISPs Telia and DNA as well as Estonian ISP Starman. Once the lease expires without renewal, udhcpc enters init mode, taking down the interfaces with it, and thus causing interruption on every lease expiry. On some ISPs (such as the ones mentioned above) that can be once every 10-20 minutes. The interruptions appear in the logs as such:\r\n\r\n\r\n```\r\nudhcpc: sending renew to x.x.x.x\r\nudhcpc: send: Network unreachable\r\nudhcpc: sending renew to 0.0.0.0\r\nudhcpc: sending renew to 0.0.0.0\r\n...\r\nudhcpc: lease lost, entering init state\r\nInterface 'wan' has lost the connection\r\nInterface 'wan' is now down\r\nNetwork alias 'eth0' link is down\r\nudhcpc: sending select for y.y.y.y\r\nudhcpc: lease of y.y.y.y obtained, lease time 1200\r\nNetwork alias 'eth0' link is up\r\nInterface 'wan' is now up\r\n```\r\nThis keeps repeating every lease period, breaking VPN connections, SSH sessions, etc.\r\n\r\nDuring lease extension, a fully configured client should be able to [reach out to the server from which it received the lease for extension](https://www.netmanias.com/en/post/techdocs/6000/dhcp-network-protocol/understanding-dhcp-relay-agents), regardless in which network it is; that's up to the gateway to find. This patch ensures that.\r\n\r\n**P.S.** I've made the change locally, built it, and have been testing it on my Archer C7 v2 for quite a while. This part of the logs from half an hour ago shows it's working as expected without interruption:\r\n```\r\nWed Jun  6 22:39:07 2018 daemon.notice netifd: wan (1299): udhcpc: sending renew to x.x.x.x\r\nWed Jun  6 22:39:07 2018 daemon.notice netifd: wan (1299): udhcpc: lease of y.y.y.y obtained, lease time 1200\r\nWed Jun  6 22:49:07 2018 daemon.notice netifd: wan (1299): udhcpc: sending renew to x.x.x.x\r\nWed Jun  6 22:49:07 2018 daemon.notice netifd: wan (1299): udhcpc: lease of y.y.y.y obtained, lease time 1200\r\nWed Jun  6 22:59:07 2018 daemon.notice netifd: wan (1299): udhcpc: sending renew to x.x.x.x\r\nWed Jun  6 22:59:07 2018 daemon.notice netifd: wan (1299): udhcpc: lease of y.y.y.y obtained, lease time 1200\r\n```"},"comment":{"url":"https://api.github.com/repos/openwrt/openwrt/issues/comments/395197780","html_url":"https://github.com/openwrt/openwrt/pull/1017#issuecomment-395197780","issue_url":"https://api.github.com/repos/openwrt/openwrt/issues/1017","id":395197780,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTE5Nzc4MA==","user":{"login":"jow-","id":2528802,"node_id":"MDQ6VXNlcjI1Mjg4MDI=","avatar_url":"https://avatars2.githubusercontent.com/u/2528802?v=4","gravatar_id":"","url":"https://api.github.com/users/jow-","html_url":"https://github.com/jow-","followers_url":"https://api.github.com/users/jow-/followers","following_url":"https://api.github.com/users/jow-/following{/other_user}","gists_url":"https://api.github.com/users/jow-/gists{/gist_id}","starred_url":"https://api.github.com/users/jow-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jow-/subscriptions","organizations_url":"https://api.github.com/users/jow-/orgs","repos_url":"https://api.github.com/users/jow-/repos","events_url":"https://api.github.com/users/jow-/events{/privacy}","received_events_url":"https://api.github.com/users/jow-/received_events","type":"User","site_admin":false},"created_at":"2018-06-06T20:10:40Z","updated_at":"2018-06-06T20:10:40Z","author_association":"CONTRIBUTOR","body":"Impressive work on tracking this down! LGTM. Did you send this upstream by any chance? I think the busybox authors should be made aware of this problem.\r\n\r\ncc @dedeckeh "}}
{"actor":{"display_login":"jow-"}}