-Please make sure that the issue subject starts with `<package-name>: ` so that it's easily identifiable.
+Please make sure that the issue subject starts with `<package-name>: `
-This repo here is ONLY for packages maintained in this repo. For base packages residing in the same repo as the build system and maintained by core devs, please consider opening tickets there for more timely responses
+This repo here is only for packages maintained in this repo. For base packages residing in the same repo as the build system and maintained by core devs, please consider opening tickets there for more timely responses
- - OpenWrt: https://dev.openwrt.org/newticket
- - LEDE: https://bugs.lede-project.org/
+ - OpenWrt base system: https://bugs.openwrt.org
- Most LuCI packages: https://github.com/openwrt/luci/issues
-Thanks for your contribution
-Please remove this text (before ---) and fill the following template
--------------------------------
+# Issue template (remove lines from top till here)
-Maintainer: @<github-user> (find it by checking history of the package Makefile)
-Environment: (put here arch, model, OpenWRT/LEDE version)
+Maintainer: @\<github-user> (find it by checking history of the package Makefile)
+Environment: (put here arch, model, OpenWrt version)
Description:
-Please double check that your commits:
-- all start with "<package name>: "
-- all contain signed-off-by
-- are linked to your github account (you see your logo in front of them)
-
-Please also read https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md
-
-Thanks for your contribution
-Please remove this text (before ---) and fill the following template
--------------------------------
-
-Maintainer: me / @<github-user>
-Compile tested: (put here arch, model, OpenWRT/LEDE version)
-Run tested: (put here arch, model, OpenWRT/LEDE version, tests done)
+Maintainer: me / @\<github-user> (find it by checking history of the package Makefile)
+Compile tested: (put here arch, model, OpenWrt version)
+Run tested: (put here arch, model, OpenWrt version, tests done)
Description:
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Comment: LEDE GnuPG key for unattended build jobs
+
+mQINBFeXZ7wBEAC3QZ+jhWrdj2XW9AdZpZrgHETZCW7lXxI3pJ2kS4UXNq+40KR2
+GJOdsXDnLb7ZiHNn6yio6qKLXFD/bimxK+22HSJlc3LSF2kKzNrgKoFR2rIKbL3c
+Us7GpWY8VqGTrfwR6OQNcoWqa1n5/tK9xuqKhfpoA2Eci8K+w5YCzCmnOz2vzbgS
+ptuFshTKYI2Z/DLQZyP+OQkEYPfCdani2KsISn4DTx8xFjmW/sb/zf0isemTwWyK
+Oh76FTa0tYdjTtAv3JHqyr2XkddM/oUSc09baCOfhUdo7Ep5rUqKw7BQsjreBYoZ
+WcL/hmlIksUrFlqo/HRpoBgCZpSjsF/Z9otZpSugMHVVlRCnAKQiWxWAd+V+y2FG
+q79myPgiMkbkaIrCelrUhDFRQ5wTnfAppFolw+xtT9bwdkwxZDNBe6PCYuLqD8wg
+jtDtt3q5UaUOMGJrMDKZ0Wi6ycdl/sM59kLfyBV4ybmYkwOLTlMvOATiyUZeJJZO
+2bTKBvD+izsx3Ea4VLPWYSFmk6QwaOMtj6tcXwBgtljzqMJ0S9Gubmopy3WAkP/m
+/6ETJpuIupqEtvbRTX4O/+qnBgY40aQX7B4NgJi2SypP/WML5v2B2amLlhTcN+we
+ULWyH9KvfKny5mrtG5C9xq1eAgKtB2QEDEbRyz34DWVWGpqIY1mscaNv8wARAQAB
+tFtMRURFIEJ1aWxkIFN5c3RlbSAoTEVERSBHbnVQRyBrZXkgZm9yIHVuYXR0ZW5k
+ZWQgYnVpbGQgam9icykgPGxlZGUtYWRtQGxpc3RzLmluZnJhZGVhZC5vcmc+iQI4
+BBMBAgAiBQJXl2e8AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDNhLzt
+YmRx8aJ2D/9eRQWekaeX8eAcAgzguFS12ODlg23lJx00d0zLhZcA6LycYJRmFN+M
+0tsVDZ6y7bLy1/h0YFYvYlJk4ZE+6sb4I/GSkMyqeZAy8whELYfEphXVYx0/wgyn
+d57wE0lDo8/zmt3rK1eD0zJioN7cL3A/t3L++al4gwmqtTfUIl96AXc3YBe/rwXS
+i7ShENVKYjTaMugP5BJ9kUZuaIjmXZWvREbURgBMWR7uR56XKJBwDBQMtHq2AoZs
+2iNR3dG8r70Sb/cMSgAqhwDZfeV71r7+Pd+asvxYb0JeNNgZ2ss/BA5yapUKZLgu
+hV6y7JSfHdb7q1t1j/wfqgYtQJB5K31JGxj+yaRxcF8LbvGZBNhaIJV+s4HmTeq4
+yI20pCRNd8lLY80XAISTk8DPwgTLOvMPKbDYW4+/FC8J6qoD9DByQxDduUWn5uD4
+LbVZ96v9+Ltf9LJzaxFVSE/dSsvgFNjo6u29ueG6aTxUIOc4Wi3mC0qNhqoyAbg6
+Xg922EF/sd6hf3aQU9rpcPbcsNognGgrKfyREvMlBsQ9U3pRcKPlG05bfUcayXkh
+59qIVU4kKCaW6LBy1fkBYyY3Nj5eoCAe9fm9ivi58FdI+7sKc2A1fMuVS83B370s
+qAsu6v2rvqYz6nS5VFIWYJmL8kbUmf5FWwbucH7/jr9s3bB0wUHcI7kCDQRXl2h/
+ARAAztMdT5ig5MKM02TFsmGvdc0SQVHPJymPTh6i/XwAbSeaTErvGLP3ke+2cdCj
+MOes4steII5MU6aD57i1zU/6xhZ2Zr8sZ4fCOzfqoI4AOIeeuiO+I5by2P+M+vj2
+v/U7KMWeixFjTkotWcvGGriP1jcRY1FHMrTfq/5lZYNHHzz/2zvszq02/WP+b/Gh
+1Rf1yfr5DlXKw6Q+7fkCg8BWfLichTtHiR0OcO0mtD6ECxz+iqDElbSAeE9Q02fO
+FTF4snHwCJvykHQ4EKudEoXcIEOR8TyH2tKorD821E/DSV9OA9XIBpDHavFQ3GCs
+29GQcqci46nOLn/LWqgTB86sgH4mnQrGsceVYzf8avM8c8TyxkufBd/k01lPn1sK
+/573AWdFRXVmOCMmlxPcI8k1+iGH1C7z0aX43NvhEI3xfbgTK8E/7Klrn/5xXUu2
+UBYov0gKaZRy3LpGF/ySR1pvnHZmUP58my2LDfWDHdHrGmkjLaqyk/+qC9NKwUQB
+S7jV7Mm15B0bkR7grLx+vN5lXVeGwyDL2dbRT0+cH8loHb+lBOR8AbDm4SJXdaRd
+DtPyq85KN+jm+9NToRz+oydL9rmguU5zRcIDtaFiYr7ZtkLJU3U02rp0uf/DdytF
+tzS/YEbpgg2Ui37q55ml707zJL2DvBffy/F2kiNpVfZ4u5cAEQEAAYkEPgQYAQIA
+CQUCV5dofwIbAgIpCRDNhLztYmRx8cFdIAQZAQIABgUCV5dofwAKCRD5NSWoi2mQ
+KQ/PD/9c/snQ2iok9H9PFinYmuOA6tf4Nbn0yX9oOTslDJ8ot6SB4OXGXGeT0lvq
+ytbYVeAlifBElYRVFYZt76dbjhqmsmDMZsYHbaXIYLZSPuTETVE3pZrpWhm9Qkhb
+eEyihAofgWleBmJcd8VXnrzsNkJGNokA6gqZ/ldqJtzMwkeHM58DHo/gFNNNlxe8
+M83PHA0rN48F6DU4tZeEvz+/QGrnn4DWcBhmWo+2ZLvTLI4cB9389j8ks7FFFXLi
+1gnWigWr29uGv8iZpAneY6414cZW3G79wTIwAATRvIvrI9pcvriUrMdOycTcwXOa
+d9eXq/mJdg8dEpKiIA8Vc9UNdT93aZt8r610LbORmdq+wFjEhWvh7xKu9hFm/3UM
+QUaVl3jsIlqZT4G8es+RLHnKVOzLMRovqRKRbsCsXxIxsVqxzhKQ5+wLCpisVNfH
+51WCTSLoAz7s0jKLCSzueUIbhV2vNBM5lFLNCl35UgN1aYuRusI7GyqkPT/A8VWj
+xVxn7o2SBIwyu4hZ4jFsq3qHOygIuRtdOHRX1vREmp7FA3+fVnx0CJUilfnGjhf/
+oydfEC6GuWUn9kTEf2eJsONwQ9gPQ9QC9cFGRFRrVwQcejr7V+DBZSdzY8YLvn7R
+qR3MmlXdpWijqj7noi2C+kbVqbLiX/LWe2axgKE+UTB7lGdl7v25D/99uFIzJmqA
+dhEAEQgb17L7kOV0MOBwFtZ6fElJaQEQV49JiQmgTzALDgXD0ACpT5qoQYCBTwuz
+m2D93ekfMnzxF8PmwW6a2czrG1KoRir2EayhgEoOJuWHLneb5nUc7X3krGNSJ3my
++lMw2QA3wIX7EAS6JJUnZFp7wawecdCekRF9ZE1Z/ZBiUZR17DkbAoYjEYZFxiXA
+cG6sFEM9uTG+y91RcQPq8tY+jw2d76ZjHSnoKjnP2VxsmtiWQ7yLj/5tjrVzQftI
+bbQQTK4V4O4aV2Y1wgkDbNPNJ6t0biQkHQv+4vaLMonOfMgGdWdYJ4hE9nlt61Aq
+GidOnyMxOb+2XpVypOoOPcTyTqe8BUjCcvHQwukZLk3XE7OQoR0wZBFhOr4JCYzT
+xIz9XYrSykZgkZMp8O4zbP+j1ZTXtJEvvPHjOS1HkL1O1H+W98dnl+oQMNQhHvvE
+6UfWEolfuWvBpfP12pUnRQAAyCBql4JAFeoCJEdJGkz8oFOFxv0kCpd7JM1gWEs2
+u0w61+5MelmliHImWiyhgV4XyKW6jeKWIpe9E5L7b8SPI5HHdT7opy3G7aD1XI3k
+jdaIiMnJbq0nSvc5VqRE7Uv0EEcepvFeiuYHYydluxRyNf/ts2JskfEnsOc1JiS+
+GPeIoGmFL85qtFOzc4sqYQGhLj9iMRfmNw==
+=W2Tk
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Comment: LEDE 17.01 "Reboot" public key
+
+mQINBFh9DQ8BEACmjR9z4mEXjTWBTcqHI8U38III55qStU4zX4mtYEm8KjaNyBu0
+F8ghe22IAPQcHuvQh0lzr2AoTYi+ZAUlHrLb3s+YdJJD2KoSD1nXW8PgtoT92tai
+utJjSKsB2ZWJc4nskAYXTkDmhTuuHBEg9hvljhXkrPxmcEDN/v1f5fv82U8JLYwt
+g1mGJmW7SsdKtkJbAmEMCi/MFFA2fxLNV33qGhzm4UeAsUrLIGBjbCtU/BK8Im28
+eAF9VP08OUK/QX7te6K6qumvuEIIc/GG4yatdbxltS1SjWYMS0vpqXm4v50CoMaB
+/XCcdq1zlIyIxQW9UF6xJDLhsHv/3iOginR/vRDbdRWk/YPwlx/d9h9GK309YhXu
+GUK/lrBHIZwZ4VEowYjK76isXmRuU9ZeTK9SeKdIyLzYg5NIXW9cvGR+4NKIqfmE
+xxbVupm7Vc+3n4KUdS2t9SLXdkG+YYmyDabftyuACU2+xeHyKcUBn4yxbrcBp5Rs
+5RgOIn/2BtiEQNSc8AagU1ie57VGErrwrpdW/Cmxrs+KG7Io8Pwv+nG9M53DqPwb
+Zuun75iuni9wAR5IVUsUWdIoalb/I4ht58FDOt2iS/KdVwi8yyCHS8gH1J3MzZWP
+Yy9k0pgup54CTXGv/KzDOAsPZzkwNiziWIVE0N49bZFkO0CXgAufOAEtewARAQAB
+tFNMRURFIFJlbGVhc2UgQnVpbGRlciAoMTcuMDEgIlJlYm9vdCIgU2lnbmluZyBL
+ZXkpIDxsZWRlLWRldkBsaXN0cy5sZWRlLXByb2plY3Qub3JnPokCPgQTAQIAKAUC
+WH0NDwIbAwUJA8JnAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQgzxgENUr
+u2tMaA//aRvfrOoMTVtjw+Pru+hBC7IhkusJ70x8gUxSPmHZX0+KvIvILyAeVEho
+TW5lMwwo6b66GcBmP53qu/rech8HyunyyDUYFEvdE/ym3uO6NpE/3N/Z69TJiC+k
+1imElx5njTZkH/qZSClqN8j6ehspywnSKWNfSOM/9K1G7qtWgiqIaDYa+sdtRHjx
+oh4dtKiauUced0C1i7V1vT1ko8iZKWFiwj9GJSaoVxyUwI2fG3iV2qdcinPCL0nU
+BfVIhU5cXMZ6VtVg5Ly6NqUbrhZzVVl8DMnu5z4MOLZWseob4LhK5W0v+DUTezJS
+Cvei+woJ3SIy0CLXe6eDKwbCS5kCaoNbExeTnSz7/Mg14NjREhtWkq79rnHrH9MV
+QAXyjmd3q0D5sDLzk8nQ3fGaH1Zg+o+VECkwEwz4ypctXqRAcHyIkYHmv8rFYlQY
+dJlfs1NgZzk9EWfZ0/RLUdqNx6beKm27r2W1j+gcaM01sk5q9TPZeuNHh8psFlCD
+b5mq6XBstA9NwN9pg5zS+UkfjjMU5FiBIEVv4Lt/dblNkjID/+XUBkHpSAz13GDW
+k0ElkSBgBvz8TSm68EUGTfTVhK21x+1x15/8AUoV8V+4txncMhnJNmrEcKolnMeF
+96xgcoHpPszlHxjiwS6hrFPDyhfYwU9plDI7ojcIleqK98XjRHY=
+=aN5O
+-----END PGP PUBLIC KEY BLOCK-----
+++ /dev/null
------BEGIN PGP PUBLIC KEY BLOCK-----
-Comment: LEDE GnuPG key for unattended build jobs
-
-mQINBFeXZ7wBEAC3QZ+jhWrdj2XW9AdZpZrgHETZCW7lXxI3pJ2kS4UXNq+40KR2
-GJOdsXDnLb7ZiHNn6yio6qKLXFD/bimxK+22HSJlc3LSF2kKzNrgKoFR2rIKbL3c
-Us7GpWY8VqGTrfwR6OQNcoWqa1n5/tK9xuqKhfpoA2Eci8K+w5YCzCmnOz2vzbgS
-ptuFshTKYI2Z/DLQZyP+OQkEYPfCdani2KsISn4DTx8xFjmW/sb/zf0isemTwWyK
-Oh76FTa0tYdjTtAv3JHqyr2XkddM/oUSc09baCOfhUdo7Ep5rUqKw7BQsjreBYoZ
-WcL/hmlIksUrFlqo/HRpoBgCZpSjsF/Z9otZpSugMHVVlRCnAKQiWxWAd+V+y2FG
-q79myPgiMkbkaIrCelrUhDFRQ5wTnfAppFolw+xtT9bwdkwxZDNBe6PCYuLqD8wg
-jtDtt3q5UaUOMGJrMDKZ0Wi6ycdl/sM59kLfyBV4ybmYkwOLTlMvOATiyUZeJJZO
-2bTKBvD+izsx3Ea4VLPWYSFmk6QwaOMtj6tcXwBgtljzqMJ0S9Gubmopy3WAkP/m
-/6ETJpuIupqEtvbRTX4O/+qnBgY40aQX7B4NgJi2SypP/WML5v2B2amLlhTcN+we
-ULWyH9KvfKny5mrtG5C9xq1eAgKtB2QEDEbRyz34DWVWGpqIY1mscaNv8wARAQAB
-tFtMRURFIEJ1aWxkIFN5c3RlbSAoTEVERSBHbnVQRyBrZXkgZm9yIHVuYXR0ZW5k
-ZWQgYnVpbGQgam9icykgPGxlZGUtYWRtQGxpc3RzLmluZnJhZGVhZC5vcmc+iQI4
-BBMBAgAiBQJXl2e8AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRDNhLzt
-YmRx8aJ2D/9eRQWekaeX8eAcAgzguFS12ODlg23lJx00d0zLhZcA6LycYJRmFN+M
-0tsVDZ6y7bLy1/h0YFYvYlJk4ZE+6sb4I/GSkMyqeZAy8whELYfEphXVYx0/wgyn
-d57wE0lDo8/zmt3rK1eD0zJioN7cL3A/t3L++al4gwmqtTfUIl96AXc3YBe/rwXS
-i7ShENVKYjTaMugP5BJ9kUZuaIjmXZWvREbURgBMWR7uR56XKJBwDBQMtHq2AoZs
-2iNR3dG8r70Sb/cMSgAqhwDZfeV71r7+Pd+asvxYb0JeNNgZ2ss/BA5yapUKZLgu
-hV6y7JSfHdb7q1t1j/wfqgYtQJB5K31JGxj+yaRxcF8LbvGZBNhaIJV+s4HmTeq4
-yI20pCRNd8lLY80XAISTk8DPwgTLOvMPKbDYW4+/FC8J6qoD9DByQxDduUWn5uD4
-LbVZ96v9+Ltf9LJzaxFVSE/dSsvgFNjo6u29ueG6aTxUIOc4Wi3mC0qNhqoyAbg6
-Xg922EF/sd6hf3aQU9rpcPbcsNognGgrKfyREvMlBsQ9U3pRcKPlG05bfUcayXkh
-59qIVU4kKCaW6LBy1fkBYyY3Nj5eoCAe9fm9ivi58FdI+7sKc2A1fMuVS83B370s
-qAsu6v2rvqYz6nS5VFIWYJmL8kbUmf5FWwbucH7/jr9s3bB0wUHcI7kCDQRXl2h/
-ARAAztMdT5ig5MKM02TFsmGvdc0SQVHPJymPTh6i/XwAbSeaTErvGLP3ke+2cdCj
-MOes4steII5MU6aD57i1zU/6xhZ2Zr8sZ4fCOzfqoI4AOIeeuiO+I5by2P+M+vj2
-v/U7KMWeixFjTkotWcvGGriP1jcRY1FHMrTfq/5lZYNHHzz/2zvszq02/WP+b/Gh
-1Rf1yfr5DlXKw6Q+7fkCg8BWfLichTtHiR0OcO0mtD6ECxz+iqDElbSAeE9Q02fO
-FTF4snHwCJvykHQ4EKudEoXcIEOR8TyH2tKorD821E/DSV9OA9XIBpDHavFQ3GCs
-29GQcqci46nOLn/LWqgTB86sgH4mnQrGsceVYzf8avM8c8TyxkufBd/k01lPn1sK
-/573AWdFRXVmOCMmlxPcI8k1+iGH1C7z0aX43NvhEI3xfbgTK8E/7Klrn/5xXUu2
-UBYov0gKaZRy3LpGF/ySR1pvnHZmUP58my2LDfWDHdHrGmkjLaqyk/+qC9NKwUQB
-S7jV7Mm15B0bkR7grLx+vN5lXVeGwyDL2dbRT0+cH8loHb+lBOR8AbDm4SJXdaRd
-DtPyq85KN+jm+9NToRz+oydL9rmguU5zRcIDtaFiYr7ZtkLJU3U02rp0uf/DdytF
-tzS/YEbpgg2Ui37q55ml707zJL2DvBffy/F2kiNpVfZ4u5cAEQEAAYkEPgQYAQIA
-CQUCV5dofwIbAgIpCRDNhLztYmRx8cFdIAQZAQIABgUCV5dofwAKCRD5NSWoi2mQ
-KQ/PD/9c/snQ2iok9H9PFinYmuOA6tf4Nbn0yX9oOTslDJ8ot6SB4OXGXGeT0lvq
-ytbYVeAlifBElYRVFYZt76dbjhqmsmDMZsYHbaXIYLZSPuTETVE3pZrpWhm9Qkhb
-eEyihAofgWleBmJcd8VXnrzsNkJGNokA6gqZ/ldqJtzMwkeHM58DHo/gFNNNlxe8
-M83PHA0rN48F6DU4tZeEvz+/QGrnn4DWcBhmWo+2ZLvTLI4cB9389j8ks7FFFXLi
-1gnWigWr29uGv8iZpAneY6414cZW3G79wTIwAATRvIvrI9pcvriUrMdOycTcwXOa
-d9eXq/mJdg8dEpKiIA8Vc9UNdT93aZt8r610LbORmdq+wFjEhWvh7xKu9hFm/3UM
-QUaVl3jsIlqZT4G8es+RLHnKVOzLMRovqRKRbsCsXxIxsVqxzhKQ5+wLCpisVNfH
-51WCTSLoAz7s0jKLCSzueUIbhV2vNBM5lFLNCl35UgN1aYuRusI7GyqkPT/A8VWj
-xVxn7o2SBIwyu4hZ4jFsq3qHOygIuRtdOHRX1vREmp7FA3+fVnx0CJUilfnGjhf/
-oydfEC6GuWUn9kTEf2eJsONwQ9gPQ9QC9cFGRFRrVwQcejr7V+DBZSdzY8YLvn7R
-qR3MmlXdpWijqj7noi2C+kbVqbLiX/LWe2axgKE+UTB7lGdl7v25D/99uFIzJmqA
-dhEAEQgb17L7kOV0MOBwFtZ6fElJaQEQV49JiQmgTzALDgXD0ACpT5qoQYCBTwuz
-m2D93ekfMnzxF8PmwW6a2czrG1KoRir2EayhgEoOJuWHLneb5nUc7X3krGNSJ3my
-+lMw2QA3wIX7EAS6JJUnZFp7wawecdCekRF9ZE1Z/ZBiUZR17DkbAoYjEYZFxiXA
-cG6sFEM9uTG+y91RcQPq8tY+jw2d76ZjHSnoKjnP2VxsmtiWQ7yLj/5tjrVzQftI
-bbQQTK4V4O4aV2Y1wgkDbNPNJ6t0biQkHQv+4vaLMonOfMgGdWdYJ4hE9nlt61Aq
-GidOnyMxOb+2XpVypOoOPcTyTqe8BUjCcvHQwukZLk3XE7OQoR0wZBFhOr4JCYzT
-xIz9XYrSykZgkZMp8O4zbP+j1ZTXtJEvvPHjOS1HkL1O1H+W98dnl+oQMNQhHvvE
-6UfWEolfuWvBpfP12pUnRQAAyCBql4JAFeoCJEdJGkz8oFOFxv0kCpd7JM1gWEs2
-u0w61+5MelmliHImWiyhgV4XyKW6jeKWIpe9E5L7b8SPI5HHdT7opy3G7aD1XI3k
-jdaIiMnJbq0nSvc5VqRE7Uv0EEcepvFeiuYHYydluxRyNf/ts2JskfEnsOc1JiS+
-GPeIoGmFL85qtFOzc4sqYQGhLj9iMRfmNw==
-=W2Tk
------END PGP PUBLIC KEY BLOCK-----
+++ /dev/null
------BEGIN PGP PUBLIC KEY BLOCK-----
-Comment: LEDE 17.01 "Reboot" public key
-
-mQINBFh9DQ8BEACmjR9z4mEXjTWBTcqHI8U38III55qStU4zX4mtYEm8KjaNyBu0
-F8ghe22IAPQcHuvQh0lzr2AoTYi+ZAUlHrLb3s+YdJJD2KoSD1nXW8PgtoT92tai
-utJjSKsB2ZWJc4nskAYXTkDmhTuuHBEg9hvljhXkrPxmcEDN/v1f5fv82U8JLYwt
-g1mGJmW7SsdKtkJbAmEMCi/MFFA2fxLNV33qGhzm4UeAsUrLIGBjbCtU/BK8Im28
-eAF9VP08OUK/QX7te6K6qumvuEIIc/GG4yatdbxltS1SjWYMS0vpqXm4v50CoMaB
-/XCcdq1zlIyIxQW9UF6xJDLhsHv/3iOginR/vRDbdRWk/YPwlx/d9h9GK309YhXu
-GUK/lrBHIZwZ4VEowYjK76isXmRuU9ZeTK9SeKdIyLzYg5NIXW9cvGR+4NKIqfmE
-xxbVupm7Vc+3n4KUdS2t9SLXdkG+YYmyDabftyuACU2+xeHyKcUBn4yxbrcBp5Rs
-5RgOIn/2BtiEQNSc8AagU1ie57VGErrwrpdW/Cmxrs+KG7Io8Pwv+nG9M53DqPwb
-Zuun75iuni9wAR5IVUsUWdIoalb/I4ht58FDOt2iS/KdVwi8yyCHS8gH1J3MzZWP
-Yy9k0pgup54CTXGv/KzDOAsPZzkwNiziWIVE0N49bZFkO0CXgAufOAEtewARAQAB
-tFNMRURFIFJlbGVhc2UgQnVpbGRlciAoMTcuMDEgIlJlYm9vdCIgU2lnbmluZyBL
-ZXkpIDxsZWRlLWRldkBsaXN0cy5sZWRlLXByb2plY3Qub3JnPokCPgQTAQIAKAUC
-WH0NDwIbAwUJA8JnAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQgzxgENUr
-u2tMaA//aRvfrOoMTVtjw+Pru+hBC7IhkusJ70x8gUxSPmHZX0+KvIvILyAeVEho
-TW5lMwwo6b66GcBmP53qu/rech8HyunyyDUYFEvdE/ym3uO6NpE/3N/Z69TJiC+k
-1imElx5njTZkH/qZSClqN8j6ehspywnSKWNfSOM/9K1G7qtWgiqIaDYa+sdtRHjx
-oh4dtKiauUced0C1i7V1vT1ko8iZKWFiwj9GJSaoVxyUwI2fG3iV2qdcinPCL0nU
-BfVIhU5cXMZ6VtVg5Ly6NqUbrhZzVVl8DMnu5z4MOLZWseob4LhK5W0v+DUTezJS
-Cvei+woJ3SIy0CLXe6eDKwbCS5kCaoNbExeTnSz7/Mg14NjREhtWkq79rnHrH9MV
-QAXyjmd3q0D5sDLzk8nQ3fGaH1Zg+o+VECkwEwz4ypctXqRAcHyIkYHmv8rFYlQY
-dJlfs1NgZzk9EWfZ0/RLUdqNx6beKm27r2W1j+gcaM01sk5q9TPZeuNHh8psFlCD
-b5mq6XBstA9NwN9pg5zS+UkfjjMU5FiBIEVv4Lt/dblNkjID/+XUBkHpSAz13GDW
-k0ElkSBgBvz8TSm68EUGTfTVhK21x+1x15/8AUoV8V+4txncMhnJNmrEcKolnMeF
-96xgcoHpPszlHxjiwS6hrFPDyhfYwU9plDI7ojcIleqK98XjRHY=
-=aN5O
------END PGP PUBLIC KEY BLOCK-----
SDK_HOME="$HOME/sdk"
SDK_PATH=https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/
-SDK=openwrt-sdk-ar71xx-generic_gcc-5.5.0_musl.Linux-x86_64
+SDK=-sdk-ar71xx-generic_
PACKAGES_DIR="$PWD"
echo_red() { printf "\033[1;31m$*\033[m\n"; }
return 0
}
+get_sdk_file() {
+ if [ -e "$SDK_HOME/sha256sums" ] ; then
+ grep -- "$SDK" "$SDK_HOME/sha256sums" | awk '{print $2}' | sed 's/*//g'
+ else
+ false
+ fi
+}
+
# download will run on the `before_script` step
# The travis cache will be used (all files under $HOME/sdk/). Meaning
# We don't have to download the file again
wget "$SDK_PATH/sha256sums.gpg" -O sha256sums.asc
# LEDE Build System (LEDE GnuPG key for unattended build jobs)
- gpg --import $PACKAGES_DIR/.travis/626471F1.asc
+ gpg --import $PACKAGES_DIR/.keys/626471F1.asc
echo '54CC74307A2C6DC9CE618269CD84BCED626471F1:6:' | gpg --import-ownertrust
# LEDE Release Builder (17.01 "Reboot" Signing Key)
- gpg --import $PACKAGES_DIR/.travis/D52BBB6B.asc
+ gpg --import $PACKAGES_DIR/.keys/D52BBB6B.asc
echo 'B09BE781AE8A0CD4702FDCD3833C6010D52BBB6B:6:' | gpg --import-ownertrust
+ echo_blue "=== Verifying sha256sums signature"
gpg --verify sha256sums.asc
- grep "$SDK" sha256sums > sha256sums.small
+ echo_blue "=== Verified sha256sums signature."
+ if ! grep -- "$SDK" sha256sums > sha256sums.small ; then
+ echo_red "=== Can not find $SDK file in sha256sums."
+ echo_red "=== Is \$SDK out of date?"
+ false
+ fi
# if missing, outdated or invalid, download again
if ! sha256sum -c ./sha256sums.small ; then
- wget "$SDK_PATH/$SDK.tar.xz" -O "$SDK.tar.xz"
+ local sdk_file
+ sdk_file="$(get_sdk_file)"
+ echo_blue "=== sha256 doesn't match or SDK file wasn't downloaded yet."
+ echo_blue "=== Downloading a fresh version"
+ wget "$SDK_PATH/$sdk_file" -O "$sdk_file"
fi
# check again and fail here if the file is still bad
- sha256sum -c ./sha256sums.small
+ echo_blue "Checking sha256sum a second time"
+ if ! sha256sum -c ./sha256sums.small ; then
+ echo_red "=== SDK can not be verified!"
+ false
+ fi
echo_blue "=== SDK is up-to-date"
}
echo_blue "=== Setting up SDK"
tmp_path=$(mktemp -d)
cd "$tmp_path"
- tar Jxf "$SDK_HOME/$SDK.tar.xz" --strip=1
+ tar Jxf "$SDK_HOME/$(get_sdk_file)" --strip=1
# use github mirrors to spare lede servers
cat > feeds.conf <<EOF
pkg_name=$(echo "$pkg_dir" | awk -F/ '{ print $NF }')
echo_blue "=== $pkg_name: Starting quick tests"
- exec_status 'WARNING|ERROR' make "package/$pkg_name/download" V=s || RET=1
- exec_status 'WARNING|ERROR' make "package/$pkg_name/check" V=s || RET=1
+ exec_status '^ERROR' make "package/$pkg_name/download" V=s || RET=1
+ exec_status '^ERROR' make "package/$pkg_name/check" V=s || RET=1
echo_blue "=== $pkg_name: quick tests done"
done
include $(TOPDIR)/rules.mk
PKG_NAME:=htop
-PKG_VERSION:=2.0.2
+PKG_VERSION:=2.2.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://hisham.hm/htop/releases/$(PKG_VERSION)/
-PKG_HASH:=179be9dccb80cee0c5e1a1f58c8f72ce7b2328ede30fb71dcdf336539be2f487
+PKG_HASH:=d9d6826f10ce3887950d709b53ee1d8c1849a70fa38e91d5896ad8cbc6ba3c57
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
+++ /dev/null
---- a/configure.ac
-+++ b/configure.ac
-@@ -2,7 +2,7 @@
- # Process this file with autoconf to produce a configure script.
-
- AC_PREREQ(2.65)
--LT_PREREQ([2.4.2])
-+LT_PREREQ([2.4.0])
- AC_INIT([htop],[2.0.2],[hisham@gobolinux.org])
-
- SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
include $(TOPDIR)/rules.mk
PKG_NAME:=netdata
-PKG_VERSION:=1.8.0
+PKG_VERSION:=1.10.0
PKG_RELEASE:=1
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net>
+PKG_MAINTAINER:=
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/firehol/netdata/releases/download/v$(PKG_VERSION)
-PKG_HASH:=1624a3b02f07dc8881b8edd5899049d4d3d53e485424ffb2fb65a322e2ff82c3
+PKG_HASH:=0514fc002c5c5fb730156b3fe928965b22327833c6c17e22b7097eda657e77a2
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
define Package/netdata
SECTION:=admin
CATEGORY:=Administration
- DEPENDS:=+zlib +libuuid
+ DEPENDS:=+zlib +libuuid +libmnl
TITLE:=Real-time performance monitoring tool
URL:=https://my-netdata.io/
endef
monitoring for Linux systems, applications and SNMP devices over the web.
endef
-TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -O3
TARGET_LDFLAGS += -Wl,--gc-sections
CONFIGURE_ARGS += --with-zlib --with-math --disable-x86-sse --disable-lto
rm $(1)/usr/share/netdata/web/fonts/*.svg
rm $(1)/usr/share/netdata/web/fonts/*.ttf
rm $(1)/usr/share/netdata/web/fonts/*.woff
- rm $(1)/usr/share/netdata/web/fonts/*.otf
mkdir -p $(1)/usr/lib/netdata
$(CP) $(PKG_INSTALL_DIR)/usr/lib/netdata $(1)/usr/lib
rm $(1)/usr/lib/netdata/python.d/python-modules-installer.sh
# You can uncomment and change any of the options below.
# The value shown in the commented settings, is the default value.
#
-# Notes about plugins
-#
-# tc - QoS stats (if wanted)
-# cgcroups - No support in OpenWRT/LEDE by default
-# charts.d - REQUIRES bash, enable here and edit charts.d.conf
-# node.d - REQUIRES node.js
-# python.d - REQUIRES python and PyYAML, edit python.d.conf to enable
-# apps - none atm
-# health - Disabled by default
-# KSM - No support in OpenWRT/LEDE by default
# global netdata configuration
[global]
# glibc malloc arena max for plugins = 1
- # glibc malloc arena max for netdata = 1
+ # hostname = LEDE
+ # history = 4036
+ update every = 2
# config directory = /etc/netdata
- # plugins directory = /usr/libexec/netdata/plugins.d
+ # log directory = /var/log/netdata
# web files directory = /usr/share/netdata/web
# cache directory = /var/cache/netdata
# lib directory = /var/lib/netdata
- # log directory = /var/log/netdata
- # host access prefix =
# home directory = /var/cache/netdata
- # debug flags = 0x00000000
+ # plugins directory = "/usr/lib/netdata/plugins.d" "/etc/netdata/custom-plugins.d"
+ # memory mode = save
+ # host access prefix =
memory deduplication (ksm) = no
+ # TZ environment variable = :/etc/localtime
+ # timezone = UTC
+ # debug flags = 0x0000000000000000
debug log = syslog
error log = syslog
access log = none
# errors flood protection period = 1200
# errors to trigger flood protection = 200
- memory mode = ram
- # hostname = LEDE
- # history = 3600
- # update every = 1
- update every = 2
- # pthread stack size = 8388608
- run as user = nobody
+ run as user = root
+ # OOM score = 1000
+ # process scheduling policy = idle
+ # process nice level = 19
+ # pthread stack size = 81920
+ # cleanup obsolete charts after seconds = 3600
+ # gap when lost iterations above = 1
+ # cleanup orphan hosts after seconds = 3600
+ # delete obsolete charts files = yes
+ # delete orphan hosts files = yes
[web]
- web files owner = root
- web files group = root
+ # mode = static-threaded
+ # listen backlog = 4096
# default port = 19999
# bind to = *
+ # web files owner = nobody
+ # web files group = nogroup
+ # disconnect idle clients after seconds = 60
+ # timeout for first request = 60
+ # respect do not track policy = no
+ # x-frame-options response header =
+ allow connections from = localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
+ allow dashboard from = localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
+ # allow badges from = *
+ # allow streaming from = *
+ # allow netdata.conf from = localhost fd* 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
+ # enable gzip compression = yes
+ # gzip compression strategy = default
+ # gzip compression level = 3
+ # web server threads = 2
+ # web server max sockets = 512
[plugins]
- # PATH environment variable = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
- tc = no
- # idlejitter = yes
+ # PATH environment variable = /usr/sbin:/usr/bin:/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+ # PYTHONPATH environment variable =
# proc = yes
# diskspace = yes
- cgroups = no
- # checks = no
- # plugins directory = /usr/libexec/netdata/plugins.d
- enable running new plugins = no
+ # cgroups = yes
+ # tc = yes
+ # idlejitter = yes
+ # enable running new plugins = yes
# check for new plugins every = 60
+ apps = no
charts.d = no
- # plugins directory = /usr/libexec/netdata/plugins.d
+ fping = no
node.d = no
python.d = no
- apps = no
- fping = no
-
-[registry]
- # enabled = no
- # registry db directory = /var/lib/netdata/registry
- # netdata unique id file = /var/lib/netdata/registry/netdata.public.unique.id
- # registry db file = /var/lib/netdata/registry/registry.db
- # registry log file = /var/lib/netdata/registry/registry-log.db
- # registry save db every new entries = 1000000
- # registry expire idle persons days = 365
- # registry domain =
- # registry to announce = https://registry.my-netdata.io
- # registry hostname = LEDE
- # verify browser cookies support = yes
- # max URL length = 1024
- # max URL name length = 50
[health]
enabled = no
- # health db directory = /var/lib/netdata/health
- # health db file = /var/lib/netdata/health/health-log.db
- # health configuration directory = /etc/netdata/health.d
- # script to execute on alarm = /usr/libexec/netdata/plugins.d/alarm-notify.sh
# in memory max health log entries = 1000
+ # script to execute on alarm = /usr/lib/netdata/plugins.d/alarm-notify.sh
+ # health configuration directory = /etc/netdata/health.d
# run at least every seconds = 10
+ # postpone alarms during hibernation for seconds = 60
# rotate log every lines = 2000
-[backend]
- # enabled = no
- # data source = average
- # type = graphite
- # destination = localhost
- # prefix = netdata
- # hostname = LEDE
- # update every = 10
- # buffer on failures = 10
- # timeout ms = 20000
-
-# per plugin configuration
-
-[plugin:fping]
- # update every = 1
- # command options =
-
-[plugin:proc]
- # netdata server resources = yes
- # /proc/stat = yes
- # /proc/uptime = yes
- # /proc/loadavg = yes
- # /proc/sys/kernel/random/entropy_avail = yes
- # /proc/interrupts = yes
- # /proc/softirqs = yes
- # /proc/vmstat = yes
- # /proc/meminfo = yes
- /sys/kernel/mm/ksm = no
- /sys/devices/system/edac/mc = no
- /sys/devices/system/node = no
- # /proc/net/dev = yes
- /proc/net/netstat = no
- /proc/net/snmp = no
- /proc/net/snmp6 = no
- /proc/net/softnet_stat = no
- /proc/net/ip_vs/stats = no
- # /proc/net/stat/conntrack = yes
- /proc/net/stat/synproxy = no
- # /proc/diskstats = yes
- /proc/net/rpc/nfsd = no
- /proc/net/rpc/nfs = no
- # ipc = yes
- /proc/spl/kstat/zfs/arcstats = no
-
-[plugin:proc:/proc/stat]
- # cpu utilization = yes
- # per cpu core utilization = yes
- # cpu interrupts = yes
- # context switches = yes
- # processes started = yes
- # processes running = yes
- # filename to monitor = /proc/stat
-[plugin:proc:/proc/interrupts]
- # interrupts per core = yes
- # filename to monitor = /proc/interrupts
-
-[plugin:proc:/proc/softirqs]
- # interrupts per core = yes
- # filename to monitor = /proc/softirqs
-
-[plugin:proc:/proc/net/dev]
- # enable new interfaces detected at runtime = auto
- # bandwidth for all interfaces = auto
- # packets for all interfaces = auto
- # errors for all interfaces = auto
- # drops for all interfaces = auto
- # fifo for all interfaces = auto
- # compressed packets for all interfaces = auto
- # frames, collisions, carrier counters for all interfaces = auto
- # disable by default interfaces matching = lo fireqos* *-ifb
- # filename to monitor = /proc/net/dev
-
-[plugin:proc:/proc/net/dev:eth0]
- # enabled = yes
- # bandwidth = auto
- # packets = auto
- # errors = auto
- # drops = auto
- # fifo = auto
- # compressed = auto
- # events = auto
-
-[plugin:proc:/proc/diskstats]
- # enable new disks detected at runtime = yes
- # performance metrics for physical disks = auto
- # performance metrics for virtual disks = auto
- # performance metrics for partitions = no
- # bandwidth for all disks = auto
- # operations for all disks = auto
- # merged operations for all disks = auto
- # i/o time for all disks = auto
- # queued operations for all disks = auto
- # utilization percentage for all disks = auto
- # backlog for all disks = auto
- # filename to monitor = /proc/diskstats
- # path to get block device infos = /sys/dev/block/%lu:%lu/%s
- # path to get h/w sector size = /sys/block/%s/queue/hw_sector_size
- # path to get h/w sector size for partitions = /sys/dev/block/%lu:%lu/subsystem/%s/../queue/hw_sector_size
- # performance metrics for disks with major 8 = yes
-
-[plugin:proc:/proc/diskstats:sda]
- # enable = yes
- # enable performance metrics = yes
- # bandwidth = auto
- # operations = auto
- # merged operations = auto
- # i/o time = auto
- # queued operations = auto
- # utilization percentage = auto
- # backlog = auto
-
-[plugin:proc:/proc/net/rpc/nfsd]
- # filename to monitor = /proc/net/rpc/nfsd
- # read cache = yes
- # file handles = yes
- # I/O = yes
- # threads = yes
- # read ahead = yes
- # network = yes
- # rpc = yes
- # NFS v2 procedures = yes
- # NFS v3 procedures = yes
- # NFS v4 procedures = yes
- # NFS v4 operations = yes
+[statsd]
+ enabled = no
+ # update every (flushInterval) = 1
+ # udp messages to process at once = 10
+ # create private charts for metrics matching = *
+ # max private charts allowed = 200
+ # max private charts hard limit = 1000
+ # private charts memory mode = save
+ # private charts history = 4036
+ # decimal detail = 1000
+ # disconnect idle tcp clients after seconds = 600
+ # private charts hidden = no
+ # histograms and timers percentile (percentThreshold) = 95.00000
+ # add dimension for number of events received = yes
+ # gaps on gauges (deleteGauges) = no
+ # gaps on counters (deleteCounters) = no
+ # gaps on meters (deleteMeters) = no
+ # gaps on sets (deleteSets) = no
+ # gaps on histograms (deleteHistograms) = no
+ # gaps on timers (deleteTimers) = no
+ # statsd server max TCP sockets = 256
+ # listen backlog = 4096
+ # default port = 8125
+ # bind to = udp:localhost tcp:localhost
-[plugin:proc:/proc/net/rpc/nfs]
- # filename to monitor = /proc/net/rpc/nfs
- # network = yes
- # rpc = yes
- # NFS v2 procedures = yes
- # NFS v3 procedures = yes
- # NFS v4 procedures = yes
include $(TOPDIR)/rules.mk
PKG_NAME:=patch
-PKG_VERSION:=2.7.5
+PKG_VERSION:=2.7.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/patch
-PKG_HASH:=fd95153655d6b95567e623843a0e77b81612d502ecf78a489a4aed7867caa299
+PKG_HASH:=ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd
PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=exfat-nofuse
-PKG_VERSION=2017-01-03-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
-PKG_SOURCE=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=80abb670a59dfa62413e600cee7d13fc65b9980e00579edaa2573fab8568fe93
PKG_SOURCE_URL:=https://github.com/dorimanx/exfat-nofuse.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=8d291f525ce6d88fe0d8b11b86fd5c2e900401d3
+PKG_SOURCE_DATE:=2017-06-20
+PKG_SOURCE_VERSION:=de4c760bc9a05ead83bc3ec6eec6cf1fb106f523
+PKG_MIRROR_HASH:=2aa53a83daf4be46e437842ee67d2e0ea327642cb6b8856a79153b52ec726a57
-PKG_MAINTAINER:=Bruno Randolf <br1@einfach.org>
+PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
include $(TOPDIR)/rules.mk
PKG_NAME:=ldbus
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_MIRROR_HASH:=0e39a80e126a77a937226e49ae0246e1fd4600a03dee6bdee5ac822963a234e1
PKG_SOURCE_PROTO:=git
PKG_MAINTAINER:=Enrico Mioso <mrkiko.rs@gmail.com>
PKG_LICENSE:=MIT
-PKG_FLAGS := nonshared
-
PKG_BUILD_DEPENDS:=luarocks/host
include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99
ifeq ($(CONFIG_USE_MUSL),y)
TARGET_CFLAGS += -D_POSIX_PRIORITY_SCHEDULING
+ # Musl doesn't do all of XOPEN_REALTIME, but it does for luaposix.
+ # see https://github.com/luaposix/luaposix/issues/295
+ TARGET_CFLAGS += -D_XOPEN_REALTIME=1
endif
ifneq ($(CONFIG_USE_GLIBC),)
PKG_NAME:=luasocket
PKG_SOURCE_VERSION:=6d5e40c324c84d9c1453ae88e0ad5bdd0a631448
PKG_VERSION:=3.0-rc1-20130909
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_MIRROR_HASH:=d2fa075d8bd026c41e0eb1a634ac2ad8115dee8abb070720e8e91fab51f86ee4
--- /dev/null
+--- a/src/makefile
++++ b/src/makefile
+@@ -345,18 +345,18 @@ none:
+ all: $(SOCKET_SO) $(MIME_SO)
+
+ $(SOCKET_SO): $(SOCKET_OBJS)
+- $(LD) $(SOCKET_OBJS) $(LDFLAGS)$@
++ $(CC) $(SOCKET_OBJS) $(LDFLAGS)$@
+
+ $(MIME_SO): $(MIME_OBJS)
+- $(LD) $(MIME_OBJS) $(LDFLAGS)$@
++ $(CC) $(MIME_OBJS) $(LDFLAGS)$@
+
+ all-unix: all $(UNIX_SO) $(SERIAL_SO)
+
+ $(UNIX_SO): $(UNIX_OBJS)
+- $(LD) $(UNIX_OBJS) $(LDFLAGS)$@
++ $(CC) $(UNIX_OBJS) $(LDFLAGS)$@
+
+ $(SERIAL_SO): $(SERIAL_OBJS)
+- $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@
++ $(CC) $(SERIAL_OBJS) $(LDFLAGS)$@
+
+ install:
+ $(INSTALL_DIR) $(INSTALL_TOP_LDIR)
PKG_NPM_NAME:=arduino-firmata
PKG_NAME:=node-$(PKG_NPM_NAME)
-PKG_VERSION:=0.3.3
-PKG_RELEASE:=7
+PKG_VERSION:=0.3.4
+PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git
-PKG_SOURCE_VERSION:=16e76007edf218d72df590adbd711ac6b7432845
+PKG_SOURCE_VERSION:=v0.3.4
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=b7a498ccf70e466503e72d38ae5b474e91416b6c9842fd167dff249357b0dc37
+#PKG_MIRROR_HASH:=b7a498ccf70e466503e72d38ae5b474e91416b6c9842fd167dff249357b0dc37
PKG_BUILD_DEPENDS:=node/host
-PKG_NODE_VERSION:=6.11.2
+PKG_NODE_VERSION:=8.10.0
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
PKG_LICENSE:=MIT
define Package/node-arduino-firmata/install
mkdir -p $(1)/usr/lib/node
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node
- rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/ $(1)/usr/lib/node
+ rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/
$(CP) ./files/* $(1)/
endef
PKG_NPM_NAME:=cylon
PKG_NAME:=node-$(PKG_NPM_NAME)
-PKG_VERSION:=0.22.0
-PKG_RELEASE:=7
+PKG_VERSION:=0.24.0
+PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git
-PKG_SOURCE_VERSION:=0c37da77e48b3e2cc3a8d566822a17689de91b40
+PKG_SOURCE_VERSION:=a930f8446f23ec2cb28aadeff54b79ab7704e3a0
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=e531d3c92965518c60d52bc497bfa9be563ee68c3cf65c77fa55d5e9c2627367
+PKG_MIRROR_HASH:=dceb75539d32f402db0a5f68f2c7e2b52e5547a5ac2dec875d34fd3cc95cce00
PKG_BUILD_DEPENDS:=node/host
-PKG_NODE_VERSION:=6.11.2
+PKG_NODE_VERSION:=8.10.0
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
PKG_LICENSE:=Apache-2.0
-Index: node-cylon-0.22.0/package.json
-===================================================================
---- node-cylon-0.22.0.orig/package.json 2015-10-20 20:32:48.000000000 +0200
-+++ node-cylon-0.22.0/package.json 2015-10-21 10:42:20.616109122 +0200
-@@ -38,7 +38,6 @@
+--- a/package.json
++++ b/package.json
+@@ -41,7 +41,8 @@
},
"dependencies": {
-- "firmata": ">= 0.3.2",
- "cylon": "1.1.0",
- "cylon-gpio": "0.26.0",
- "cylon-i2c": "0.22.0"
+- "firmata": ">= 0.8.0",
+- "cylon": "^1.3.0"
++ "cylon": "^1.3.0",
++ "cylon-gpio": "0.30.1",
++ "cylon-i2c": "0.26.1"
+ }
+ }
PKG_NPM_NAME:=hid
PKG_NAME:=node-$(PKG_NPM_NAME)
-PKG_VERSION:=0.5.1
-PKG_RELEASE:=7
+PKG_VERSION:=0.7.2
+PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=35d830b7810c87d32484d0a346621568c4849441
+PKG_SOURCE_VERSION:=v0.7.2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=125f752d491ac10d32bab0f0d660f6f150c6a9a168b2b56bfddc2cb1d65166fc
+PKG_MIRROR_HASH:=ede801a26a23290ab76d64ab636c3c3e2788030bb830af7006d37444c2a7b2c4
-PKG_BUILD_DEPENDS:=node/host
-PKG_NODE_VERSION:=6.11.2
+PKG_BUILD_DEPENDS:=node/host libudev-fbsd
+PKG_NODE_VERSION:=8.10.0
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
PKG_LICENSE:=Custom
define Package/node-hid/install
mkdir -p $(1)/usr/lib/node/node-hid/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/ $(1)/usr/lib/node/
endef
$(eval $(call BuildPackage,node-hid))
--- /dev/null
+#
+# Copyright (C) 2018 Sartura Ltd.
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NPM_NAME:=mozilla-iot-gateway
+PKG_NAME:=node-$(PKG_NPM_NAME)
+PKG_VERSION:=0.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/mozilla-iot/gateway.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MIRROR_HASH:=ba05bc3e93c36768244df922434e7132c2dae85a1ff9e3213beea087a4844d11
+
+PKG_BUILD_DEPENDS:=node/host openzwave
+
+PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
+PKG_LICENSE:=MPL-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/node-mozilla-iot-gateway
+ SUBMENU:=Node.js
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Things Gateway by Mozilla
+ URL:=https://iot.mozilla.org/gateway/
+ DEPENDS:=+node +node-npm +libopenzwave +python +openssl-util
+endef
+
+define Package/node-mozilla-iot-gateway/description
+ Build Your Own Web of Things Gateway. The "Web of Things" (WoT) is the
+ idea of taking the lessons learned from the World Wide Web and applying
+ them to IoT. It's about creating a decentralized Internet of Things by
+ giving Things URLs on the web to make them linkable and discoverable,
+ and defining a standard data model and APIs to make them interoperable.
+endef
+
+CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
+
+define Build/Compile
+ $(MAKE_VARS) \
+ $(MAKE_FLAGS) \
+ npm_config_arch=$(CONFIG_ARCH) \
+ npm_config_nodedir=$(STAGING_DIR)/usr/ \
+ npm_config_cache=$(TMP_DIR)/npm-cache \
+ npm_config_tmp=$(TMP_DIR)/npm-tmp \
+ PREFIX="$(PKG_INSTALL_DIR)/usr/" \
+ $(STAGING_DIR_HOSTPKG)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(DL_DIR)/$(PKG_SOURCE)
+endef
+
+define Package/node-mozilla-iot-gateway/install
+ $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/opt/mozilla-iot/gateway
+ $(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway
+ $(LN) ../constants.js $(1)/opt/mozilla-iot/gateway/src/addons/addon-constants.js
+ $(LN) /tmp/mozilla-iot/gateway/run-app.log $(1)/opt/mozilla-iot/gateway/run-app.log
+
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
+endef
+
+$(eval $(call BuildPackage,node-mozilla-iot-gateway))
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=99
+
+_npm=/usr/bin/npm
+
+start()
+{
+ mkdir -p /tmp/mozilla-iot/gateway/
+ cd /opt/mozilla-iot/gateway/
+ $_npm start &> /tmp/mozilla-iot/gateway/run-app.log &
+}
PKG_NPM_NAME:=serialport
PKG_NAME:=node-$(PKG_NPM_NAME)
-PKG_VERSION:=3.0.0
-PKG_RELEASE:=5
+PKG_VERSION:=6.1.1
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
-PKG_HASH:=3bc75b4c2742f0efe8495feb28c5da1a4774df75d94836e43409ed352addfec7
+PKG_HASH:=b58c326d217fb0af1639e4ea834d9fca4be16934c486499e2ddac6e52b8dd560
PKG_BUILD_DEPENDS:=node/host
-PKG_NODE_VERSION:=6.11.2
+PKG_NODE_VERSION:=8.10.0
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
PKG_LICENSE:=Custom
include $(TOPDIR)/rules.mk
PKG_NAME:=node
-PKG_VERSION:=v6.11.2
-PKG_RELEASE:=3
+PKG_VERSION:=v8.10.0
+PKG_RELEASE:=1
PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
-PKG_HASH:=04af4992238b19124ea56f1bcfda36827613a24eb3b00fc3b50f261a415a26e4
+PKG_HASH:=b72d4e71618d6bcbd039b487b51fa7543631a4ac3331d7caf69bdf55b5b2901a
HOST_BUILD_DEPENDS:=python/host
PKG_BUILD_DEPENDS:=python/host
SUBMENU:=Node.js
TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
URL:=http://nodejs.org/
- DEPENDS:=+libstdcpp +libopenssl +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu
+ DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) +libstdcpp +libopenssl +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu
endef
define Package/node/description
define Package/node-npm/install
mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/npm $(1)/usr/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
endef
-diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc
-index 4f58720..1f3071e 100644
--- a/deps/v8/src/base/cpu.cc
+++ b/deps/v8/src/base/cpu.cc
-@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) {
+@@ -144,6 +144,7 @@
".set push\n\t"
".set noreorder\n\t"
".set oddspreg\n\t"
--- a/deps/uv/src/unix/getaddrinfo.c
+++ b/deps/uv/src/unix/getaddrinfo.c
-@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct
+@@ -100,6 +100,7 @@
int err;
req = container_of(w, uv_getaddrinfo_t, work_req);
--- a/lib/module.js
+++ b/lib/module.js
-@@ -625,7 +625,8 @@
+@@ -714,7 +714,8 @@
} else {
prefixDir = path.resolve(process.execPath, '..', '..');
}
--- /dev/null
+diff --git a/src/node_crypto.cc b/src/node_crypto.cc
+index 972b1e4..7c0f65a 100644
+--- a/src/node_crypto.cc
++++ b/src/node_crypto.cc
+@@ -5623,7 +5623,7 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
+ }
+
+ raw_keylen = args[3]->NumberValue();
+- if (raw_keylen < 0.0 || std::isnan(raw_keylen) || std::isinf(raw_keylen) ||
++ if (raw_keylen < 0.0 || isnan(raw_keylen) || isinf(raw_keylen) ||
+ raw_keylen > INT_MAX) {
+ type_error = "Bad key length";
+ goto err;
--- /dev/null
+#
+# Copyright (C) 2017 Philip Prindeville <philipp@redfish-solutions.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-authen-sasl-xs
+PKG_VERSION:=1.00
+PKG_RELEASE:=1
+
+PKG_SOURCE_NAME:=Authen-SASL-XS
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GB/GBARR/
+PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=1b0eaa0e7ac3a45857147d837e3d34c80c6eca1d9fdcb826a213c2a105454234
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-authen-sasl-xs
+ SUBMENU:=Perl
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Authen::XS hooks into libsasl.
+ URL:=http://search.cpan.org/dist/$(PKG_SOURCE_NAME)/
+ # DEPENDS:=perl +perl-authen-sasl +libsasl2 +perl-devel-checklib/host
+ DEPENDS:=perl +perl-authen-sasl +libsasl2
+endef
+
+define Build/Configure
+ $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+ $(call perlmod/Compile,,)
+endef
+
+define Package/perl-authen-sasl-xs/install
+ $(call perlmod/Install,$(1),Authen)
+endef
+
+
+$(eval $(call BuildPackage,perl-authen-sasl-xs))
--- /dev/null
+--- a/Makefile.PL 2009-09-22 16:22:09.000000000 -0600
++++ b/Makefile.PL 2018-01-01 18:54:13.023366252 -0700
+@@ -1,7 +1,6 @@
+ # Do yourself a favour, and don't edit this file, see README for build instructions
+
+ use ExtUtils::MakeMaker;
+-use Devel::CheckLib;
+
+ my @inc_search = qw(/opt/local/include /usr/local/include);
+ my @lib_search = qw(/opt/local/lib64 /usr/local/lib64 /opt/local/lib /usr/local/lib);
+@@ -12,15 +12,7 @@ unless (exists $args{INC} or exists $arg
+
+ my @incpath = grep {-d} @inc_search;
+ my @libpath = grep {-d} @lib_search;
+- my $have_sasl2 = eval {
+- assert_lib(
+- lib => "sasl2",
+- header => "sasl/sasl.h",
+- libpath => \@libpath,
+- incpath => \@incpath
+- );
+- 1;
+- };
++ my $have_sasl2 = 1;
+
+ if ($have_sasl2) {
+ $mmopt{DEFINE} = "-DSASL2" unless $use_sasl2;
+@@ -28,13 +27,6 @@ unless (exists $args{INC} or exists $arg
+ }
+ else {
+ exit(0) if $use_sasl2;
+- @incpath = grep {-d} map { ("$_/sasl", $_) } @inc_search;
+- check_lib_or_exit(
+- lib => "sasl",
+- header => "sasl.h",
+- libpath => \@libpath,
+- incpath => \@incpath
+- );
+ }
+
+ $mmopt{INC} = join " ", map {"-I$_"} @incpath;
+@@ -58,7 +50,6 @@ WriteMakefile(
+ repository => 'http://github.com/gbarr/perl-authen-sasl-xs',
+ },
+ build_requires => {
+- 'Devel::CheckLib' => 0,
+ },
+ }
+ )
--- /dev/null
+#
+# Copyright (C) 2017 Philip Prindeville <philipp@redfish-solutions.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-authen-sasl
+PKG_VERSION:=2.16
+PKG_RELEASE:=1
+
+PKG_SOURCE_NAME:=Authen-SASL
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GB/GBARR/
+PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=6614fa7518f094f853741b63c73f3627168c5d3aca89b1d02b1016dc32854e09
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-authen-sasl
+ SUBMENU:=Perl
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=Generic network authentication protocol framework.
+ URL:=http://search.cpan.org/dist/$(PKG_SOURCE_NAME)/
+ DEPENDS:=perl +perlbase-digest
+endef
+
+define Build/Configure
+ $(call perlmod/Configure,,)
+endef
+
+define Build/Compile
+ $(call perlmod/Compile,,)
+endef
+
+define Package/perl-authen-sasl/install
+ $(call perlmod/Install,$(1),Authen)
+endef
+
+
+$(eval $(call BuildPackage,perl-authen-sasl))
+++ /dev/null
---- a/Makefile.PL 2017-05-30 14:58:53.000000000 -0600
-+++ b/Makefile.PL 2017-11-07 13:40:05.172119764 -0700
-@@ -82,3 +82,5 @@ package
- MY;
- use File::ShareDir::Install qw(postamble);
- }
-+
-+1;
include $(TOPDIR)/rules.mk
PKG_NAME:=perl-text-csv_xs
-PKG_VERSION:=1.34
+PKG_VERSION:=1.35
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://www.cpan.org/authors/id/H/HM/HMBRAND/
PKG_SOURCE:=Text-CSV_XS-$(PKG_VERSION).tgz
-PKG_HASH:=ea3aa6fe50e8ef9c07f4304ace98fca413c9c6cf60d84efc32c314b902e8a134
+PKG_HASH:=2b4f111e9486b230b02bfabbbf50c453f959d18ec17351a930e41f0959b358b7
PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
include $(TOPDIR)/rules.mk
PKG_NAME:=perl
-PKG_VERSION:=5.26.1
-PKG_RELEASE:=2
+PKG_VERSION:=5.26.2
+PKG_RELEASE:=1
PKG_SOURCE_URL:=\
https://cpan.metacpan.org/src/5.0 \
https://mirrors.sonic.net/cpan/src/5.0 \
https://www.cpan.org/src/5.0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=fe8208133e73e47afc3251c08d2c21c5a60160165a8ab8b669c43a420e4ec680
+PKG_HASH:=0f8c0fb1b0db4681adb75c3ba0dd77a0472b1b359b9e80efd79fc27b4352132c
PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
PKG_LICENSE_FILES:=Copying Artistic README
--- /dev/null
+owrt:arch=aarch64
+owrt:bits=64
+owrt:endian=little
+
+ccsymbols=''
+cppccsymbols=''
+cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE=1 _LP64=1 _STDC_PREDEF_H= _XOPEN_SOURCE=700 __AARCH64EL__=1 __AARCH64_CMODEL_SMALL__=1 __ARM_64BIT_STATE=1 __ARM_ARCH=8 __ARM_ARCH_8A=1 __ARM_ARCH_ISA_A64=1 __ARM_ARCH_PROFILE=65 __ARM_FEATURE_CLZ=1 __ARM_FEATURE_FMA=1 __ARM_FEATURE_IDIV=1 __ARM_FEATURE_NUMERIC_MAXMIN=1 __ARM_FEATURE_UNALIGNED=1 __ARM_FP=12 __ARM_NEON=1 __ARM_NEON_FP=12 __ARM_PCS_AAPCS64=1 __ARM_SIZEOF_MINIMAL_ENUM=4 __ARM_SIZEOF_WCHAR_T=4 __ATOMIC_ACQUIRE=2 __ATOMIC_ACQ_REL=4 __ATOMIC_CONSUME=1 __ATOMIC_RELAXED=0 __ATOMIC_RELEASE=3 __ATOMIC_SEQ_CST=5 __BIGGEST_ALIGNMENT__=16 __BYTE_ORDER__=1234 __CHAR16_TYPE__=short\ unsigned\ int __CHAR32_TYPE__=unsigned\ int __CHAR_BIT__=8 __CHAR_UNSIGNED__=1 __DBL_DECIMAL_DIG__=17 __DBL_DENORM_MIN__=((double)4.94065645841246544176568792868221372e-324L) __DBL_DIG__=15 __DBL_EPSILON__=((double)2.22044604925031308084726333618164062e-16L) __DBL_HAS_DENORM__=1 __DBL_HAS_INFINITY__=1 __DBL_HAS_QUIET_NAN__=1 __DBL_MANT_DIG__=53 __DBL_MAX_10_EXP__=308 __DBL_MAX_EXP__=1024 __DBL_MAX__=((double)1.79769313486231570814527423731704357e+308L) __DBL_MIN_10_EXP__=(-307) __DBL_MIN_EXP__=(-1021) __DBL_MIN__=((double)2.22507385850720138309023271733240406e-308L) __DEC128_EPSILON__=1E-33DL __DEC128_MANT_DIG__=34 __DEC128_MAX_EXP__=6145 __DEC128_MAX__=9.999999999999999999999999999999999E6144DL __DEC128_MIN_EXP__=(-6142) __DEC128_MIN__=1E-6143DL __DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL __DEC32_EPSILON__=1E-6DF __DEC32_MANT_DIG__=7 __DEC32_MAX_EXP__=97 __DEC32_MAX__=9.999999E96DF __DEC32_MIN_EXP__=(-94) __DEC32_MIN__=1E-95DF __DEC32_SUBNORMAL_MIN__=0.000001E-95DF __DEC64_EPSILON__=1E-15DD __DEC64_MANT_DIG__=16 __DEC64_MAX_EXP__=385 __DEC64_MAX__=9.999999999999999E384DD __DEC64_MIN_EXP__=(-382) __DEC64_MIN__=1E-383DD __DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD __DECIMAL_DIG__=36 __DEC_EVAL_METHOD__=2 __ELF__=1 __FINITE_MATH_ONLY__=0 __FLOAT_WORD_ORDER__=1234 __FLT_DECIMAL_DIG__=9 __FLT_DENORM_MIN__=1.40129846432481707092372958328991613e-45F __FLT_DIG__=6 __FLT_EPSILON__=1.19209289550781250000000000000000000e-7F __FLT_EVAL_METHOD__=0 __FLT_HAS_DENORM__=1 __FLT_HAS_INFINITY__=1 __FLT_HAS_QUIET_NAN__=1 __FLT_MANT_DIG__=24 __FLT_MAX_10_EXP__=38 __FLT_MAX_EXP__=128 __FLT_MAX__=3.40282346638528859811704183484516925e+38F __FLT_MIN_10_EXP__=(-37) __FLT_MIN_EXP__=(-125) __FLT_MIN__=1.17549435082228750796873653722224568e-38F __FLT_RADIX__=2 __FP_FAST_FMA=1 __FP_FAST_FMAF=1 __GCC_ATOMIC_BOOL_LOCK_FREE=2 __GCC_ATOMIC_CHAR16_T_LOCK_FREE=2 __GCC_ATOMIC_CHAR32_T_LOCK_FREE=2 __GCC_ATOMIC_CHAR_LOCK_FREE=2 __GCC_ATOMIC_INT_LOCK_FREE=2 __GCC_ATOMIC_LLONG_LOCK_FREE=2 __GCC_ATOMIC_LONG_LOCK_FREE=2 __GCC_ATOMIC_POINTER_LOCK_FREE=2 __GCC_ATOMIC_SHORT_LOCK_FREE=2 __GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1 __GCC_ATOMIC_WCHAR_T_LOCK_FREE=2 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1 __GCC_IEC_559=2 __GCC_IEC_559_COMPLEX=2 __GNUC_MINOR__=4 __GNUC_PATCHLEVEL__=0 __GNUC_STDC_INLINE__=1 __GNUC__=5 __INT16_C=__INT16_C __INT16_MAX__=0x7fff __INT16_TYPE__=short\ int __INT32_C=__INT32_C __INT32_MAX__=0x7fffffff __INT32_TYPE__=int __INT64_C=__INT64_C __INT64_MAX__=0x7fffffffffffffffL __INT64_TYPE__=long\ int __INT8_C=__INT8_C __INT8_MAX__=0x7f __INT8_TYPE__=signed\ char __INTMAX_C=__INTMAX_C __INTMAX_MAX__=0x7fffffffffffffffL __INTMAX_TYPE__=long\ int __INTPTR_MAX__=0x7fffffffffffffffL __INTPTR_TYPE__=long\ int __INT_FAST16_MAX__=0x7fffffff __INT_FAST16_TYPE__=int __INT_FAST32_MAX__=0x7fffffff __INT_FAST32_TYPE__=int __INT_FAST64_MAX__=0x7fffffffffffffffL __INT_FAST64_TYPE__=long\ int __INT_FAST8_MAX__=0x7f __INT_FAST8_TYPE__=signed\ char __INT_LEAST16_MAX__=0x7fff __INT_LEAST16_TYPE__=short\ int __INT_LEAST32_MAX__=0x7fffffff __INT_LEAST32_TYPE__=int __INT_LEAST64_MAX__=0x7fffffffffffffffL __INT_LEAST64_TYPE__=long\ int __INT_LEAST8_MAX__=0x7f __INT_LEAST8_TYPE__=signed\ char __INT_MAX__=0x7fffffff __LDBL_DENORM_MIN__=6.47517511943802511092443895822764655e-4966L __LDBL_DIG__=33 __LDBL_EPSILON__=1.92592994438723585305597794258492732e-34L __LDBL_HAS_DENORM__=1 __LDBL_HAS_INFINITY__=1 __LDBL_HAS_QUIET_NAN__=1 __LDBL_MANT_DIG__=113 __LDBL_MAX_10_EXP__=4932 __LDBL_MAX_EXP__=16384 __LDBL_MAX__=1.18973149535723176508575932662800702e+4932L __LDBL_MIN_10_EXP__=(-4931) __LDBL_MIN_EXP__=(-16381) __LDBL_MIN__=3.36210314311209350626267781732175260e-4932L __LONG_LONG_MAX__=0x7fffffffffffffffLL __LONG_MAX__=0x7fffffffffffffffL __LP64__=1 __ORDER_BIG_ENDIAN__=4321 __ORDER_LITTLE_ENDIAN__=1234 __ORDER_PDP_ENDIAN__=3412 __PRAGMA_REDEFINE_EXTNAME=1 __PTRDIFF_MAX__=0x7fffffffffffffffL __PTRDIFF_TYPE__=long\ int __REGISTER_PREFIX__= __SCHAR_MAX__=0x7f __SHRT_MAX__=0x7fff __SIG_ATOMIC_MAX__=0x7fffffff __SIG_ATOMIC_MIN__=(-0x7fffffff\ -\ 1) __SIG_ATOMIC_TYPE__=int __SIZEOF_DOUBLE__=8 __SIZEOF_FLOAT__=4 __SIZEOF_INT128__=16 __SIZEOF_INT__=4 __SIZEOF_LONG_DOUBLE__=16 __SIZEOF_LONG_LONG__=8 __SIZEOF_LONG__=8 __SIZEOF_POINTER__=8 __SIZEOF_PTRDIFF_T__=8 __SIZEOF_SHORT__=2 __SIZEOF_SIZE_T__=8 __SIZEOF_WCHAR_T__=4 __SIZEOF_WINT_T__=4 __SIZE_MAX__=0xffffffffffffffffUL __SIZE_TYPE__=long\ unsigned\ int __STDC_HOSTED__=1 __STDC_IEC_559__=1 __STDC_ISO_10646__=201206L __STDC_UTF_16__=1 __STDC_UTF_32__=1 __STDC__=1 __UINT16_C=__UINT16_C __UINT16_MAX__=0xffff __UINT16_TYPE__=short\ unsigned\ int __UINT32_C=__UINT32_C __UINT32_MAX__=0xffffffffU __UINT32_TYPE__=unsigned\ int __UINT64_C=__UINT64_C __UINT64_MAX__=0xffffffffffffffffUL __UINT64_TYPE__=long\ unsigned\ int __UINT8_C=__UINT8_C __UINT8_MAX__=0xff __UINT8_TYPE__=unsigned\ char __UINTMAX_C=__UINTMAX_C __UINTMAX_MAX__=0xffffffffffffffffUL __UINTMAX_TYPE__=long\ unsigned\ int __UINTPTR_MAX__=0xffffffffffffffffUL __UINTPTR_TYPE__=long\ unsigned\ int __UINT_FAST16_MAX__=0xffffffffU __UINT_FAST16_TYPE__=unsigned\ int __UINT_FAST32_MAX__=0xffffffffU __UINT_FAST32_TYPE__=unsigned\ int __UINT_FAST64_MAX__=0xffffffffffffffffUL __UINT_FAST64_TYPE__=long\ unsigned\ int __UINT_FAST8_MAX__=0xff __UINT_FAST8_TYPE__=unsigned\ char __UINT_LEAST16_MAX__=0xffff __UINT_LEAST16_TYPE__=short\ unsigned\ int __UINT_LEAST32_MAX__=0xffffffffU __UINT_LEAST32_TYPE__=unsigned\ int __UINT_LEAST64_MAX__=0xffffffffffffffffUL __UINT_LEAST64_TYPE__=long\ unsigned\ int __UINT_LEAST8_MAX__=0xff __UINT_LEAST8_TYPE__=unsigned\ char __USER_LABEL_PREFIX__= __WCHAR_MAX__=0xffffffffU __WCHAR_MIN__=0U __WCHAR_TYPE__=unsigned\ int __WINT_MAX__=0xffffffffU __WINT_MIN__=0U __WINT_TYPE__=unsigned\ int __aarch64__=1 __linux=1 __linux__=1 __unix=1 __unix__=1 linux=1 unix=1'
+d_casti32='define'
+d_double_style_ieee='define'
+d_modflproto='define'
+doublekind='3'
+fpossize='16'
+longdblkind='1'
+need_va_copy='undef'
+quadkind='2'
+
+owrt:sig_count='64'
+owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS'
+owrt:sig_name_extra='IOT CLD POLL UNUSED'
+owrt:sig_num_extra='6 17 29 31'
# Set the version here
PERL_REVISION=5
PERL_VERSION=26
-PERL_SUBVERSION=1
+PERL_SUBVERSION=2
# (api_revison, api_version, api_subversion) = (revision, version, 0) usually
PERL_API_REVISION=5
---- a/pp.c
-+++ b/pp.c
-@@ -43,7 +43,7 @@ extern Pid_t getpid (void);
- * Some BSDs and Cygwin default to POSIX math instead of IEEE.
- * This switches them over to IEEE.
- */
--#if defined(LIBM_LIB_VERSION)
-+#if defined(LIBM_LIB_VERSION) && (defined(__GLIBC__) || defined(__UCLIBC__))
- _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
+--- a/perl.c
++++ b/perl.c
+@@ -286,7 +286,7 @@ perl_construct(pTHXx)
+ PL_localpatches = local_patches; /* For possible -v */
#endif
+-#if defined(LIBM_LIB_VERSION)
++#if defined(LIBM_LIB_VERSION) && (defined(__GLIBC__) || defined(__UCLIBC__))
+ /*
+ * Some BSDs and Cygwin default to POSIX math instead of IEEE.
+ * This switches them over to IEEE.
===================================================================
--- perl-5.26.1.orig/perl.c
+++ perl-5.26.1/perl.c
-@@ -1870,16 +1870,6 @@ S_Internals_V(pTHX_ CV *cv)
+@@ -1878,16 +1878,6 @@ S_Internals_V(pTHX_ CV *cv)
PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
sizeof(non_bincompat_options) - 1, SVs_TEMP));
--- a/Makefile.SH 2017-10-15 18:57:08.436234652 -0600
+++ b/Makefile.SH 2017-10-15 19:02:47.587658819 -0600
-@@ -327,7 +327,7 @@ PATH_SEP = $p_
+@@ -328,7 +328,7 @@ PATH_SEP = $p_
# Macros to invoke a copy of miniperl during the build. Targets which
# are built using these macros should depend on \$(MINIPERL_EXE)
MINIPERL_EXE = miniperl\$(EXE_EXT)
# Macros to invoke sort the MANIFEST during build
MANIFEST_SRT = MANIFEST.srt
-@@ -990,7 +990,7 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -991,7 +991,7 @@ NAMESPACEFLAGS = -force_flat_namespace
@$(RMS) miniperl.xok
$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
$(miniperl_objs) $(libs)
$(MINIPERL) -f write_buildcustomize.pl
!NO!SUBS!
;;
-@@ -1001,16 +1001,16 @@ lib/buildcustomize.pl: $& $(miniperl_obj
+@@ -1002,16 +1002,16 @@ lib/buildcustomize.pl: $& $(miniperl_obj
@\$(RMS) miniperl.xok
@\$(RMS) \$(MINIPERL_EXE)
\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
define perlmod/Configure
(cd $(if $(3),$(3),$(PKG_BUILD_DIR)); \
- PERL_MM_USE_DEFAULT=1 \
- $(2) \
- $(PERL_CMD) -MConfig -e '$$$${tied %Config::Config}{cpprun}="$(GNU_TARGET_NAME)-cpp -E"; unshift(@INC, "."); unless (defined (do "./Makefile.PL")) { if ($$$$@) { die "couldn\047t parse Makefile.PL: $$$$@"; } elsif ($$$$!) { die "Could\047t run Makefile.PL: $$$$!"; } }; die "No Makefile generated!" unless -f "Makefile";' \
+ (echo -e 'use Config;\n\n$$$${tied %Config::Config}{cpprun}="$(GNU_TARGET_NAME)-cpp -E";\n' ; cat Makefile.PL) | \
+ PERL_MM_USE_DEFAULT=1 \
+ $(2) \
+ $(PERL_CMD) -I. -- - \
$(1) \
AR=ar \
CC=$(GNU_TARGET_NAME)-gcc \
INSTALLVENDORMAN3DIR=" " \
LINKTYPE=dynamic \
DESTDIR=$(PKG_INSTALL_DIR) \
- );
- sed 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/!' -i $(if $(3),$(3),$(PKG_BUILD_DIR))/Makefile
+ )
+ sed -i -e 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/!' $(if $(3),$(3),$(PKG_BUILD_DIR))/Makefile
endef
define perlmod/Compile
PECL_LONGNAME:=Extended HTTP Support
PKG_VERSION:=3.1.0
-PKG_RELEASE:=4
+PKG_RELEASE:=5
PKG_HASH:=e3de67b156e7d5f6c2e5eb1e2b5f0acceb7004f1260d68c9f8b2c0f9629aabf0
PKG_NAME:=php7-pecl-http
--with-http-libevent-dir="$(STAGING_DIR)/usr" \
--with-http-libidn-dir="$(STAGING_DIR)/usr"
-$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+icu +libcurl +librt +libevent2 +libidn +php7-mod-hash +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30))
+$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+icu +libcurl +librt +libevent2 +PACKAGE_libidn:libidn +libidn2 +php7-mod-hash +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30))
$(eval $(call BuildPackage,$(PKG_NAME)))
--- /dev/null
+From 8158548a80733b3af9539356b47527d960a13287 Mon Sep 17 00:00:00 2001
+From: Michael Wallner <mike@php.net>
+Date: Thu, 1 Feb 2018 14:36:09 +0100
+Subject: [PATCH] fix #73
+
+include idna.h prior idn2.h to ensure INDA_H is defined and libidn2 does
+not try to define the idna compat layer
+---
+ src/php_http.c | 6 +++---
+ src/php_http_url.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/php_http.c b/src/php_http.c
+index 207c248..bc9166a 100644
+--- a/src/php_http.c
++++ b/src/php_http.c
+@@ -31,12 +31,12 @@
+ #if PHP_HTTP_HAVE_LIBICU
+ # include <unicode/uversion.h>
+ #endif
+-#if PHP_HTTP_HAVE_LIBIDN2
+-# include <idn2.h>
+-#endif
+ #if PHP_HTTP_HAVE_LIBIDN
+ # include <idna.h>
+ #endif
++#if PHP_HTTP_HAVE_LIBIDN2
++# include <idn2.h>
++#endif
+ #if PHP_HTTP_HAVE_LIBIDNKIT2 || PHP_HTTP_HAVE_LIBIDNKIT
+ #include "idn/version.h"
+ #endif
+diff --git a/src/php_http_url.c b/src/php_http_url.c
+index 029e6a8..361e61c 100644
+--- a/src/php_http_url.c
++++ b/src/php_http_url.c
+@@ -12,12 +12,12 @@
+
+ #include "php_http_api.h"
+
+-#if PHP_HTTP_HAVE_LIBIDN2
+-# include <idn2.h>
+-#endif
+ #if PHP_HTTP_HAVE_LIBIDN
+ # include <idna.h>
+ #endif
++#if PHP_HTTP_HAVE_LIBIDN2
++# include <idn2.h>
++#endif
+ #if PHP_HTTP_HAVE_LIBICU
+ # include <unicode/uidna.h>
+ #endif
+--
+2.7.4
+
PECL_LONGNAME:=Libevent - event notification
PKG_NAME:=php7-pecl-$(PECL_NAME)
-PKG_VERSION=2016-08-30-$(PKG_SOURCE_VERSION)
+PKG_VERSION=2017-03-24-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/expressif/pecl-event-libevent.git
-PKG_SOURCE_VERSION:=9e72744ce6224beafc7b54ce2a3a990f1c552a5a
+PKG_SOURCE_VERSION:=5a726cee95ef9760fe81a60e595e87655f324594
PKG_SOURCE_SUBDIR:=$(PECL_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PECL_NAME)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=b81f02ef7f990f4ce3f859e22a85b7430188fc6f1395cd8fba82ef237ba62d8b
+PKG_MIRROR_HASH:=8d6ef4e5f496cfe6aa927d4a8c886041c1aec04220f1a3670c084faa2cc01fe1
PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
PECL_NAME:=propro
PECL_LONGNAME:=Property proxy
-PKG_VERSION:=2.0.1
-PKG_RELEASE:=2
-PKG_HASH:=ce136875650e22d28804a41a62a5325fff85318e559626d63c5b8875fb2e4529
+PKG_VERSION:=2.1.0
+PKG_RELEASE:=1
+PKG_HASH:=7bba0653d90cd8f61816e13ac6c0f7102b4a16dc4c4e966095a121eeb4ae8271
PKG_NAME:=php7-pecl-propro
PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
include $(TOPDIR)/rules.mk
PKG_NAME:=php
-PKG_VERSION:=7.2.1
-PKG_RELEASE:=1
+PKG_VERSION:=7.2.5
+PKG_RELEASE:=2
PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://www.php.net/distributions/
-PKG_HASH:=6c6cf82fda6660ed963821eb0525214bb3547e8e29f447b9c15b2d8e6efd8822
+PKG_HASH:=af70a33b3f7a51510467199b39af151333fbbe4cc21923bad9c7cf64268cddb2
PKG_FIXUP:=libtool autoreconf
PKG_BUILD_PARALLEL:=1
--with-config-file-scan-dir=/etc/php7 \
--disable-short-tags \
\
+ --without-valgrind \
+ --with-pcre-regex="$(STAGING_DIR)/usr" \
--with-zlib="$(STAGING_DIR)/usr" \
--with-zlib-dir="$(STAGING_DIR)/usr"
php_cv_cc_rpath="no" \
iconv_impl_name="gnu_libiconv" \
ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
- ac_cv_u8t_decompose=yes \
- ac_cv_enable_valgrind_check=no \
+ ac_cv_u8t_decompose=yes
define Package/php7/conffiles
/etc/php.ini
sapi/phpdbg/phpdbg.c | 4 +---
6 files changed, 10 insertions(+), 22 deletions(-)
-diff --git a/ext/standard/info.c b/ext/standard/info.c
-index e74d6b4..883fbdf 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
-@@ -865,7 +865,6 @@ PHPAPI void php_print_info(int flag)
+@@ -830,7 +830,6 @@ PHPAPI void php_print_info(int flag)
php_info_print_box_end();
php_info_print_table_start();
php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
#ifdef COMPILER
php_info_print_table_row(2, "Compiler", COMPILER);
#endif
-diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
-index f286b1a..fba92b8 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
-@@ -59,18 +59,9 @@ if test "$PHP_APXS2" != "no"; then
- APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
+@@ -67,18 +67,9 @@ if test "$PHP_APXS2" != "no"; then
+ fi
APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
- if test -z `$APXS -q SYSCONFDIR`; then
case $host_alias in
*aix*)
-diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
-index 0b6deb1..bb9014a 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
-@@ -2342,9 +2342,9 @@ consult the installation file that came with this distribution, or visit \n\
+@@ -2427,9 +2427,9 @@ consult the installation file that came
SG(request_info).no_headers = 1;
}
#if ZEND_DEBUG
-- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#else
-- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#endif
php_request_shutdown((void *) 0);
fcgi_shutdown();
-diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
-index dc92045..bb28364 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
-@@ -690,8 +690,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
+@@ -697,8 +697,8 @@ static int do_cli(int argc, char **argv)
goto out;
case 'v': /* show php version & quit */
-- php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2017 The PHP Group\n%s",
+- php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2018 The PHP Group\n%s",
- PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
-+ php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2017 The PHP Group\n%s",
++ php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2018 The PHP Group\n%s",
+ PHP_VERSION, cli_sapi_module.name,
#if ZTS
"ZTS "
#else
-diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
-index 6768113..545c52e 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
-@@ -1756,9 +1756,9 @@ int main(int argc, char *argv[])
+@@ -1755,9 +1755,9 @@ int main(int argc, char *argv[])
SG(request_info).no_headers = 1;
#if ZEND_DEBUG
-- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#else
-- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#endif
php_request_shutdown((void *) 0);
fcgi_shutdown();
-diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
-index b47c7c8..ab94bba 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
-@@ -1699,10 +1699,8 @@ phpdbg_main:
+@@ -1697,10 +1697,8 @@ phpdbg_main:
phpdbg_do_help_cmd(exec);
} else if (show_version) {
phpdbg_out(
-- "phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2017 The PHP Group\n%s",
-+ "phpdbg %s\nPHP %s, Copyright (c) 1997-2017 The PHP Group\n%s",
+- "phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2018 The PHP Group\n%s",
++ "phpdbg %s\nPHP %s, Copyright (c) 1997-2018 The PHP Group\n%s",
PHPDBG_VERSION,
- __DATE__,
- __TIME__,
-Index: php-7.1.12/ext/opcache/ZendAccelerator.c
-===================================================================
---- php-7.1.12.orig/ext/opcache/ZendAccelerator.c
-+++ php-7.1.12/ext/opcache/ZendAccelerator.c
-@@ -2604,11 +2604,6 @@ static void accel_gen_system_id(void)
+--- a/ext/opcache/ZendAccelerator.c
++++ b/ext/opcache/ZendAccelerator.c
+@@ -2456,11 +2456,6 @@ static void accel_gen_system_id(void)
PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
PHP_MD5Update(&context, ZEND_EXTENSION_BUILD_ID, sizeof(ZEND_EXTENSION_BUILD_ID)-1);
PHP_MD5Update(&context, ZEND_BIN_ID, sizeof(ZEND_BIN_ID)-1);
PHP_MD5Final(digest, &context);
for (i = 0; i < 16; i++) {
c = digest[i] >> 4;
-Index: php-7.1.12/sapi/litespeed/lsapi_main.c
-===================================================================
---- php-7.1.12.orig/sapi/litespeed/lsapi_main.c
-+++ php-7.1.12/sapi/litespeed/lsapi_main.c
-@@ -1036,9 +1036,9 @@ static int cli_main( int argc, char * ar
+--- a/sapi/litespeed/lsapi_main.c
++++ b/sapi/litespeed/lsapi_main.c
+@@ -1034,9 +1034,9 @@ static int cli_main( int argc, char * ar
case 'v':
if (php_request_startup() != FAILURE) {
#if ZEND_DEBUG
-- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#else
-- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+ php_printf("PHP %s (%s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2018 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
#endif
#ifdef PHP_OUTPUT_NEWAPI
php_output_end_all();
+++ /dev/null
---- a/acinclude.m4 2017-11-28 10:22:53.000000000 +0100
-+++ b/acinclude.m4 2017-12-22 16:28:09.361331754 +0100
-@@ -3227,20 +3227,26 @@
-
- dnl PHP_CHECK_VALGRIND
- AC_DEFUN([PHP_CHECK_VALGRIND], [
-- AC_MSG_CHECKING([for valgrind])
-+ AC_CACHE_CHECK(whether to enable the check for valgrind support,ac_cv_enable_valgrind_check,[
-+ ac_cv_enable_valgrind_check=yes
-+ ])
-
-- SEARCH_PATH="/usr/local /usr"
-- SEARCH_FOR="/include/valgrind/valgrind.h"
-- for i in $SEARCH_PATH ; do
-- if test -r $i/$SEARCH_FOR; then
-- VALGRIND_DIR=$i
-- fi
-- done
-+ if test "$ac_cv_enable_valgrind_check" = "yes"; then
-+ AC_MSG_CHECKING([for valgrind])
-+
-+ SEARCH_PATH="/usr/local /usr"
-+ SEARCH_FOR="/include/valgrind/valgrind.h"
-+ for i in $SEARCH_PATH ; do
-+ if test -r $i/$SEARCH_FOR; then
-+ VALGRIND_DIR=$i
-+ fi
-+ done
-
-- if test -z "$VALGRIND_DIR"; then
-- AC_MSG_RESULT([not found])
-- else
-- AC_MSG_RESULT(found in $VALGRIND_DIR)
-- AC_DEFINE(HAVE_VALGRIND, 1, [ ])
-+ if test -z "$VALGRIND_DIR"; then
-+ AC_MSG_RESULT([not found])
-+ else
-+ AC_MSG_RESULT(found in $VALGRIND_DIR)
-+ AC_DEFINE(HAVE_VALGRIND, 1, [ ])
-+ fi
- fi
- ])
--- /dev/null
+commit 31e53f07c26e5ac75ec2c2d99497439323dbdaf7
+Author: Philip Prindeville <philipp@redfish-solutions.com>
+Date: Wed Jan 24 18:47:19 2018 -0700
+
+ Be consistent in clearing out in php_iconv_string()
+
+ Also, don't bother checking returned point in error case since it
+ will always be NULL (and not require free()ing, obviously).
+
+diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
+index 35dafd4..4289242 100644
+--- a/ext/iconv/iconv.c
++++ b/ext/iconv/iconv.c
+@@ -559,6 +559,8 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
+ size_t result;
+ zend_string *ret, *out_buffer;
+
++ *out = NULL;
++
+ /*
+ This is not the right way to get output size...
+ This is not space efficient for large text.
+
+commit 3763c8f1645983b5abc37c60597e1ecc1bf89019
+Author: Philip Prindeville <philipp@redfish-solutions.com>
+Date: Thu Jan 25 14:18:00 2018 -0700
+
+ Always free out_buf in php_iconv_string()
+
+diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
+index 4289242..807bb14 100644
+--- a/ext/iconv/iconv.c
++++ b/ext/iconv/iconv.c
+@@ -697,6 +697,7 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
+ iconv_close(cd);
+
+ if (result == (size_t)(-1)) {
++ zend_string_free(out_buf);
+ switch (errno) {
+ case EINVAL:
+ retval = PHP_ICONV_ERR_ILLEGAL_CHAR;
+@@ -713,7 +714,6 @@ PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
+
+ default:
+ /* other error */
+- zend_string_free(out_buf);
+ return PHP_ICONV_ERR_UNKNOWN;
+ }
+ }
+@@ -986,9 +986,6 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
+ err = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc);
+
+ if (err != PHP_ICONV_ERR_SUCCESS) {
+- if (ndl_buf != NULL) {
+- zend_string_free(ndl_buf);
+- }
+ return err;
+ }
+
+@@ -2465,9 +2462,6 @@ PHP_NAMED_FUNCTION(php_if_iconv)
+ if (err == PHP_ICONV_ERR_SUCCESS && out_buffer != NULL) {
+ RETVAL_STR(out_buffer);
+ } else {
+- if (out_buffer != NULL) {
+- zend_string_free(out_buffer);
+- }
+ RETURN_FALSE;
+ }
+ }
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-flask
SECTION:=lang
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-jinja2
SECTION:=lang
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-markupsafe
SECTION:=lang
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-werkzeug
SECTION:=lang
PKG_HASH:=84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/chardet
SUBMENU:=Python
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-click
SECTION:=lang
PKG_HASH:=6a4d9aea683b4c224d97ab8ee11ad2d29a37072c0c6c509896dd9857466fb261
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-appconf
SUBMENU:=Python
PKG_HASH:=9616570e5b08e92fa9eadc7a1b1b49639cce07ef392fc27c74230ab08075b30f
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-compressor
SUBMENU:=Python
PKG_HASH:=6eec9f3ac4e5657b93e64f3379181d1e727088df10dd34f0398cd12119b9f0b0
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-constance
SUBMENU:=Python
PKG_HASH:=6c0afd5554739365b55d86e285cf966cc3a45682fff963463364ea1f6511ca3e
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-jsonfield
SUBMENU:=Python
PKG_HASH:=61e3ba7f6df82d8df9e6be3a8c55ef589eb3bf926c3d25d2b7949b07eae78354
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-picklefield
SUBMENU:=Python
PKG_HASH:=8d691b2e53ba8121d770ce448f05568874cf78a3cf63215918ad49536db5e76a
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-postoffice
SUBMENU:=Python
PKG_HASH:=305b2c6564ca46d3b558ba21110ed717135c467adf1a6dfd192bd85f4bb04d50
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-restframework
SUBMENU:=Python
#
-# Copyright (C) 2007-2017 OpenWrt.org
+# Copyright (C) 2007-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=django-statici18n
-PKG_VERSION:=1.4.0
+PKG_VERSION:=1.6.1
PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://pypi.python.org/packages/29/4d/fd9ba0e9b86c05714d9bc945d26376b331899d38c9b0666c7b38f3f26686/
-PKG_HASH:=3cb5334d42cfabda49c9c0efb1c24f5663e318ed34b3a34fada5195232f75f65
+PKG_SOURCE_URL:=https://pypi.python.org/packages/0a/24/1bed254529fc492ee5daf4cba18cf188b059866049889ecf1f178f25a2c2/
+PKG_HASH:=47d30939d52bcbbf1cbfe56b786bc2f2ea874266a8315cb027c061f320c4e2f6
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django-statici18n
SUBMENU:=Python
PKG_MIRROR_HASH:=c82c2cc338ae46ba8572d9960fc98dca932edc43a00f011fed102810a86185ae
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/django
SUBMENU:=Python
PKG_HASH:=614d9722d572f6246302c4491846d2c393c199cfa4edc9af593437691683335b
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/et_xmlfile
SUBMENU:=Python
PKG_HASH:=4bad317a5fc1ce3d4fe5e9b6d846ec38a8023e16876785d4f88102f2c8097dd9
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/flup
SUBMENU:=Python
PKG_HASH:=eee1169f0ca667be05db3351a0960765620dad53f53434262ff8901b68a1b622
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/gunicorn
SUBMENU:=Python
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-itsdangerous
SECTION:=lang
PKG_HASH:=b760160f8dc8cc51d17875c6b663fafe64be699e10ce34b6a95184b5aa0fdc9e
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/jdcal
SUBMENU:=Python
PKG_HASH:=3b42ece7933b46b2128f8d4111c57c80fb5aa46f4d16e7f83281f169e7398ba7
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/openpyxl
SUBMENU:=Python
PKG_MIRROR_HASH:=e7c36bcf89614337d9abc4d07780da0b346a745be7a9aa55b398fa427549273c
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/pillow
SUBMENU:=Python
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
define Package/python-pyodbc/Default
SECTION:=lang
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-asn1crypto-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
PKG_NAME:=python-attrs
PKG_VERSION:=17.4.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=attrs-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/8b/0b/a06cfcb69d0cb004fde8bc6f0fd192d96d565d1b8aa2829f0f20adb796e5
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-attrs))
$(eval $(call BuildPackage,python-attrs))
+$(eval $(call BuildPackage,python-attrs-src))
$(eval $(call Py3Package,python3-attrs))
$(eval $(call BuildPackage,python3-attrs))
+$(eval $(call BuildPackage,python3-attrs-src))
--- /dev/null
+#
+# Copyright (C) 2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-automat
+PKG_VERSION:=0.6.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=Automat-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/A/Automat
+PKG_HASH:=3c1fd04ecf08ac87b4dd3feae409542e9bf7827257097b2b6ed5692f69d6f6a8
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-automat-$(PKG_VERSION)
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-automat/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/glyph/Automat
+endef
+
+define Package/python-automat
+$(call Package/python-automat/Default)
+ TITLE:=Concise, idiomatic finite-state automata
+ DEPENDS:= \
+ +PACKAGE_python-automat:python-light \
+ +PACKAGE_python-automat:python-attrs \
+ +PACKAGE_python-automat:python-six
+ VARIANT:=python
+endef
+
+define Package/python3-automat
+$(call Package/python-automat/Default)
+ TITLE:=Concise, idiomatic finite-state automata
+ DEPENDS:= \
+ +PACKAGE_python3-automat:python3-light \
+ +PACKAGE_python3-automat:python3-attrs \
+ +PACKAGE_python3-automat:python3-six
+ VARIANT:=python3
+endef
+
+define Package/python-automat/description
+Automat is a library for concise, idiomatic Python expression of
+finite-state automata (particularly deterministic finite-state
+transducers).
+endef
+
+define Package/python3-automat/description
+$(call Package/python-automat/description)
+.
+(Variant for Python3)
+endef
+
+define PyPackage/python-automat/filespec
++|$(PYTHON_PKG_DIR)
+-|$(PYTHON_PKG_DIR)/automat/_visualize.py
+endef
+
+define Py3Package/python3-automat/filespec
++|$(PYTHON3_PKG_DIR)
+-|$(PYTHON3_PKG_DIR)/automat/_visualize.py
+endef
+
+define PyBuild/Compile
+ $(call Build/Compile/PyMod,, \
+ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
+ PKG_VERSION="$(PKG_VERSION)" \
+ )
+endef
+
+define Py3Build/Compile
+ $(call Build/Compile/Py3Mod,, \
+ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
+ PKG_VERSION="$(PKG_VERSION)" \
+ )
+endef
+
+$(eval $(call PyPackage,python-automat))
+$(eval $(call BuildPackage,python-automat))
+$(eval $(call BuildPackage,python-automat-src))
+
+$(eval $(call Py3Package,python3-automat))
+$(eval $(call BuildPackage,python3-automat))
+$(eval $(call BuildPackage,python3-automat-src))
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -2,6 +2,7 @@
+ Setup file for automat
+ """
+
++import os
+ from setuptools import setup, find_packages
+
+ try:
+@@ -14,7 +15,7 @@ except(IOError, ImportError):
+
+ setup(
+ name='Automat',
+- use_scm_version=True,
++ version=os.getenv('PKG_VERSION'),
+ url='https://github.com/glyph/Automat',
+ description="""
+ Self-service finite-state machines for the programmer on the go.
+@@ -22,10 +23,6 @@ setup(
+ long_description=long_description,
+ packages=find_packages(exclude=[]),
+ package_dir={'automat': 'automat'},
+- setup_requires=[
+- 'setuptools-scm',
+- 'm2r',
+- ],
+ install_requires=[
+ "attrs",
+ "six",
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -27,15 +27,6 @@ setup(
+ "attrs",
+ "six",
+ ],
+- extras_require={
+- "visualize": ["graphviz>0.5.1",
+- "Twisted>=16.1.1"],
+- },
+- entry_points={
+- "console_scripts": [
+- "automat-visualize = automat._visualize:tool"
+- ],
+- },
+ author='Glyph',
+ author_email='glyph@twistedmatrix.com',
+ include_package_data=True,
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -21,7 +21,7 @@ setup(
+ Self-service finite-state machines for the programmer on the go.
+ """.strip(),
+ long_description=long_description,
+- packages=find_packages(exclude=[]),
++ packages=find_packages(exclude=["*._test", "*._test.*"]),
+ package_dir={'automat': 'automat'},
+ install_requires=[
+ "attrs",
+@@ -30,6 +30,7 @@ setup(
+ author='Glyph',
+ author_email='glyph@twistedmatrix.com',
+ include_package_data=True,
++ exclude_package_data={'':['_test/*']},
+ license="MIT",
+ keywords='fsm finite state machine automata',
+ )
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=python-cffi
-PKG_VERSION:=1.11.2
-PKG_RELEASE:=2
+PKG_VERSION:=1.11.4
+PKG_RELEASE:=1
PKG_SOURCE:=cffi-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://pypi.python.org/packages/c9/70/89b68b6600d479034276fed316e14b9107d50a62f5627da37fafe083fde3
-PKG_HASH:=ab87dd91c0c4073758d07334c1e5f712ce8fe48f007b86f8238773963ee700a6
+PKG_SOURCE_URL:=https://pypi.python.org/packages/10/f7/3b302ff34045f25065091d40e074479d6893882faef135c96f181a57ed06
+PKG_HASH:=df9083a992b17a28cd4251a3f5c879e0198bb26c9e808c4647e0a18739f1d11d
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-cffi-$(PKG_VERSION)
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="cffi==$(PKG_VERSION)"
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-cffi))
$(eval $(call BuildPackage,python-cffi))
+$(eval $(call BuildPackage,python-cffi-src))
$(eval $(call Py3Package,python3-cffi))
$(eval $(call BuildPackage,python3-cffi))
+$(eval $(call BuildPackage,python3-cffi-src))
--- /dev/null
+#
+# Copyright (C) 2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-constantly
+PKG_VERSION:=15.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=constantly-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/c/constantly
+PKG_HASH:=586372eb92059873e29eba4f9dec8381541b4d3834660707faf8ba59146dfc35
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-constantly-$(PKG_VERSION)
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-constantly/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/twisted/constantly
+endef
+
+define Package/python-constantly
+$(call Package/python-constantly/Default)
+ TITLE:=Symbolic constants in Python
+ DEPENDS:=+PACKAGE_python-constantly:python-light
+ VARIANT:=python
+endef
+
+define Package/python3-constantly
+$(call Package/python-constantly/Default)
+ TITLE:=Symbolic constants in Python
+ DEPENDS:=+PACKAGE_python3-constantly:python3-light
+ VARIANT:=python3
+endef
+
+define Package/python-constantly/description
+A library that provides symbolic constant support. It includes
+collections and constants with text, numeric, and bit flag values.
+Originally twisted.python.constants from the Twisted project.
+endef
+
+define Package/python3-constantly/description
+$(call Package/python-constantly/description)
+.
+(Variant for Python3)
+endef
+
+$(eval $(call PyPackage,python-constantly))
+$(eval $(call BuildPackage,python-constantly))
+$(eval $(call BuildPackage,python-constantly-src))
+
+$(eval $(call Py3Package,python3-constantly))
+$(eval $(call BuildPackage,python3-constantly))
+$(eval $(call BuildPackage,python3-constantly-src))
PKG_BUILD_DEPENDS:=python
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-crcmod
SUBMENU:=Python
#
-# Copyright (C) 2009-2015 OpenWrt.org
+# Copyright (C) 2009-2015, 2017-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
-PKG_NAME:=pycrypto
+PKG_NAME:=python-crypto
PKG_VERSION:=2.6.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=pycrypto-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/
PKG_HASH:=f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-crypto-$(PKG_VERSION)
+
PKG_LICENSE:=Public Domain
PKG_LICENSE_FILES:=COPYRIGHT
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-crypto/Default
+ SECTION:=lang-python
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=http://www.pycrypto.org/
+endef
define Package/python-crypto
- SECTION:=lang-python
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-crypto
- URL:=http://www.pycrypto.org/
- DEPENDS:=+python +libgmp
+$(call Package/python-crypto/Default)
+ TITLE:=python-crypto
+ DEPENDS:=+libgmp +PACKAGE_python-crypto:python
+ VARIANT:=python
+endef
+
+define Package/python3-crypto
+$(call Package/python-crypto/Default)
+ TITLE:=python3-crypto
+ DEPENDS:=+libgmp +PACKAGE_python3-crypto:python3
+ VARIANT:=python3
endef
define Package/python-crypto/description
and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.).
endef
-define Build/Compile
+define Package/python3-crypto/description
+$(call Package/python-crypto/description)
+.
+(Variant for Python3)
+endef
+
+define PyBuild/Compile
$(call Build/Compile/PyMod,,\
install --prefix=/usr --root=$(PKG_INSTALL_DIR),\
CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)" \
)
endef
-define Package/python-crypto/install
- $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
- $(CP) \
- $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
- $(1)$(PYTHON_PKG_DIR)/
+define Py3Build/Compile
+ $(call Build/Compile/Py3Mod,,\
+ install --prefix=/usr --root=$(PKG_INSTALL_DIR),\
+ CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)" \
+ )
endef
$(eval $(call PyPackage,python-crypto))
$(eval $(call BuildPackage,python-crypto))
+$(eval $(call BuildPackage,python-crypto-src))
+
+$(eval $(call Py3Package,python3-crypto))
+$(eval $(call BuildPackage,python3-crypto))
+$(eval $(call BuildPackage,python3-crypto-src))
--- a/setup.py
+++ b/setup.py
-@@ -100,6 +100,10 @@
+@@ -100,6 +100,10 @@ def PrintErr(*args, **kwd):
w(kwd.get("end", "\n"))
def endianness_macro():
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -357,16 +357,6 @@ kw = {'name':"pycrypto",
+ "Crypto.Random",
+ "Crypto.Random.Fortuna",
+ "Crypto.Random.OSRNG",
+- "Crypto.SelfTest",
+- "Crypto.SelfTest.Cipher",
+- "Crypto.SelfTest.Hash",
+- "Crypto.SelfTest.Protocol",
+- "Crypto.SelfTest.PublicKey",
+- "Crypto.SelfTest.Random",
+- "Crypto.SelfTest.Random.Fortuna",
+- "Crypto.SelfTest.Random.OSRNG",
+- "Crypto.SelfTest.Util",
+- "Crypto.SelfTest.Signature",
+ "Crypto.Protocol",
+ "Crypto.PublicKey",
+ "Crypto.Signature"],
PKG_NAME:=python-cryptography
PKG_VERSION:=2.1.4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=cryptography-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/78/c5/7188f15a92413096c93053d5304718e1f6ba88b818357d05d19250ebff85
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-cryptography-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-cryptography))
$(eval $(call BuildPackage,python-cryptography))
+$(eval $(call BuildPackage,python-cryptography-src))
+
$(eval $(call Py3Package,python3-cryptography))
$(eval $(call BuildPackage,python3-cryptography))
+$(eval $(call BuildPackage,python3-cryptography-src))
PKG_HASH:=43231bf2bafde923a6d9bb79e2407342a5f3382c1ef0a3b2e491c6a4e50b91aa
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-curl
CATEGORY:=Languages
PKG_HASH:=891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-dateutil
SUBMENU:=Python
PKG_BUILD_DIR:=$(BUILD_DIR)/dnspython-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-dns
SECTION:=language-python
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-dpkt
SECTION:=language-python
PKG_BUILD_DEPENDS:=python
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-egenix-mx-base
SUBMENU:=Python
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
-PKG_NAME:=enum34
+PKG_NAME:=python-enum34
PKG_VERSION:=1.1.6
-PKG_RELEASE:=2
+PKG_RELEASE:=3
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=enum34-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876
PKG_HASH:=8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-enum34-$(PKG_VERSION)
+
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=enum/LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-enum34/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://pypi.python.org/pypi/enum34/
+endef
define Package/python-enum34
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-enum34
- URL:=https://pypi.python.org/pypi/enum34/
- DEPENDS:=+python-light
+$(call Package/python-enum34/Default)
+ TITLE:=python-enum34
+ DEPENDS:=+PACKAGE_python-enum34:python-light
+ VARIANT:=python
endef
define Package/python-enum34/description
-|$(PYTHON_PKG_DIR)/enum/test.py
endef
-define Build/Compile
- $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
-endef
-
$(eval $(call PyPackage,python-enum34))
$(eval $(call BuildPackage,python-enum34))
+$(eval $(call BuildPackage,python-enum34-src))
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-evdev-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE); mv -f $(PKG_BUILD_DIR)/gmpy2-$(PKG_VERSION)/* $(PKG_BUILD_DIR)
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
define Package/python-gnupg/Default
SECTION:=lang
--- /dev/null
+#
+# Copyright (C) 2015-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
+# if `python-package.mk` is included, this will already be included
+
+ifneq ($(__python_host_mk_inc),1)
+__python_host_mk_inc=1
+
+# For PYTHON_VERSION
+python_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
+include $(python_mk_path)python-version.mk
+
+HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
+HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
+HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
+
+HOST_PYTHON_PKG_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)/site-packages
+
+HOST_PYTHON_BIN:=$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)
+
+HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(HOST_PYTHON_PKG_DIR)
+
+define HostPython
+ if [ "$(strip $(3))" == "HOST" ]; then \
+ export PYTHONPATH="$(HOST_PYTHONPATH)"; \
+ export PYTHONDONTWRITEBYTECODE=0; \
+ else \
+ export PYTHONPATH="$(PYTHONPATH)"; \
+ export PYTHONDONTWRITEBYTECODE=1; \
+ export _python_sysroot="$(STAGING_DIR)"; \
+ export _python_prefix="/usr"; \
+ export _python_exec_prefix="/usr"; \
+ fi; \
+ export PYTHONOPTIMIZE=""; \
+ $(1) \
+ $(HOST_PYTHON_BIN) $(2);
+endef
+
+define host_python_settings
+ ARCH="$(HOST_ARCH)" \
+ CC="$(HOSTCC)" \
+ CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
+ CXX="$(HOSTCXX)" \
+ LD="$(HOSTCC)" \
+ LDSHARED="$(HOSTCC) -shared" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
+ LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
+ _PYTHON_HOST_PLATFORM=linux2
+endef
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPyRunHost
+ $(call HostPython, \
+ $(if $(1),$(1);) \
+ $(call host_python_settings) \
+ $(3) \
+ , \
+ $(2) \
+ , \
+ HOST \
+ )
+endef
+
+# Note: I shamelessly copied this from Yousong's logic (from python-packages);
+HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
+define host_python_pip_install
+ $(call host_python_settings) \
+ $(HOST_PYTHON_PIP) install \
+ --root=$(1) \
+ --prefix=$(2) \
+ --ignore-installed \
+ $(3)
+endef
+
+define host_python_pip_install_host
+$(call host_python_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/HostPyMod
+ $(call Build/Compile/HostPyRunHost, \
+ cd $(HOST_BUILD_DIR)/$(strip $(1)), \
+ ./setup.py $(2), \
+ $(3))
+endef
+
+endif # __python_host_mk_inc
--- /dev/null
+#
+# Copyright (C) 2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-hyperlink
+PKG_VERSION:=17.3.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=hyperlink-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/h/hyperlink
+PKG_HASH:=bc4ffdbde9bdad204d507bd8f554f16bba82dd356f6130cb16f41422909c33bc
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-hyperlink-$(PKG_VERSION)
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-hyperlink/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/python-hyper/hyperlink
+endef
+
+define Package/python-hyperlink
+$(call Package/python-hyperlink/Default)
+ TITLE:=Pure-Python immutable URLs
+ DEPENDS:=+PACKAGE_python-hyperlink:python-light
+ VARIANT:=python
+endef
+
+define Package/python3-hyperlink
+$(call Package/python-hyperlink/Default)
+ TITLE:=Pure-Python immutable URLs
+ DEPENDS:=+PACKAGE_python3-hyperlink:python3-light
+ VARIANT:=python3
+endef
+
+define Package/python-hyperlink/description
+Hyperlink provides a pure-Python implementation of immutable URLs. Based
+on RFC 3986 and 3987, the Hyperlink URL makes working with both URIs and
+IRIs easy.
+endef
+
+define Package/python3-hyperlink/description
+$(call Package/python-hyperlink/description)
+.
+(Variant for Python3)
+endef
+
+$(eval $(call PyPackage,python-hyperlink))
+$(eval $(call BuildPackage,python-hyperlink))
+$(eval $(call BuildPackage,python-hyperlink-src))
+
+$(eval $(call Py3Package,python3-hyperlink))
+$(eval $(call BuildPackage,python3-hyperlink))
+$(eval $(call BuildPackage,python3-hyperlink-src))
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -24,8 +24,9 @@ setup(name='hyperlink',
+ author=__author__,
+ author_email=__contact__,
+ url=__url__,
+- packages=['hyperlink', 'hyperlink.test'],
++ packages=['hyperlink'],
+ include_package_data=True,
++ exclude_package_data={'':['test/*']},
+ zip_safe=False,
+ license=__license__,
+ platforms='any',
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=python-idna
PKG_VERSION:=2.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=idna-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-idna-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-idna))
$(eval $(call BuildPackage,python-idna))
+$(eval $(call BuildPackage,python-idna-src))
+
$(eval $(call Py3Package,python3-idna))
$(eval $(call BuildPackage,python3-idna))
+$(eval $(call BuildPackage,python3-idna-src))
--- /dev/null
+#
+# Copyright (C) 2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-incremental
+PKG_VERSION:=17.5.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=incremental-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/i/incremental
+PKG_HASH:=7b751696aaf36eebfab537e458929e194460051ccad279c72b755a167eebd4b3
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-incremental-$(PKG_VERSION)
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-incremental/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/twisted/incremental
+endef
+
+define Package/python-incremental
+$(call Package/python-incremental/Default)
+ TITLE:=Versions your Python projects
+ DEPENDS:=+PACKAGE_python-incremental:python-light
+ VARIANT:=python
+endef
+
+define Package/python3-incremental
+$(call Package/python-incremental/Default)
+ TITLE:=Versions your Python projects
+ DEPENDS:=+PACKAGE_python3-incremental:python3-light
+ VARIANT:=python3
+endef
+
+define Package/python-incremental/description
+Incremental is a small library that versions your Python projects.
+endef
+
+define Package/python3-incremental/description
+$(call Package/python-incremental/description)
+.
+(Variant for Python3)
+endef
+
+$(eval $(call PyPackage,python-incremental))
+$(eval $(call BuildPackage,python-incremental))
+$(eval $(call BuildPackage,python-incremental-src))
+
+$(eval $(call Py3Package,python3-incremental))
+$(eval $(call BuildPackage,python3-incremental))
+$(eval $(call BuildPackage,python3-incremental-src))
--- /dev/null
+--- a/setup.py
++++ b/setup.py
+@@ -32,7 +32,7 @@ setup(
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
+ ],
+- packages=find_packages("src", exclude=("exampleproj",)),
++ packages=find_packages("src", exclude=("exampleproj", "*.tests", "*.tests.*")),
+ package_dir={"": "src"},
+ extras_require={
+ "scripts": [
include $(TOPDIR)/rules.mk
-PKG_NAME:=ipaddress
+PKG_NAME:=python-ipaddress
PKG_VERSION:=1.0.19
-PKG_RELEASE:=1
+PKG_RELEASE:=2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=ipaddress-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/f0/ba/860a4a3e283456d6b7e2ab39ce5cf11a3490ee1a363652ac50abf9f0f5df
PKG_HASH:=200d8686011d470b5e4de207d803445deee427455cd0cb7c982b68cf82524f81
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-ipaddress-$(PKG_VERSION)
+
PKG_LICENSE:=Python-2.0
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-ipaddress/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/phihag/ipaddress
+endef
define Package/python-ipaddress
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-ipaddress
- URL:=https://github.com/phihag/ipaddress
- DEPENDS:=+python-light
+$(call Package/python-ipaddress/Default)
+ TITLE:=python-ipaddress
+ DEPENDS:=+PACKAGE_python-ipaddress:python-light
+ VARIANT:=python
endef
define Package/python-ipaddress/description
Python 3.3+'s ipaddress for Python 2.6, 2.7, 3.2.
endef
-define Build/Compile
- $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
-endef
-
$(eval $(call PyPackage,python-ipaddress))
$(eval $(call BuildPackage,python-ipaddress))
+$(eval $(call BuildPackage,python-ipaddress-src))
PKG_HASH:=5810f1b5a9ae9255df99fb9c2dcab7352fed325687efda56c0faae1a82c5e3cb
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-ldap
SUBMENU:=Python
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
define Package/python-lxml/Default
SECTION:=lang
PKG_HASH:=811040b647e5d5686f84db415efd697e6250008b112b6909ba77ac059e140c74
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-mysql
SUBMENU:=Python
--- /dev/null
+#!/bin/sh
+set -e
+
+[ -z "$SOURCE_DATE_EPOCH" ] || {
+ PYTHONHASHSEED="$SOURCE_DATE_EPOCH"
+ export PYTHONHASHSEED
+}
+
+process_filespec() {
+ local src_dir="$1"
+ local dst_dir="$2"
+ local filespec="$3"
+ echo "$filespec" | (
+ IFS='|'
+ while read fop fspec fperm; do
+ local fop=`echo "$fop" | tr -d ' \t\n'`
+ if [ "$fop" = "+" ]; then
+ if [ ! -e "${src_dir}${fspec}" ]; then
+ echo "File not found '${src_dir}${fspec}'"
+ exit 1
+ fi
+ dpath=`dirname "$fspec"`
+ if [ -z "$fperm" ]; then
+ dperm=`stat -c "%a" ${src_dir}${dpath}`
+ fi
+ mkdir -p -m$dperm ${dst_dir}${dpath}
+ echo "copying: '$fspec'"
+ cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
+ if [ -n "$fperm" ]; then
+ chmod -R $fperm ${dst_dir}${fspec}
+ fi
+ elif [ "$fop" = "-" ]; then
+ echo "removing: '$fspec'"
+ rm -fR ${dst_dir}${fspec}
+ elif [ "$fop" = "=" ]; then
+ echo "setting permissions: '$fperm' on '$fspec'"
+ chmod -R $fperm ${dst_dir}${fspec}
+ fi
+ done
+ )
+}
+
+ver="$1"
+src_dir="$2"
+dst_dir="$3"
+python="$4"
+mode="$5"
+filespec="$6"
+
+process_filespec "$src_dir" "$dst_dir" "$filespec" || {
+ echo "process filespec error-ed"
+ exit 1
+}
+
+if [ "$mode" == "sources" ] ; then
+ # Copy only python source files
+ find $dst_dir -not -type d -not -name "*\.py" | xargs rm -f
+
+ # Delete empty folders (if the case)
+ if [ -d "$dst_dir/usr" ] ; then
+ find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
+ rmdir --ignore-fail-on-non-empty $dst_dir/usr
+ fi
+ exit 0
+fi
+
+legacy=
+[ "$ver" == "3" ] && legacy="-b"
+
+# XXX [So that you won't goof as I did]
+# Note: Yes, I tried to use the -O & -OO flags here.
+# However the generated byte-codes were not portable.
+# So, we just stuck to un-optimized byte-codes,
+# which is still way better/faster than running
+# Python sources all the time.
+$python -m compileall $legacy -d '/' $dst_dir || {
+ echo "python -m compileall err-ed"
+ exit 1
+}
+
+# Delete source files and pyc [ un-optimized bytecode files ]
+# We may want to make this optimization thing configurable later, but not sure atm
+find $dst_dir -type f -name "*\.py" | xargs rm -f
+
+# Delete empty folders (if the case)
+if [ -d "$dst_dir/usr" ] ; then
+ find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
+ rmdir --ignore-fail-on-non-empty $dst_dir/usr
+fi
+
+exit 0
--- /dev/null
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
+
+python_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
+include $(python_mk_path)python-host.mk
+
+PYTHON_DIR:=$(STAGING_DIR)/usr
+PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
+PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
+PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
+
+PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
+
+PYTHON:=python$(PYTHON_VERSION)
+
+PYTHONPATH:=$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
+
+# These configure args are needed in detection of path to Python header files
+# using autotools.
+CONFIGURE_ARGS += \
+ _python_sysroot="$(STAGING_DIR)" \
+ _python_prefix="/usr" \
+ _python_exec_prefix="/usr"
+
+PKG_USE_MIPS16:=0
+# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
+# flags are inherited from the Python base package (via sysconfig module)
+ifdef CONFIG_USE_MIPS16
+ TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
+endif
+
+define PyPackage
+
+ define Package/$(1)-src
+ $(call Package/$(1))
+ DEPENDS:=
+ TITLE+= (sources)
+ endef
+
+ define Package/$(1)-src/description
+ $(call Package/$(1)/description).
+ (Contains the Python sources for this package).
+ endef
+
+ # Add default PyPackage filespec none defined
+ ifndef PyPackage/$(1)/filespec
+ define PyPackage/$(1)/filespec
+ +|$(PYTHON_PKG_DIR)
+ endef
+ endif
+
+ ifndef PyPackage/$(1)/install
+ define PyPackage/$(1)/install
+ if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
+ $(INSTALL_DIR) $$(1)/usr/bin ; \
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
+ fi
+ endef
+ endif
+
+ ifndef Package/$(1)/install
+ $(call shexport,PyPackage/$(1)/filespec)
+
+ define Package/$(1)/install
+ $(call PyPackage/$(1)/install,$$(1))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+ $(SHELL) $(python_mk_path)python-package-install.sh "2" \
+ "$(PKG_INSTALL_DIR)" "$$(1)" \
+ "$(HOST_PYTHON_BIN)" "$$(2)" \
+ "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)"
+ endef
+
+ define Package/$(1)-src/install
+ $$(call Package/$(1)/install,$$(1),sources)
+ endef
+ endif # Package/$(1)/install
+endef
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPyRunTarget
+ $(call HostPython, \
+ $(if $(1),$(1);) \
+ CC="$(TARGET_CC)" \
+ CCSHARED="$(TARGET_CC) $(FPIC)" \
+ CXX="$(TARGET_CXX)" \
+ LD="$(TARGET_CC)" \
+ LDSHARED="$(TARGET_CC) -shared" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON_INC_DIR)" \
+ LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON_VERSION)" \
+ _PYTHON_HOST_PLATFORM=linux2 \
+ __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \
+ $(3) \
+ , \
+ $(2) \
+ )
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/PyMod
+ $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
+ $(call Build/Compile/HostPyRunTarget, \
+ cd $(PKG_BUILD_DIR)/$(strip $(1)), \
+ ./setup.py $(2), \
+ $(3))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+endef
+
+PYTHON_PKG_SETUP_ARGS:=--single-version-externally-managed
+PYTHON_PKG_SETUP_VARS:=
+
+define PyBuild/Compile/Default
+ $(foreach pkg,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
+ $(call host_python_pip_install_host,$(pkg))
+ )
+ $(call Build/Compile/PyMod,, \
+ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+ $(PYTHON_PKG_SETUP_ARGS), \
+ $(PYTHON_PKG_SETUP_VARS) \
+ )
+endef
+
+PyBuild/Compile=$(PyBuild/Compile/Default)
+
+ifeq ($(BUILD_VARIANT),python)
+define Build/Compile
+ $(call PyBuild/Compile)
+endef
+endif # python
PKG_BUILD_DEPENDS:=python python/host
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-packages
SUBMENU:=Python
PKG_NAME:=python-parsley
PKG_VERSION:=1.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=Parsley-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/source/P/Parsley
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-parsley))
$(eval $(call BuildPackage,python-parsley))
+$(eval $(call BuildPackage,python-parsley-src))
$(eval $(call Py3Package,python3-parsley))
$(eval $(call BuildPackage,python3-parsley))
+$(eval $(call BuildPackage,python3-parsley-src))
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-pcapy
SECTION:=language-python
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=python-ply
PKG_VERSION:=3.10
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=ply-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.dabeaz.com/ply
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-ply))
$(eval $(call BuildPackage,python-ply))
+$(eval $(call BuildPackage,python-ply-src))
$(eval $(call Py3Package,python3-ply))
$(eval $(call BuildPackage,python3-ply))
+$(eval $(call BuildPackage,python3-ply-src))
PKG_BUILD_DEPENDS:=python/host
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-psycopg2
SUBMENU:=Python
PKG_NAME:=python-pyasn1-modules
PKG_VERSION:=0.2.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=pyasn1-modules-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/ab/76/36ab0e099e6bd27ed95b70c2c86c326d3affa59b9b535c63a2f892ac9f45
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-pyasn1-modules-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-pyasn1-modules))
$(eval $(call BuildPackage,python-pyasn1-modules))
+$(eval $(call BuildPackage,python-pyasn1-modules-src))
+
$(eval $(call Py3Package,python3-pyasn1-modules))
$(eval $(call BuildPackage,python3-pyasn1-modules))
+$(eval $(call BuildPackage,python3-pyasn1-modules-src))
PKG_NAME:=python-pyasn1
PKG_VERSION:=0.4.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=pyasn1-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/eb/3d/b7d0fdf4a882e26674c68c20f40682491377c4db1439870f5b6f862f76ed
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-pyasn1-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-pyasn1))
$(eval $(call BuildPackage,python-pyasn1))
+$(eval $(call BuildPackage,python-pyasn1-src))
+
$(eval $(call Py3Package,python3-pyasn1))
$(eval $(call BuildPackage,python3-pyasn1))
+$(eval $(call BuildPackage,python3-pyasn1-src))
PKG_NAME:=python-pycparser
PKG_VERSION:=2.18
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=pycparser-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="ply==3.10"
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-pycparser))
$(eval $(call BuildPackage,python-pycparser))
+$(eval $(call BuildPackage,python-pycparser-src))
$(eval $(call Py3Package,python3-pycparser))
$(eval $(call BuildPackage,python3-pycparser))
+$(eval $(call BuildPackage,python3-pycparser-src))
PKG_NAME:=python-pyopenssl
PKG_VERSION:=17.5.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=pyOpenSSL-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/3b/15/a5d90ab1a41075e8f0fae334f13452549528f82142b3b9d0c9d86ab7178c
PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-pyopenssl-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-pyopenssl))
$(eval $(call BuildPackage,python-pyopenssl))
+$(eval $(call BuildPackage,python-pyopenssl-src))
+
$(eval $(call Py3Package,python3-pyopenssl))
$(eval $(call BuildPackage,python3-pyopenssl))
+$(eval $(call BuildPackage,python3-pyopenssl-src))
#
-# Copyright (C) 2015 OpenWrt.org
+# Copyright (C) 2015, 2017-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
-PKG_NAME:=pyptlib
+PKG_NAME:=python-pyptlib
PKG_VERSION:=0.0.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=pyptlib-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/source/p/pyptlib
PKG_HASH:=b98472e3d9e8f4689d3913ca8f89afa5e6cc5383dcd8686987606166f9dac607
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-pyptlib-$(PKG_VERSION)
+
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-pyptlib/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://pypi.python.org/pypi/pyptlib
+endef
define Package/python-pyptlib
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-pyptlib
- URL:=https://pypi.python.org/pypi/pyptlib
- DEPENDS:=+python-light
+$(call Package/python-pyptlib/Default)
+ TITLE:=python-pyptlib
+ DEPENDS:=+PACKAGE_python-pyptlib:python-light
+ VARIANT:=python
endef
define Package/python-pyptlib/description
specification for Tor
endef
-define Build/Compile
- $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
-endef
-
$(eval $(call PyPackage,python-pyptlib))
$(eval $(call BuildPackage,python-pyptlib))
+$(eval $(call BuildPackage,python-pyptlib-src))
PKG_BUILD_DEPENDS:=python
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-pyserial
SUBMENU:=Python
#
-# Copyright (C) 2016 OpenWrt.org
+# Copyright (C) 2016-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
-PKG_NAME:=service_identity
-PKG_VERSION:=16.0.0
-PKG_RELEASE:=1
+PKG_NAME:=python-service-identity
+PKG_VERSION:=17.0.0
+PKG_RELEASE:=2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://pypi.python.org/packages/source/s/service_identity
-PKG_HASH:=0630e222f59f91f3db498be46b1d879ff220955d7bbad719a5cb9ad14e3c3036
+PKG_SOURCE:=service_identity-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://pypi.python.org/packages/de/2a/cab6e30be82c8fcd2339ef618036720eda954cf05daef514e386661c9221
+PKG_HASH:=4001fbb3da19e0df22c47a06d29681a398473af4aa9d745eca525b3b2c2302ab
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-service-identity-$(PKG_VERSION)
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-service-identity/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/pyca/service_identity
+endef
define Package/python-service-identity
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-service-identity
- URL:=https://github.com/pyca/service_identity
- DEPENDS:=+python-light +python-attrs +python-pyasn1 +python-pyasn1-modules +python-pyopenssl
+$(call Package/python-service-identity/Default)
+ TITLE:=python-service-identity
+ DEPENDS:= \
+ +PACKAGE_python-service-identity:python-light \
+ +PACKAGE_python-service-identity:python-attrs \
+ +PACKAGE_python-service-identity:python-pyasn1 \
+ +PACKAGE_python-service-identity:python-pyasn1-modules \
+ +PACKAGE_python-service-identity:python-pyopenssl
+ VARIANT:=python
+endef
+
+define Package/python3-service-identity
+$(call Package/python-service-identity/Default)
+ TITLE:=python3-service-identity
+ DEPENDS:= \
+ +PACKAGE_python3-service-identity:python3-light \
+ +PACKAGE_python3-service-identity:python3-attrs \
+ +PACKAGE_python3-service-identity:python3-pyasn1 \
+ +PACKAGE_python3-service-identity:python3-pyasn1-modules \
+ +PACKAGE_python3-service-identity:python3-pyopenssl
+ VARIANT:=python3
endef
define Package/python-service-identity/description
verifying whether a certificate is valid for the intended purposes.
endef
-define Build/Compile
- $(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
+define Package/python3-service-identity/description
+$(call Package/python-service-identity/description)
+.
+(Variant for Python3)
endef
$(eval $(call PyPackage,python-service-identity))
$(eval $(call BuildPackage,python-service-identity))
+$(eval $(call BuildPackage,python-service-identity-src))
+
+$(eval $(call Py3Package,python3-service-identity))
+$(eval $(call BuildPackage,python3-service-identity))
+$(eval $(call BuildPackage,python3-service-identity-src))
#
-# Copyright (C) 2015 OpenWrt.org
+# Copyright (C) 2015, 2017-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=python-six
PKG_VERSION:=1.11.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=six-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
HOST_UNPACK:=$(HOST_TAR) -C $(HOST_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
$(eval $(call PyPackage,python-six))
$(eval $(call BuildPackage,python-six))
+$(eval $(call BuildPackage,python-six-src))
+
$(eval $(call Py3Package,python3-six))
$(eval $(call BuildPackage,python3-six))
+$(eval $(call BuildPackage,python3-six-src))
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015, 2017-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
-PKG_NAME:=txsocksx
+PKG_NAME:=python-txsocksx
PKG_VERSION:=1.15.0.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=txsocksx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/source/t/txsocksx
PKG_HASH:=4f79b5225ce29709bfcee45e6f726e65b70fd6f1399d1898e54303dbd6f8065f
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-txsocksx-$(PKG_VERSION)
+
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-txsocksx/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/habnabit/txsocksx
+endef
define Package/python-txsocksx
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=python-txsocksx
- URL:=https://github.com/habnabit/txsocksx
- DEPENDS:=+python-light +python-parsley +twisted
+$(call Package/python-txsocksx/Default)
+ TITLE:=python-txsocksx
+ DEPENDS:= \
+ +PACKAGE_python-txsocksx:python-light \
+ +PACKAGE_python-txsocksx:python-parsley \
+ +PACKAGE_python-txsocksx:twisted
+ VARIANT:=python
endef
define Package/python-txsocksx/description
greater.
endef
-define Build/Compile
+define PyBuild/Compile
$(call Build/Compile/PyMod,, \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)", \
PKG_VERSION="$(PKG_VERSION)" \
$(eval $(call PyPackage,python-txsocksx))
$(eval $(call BuildPackage,python-txsocksx))
+$(eval $(call BuildPackage,python-txsocksx-src))
-diff --git a/setup.py b/setup.py
-index 7979f89..3873a1e 100644
--- a/setup.py
+++ b/setup.py
@@ -35,5 +35,5 @@ setup(
-diff --git a/setup.py b/setup.py
-index 7979f89..5e1abb3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,8 @@
+ #},
+ version=os.environ.get('PKG_VERSION'),
install_requires=install_requires,
- packages=['txsocksx', 'txsocksx.test'],
+ packages=['txsocksx'],
)
PKG_HASH:=cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/python-urllib3
SUBMENU:=Python
--- /dev/null
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON_VERSION:=2.7
+PYTHON_VERSION_MICRO:=15
+
+PYTHON_SETUPTOOLS_PKG_RELEASE:=1
+PYTHON_PIP_PKG_RELEASE:=1
+
+PYTHON_SETUPTOOLS_VERSION:=39.0.1
+PYTHON_PIP_VERSION:=9.0.3
+
+PYTHON_SETUPTOOLS_VERSION:=$(PYTHON_SETUPTOOLS_VERSION)-$(PYTHON_SETUPTOOLS_PKG_RELEASE)
+PYTHON_PIP_VERSION:=$(PYTHON_PIP_VERSION)-$(PYTHON_PIP_PKG_RELEASE)
+
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../python-package.mk
+include ../python3-package.mk
define Package/python-yaml/Default
SUBMENU:=Python
--- /dev/null
+#
+# Copyright (C) 2006-2011, 2015-2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-zope-interface
+PKG_VERSION:=4.4.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=zope.interface-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://pypi.python.org/packages/bd/d2/25349ed41f9dcff7b3baf87bd88a4c82396cf6e02f1f42bb68657a3132af
+PKG_HASH:=d6d26d5dfbfd60c65152938fcb82f949e8dada37c041f72916fef6621ba5c5ce
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-zope-interface-$(PKG_VERSION)
+
+PKG_LICENSE:=ZPL-2.1
+PKG_LICENSE_FILES:=LICENSE.txt
+PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../python-package.mk
+include ../python3-package.mk
+
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/python-zope-interface/Default
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ URL:=https://github.com/zopefoundation/zope.interface
+endef
+
+define Package/python-zope-interface
+$(call Package/python-zope-interface/Default)
+ TITLE:=python-zope-interface
+ DEPENDS:=+PACKAGE_python-zope-interface:python-light
+ VARIANT:=python
+endef
+
+define Package/python3-zope-interface
+$(call Package/python-zope-interface/Default)
+ TITLE:=python3-zope-interface
+ DEPENDS:=+PACKAGE_python3-zope-interface:python3-light
+ VARIANT:=python3
+endef
+
+define Package/python-zope-interface/description
+This package provides an implementation of "object interfaces" for
+Python. Interfaces are a mechanism for labeling objects as conforming to
+a given API or contract. So, this package can be considered as
+implementation of the Design By Contract methodology support in Python.
+endef
+
+define Package/python3-zope-interface/description
+$(call Package/python-zope-interface/description)
+.
+(Variant for Python3)
+endef
+
+define PyPackage/python-zope-interface/filespec
++|$(PYTHON_PKG_DIR)
+-|$(PYTHON_PKG_DIR)/zope/interface/common/tests
+-|$(PYTHON_PKG_DIR)/zope/interface/tests
+endef
+
+define Py3Package/python3-zope-interface/filespec
++|$(PYTHON3_PKG_DIR)
+-|$(PYTHON3_PKG_DIR)/zope/interface/common/tests
+-|$(PYTHON3_PKG_DIR)/zope/interface/tests
+endef
+
+$(eval $(call PyPackage,python-zope-interface))
+$(eval $(call BuildPackage,python-zope-interface))
+$(eval $(call BuildPackage,python-zope-interface-src))
+
+$(eval $(call Py3Package,python3-zope-interface))
+$(eval $(call BuildPackage,python3-zope-interface))
+$(eval $(call BuildPackage,python3-zope-interface-src))
include $(TOPDIR)/rules.mk
# For PYTHON_VERSION
-include ./files/python-version.mk
+include ../python-version.mk
PKG_NAME:=python
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
-PKG_RELEASE:=8
+PKG_RELEASE:=1
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
-PKG_HASH:=71ffb26e09e78650e424929b2b457b9c912ac216576e6bd9e7d204ed03296a66
+PKG_HASH:=22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574
PKG_LICENSE:=PSF
PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
# This file provides the necsessary host build variables
-include ./files/python-host.mk
+include ../python-host.mk
# For PyPackage
-include ./files/python-package.mk
+include ../python-package.mk
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
CONFIG_PYTHON_BLUETOOTH_SUPPORT
PKG_BUILD_DEPENDS:=python/host
-HOST_BUILD_DEPENDS:=bzip2/host expat/host zlib/host
+HOST_BUILD_DEPENDS:=bzip2/host expat/host
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
$(call Build/Compile/python-pip)
endef
-define Build/InstallMkFiles
- $(INSTALL_DIR) $(STAGING_DIR)/mk/
- $(INSTALL_DATA) \
- ./files/python-package.mk \
- ./files/python-host.mk \
- ./files/python-version.mk \
- ./files/python-package-install.sh \
- $(STAGING_DIR)/mk/
-endef
-
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
$(1)/usr/lib/python$(PYTHON_VERSION)/
- $(call Build/InstallMkFiles)
endef
PYTHON_BASE_LIB_FILES:= \
endef
HOST_LDFLAGS += \
- -Wl,--no-as-needed -lrt \
$$$$(pkg-config --static --libs libcrypto libssl)
+ifeq ($(HOST_OS),Linux)
+HOST_LDFLAGS += \
+ -Wl,--no-as-needed -lrt
+endif
+
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-pymalloc \
--prefix=$(HOST_PYTHON_DIR) \
--exec-prefix=$(HOST_PYTHON_DIR) \
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
- --with-system-ffi=no \
--with-ensurepip=install \
CONFIG_SITE=
endef
define Host/Install
- $(call Build/InstallMkFiles)
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
$(eval $(call BuildPackage,python-base-src))
$(eval $(call BuildPackage,python-light-src))
-$(eval $(call BuildPackage,python-src))
+++ /dev/null
-#
-# Copyright (C) 2015-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-ifneq ($(__python_host_mk_inc),1)
-__python_host_mk_inc=1
-
-# For PYTHON_VERSION
-$(call include_mk, python-version.mk)
-
-HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
-HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
-HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
-
-HOST_PYTHON_PKG_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)/site-packages
-
-HOST_PYTHON_BIN:=$(HOST_PYTHON_DIR)/bin/python$(PYTHON_VERSION)
-
-HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(HOST_PYTHON_PKG_DIR)
-
-define HostPython
- if [ "$(strip $(3))" == "HOST" ]; then \
- export PYTHONPATH="$(HOST_PYTHONPATH)"; \
- export PYTHONDONTWRITEBYTECODE=0; \
- else \
- export PYTHONPATH="$(PYTHONPATH)"; \
- export PYTHONDONTWRITEBYTECODE=1; \
- export _python_sysroot="$(STAGING_DIR)"; \
- export _python_prefix="/usr"; \
- export _python_exec_prefix="/usr"; \
- fi; \
- export PYTHONOPTIMIZE=""; \
- $(1) \
- $(HOST_PYTHON_BIN) $(2);
-endef
-
-define host_python_settings
- ARCH="$(HOST_ARCH)" \
- CC="$(HOSTCC)" \
- CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
- CXX="$(HOSTCXX)" \
- LD="$(HOSTCC)" \
- LDSHARED="$(HOSTCC) -shared" \
- CFLAGS="$(HOST_CFLAGS)" \
- CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON_INC_DIR)" \
- LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
- _PYTHON_HOST_PLATFORM=linux2
-endef
-
-# $(1) => commands to execute before running pythons script
-# $(2) => python script and its arguments
-# $(3) => additional variables
-define Build/Compile/HostPyRunHost
- $(call HostPython, \
- $(if $(1),$(1);) \
- $(call host_python_settings) \
- $(3) \
- , \
- $(2) \
- , \
- HOST \
- )
-endef
-
-# Note: I shamelessly copied this from Yousong's logic (from python-packages);
-HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
-define host_python_pip_install
- $(call host_python_settings) \
- $(HOST_PYTHON_PIP) install \
- --root=$(1) \
- --prefix=$(2) \
- --ignore-installed \
- $(3)
-endef
-
-define host_python_pip_install_host
-$(call host_python_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
-endef
-
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
-# $(3) => additional variables
-define Build/Compile/HostPyMod
- $(call Build/Compile/HostPyRunHost, \
- cd $(HOST_BUILD_DIR)/$(strip $(1)), \
- ./setup.py $(2), \
- $(3))
-endef
-
-endif # __python_host_mk_inc
+++ /dev/null
-#!/bin/sh
-set -e
-
-process_filespec() {
- local src_dir="$1"
- local dst_dir="$2"
- local filespec="$3"
- echo "$filespec" | (
- IFS='|'
- while read fop fspec fperm; do
- local fop=`echo "$fop" | tr -d ' \t\n'`
- if [ "$fop" = "+" ]; then
- if [ ! -e "${src_dir}${fspec}" ]; then
- echo "File not found '${src_dir}${fspec}'"
- exit 1
- fi
- dpath=`dirname "$fspec"`
- if [ -z "$fperm" ]; then
- dperm=`stat -c "%a" ${src_dir}${dpath}`
- fi
- mkdir -p -m$dperm ${dst_dir}${dpath}
- echo "copying: '$fspec'"
- cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
- if [ -n "$fperm" ]; then
- chmod -R $fperm ${dst_dir}${fspec}
- fi
- elif [ "$fop" = "-" ]; then
- echo "removing: '$fspec'"
- rm -fR ${dst_dir}${fspec}
- elif [ "$fop" = "=" ]; then
- echo "setting permissions: '$fperm' on '$fspec'"
- chmod -R $fperm ${dst_dir}${fspec}
- fi
- done
- )
-}
-
-src_dir="$1"
-dst_dir="$2"
-python="$3"
-mode="$4"
-filespec="$5"
-
-process_filespec "$src_dir" "$dst_dir" "$filespec" || {
- echo "process filespec error-ed"
- exit 1
-}
-
-if [ "$mode" == "sources" ] ; then
- # Copy only python source files
- find $dst_dir -not -type d -not -name "*\.py" | xargs rm -f
-
- # Delete empty folders (if the case)
- if [ -d "$dst_dir/usr" ] ; then
- find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
- rmdir --ignore-fail-on-non-empty $dst_dir/usr
- fi
- exit 0
-fi
-
-# XXX [So that you won't goof as I did]
-# Note: Yes, I tried to use the -O & -OO flags here.
-# However the generated byte-codes were not portable.
-# So, we just stuck to un-optimized byte-codes,
-# which is still way better/faster than running
-# Python sources all the time.
-$python -m compileall -d '/' $dst_dir || {
- echo "python -m compileall err-ed"
- exit 1
-}
-
-# Delete source files and pyc [ un-optimized bytecode files ]
-# We may want to make this optimization thing configurable later, but not sure atm
-find $dst_dir -type f -name "*\.py" | xargs rm -f
-
-# Delete empty folders (if the case)
-if [ -d "$dst_dir/usr" ] ; then
- find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
- rmdir --ignore-fail-on-non-empty $dst_dir/usr
-fi
-
-exit 0
+++ /dev/null
-#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-$(call include_mk, python-version.mk)
-
-PYTHON_DIR:=$(STAGING_DIR)/usr
-PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
-PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
-PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
-
-PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
-
-PYTHON:=python$(PYTHON_VERSION)
-
-PYTHONPATH:=$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
-
-# These configure args are needed in detection of path to Python header files
-# using autotools.
-CONFIGURE_ARGS += \
- _python_sysroot="$(STAGING_DIR)" \
- _python_prefix="/usr" \
- _python_exec_prefix="/usr"
-
-PKG_USE_MIPS16:=0
-# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
-# flags are inherited from the Python base package (via sysconfig module)
-ifdef CONFIG_USE_MIPS16
- TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
-endif
-
-define PyPackage
-
- define Package/$(1)-src
- $(call Package/$(1))
- TITLE+= (sources)
- DEPENDS:=$$$$(foreach dep,$$$$(filter +python-%,$$$$(DEPENDS)),$$$$(dep)-src)
- endef
-
- define Package/$(1)-src/description
- $(call Package/$(1)/description).
- (Contains the Python sources for this package).
- endef
-
- # Add default PyPackage filespec none defined
- ifndef PyPackage/$(1)/filespec
- define PyPackage/$(1)/filespec
- +|$(PYTHON_PKG_DIR)
- endef
- endif
-
- ifndef PyPackage/$(1)/install
- define PyPackage/$(1)/install
- if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
- $(INSTALL_DIR) $$(1)/usr/bin ; \
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
- fi
- endef
- endif
-
- ifndef Package/$(1)/install
- $(call shexport,PyPackage/$(1)/filespec)
-
- define Package/$(1)/install
- $(call PyPackage/$(1)/install,$$(1))
- find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
- if [ -e files/python-package-install.sh ] ; then \
- $(SHELL) files/python-package-install.sh \
- "$(PKG_INSTALL_DIR)" "$$(1)" \
- "$(HOST_PYTHON_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \
- elif [ -e $(STAGING_DIR)/mk/python-package-install.sh ] ; then \
- $(SHELL) $(STAGING_DIR)/mk/python-package-install.sh \
- "$(PKG_INSTALL_DIR)" "$$(1)" \
- "$(HOST_PYTHON_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" ; \
- else \
- echo "No 'python-package-install.sh' script found" ; \
- exit 1 ; \
- fi
- endef
-
- define Package/$(1)-src/install
- $$(call Package/$(1)/install,$$(1),sources)
- endef
- endif # Package/$(1)/install
-endef
-
-$(call include_mk, python-host.mk)
-
-# $(1) => commands to execute before running pythons script
-# $(2) => python script and its arguments
-# $(3) => additional variables
-define Build/Compile/HostPyRunTarget
- $(call HostPython, \
- $(if $(1),$(1);) \
- CC="$(TARGET_CC)" \
- CCSHARED="$(TARGET_CC) $(FPIC)" \
- CXX="$(TARGET_CXX)" \
- LD="$(TARGET_CC)" \
- LDSHARED="$(TARGET_CC) -shared" \
- CFLAGS="$(TARGET_CFLAGS)" \
- CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON_INC_DIR)" \
- LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON_VERSION)" \
- _PYTHON_HOST_PLATFORM=linux2 \
- __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON)" \
- $(3) \
- , \
- $(2) \
- )
-endef
-
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
-# $(3) => additional variables
-define Build/Compile/PyMod
- $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)
- $(call Build/Compile/HostPyRunTarget, \
- cd $(PKG_BUILD_DIR)/$(strip $(1)), \
- ./setup.py $(2), \
- $(3))
- find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
-endef
-
-define PyBuild/Compile/Default
- $(foreach pkg,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
- $(call host_python_pip_install_host,$(pkg))
- )
- $(call Build/Compile/PyMod,, \
- install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
- --single-version-externally-managed \
- )
-endef
-
-PyBuild/Compile=$(PyBuild/Compile/Default)
-
-ifeq ($(BUILD_VARIANT),python)
-define Build/Compile
- $(call PyBuild/Compile)
-endef
-endif # python
+++ /dev/null
-#
-# Copyright (C) 2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-PYTHON_VERSION:=2.7
-PYTHON_VERSION_MICRO:=14
-
-PYTHON_SETUPTOOLS_VERSION:=28.8.0
-PYTHON_PIP_VERSION:=9.0.1
-
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
-@@ -1110,6 +1110,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
+@@ -1127,6 +1127,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
done; \
done
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
$(DESTDIR)$(LIBDEST)/distutils/tests ; \
-@@ -1136,6 +1137,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
+@@ -1153,6 +1154,7 @@ libinstall: build_all $(srcdir)/Lib/$(PL
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
-@@ -79,7 +79,7 @@ int Py_InteractiveFlag; /* Needed by Py_
+@@ -71,7 +71,7 @@ int Py_InteractiveFlag; /* Needed by Py_
int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
int Py_UnicodeFlag = 0; /* Needed by compile.c */
-@@ -185,7 +185,7 @@ Py_InitializeEx(int install_sigs)
- if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
- Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
- if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
-- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
-+ Py_DontWriteBytecodeFlag = atoi(p);
- /* The variable is only tested for existence here; _PyRandom_Init will
- check its value further. */
- if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
-diff --git a/configure b/configure
-index 4c0435e..0068a9d 100755
--- a/configure
+++ b/configure
-@@ -7045,7 +7045,7 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/
+@@ -7077,7 +7077,7 @@ sys/param.h sys/poll.h sys/random.h sys/
sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
--bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h
-+linux/tipc.h spawn.h util.h alloca.h
+-bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h
++linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-@@ -7267,6 +7267,24 @@ fi
+@@ -7299,6 +7299,24 @@ fi
fi
# On Linux, netlink.h requires asm/types.h
for ac_header in linux/netlink.h
do :
-diff --git a/configure.ac b/configure.ac
-index 780f275..dceca1c 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -1702,10 +1702,17 @@ sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/
+@@ -1732,10 +1732,17 @@ sys/param.h sys/poll.h sys/random.h sys/
sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
--bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h)
-+linux/tipc.h spawn.h util.h alloca.h)
+-bluetooth/bluetooth.h linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
++linux/tipc.h spawn.h util.h alloca.h sys/sysmacros.h)
AC_HEADER_DIRENT
AC_HEADER_MAJOR
+++ /dev/null
---- a/Modules/_cursesmodule.c
-+++ b/Modules/_cursesmodule.c
-@@ -117,7 +117,6 @@ char *PyCursesVersion = "2.2";
- #defines many common symbols (such as "lines") which breaks the
- curses module in other ways. So the code will just specify
- explicit prototypes here. */
--extern int setupterm(char *,int,int *);
- #ifdef __sgi
- #include <term.h>
- #endif
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
-@@ -108,6 +108,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
+@@ -108,6 +108,7 @@ def compile(file, cfile=None, dfile=None
timestamp = long(os.fstat(f.fileno()).st_mtime)
except AttributeError:
timestamp = long(os.stat(file).st_mtime)
--- /dev/null
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -634,6 +634,16 @@ regen-all: regen-opcode-targets regen-gr
+ ############################################################################
+ # Special rules for object files
+
++DATE_FMT = %b %d %Y
++TIME_FMT = %H:%M:%S
++ifdef SOURCE_DATE_EPOCH
++ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
++ BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(TIME_FMT)")
++else
++ BUILD_DATE ?= $(shell date "+$(DATE_FMT)")
++ BUILD_TIME ?= $(shell date "+$(TIME_FMT)")
++endif
++
+ Modules/getbuildinfo.o: $(PARSER_OBJS) \
+ $(OBJECT_OBJS) \
+ $(PYTHON_OBJS) \
+@@ -642,6 +652,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
+ $(MODOBJS) \
+ $(srcdir)/Modules/getbuildinfo.c
+ $(CC) -c $(PY_CFLAGS) \
++ -DDATE="\"$(BUILD_DATE)\"" \
++ -DTIME="\"$(BUILD_TIME)\"" \
+ -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
+ -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
+ -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python3-package.mk)
+include ../python3-package.mk
define Package/python3-bottle
SECTION:=lang
--- /dev/null
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
+# if `python3-package.mk` is included, this will already be included
+
+ifneq ($(__python3_host_mk_inc),1)
+__python3_host_mk_inc=1
+
+# For PYTHON3_VERSION
+python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
+include $(python3_mk_path)python3-version.mk
+
+HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG)
+HOST_PYTHON3_INC_DIR:=$(HOST_PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
+HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
+
+HOST_PYTHON3_PKG_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)/site-packages
+
+HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python$(PYTHON3_VERSION)
+
+HOST_PYTHON3PATH:=$(HOST_PYTHON3_LIB_DIR):$(HOST_PYTHON3_PKG_DIR)
+
+define HostPython3
+ if [ "$(strip $(3))" == "HOST" ]; then \
+ export PYTHONPATH="$(HOST_PYTHON3PATH)"; \
+ export PYTHONDONTWRITEBYTECODE=0; \
+ else \
+ export PYTHONPATH="$(PYTHON3PATH)"; \
+ export PYTHONDONTWRITEBYTECODE=1; \
+ export _python_sysroot="$(STAGING_DIR)"; \
+ export _python_prefix="/usr"; \
+ export _python_exec_prefix="/usr"; \
+ fi; \
+ export PYTHONOPTIMIZE=""; \
+ $(1) \
+ $(HOST_PYTHON3_BIN) $(2);
+endef
+
+define host_python3_settings
+ ARCH="$(HOST_ARCH)" \
+ CC="$(HOSTCC)" \
+ CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
+ CXX="$(HOSTCXX)" \
+ LD="$(HOSTCC)" \
+ LDSHARED="$(HOSTCC) -shared" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
+ LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
+ _PYTHON_HOST_PLATFORM=linux2
+endef
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPy3RunHost
+ $(call HostPython3, \
+ $(if $(1),$(1);) \
+ $(call host_python3_settings) \
+ $(3) \
+ , \
+ $(2) \
+ , \
+ HOST \
+ )
+endef
+
+# Note: I shamelessly copied this from Yousong's logic (from python-packages);
+HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
+define host_python3_pip_install
+ $(call host_python3_settings) \
+ $(HOST_PYTHON3_PIP) install \
+ --root=$(1) \
+ --prefix=$(2) \
+ --ignore-installed \
+ $(3)
+endef
+
+define host_python3_pip_install_host
+$(call host_python3_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/HostPy3Mod
+ $(call Build/Compile/HostPy3RunHost, \
+ cd $(HOST_BUILD_DIR)/$(strip $(1)), \
+ ./setup.py $(2), \
+ $(3))
+endef
+
+endif # __python3_host_mk_inc
--- /dev/null
+#
+# Copyright (C) 2007-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: include this after `include $(TOPDIR)/rules.mk in your package Makefile
+python3_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
+include $(python3_mk_path)python3-host.mk
+
+PYTHON3_DIR:=$(STAGING_DIR)/usr
+PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin
+PYTHON3_INC_DIR:=$(PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
+PYTHON3_LIB_DIR:=$(PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
+
+PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
+
+PYTHON3:=python$(PYTHON3_VERSION)
+
+PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+
+# These configure args are needed in detection of path to Python header files
+# using autotools.
+CONFIGURE_ARGS += \
+ _python_sysroot="$(STAGING_DIR)" \
+ _python_prefix="/usr" \
+ _python_exec_prefix="/usr"
+
+PKG_USE_MIPS16:=0
+# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
+# flags are inherited from the Python base package (via sysconfig module)
+ifdef CONFIG_USE_MIPS16
+ TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
+endif
+
+define Py3Package
+
+ define Package/$(1)-src
+ $(call Package/$(1))
+ DEPENDS:=
+ TITLE+= (sources)
+ endef
+
+ define Package/$(1)-src/description
+ $(call Package/$(1)/description).
+ (Contains the Python3 sources for this package).
+ endef
+
+ # Add default PyPackage filespec none defined
+ ifndef Py3Package/$(1)/filespec
+ define Py3Package/$(1)/filespec
+ +|$(PYTHON3_PKG_DIR)
+ endef
+ endif
+
+ ifndef Py3Package/$(1)/install
+ define Py3Package/$(1)/install
+ if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
+ $(INSTALL_DIR) $$(1)/usr/bin ; \
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
+ fi
+ endef
+ endif
+
+ ifndef Package/$(1)/install
+ $(call shexport,Py3Package/$(1)/filespec)
+
+ define Package/$(1)/install
+ $(call Py3Package/$(1)/install,$$(1))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+ $(SHELL) $(python3_mk_path)python-package-install.sh "3" \
+ "$(PKG_INSTALL_DIR)" "$$(1)" \
+ "$(HOST_PYTHON3_BIN)" "$$(2)" \
+ "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)"
+ endef
+
+ define Package/$(1)-src/install
+ $$(call Package/$(1)/install,$$(1),sources)
+ endef
+ endif # Package/$(1)/install
+endef
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPy3RunTarget
+ $(call HostPython3, \
+ $(if $(1),$(1);) \
+ CC="$(TARGET_CC)" \
+ CCSHARED="$(TARGET_CC) $(FPIC)" \
+ CXX="$(TARGET_CXX)" \
+ LD="$(TARGET_CC)" \
+ LDSHARED="$(TARGET_CC) -shared" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \
+ LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \
+ _PYTHON_HOST_PLATFORM=linux2 \
+ __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
+ $(3) \
+ , \
+ $(2) \
+ )
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/Py3Mod
+ $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+ $(call Build/Compile/HostPy3RunTarget, \
+ cd $(PKG_BUILD_DIR)/$(strip $(1)), \
+ ./setup.py $(2), \
+ $(3))
+ find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
+endef
+
+PYTHON3_PKG_SETUP_ARGS:=--single-version-externally-managed
+PYTHON3_PKG_SETUP_VARS:=
+
+define Py3Build/Compile/Default
+ $(foreach pkg,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS),
+ $(call host_python3_pip_install_host,$(pkg))
+ )
+ $(call Build/Compile/Py3Mod,, \
+ install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+ $(PYTHON3_PKG_SETUP_ARGS), \
+ $(PYTHON3_PKG_SETUP_VARS) \
+ )
+endef
+
+Py3Build/Compile=$(Py3Build/Compile/Default)
+
+ifeq ($(BUILD_VARIANT),python3)
+define Build/Compile
+ $(call Py3Build/Compile)
+endef
+endif # python3
--- /dev/null
+#
+# Copyright (C) 2007-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+# Note: keep in sync with setuptools & pip
+PYTHON3_VERSION_MAJOR:=3
+PYTHON3_VERSION_MINOR:=6
+PYTHON3_VERSION_MICRO:=5
+
+PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
+
+PYTHON3_SETUPTOOLS_PKG_RELEASE:=1
+PYTHON3_PIP_PKG_RELEASE:=1
+
+PYTHON3_SETUPTOOLS_VERSION:=39.0.1
+PYTHON3_PIP_VERSION:=9.0.3
+
+PYTHON3_SETUPTOOLS_VERSION:=$(PYTHON3_SETUPTOOLS_VERSION)-$(PYTHON3_SETUPTOOLS_PKG_RELEASE)
+PYTHON3_PIP_VERSION:=$(PYTHON3_PIP_VERSION)-$(PYTHON3_PIP_PKG_RELEASE)
+
include $(TOPDIR)/rules.mk
# The file included below defines PYTHON_VERSION
-include ./files/python3-version.mk
+include ../python3-version.mk
PYTHON_VERSION:=$(PYTHON3_VERSION)
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3
-PKG_RELEASE:=3
+PKG_RELEASE:=1
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
-PKG_HASH:=159b932bf56aeaa76fd66e7420522d8c8853d486b8567c459b84fe2ed13bcaba
+PKG_HASH:=f434053ba1b5c8a5cc597e966ead3c5143012af827fd3f0697d21450bb8d87a6
PKG_LICENSE:=PSF
PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
# This file provides the necsessary host build variables
-include ./files/python3-host.mk
+include ../python3-host.mk
# For Py3Package
-include ./files/python3-package.mk
+include ../python3-package.mk
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
CONFIG_PYTHON3_BLUETOOTH_SUPPORT
PKG_BUILD_DEPENDS:=python3/host
-HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host zlib/host
+HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
$(call Build/Compile/python3-pip)
endef
-define Build/InstallMkFiles
- $(INSTALL_DIR) $(STAGING_DIR)/mk/
- $(INSTALL_DATA) \
- ./files/python3-package.mk \
- ./files/python3-host.mk \
- ./files/python3-version.mk \
- ./files/python3-package-install.sh \
- $(STAGING_DIR)/mk/
-endef
-
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
$(1)/usr/lib/python$(PYTHON_VERSION)/
- $(call Build/InstallMkFiles)
endef
PYTHON3_BASE_LIB_FILES:= \
endef
HOST_LDFLAGS += \
- -Wl,--no-as-needed -lrt \
$$$$(pkg-config --static --libs libcrypto libssl)
+ifeq ($(HOST_OS),Linux)
+HOST_LDFLAGS += \
+ -Wl,--no-as-needed -lrt
+endif
+
HOST_CONFIGURE_ARGS+= \
--without-cxx-main \
--without-pymalloc \
--prefix=$(HOST_PYTHON3_DIR) \
--exec-prefix=$(HOST_PYTHON3_DIR) \
--with-system-expat=$(STAGING_DIR_HOSTPKG) \
- --with-system-ffi=no \
--with-ensurepip=install \
CONFIG_SITE=
endef
define Host/Install
- $(call Build/InstallMkFiles)
$(MAKE) -C $(HOST_BUILD_DIR) install
$(INSTALL_DIR) $(HOST_PYTHON3_DIR)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON3_DIR)/bin/pgen3
$(eval $(call BuildPackage,python3-base-src))
$(eval $(call BuildPackage,python3-light-src))
-$(eval $(call BuildPackage,python3-src))
+++ /dev/null
-#
-# Copyright (C) 2017 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-ifneq ($(__python3_host_mk_inc),1)
-__python3_host_mk_inc=1
-
-# For PYTHON3_VERSION
-$(call include_mk, python3-version.mk)
-
-HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG)
-HOST_PYTHON3_INC_DIR:=$(HOST_PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
-HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
-
-HOST_PYTHON3_PKG_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)/site-packages
-
-HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python$(PYTHON3_VERSION)
-
-HOST_PYTHON3PATH:=$(HOST_PYTHON3_LIB_DIR):$(HOST_PYTHON3_PKG_DIR)
-
-define HostPython3
- if [ "$(strip $(3))" == "HOST" ]; then \
- export PYTHONPATH="$(HOST_PYTHON3PATH)"; \
- export PYTHONDONTWRITEBYTECODE=0; \
- else \
- export PYTHONPATH="$(PYTHON3PATH)"; \
- export PYTHONDONTWRITEBYTECODE=1; \
- export _python_sysroot="$(STAGING_DIR)"; \
- export _python_prefix="/usr"; \
- export _python_exec_prefix="/usr"; \
- fi; \
- export PYTHONOPTIMIZE=""; \
- $(1) \
- $(HOST_PYTHON3_BIN) $(2);
-endef
-
-define host_python3_settings
- ARCH="$(HOST_ARCH)" \
- CC="$(HOSTCC)" \
- CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
- CXX="$(HOSTCXX)" \
- LD="$(HOSTCC)" \
- LDSHARED="$(HOSTCC) -shared" \
- CFLAGS="$(HOST_CFLAGS)" \
- CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
- LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
- _PYTHON_HOST_PLATFORM=linux2
-endef
-
-# $(1) => commands to execute before running pythons script
-# $(2) => python script and its arguments
-# $(3) => additional variables
-define Build/Compile/HostPy3RunHost
- $(call HostPython3, \
- $(if $(1),$(1);) \
- $(call host_python3_settings) \
- $(3) \
- , \
- $(2) \
- , \
- HOST \
- )
-endef
-
-# Note: I shamelessly copied this from Yousong's logic (from python-packages);
-HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
-define host_python3_pip_install
- $(call host_python3_settings) \
- $(HOST_PYTHON3_PIP) install \
- --root=$(1) \
- --prefix=$(2) \
- --ignore-installed \
- $(3)
-endef
-
-define host_python3_pip_install_host
-$(call host_python3_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
-endef
-
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
-# $(3) => additional variables
-define Build/Compile/HostPy3Mod
- $(call Build/Compile/HostPy3RunHost, \
- cd $(HOST_BUILD_DIR)/$(strip $(1)), \
- ./setup.py $(2), \
- $(3))
-endef
-
-endif # __python3_host_mk_inc
+++ /dev/null
-#!/bin/sh
-set -e
-
-process_filespec() {
- local src_dir="$1"
- local dst_dir="$2"
- local filespec="$3"
- echo "$filespec" | (
- IFS='|'
- while read fop fspec fperm; do
- local fop=`echo "$fop" | tr -d ' \t\n'`
- if [ "$fop" = "+" ]; then
- if [ ! -e "${src_dir}${fspec}" ]; then
- echo "File not found '${src_dir}${fspec}'"
- exit 1
- fi
- dpath=`dirname "$fspec"`
- if [ -z "$fperm" ]; then
- dperm=`stat -c "%a" ${src_dir}${dpath}`
- fi
- mkdir -p -m$dperm ${dst_dir}${dpath}
- echo "copying: '$fspec'"
- cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
- if [ -n "$fperm" ]; then
- chmod -R $fperm ${dst_dir}${fspec}
- fi
- elif [ "$fop" = "-" ]; then
- echo "removing: '$fspec'"
- rm -fR ${dst_dir}${fspec}
- elif [ "$fop" = "=" ]; then
- echo "setting permissions: '$fperm' on '$fspec'"
- chmod -R $fperm ${dst_dir}${fspec}
- fi
- done
- )
-}
-
-src_dir="$1"
-dst_dir="$2"
-python="$3"
-mode="$4"
-filespec="$5"
-
-process_filespec "$src_dir" "$dst_dir" "$filespec" || {
- echo "process filespec error-ed"
- exit 1
-}
-
-if [ "$mode" == "sources" ] ; then
- # Copy only python source files
- find $dst_dir -not -type d -not -name "*\.py" | xargs rm -f
-
- # Delete empty folders (if the case)
- if [ -d "$dst_dir/usr" ] ; then
- find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
- rmdir --ignore-fail-on-non-empty $dst_dir/usr
- fi
- exit 0
-fi
-
-# XXX [So that you won't goof as I did]
-# Note: Yes, I tried to use the -O & -OO flags here.
-# However the generated byte-codes were not portable.
-# So, we just stuck to un-optimized byte-codes,
-# which is still way better/faster than running
-# Python sources all the time.
-$python -m compileall -b -d '/' $dst_dir || {
- echo "python -m compileall err-ed"
- exit 1
-}
-
-# Delete source files and pyc [ un-optimized bytecode files ]
-# We may want to make this optimization thing configurable later, but not sure atm
-find $dst_dir -type f -name "*\.py" | xargs rm -f
-
-# Delete empty folders (if the case)
-if [ -d "$dst_dir/usr" ] ; then
- find $dst_dir/usr -type d | xargs rmdir --ignore-fail-on-non-empty
- rmdir --ignore-fail-on-non-empty $dst_dir/usr
-fi
-
-exit 0
+++ /dev/null
-#
-# Copyright (C) 2007-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-$(call include_mk, python3-version.mk)
-
-PYTHON3_DIR:=$(STAGING_DIR)/usr
-PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin
-PYTHON3_INC_DIR:=$(PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
-PYTHON3_LIB_DIR:=$(PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
-
-PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
-
-PYTHON3:=python$(PYTHON3_VERSION)
-
-PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
-
-# These configure args are needed in detection of path to Python header files
-# using autotools.
-CONFIGURE_ARGS += \
- _python_sysroot="$(STAGING_DIR)" \
- _python_prefix="/usr" \
- _python_exec_prefix="/usr"
-
-PKG_USE_MIPS16:=0
-# This is required in addition to PKG_USE_MIPS16:=0 because otherwise MIPS16
-# flags are inherited from the Python base package (via sysconfig module)
-ifdef CONFIG_USE_MIPS16
- TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
-endif
-
-define Py3Package
-
- define Package/$(1)-src
- $(call Package/$(1))
- TITLE+= (sources)
- DEPENDS:=$$$$(foreach dep,$$$$(filter +python3-%,$$$$(DEPENDS)),$$$$(dep)-src)
- endef
-
- define Package/$(1)-src/description
- $(call Package/$(1)/description).
- (Contains the Python3 sources for this package).
- endef
-
- # Add default PyPackage filespec none defined
- ifndef Py3Package/$(1)/filespec
- define Py3Package/$(1)/filespec
- +|$(PYTHON3_PKG_DIR)
- endef
- endif
-
- ifndef Py3Package/$(1)/install
- define Py3Package/$(1)/install
- if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
- $(INSTALL_DIR) $$(1)/usr/bin ; \
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ ; \
- fi
- endef
- endif
-
- ifndef Package/$(1)/install
- $(call shexport,Py3Package/$(1)/filespec)
-
- define Package/$(1)/install
- $(call Py3Package/$(1)/install,$$(1))
- find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
- if [ -e files/python3-package-install.sh ] ; then \
- $(SHELL) files/python3-package-install.sh \
- "$(PKG_INSTALL_DIR)" "$$(1)" \
- "$(HOST_PYTHON3_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \
- elif [ -e $(STAGING_DIR)/mk/python3-package-install.sh ] ; then \
- $(SHELL) $(STAGING_DIR)/mk/python3-package-install.sh \
- "$(PKG_INSTALL_DIR)" "$$(1)" \
- "$(HOST_PYTHON3_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" ; \
- else \
- echo "No 'python3-package-install.sh' script found" ; \
- exit 1 ; \
- fi
- endef
-
- define Package/$(1)-src/install
- $$(call Package/$(1)/install,$$(1),sources)
- endef
- endif # Package/$(1)/install
-endef
-
-$(call include_mk, python3-host.mk)
-
-# $(1) => commands to execute before running pythons script
-# $(2) => python script and its arguments
-# $(3) => additional variables
-define Build/Compile/HostPy3RunTarget
- $(call HostPython3, \
- $(if $(1),$(1);) \
- CC="$(TARGET_CC)" \
- CCSHARED="$(TARGET_CC) $(FPIC)" \
- CXX="$(TARGET_CXX)" \
- LD="$(TARGET_CC)" \
- LDSHARED="$(TARGET_CC) -shared" \
- CFLAGS="$(TARGET_CFLAGS)" \
- CPPFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR)" \
- LDFLAGS="$(TARGET_LDFLAGS) -lpython$(PYTHON3_VERSION)" \
- _PYTHON_HOST_PLATFORM=linux2 \
- __PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
- $(3) \
- , \
- $(2) \
- )
-endef
-
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
-# $(3) => additional variables
-define Build/Compile/Py3Mod
- $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
- $(call Build/Compile/HostPy3RunTarget, \
- cd $(PKG_BUILD_DIR)/$(strip $(1)), \
- ./setup.py $(2), \
- $(3))
- find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
-endef
-
-define Py3Build/Compile/Default
- $(foreach pkg,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS),
- $(call host_python3_pip_install_host,$(pkg))
- )
- $(call Build/Compile/Py3Mod,, \
- install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
- --single-version-externally-managed \
- )
-endef
-
-Py3Build/Compile=$(Py3Build/Compile/Default)
-
-ifeq ($(BUILD_VARIANT),python3)
-define Build/Compile
- $(call Py3Build/Compile)
-endef
-endif # python3
+++ /dev/null
-#
-# Copyright (C) 2007-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-# Note: keep in sync with setuptools & pip
-PYTHON3_VERSION_MAJOR:=3
-PYTHON3_VERSION_MINOR:=6
-PYTHON3_VERSION_MICRO:=4
-
-PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
-
-PYTHON3_SETUPTOOLS_VERSION:=28.8.0
-PYTHON3_PIP_VERSION:=9.0.1
-
int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
-@@ -329,7 +329,7 @@ _Py_InitializeEx_Private(int install_sig
- if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
- Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
- if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
-- Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
-+ Py_DontWriteBytecodeFlag = atoi(p);
- /* The variable is only tested for existence here; _PyRandom_Init will
- check its value further. */
- if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
--- /dev/null
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -725,6 +725,16 @@ regen-all: regen-opcode regen-opcode-tar
+ ############################################################################
+ # Special rules for object files
+
++DATE_FMT = %b %d %Y
++TIME_FMT = %H:%M:%S
++ifdef SOURCE_DATE_EPOCH
++ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
++ BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(TIME_FMT)")
++else
++ BUILD_DATE ?= $(shell date "+$(DATE_FMT)")
++ BUILD_TIME ?= $(shell date "+$(TIME_FMT)")
++endif
++
+ Modules/getbuildinfo.o: $(PARSER_OBJS) \
+ $(OBJECT_OBJS) \
+ $(PYTHON_OBJS) \
+@@ -732,6 +742,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
+ $(MODOBJS) \
+ $(srcdir)/Modules/getbuildinfo.c
+ $(CC) -c $(PY_CORE_CFLAGS) \
++ -DDATE="\"$(BUILD_DATE)\"" \
++ -DTIME="\"$(BUILD_TIME)\"" \
+ -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \
+ -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \
+ -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
--- a/configure
+++ b/configure
-@@ -14986,7 +14986,7 @@ $as_echo_n "checking ABIFLAGS... " >&6;
+@@ -14995,7 +14995,7 @@ $as_echo_n "checking ABIFLAGS... " >&6;
$as_echo "$ABIFLAGS" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5
$as_echo_n "checking SOABI... " >&6; }
--- a/configure.ac
+++ b/configure.ac
-@@ -4639,7 +4639,7 @@ AC_SUBST(SOABI)
+@@ -4647,7 +4647,7 @@ AC_SUBST(SOABI)
AC_MSG_CHECKING(ABIFLAGS)
AC_MSG_RESULT($ABIFLAGS)
AC_MSG_CHECKING(SOABI)
abi=sys.abiflags,
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
-@@ -1338,7 +1338,7 @@ libinstall: build_all $(srcdir)/Modules/
+@@ -1350,7 +1350,7 @@ libinstall: build_all $(srcdir)/Modules/
esac; \
done; \
done
$(DESTDIR)$(LIBDEST); \
$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
ifeq (@COMPILE_ALL_TESTS@,yes)
-@@ -1475,7 +1475,7 @@ sharedinstall: sharedmods
+@@ -1487,7 +1487,7 @@ sharedinstall: sharedmods
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
--root=$(DESTDIR)/
# Here are a couple of targets for MacOSX again, to install a full
--- a/configure
+++ b/configure
-@@ -15005,7 +15005,7 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
+@@ -15014,7 +15014,7 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
$as_echo "$LDVERSION" >&6; }
LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
--- a/configure.ac
+++ b/configure.ac
-@@ -4656,7 +4656,7 @@ AC_MSG_RESULT($LDVERSION)
+@@ -4664,7 +4664,7 @@ AC_MSG_RESULT($LDVERSION)
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
AC_SUBST(PY_ENABLE_SHARED)
#
-# Copyright (C) 2007-2017 OpenWrt.org
+# Copyright (C) 2007-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=pytz
-PKG_VERSION:=2017.2
+PKG_VERSION:=2018.3
PKG_RELEASE:=1
PKG_LICENSE:=MIT
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
-PKG_SOURCE_URL:=https://pypi.python.org/packages/a4/09/c47e57fc9c7062b4e83b075d418800d322caa87ec0ac21e6308bd3a2d519/
-PKG_HASH:=f5c056e8f62d45ba8215e5cb8f50dfccb198b4b9fbea8500674f3443e4689589
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://pypi.python.org/packages/1b/50/4cdc62fc0753595fc16c8f722a89740f487c6e5670c644eb8983946777be/
+PKG_HASH:=410bcd1d6409026fbaa65d9ed33bf6dd8b1e94a499e32168acfc7b332e4095c0
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/pytz
SUBMENU:=Python
PKG_MIRROR_HASH:=a52728cc5653bf3c2a2f92954c6001338442a6e589bd364c497ba615c4365211
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/rcssmin
SUBMENU:=Python
PKG_HASH:=01a22d49ddd9a168b136f26cac87d9a335660ce07aa5c630b8e3607d6f4325e7
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
define Package/simplejson
SUBMENU:=Python
#
-# Copyright (C) 2006-2011, 2015-2016 OpenWrt.org
+# Copyright (C) 2006-2011, 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=twisted
-PKG_VERSION:=16.4.1
+PKG_VERSION:=17.9.0
PKG_RELEASE:=1
PKG_SOURCE:=Twisted-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=https://pypi.python.org/packages/6b/23/8dbe86fc83215015e221fbd861a545c6ec5c9e9cd7514af114d1f64084ab \
- http://twistedmatrix.com/Releases/Twisted/16.4
-PKG_HASH:=1d8d73f006c990744effb35588359fd44d43608649ac0b6b7edc71176e88e816
+PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/T/Twisted
+PKG_HASH:=0da1a7e35d5fcae37bc9c7978970b5feb3bc82822155b8654ec63925c05af75c
-PKG_BUILD_DIR:=$(BUILD_DIR)/Twisted-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-twisted-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=USE_MUSL:librpc
PKG_LICENSE:=MIT
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../python-package.mk
-define Package/twisted
+PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xjf $(DL_DIR)/$(PKG_SOURCE)
+
+define Package/twisted/Default
SUBMENU:=Python
SECTION:=lang
CATEGORY:=Languages
- TITLE:=Python networking engine
URL:=http://twistedmatrix.com/
- DEPENDS:=+python-light +zope-interface
+endef
+
+define Package/twisted
+$(call Package/twisted/Default)
+ TITLE:=Python networking engine
+ DEPENDS:= \
+ +PACKAGE_twisted:python-light \
+ +PACKAGE_twisted:python-automat \
+ +PACKAGE_twisted:python-constantly \
+ +PACKAGE_twisted:python-incremental \
+ +PACKAGE_twisted:python-hyperlink \
+ +PACKAGE_twisted:python-zope-interface
+ VARIANT:=python
endef
define Package/twisted/description
- Twisted is a networking engine written in Python, supporting numerous
- protocols. It contains a web server, numerous chat clients, chat servers,
- mail servers, and more.
+Twisted is a networking engine written in Python, supporting numerous
+protocols. It contains a web server, numerous chat clients, chat servers,
+mail servers, and more.
endef
define PyPackage/twisted/filespec
+|/usr/bin
--|/usr/bin/tkconch
+|$(PYTHON_PKG_DIR)
-|$(PYTHON_PKG_DIR)/twisted/conch/scripts/tkconch.py
endef
-define Build/Compile
- $(call Build/Compile/PyMod,, \
- install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" --no-compile, \
- )
-endef
-
$(eval $(call PyPackage,twisted))
$(eval $(call BuildPackage,twisted))
+$(eval $(call BuildPackage,twisted-src))
+++ /dev/null
-diff --git a/twisted/python/twisted-completion.zsh b/twisted/python/twisted-completion.zsh
-index 4d97aa5..9a8d4d8 100644
---- a/twisted/python/twisted-completion.zsh
-+++ b/twisted/python/twisted-completion.zsh
-@@ -1,4 +1,4 @@
--#compdef twistd trial conch cftp ckeygen pyhtmlizer tkconch
-+#compdef twistd trial conch cftp ckeygen pyhtmlizer
- #
- # This is the ZSH completion file for Twisted commands. It calls the current
- # command-line with the special "--_shell-completion" option which is handled
--- /dev/null
+diff --git a/src/twisted/python/_setup.py b/src/twisted/python/_setup.py
+index 3b5f69d4b..c69c5d13c 100644
+--- a/src/twisted/python/_setup.py
++++ b/src/twisted/python/_setup.py
+@@ -142,7 +142,6 @@ _CONSOLE_SCRIPTS = [
+ "cftp = twisted.conch.scripts.cftp:run",
+ "conch = twisted.conch.scripts.conch:run",
+ "pyhtmlizer = twisted.scripts.htmlizer:run",
+- "tkconch = twisted.conch.scripts.tkconch:run",
+ "trial = twisted.scripts.trial:run",
+ "twist = twisted.application.twist._twist:Twist.main",
+ "twistd = twisted.scripts.twistd:run",
+diff --git a/src/twisted/python/twisted-completion.zsh b/src/twisted/python/twisted-completion.zsh
+index 4d97aa5d3..9a8d4d82e 100644
+--- a/src/twisted/python/twisted-completion.zsh
++++ b/src/twisted/python/twisted-completion.zsh
+@@ -1,4 +1,4 @@
+-#compdef twistd trial conch cftp ckeygen pyhtmlizer tkconch
++#compdef twistd trial conch cftp ckeygen pyhtmlizer
+ #
+ # This is the ZSH completion file for Twisted commands. It calls the current
+ # command-line with the special "--_shell-completion" option which is handled
-diff --git a/setup.py b/setup.py
-index e21ef70..a4d9ee8 100755
---- a/setup.py
-+++ b/setup.py
-@@ -55,13 +55,14 @@ def main(args):
- setup_args = STATIC_PACKAGE_METADATA.copy()
+diff --git a/src/twisted/python/_setup.py b/src/twisted/python/_setup.py
+index 3b5f69d4b..2dca47aa5 100644
+--- a/src/twisted/python/_setup.py
++++ b/src/twisted/python/_setup.py
+@@ -175,11 +175,6 @@ class ConditionalExtension(Extension, object):
- setup_args.update(dict(
-- packages=setuptools.find_packages(),
-+ packages=setuptools.find_packages(exclude=["*.test", "*.test.*"]),
+ # The C extensions used for Twisted.
+ _EXTENSIONS = [
+- ConditionalExtension(
+- "twisted.test.raiser",
+- sources=["src/twisted/test/raiser.c"],
+- condition=lambda _: _isCPython),
+-
+ ConditionalExtension(
+ "twisted.internet.iocpreactor.iocpsupport",
+ sources=[
+@@ -232,7 +227,7 @@ def getSetupArgs(extensions=_EXTENSIONS):
+ requirements.append("hyperlink >= 17.1.1")
+
+ arguments.update(dict(
+- packages=find_packages("src"),
++ packages=find_packages("src", exclude=["*.test", "*.test.*"]),
+ use_incremental=True,
+ setup_requires=["incremental >= 16.10.1"],
install_requires=requirements,
- conditionalExtensions=getExtensions(),
- entry_points={
- 'console_scripts': getConsoleScripts()
+@@ -241,6 +236,7 @@ def getSetupArgs(extensions=_EXTENSIONS):
},
+ cmdclass=command_classes,
include_package_data=True,
+ exclude_package_data={'':['test/*']},
zip_safe=False,
extras_require=_EXTRAS_REQUIRE,
- ))
-diff --git a/twisted/python/dist.py b/twisted/python/dist.py
-index dfff9dc..a05b716 100644
---- a/twisted/python/dist.py
-+++ b/twisted/python/dist.py
-@@ -191,11 +191,11 @@ def getExtensions():
- Get the C extensions used for Twisted.
- """
- extensions = [
-- ConditionalExtension(
-- "twisted.test.raiser",
-- ["twisted/test/raiser.c"],
-- condition=lambda _: _isCPython
-- ),
-+ #ConditionalExtension(
-+ # "twisted.test.raiser",
-+ # ["twisted/test/raiser.c"],
-+ # condition=lambda _: _isCPython
-+ #),
- ConditionalExtension(
- "twisted.internet.iocpreactor.iocpsupport",
- ["twisted/internet/iocpreactor/iocpsupport/iocpsupport.c",
+ package_dir={"": "src"},
+++ /dev/null
-#
-# Copyright (C) 2006-2011, 2015-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=zope.interface
-PKG_VERSION:=4.3.2
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://pypi.python.org/packages/38/1b/d55c39f2cf442bd9fb2c59760ed058c84b57d25c680819c25f3aff741e1f
-PKG_HASH:=6a0e224a052e3ce27b3a7b1300a24747513f7a507217fcc2a4cb02eb92945cee
-
-PKG_LICENSE:=ZPL-2.1
-PKG_LICENSE_FILES:=LICENSE.txt
-PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
-
-include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-
-define Package/zope-interface
- SECTION:=lang
- CATEGORY:=Languages
- SUBMENU:=Python
- TITLE:=Zope interface
- URL:=https://github.com/zopefoundation/zope.interface
- DEPENDS:=+python-light
-endef
-
-define Package/zope-interface/description
-This package provides an implementation of "object interfaces" for
-Python. Interfaces are a mechanism for labeling objects as conforming to
-a given API or contract. So, this package can be considered as
-implementation of the Design By Contract methodology support in Python.
-endef
-
-define PyPackage/zope-interface/filespec
-+|$(PYTHON_PKG_DIR)
--|$(PYTHON_PKG_DIR)/zope/interface/common/tests
--|$(PYTHON_PKG_DIR)/zope/interface/tests
-endef
-
-define Build/Compile
- $(call Build/Compile/PyMod,, \
- install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" --no-compile, \
- )
-endef
-
-$(eval $(call PyPackage,zope-interface))
-$(eval $(call BuildPackage,zope-interface))
include $(TOPDIR)/rules.mk
PKG_NAME:=ruby
-PKG_VERSION:=2.5.0
+PKG_VERSION:=2.5.1
PKG_RELEASE:=1
# First two numbes
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://cache.ruby-lang.org/pub/ruby/$(PKG_ABI_VERSION)/
-PKG_HASH:=1da0afed833a0dab94075221a615c14487b05d0c407f991c8080d576d985b49b
+PKG_HASH:=886ac5eed41e3b5fc699be837b0087a6a5a3d10f464087560d2d21b3e71b754d
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=COPYING
#
-# Copyright (C) 2015-2017 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(INCLUDE_DIR)/target.mk
PKG_NAME:=boost
-PKG_VERSION:=1.66.0
-PKG_SOURCE_VERSION:=1_66_0
+PKG_VERSION:=1.67.0
+PKG_SOURCE_VERSION:=1_67_0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
-PKG_HASH:=5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9
+PKG_HASH:=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
endef
define Package/boost/description
-This package provides the Boost v1.66.0 libraries.
+This package provides the Boost v1.67.0 libraries.
Boost is a set of free, peer-reviewed, portable C++ source libraries.
-----------------------------------------------------------------------------
- wave
There are many more header-only libraries supported by Boost.
-See more at http://www.boost.org/doc/libs/1_66_0/
+See more at http://www.boost.org/doc/libs/1_67_0/
endef
PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
$(eval $(call DefineBoostLibrary,chrono,system,))
$(eval $(call DefineBoostLibrary,container,,))
$(eval $(call DefineBoostLibrary,context,chrono system thread,))
+$(eval $(call DefineBoostLibrary,contract,system,))
$(eval $(call DefineBoostLibrary,coroutine,system chrono context thread,))
$(eval $(call DefineBoostLibrary,date_time,,))
#$(eval $(call DefineBoostLibrary,exception,,))
include $(TOPDIR)/rules.mk
PKG_NAME:=c-ares
-PKG_VERSION:=1.13.0
+PKG_VERSION:=1.14.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://c-ares.haxx.se/download
-PKG_HASH:=03f708f1b14a26ab26c38abd51137640cb444d3ec72380b21b20f1a8d2861da7
+PKG_HASH:=45d3c1fd29263ceec2afc8ff9cd06d5f8f889636eb4e80ce3cc7f0eaf7aadc6e
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/martinh/libconfuse/releases/download/v$(PKG_VERSION)
PKG_HASH:=23c63272baf2ef4e2cbbafad2cf57de7eb81f006ec347c00b954819824add25e
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net>
+PKG_MAINTAINER:=
PKG_LICENSE:=ISC
PKG_FIXUP:=autoreconf
include $(TOPDIR)/rules.mk
PKG_NAME:=cyrus-sasl
-PKG_VERSION:=2.1.26
-PKG_RELEASE:=3
+PKG_VERSION_BASE:=2.1.27
+PKG_VERSION:=$(PKG_VERSION_BASE)-rc7
+PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=ftp://ftp.cyrusimap.org/cyrus-sasl/
-PKG_HASH:=8fbc5136512b59bb793657f36fadda6359cae3b08f01fd16b3d406f1345b7bc3
+PKG_SOURCE_URL:=https://www.cyrusimap.org/releases/
+PKG_HASH:=c1846b80e80286c94941a1e27974bba759b171ccad25d5b49bd8d9deab10f54b
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION_BASE)
PKG_LICENSE:=BSD-4c BSD
PKG_LICENSE_FILES:=COPYING cmulocal/COPYING saslauthd/COPYING
PKG_NAME:=dmx_usb_module
PKG_VERSION:=0.1.20130818
-PKG_RELEASE:=0.1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=git://github.com/lowlander/dmx_usb_module.git
+PKG_SOURCE_URL:=https://github.com/lowlander/dmx_usb_module.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ee99ca7edbd9e093480ad63341ac007394047bde
PKG_MAINTAINER:=Martijn Zilverschoon <martijn@friedzombie.com>
--- /dev/null
+--- a/dmx_usb.c
++++ b/dmx_usb.c
+@@ -20,7 +20,7 @@
+ #include <linux/module.h>
+ #include <linux/spinlock.h>
+ #include <linux/completion.h>
+-#include <asm/uaccess.h>
++#include <linux/uaccess.h>
+ #include <linux/usb.h>
+ #include <linux/version.h>
+
SECTION:=libs
CATEGORY:=Libraries
TITLE+=library
- DEPENDS:=@BUILD_PATENTED
MENU:=1
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=freetype
-PKG_VERSION:=2.8.1
-PKG_RELEASE:=2
+PKG_VERSION:=2.9
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/freetype
-PKG_HASH:=e5435f02e02d2b87bb8e4efdcaa14b1f78c9cf3ab1ed80f94b6382fb6acc7d78
+PKG_HASH:=e6ffba3c8cef93f557d1f767d7bc3dee860ac7a3aaff588a521e081bc36f4c8a
PKG_LICENSE:=FTL GPL-2.0 MIT ZLIB
PKG_LICENSE_FILES:=docs/LICENSE.TXT docs/FTL.TXT docs/GPLv2.TXT src/bdf/README src/pcf/README src/gzip/zlib.h
--- /dev/null
+menu "Configuration"
+ depends on PACKAGE_getdns
+
+config GETDNS_ENABLE_STUB_ONLY
+ bool "GETDNS_ENABLE_STUB_ONLY"
+ help
+ getdns can be configured for stub resolution mode only. (Removes libunbound dependency)
+ default y
+
+config GETDNS_ENABLE_IDN_LIBIDN2
+ bool "GETDNS_ENABLE_IDN_LIBIDN2"
+ help
+ getdns can be configured with some IDN Support. (Requires libidn2 dependency)
+ default n
+
+endmenu
--- /dev/null
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=getdns
+PKG_VERSION:=1.4.1
+PKG_RELEASE:=2
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=David Mora <iamperson347+public@gmail.com>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://getdnsapi.net/dist/
+PKG_HASH:=245233dc780f615b6ab1472f2b9cdcd957a451a736f3036717d0da466ab1c51e
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:= \
+ CONFIG_GETDNS_ENABLE_STUB_ONLY \
+ CONFIG_GETDNS_ENABLE_IDN_LIBIDN2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/getdns/Default
+ TITLE:=getdns
+ URL:=https://getdnsapi.net/
+endef
+
+define Package/getdns
+ $(call Package/getdns/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE+= (library)
+ DEPENDS+= +libopenssl +!GETDNS_ENABLE_STUB_ONLY:libunbound +GETDNS_ENABLE_IDN_LIBIDN2:libidn2
+ MENU:=1
+endef
+
+define Package/getdns/description
+ This package contains the getdns library (libgetdns).
+ This package also contains the "getdns_query" command line wrapper for getdns exposing the features of this implementation (both in the official API and the additional API functions).
+endef
+
+define Package/getdns/config
+ source "$(SOURCE)/Config.in"
+endef
+
+CONFIGURE_ARGS += \
+ $(if $(CONFIG_GETDNS_ENABLE_STUB_ONLY), --enable-stub-only, ) \
+ --without-libidn \
+ $(if $(CONFIG_GETDNS_ENABLE_IDN_LIBIDN2), , --without-libidn2 ) \
+ --with-ssl="$(STAGING_DIR)/usr" \
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include/getdns/
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/getdns/getdns*.h $(1)/usr/include/getdns/
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgetdns*.{a,so*} $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/getdns*.pc $(1)/usr/lib/pkgconfig/
+endef
+
+
+define Package/getdns/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libgetdns.so.* $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/getdns_query $(1)/usr/sbin/getdns_query
+endef
+
+$(eval $(call BuildPackage,getdns))
include $(TOPDIR)/rules.mk
PKG_NAME:=glib2
-PKG_VERSION:=2.55.0
+PKG_VERSION:=2.56.1
PKG_RELEASE:=1
PKG_SOURCE:=glib-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(BUILD_DIR)/glib-$(PKG_VERSION)
-PKG_SOURCE_URL:=@GNOME/glib/2.55
-PKG_HASH:=13fc009e68ca490f986f21a7d5d3a429486fb28a1f4e06298c9ac976067518f5
+PKG_SOURCE_URL:=@GNOME/glib/2.56
+PKG_HASH:=40ef3f44f2c651c7a31aedee44259809b6f03d3d20be44545cd7d177221c0b8d
PKG_BUILD_PARALLEL:=1
HOST_BUILD_PARALLEL:=1
--- a/gtk-doc.make
+++ b/gtk-doc.make
-@@ -277,7 +277,7 @@ uninstall-local:
+@@ -298,7 +298,7 @@ uninstall-local:
#
# Require gtk-doc when making dist
#
--- /dev/null
+--- a/gio/gthreadedresolver.c
++++ b/gio/gthreadedresolver.c
+@@ -871,6 +871,8 @@ do_lookup_records (GTask *task,
+
+ #ifdef HAVE_RES_NQUERY
+
++#ifdef HAVE_RES_NQUERY
++
+ #if defined(HAVE_RES_NDESTROY)
+ res_ndestroy (&res);
+ #elif defined(HAVE_RES_NCLOSE)
+@@ -881,6 +883,8 @@ do_lookup_records (GTask *task,
+
+ #endif /* HAVE_RES_NQUERY */
+
++#endif
++
+ #else
+
+ DNS_STATUS status;
+++ /dev/null
-From 0817af40e8c74c721c30f6ef482b1f53d12044c7 Mon Sep 17 00:00:00 2001
-From: coypu <coypu@sdf.org>
-Date: Mon, 8 Feb 2016 00:06:06 +0200
-Subject: gdate: Suppress string format literal warning
-
-Newer versions of GCC emit an error here, but we know it's safe.
-https://bugzilla.gnome.org/761550
----
- glib/gdate.c | 3 +++
- 1 file changed, 3 insertions(+)
-
---- a/glib/gdate.c
-+++ b/glib/gdate.c
-@@ -2497,7 +2497,10 @@ g_date_strftime (gchar *s,
- * recognize whether strftime actually failed or just returned "".
- */
- tmpbuf[0] = '\1';
-+ #pragma GCC diagnostic push
-+ #pragma GCC diagnostic ignored "-Wformat-nonliteral"
- tmplen = strftime (tmpbuf, tmpbufsize, locale_format, &tm);
-+ #pragma GCC diagnostic pop
-
- if (tmplen == 0 && tmpbuf[0] != '\0')
- {
include $(TOPDIR)/rules.mk
PKG_NAME:=icu4c
-PKG_VERSION:=60.2
+PKG_VERSION:=61.1
PKG_RELEASE:=1
-PKG_SOURCE:=$(PKG_NAME)-60_2-src.tgz
+PKG_SOURCE:=$(PKG_NAME)-61_1-src.tgz
PKG_SOURCE_URL:=http://download.icu-project.org/files/$(PKG_NAME)/$(PKG_VERSION)
-PKG_HASH:=f073ea8f35b926d70bb33e6577508aa642a8b316a803f11be20af384811db418
+PKG_HASH:=d007f89ae8a2543a53525c74359b65b36412fa84b3349f1400be6dcf409fafef
PKG_LICENSE:=ICU-1.8.1+
PKG_LICENSE_FILES:=LICENSE
PKG_NAME:=libcap
PKG_VERSION:=2.25
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
URL:=http://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
endef
+define Package/libcap/config
+ if PACKAGE_libcap
+
+ config PACKAGE_libcap-bin
+ bool "install libcap executables"
+ help
+ Install capsh, getcap, getpcaps, setcap into the target image.
+ default n
+
+ config PACKAGE_libcap-bin-capsh-shell
+ string "capsh shell"
+ depends on PACKAGE_libcap-bin
+ help
+ Set the capsh shell.
+ default "/bin/sh"
+
+ endif
+endef
+
MAKE_FLAGS += \
- CFLAGS="$(TARGET_CFLAGS)" \
BUILD_CC="$(CC)" \
BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
CFLAGS="$(TARGET_CFLAGS)" \
- LD="$(TARGET_CC)" \
- LDFLAGS="$(TARGET_LDFLAGS) -shared" \
+ LD="$(TARGET_CC) -Wl,-x -shared" \
+ LDFLAGS="$(TARGET_LDFLAGS)" \
INDENT="| true" \
PAM_CAP="no" \
RAISE_SETFCAP="no" \
DYNAMIC="yes" \
lib="lib"
+ifneq ($(CONFIG_PACKAGE_libcap-bin-capsh-shell),)
+TARGET_CFLAGS += -DSHELL='\"$(CONFIG_PACKAGE_libcap-bin-capsh-shell)\"'
+endif
+
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/sys
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
define Package/libcap/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
+ifneq ($(CONFIG_PACKAGE_libcap-bin),)
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/sbin/getcap $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/sbin/setcap $(1)/usr/sbin/
+endif
endef
$(eval $(call BuildPackage,libcap))
--- /dev/null
+--- a/progs/capsh.c
++++ b/progs/capsh.c
+@@ -24,6 +24,9 @@
+ #include <sys/wait.h>
+ #include <sys/prctl.h>
+
++#ifndef SHELL
++#define SHELL "/bin/sh"
++#endif
+ #define MAX_GROUPS 100 /* max number of supplementary groups for user */
+
+ static const cap_value_t raise_setpcap[1] = { CAP_SETPCAP };
+@@ -557,10 +560,10 @@ int main(int argc, char *argv[], char *envp[])
+ }
+ printf("\n");
+ } else if ((!strcmp("--", argv[i])) || (!strcmp("==", argv[i]))) {
+- argv[i] = strdup(argv[i][0] == '-' ? "/bin/bash" : argv[0]);
++ argv[i] = strdup(argv[i][0] == '-' ? SHELL : argv[0]);
+ argv[argc] = NULL;
+ execve(argv[i], argv+i, envp);
+- fprintf(stderr, "execve /bin/bash failed!\n");
++ fprintf(stderr, "execve " SHELL " failed!\n");
+ exit(1);
+ } else {
+ usage:
+@@ -582,7 +585,7 @@ int main(int argc, char *argv[], char *envp[])
+ " --killit=<n> send signal(n) to child\n"
+ " --forkfor=<n> fork and make child sleep for <n> sec\n"
+ " == re-exec(capsh) with args as for --\n"
+- " -- remaing arguments are for /bin/bash\n"
++ " -- remaing arguments are for " SHELL "\n"
+ " (without -- [%s] will simply exit(0))\n",
+ argv[0], argv[0]);
+
include $(TOPDIR)/rules.mk
PKG_NAME:=libdaq
-PKG_VERSION:=2.0.4
+PKG_VERSION:=2.0.6
PKG_RELEASE:=2
PKG_SOURCE_URL:=https://www.snort.org/downloads/snort/ \
@SF/snort
PKG_SOURCE:=daq-$(PKG_VERSION).tar.gz
-PKG_HASH:=a294aa3d01cd8902bf842d320e7f2c043af9ead95d0e7198c3b71a0dbc9d253c
+PKG_HASH:=d41da5f7793e66044e6927dd868c0525e7ee4ec1a3515bf74ef9a30cd9273af0
PKG_BUILD_DIR:=$(BUILD_DIR)/daq-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0
-PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
--- a/configure
+++ b/configure
-@@ -12967,10 +12967,11 @@ if ${daq_cv_libpcap_version_1x+:} false;
+@@ -13552,10 +13552,11 @@ if ${daq_cv_libpcap_version_1x+:} false;
else
if test "$cross_compiling" = yes; then :
--- /dev/null
+#
+# Copyright (C) 2018 Othmar Truniger
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libfmt
+PKG_VERSION:=4.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/fmtlib/fmt.git
+PKG_SOURCE_VERSION:=$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_MIRROR_HASH:=112c964c1537fbc2f3a993f405547fc57b0f3d1524c808006920c53fab42c233
+
+PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
+PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE_FILES:=LICENSE.rst
+
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_OPTIONS += -DBUILD_SHARED_LIBS=ON
+CMAKE_OPTIONS += -DFMT_DOC=OFF
+CMAKE_OPTIONS += -DFMT_TEST=OFF
+
+define Package/libfmt
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=Small, safe and fast formatting library
+ URL:=https://github.com/fmtlib/fmt
+ DEPENDS:=+libstdcpp
+endef
+
+define Package/libfmt/description
+ fmt is an open-source formatting library for C++.
+ It can be used as a safe alternative to printf or as a fast alternative to IOStreams.
+endef
+
+define Package/libfmt/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfmt.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include/fmt
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/fmt/*.h $(1)/usr/include/fmt/
+
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfmt.so* $(1)/usr/lib/
+
+ $(INSTALL_DIR) $(1)/usr/lib/cmake
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmake/* $(1)/usr/lib/cmake/
+endef
+
+$(eval $(call BuildPackage,libfmt))
PKG_NAME:=libgcrypt
PKG_VERSION:=1.6.6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.gnupg.org/ftp/gcrypt/libgcrypt/
PKG_LICENSE:=LGPL-2.1+ GPL-2.0+
PKG_LICENSE_FILES:=COPYING
-PKG_FIXUP:=patch-libtool
+PKG_FIXUP:=autoreconf patch-libtool
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
--- /dev/null
+From a785cc3db0c4e8eb8ebbf784b833a40d2c42ec3e Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk@gnupg.org>
+Date: Tue, 25 Aug 2015 21:11:05 +0200
+Subject: [PATCH] Add configure option --enable-build-timestamp.
+
+* configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.
+--
+
+This is based on
+libgpg-error commit d620005fd1a655d591fccb44639e22ea445e4554
+but changed to be disabled by default. Check there for some
+background.
+
+Signed-off-by: Werner Koch <wk@gnupg.org>
+---
+ configure.ac | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 48e217947287..2acfa3630cac 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2272,7 +2272,16 @@ changequote([,])dnl
+ BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
+ AC_SUBST(BUILD_FILEVERSION)
+
+-BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
++AC_ARG_ENABLE([build-timestamp],
++ AC_HELP_STRING([--enable-build-timestamp],
++ [set an explicit build timestamp for reproducibility.
++ (default is the current time in ISO-8601 format)]),
++ [if test "$enableval" = "yes"; then
++ BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
++ else
++ BUILD_TIMESTAMP="$enableval"
++ fi],
++ [BUILD_TIMESTAMP="<none>"])
+ AC_SUBST(BUILD_TIMESTAMP)
+ AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
+ [The time this package was configured for a build])
+--
+2.15.1
+
include $(TOPDIR)/rules.mk
PKG_NAME:=libgphoto2
-PKG_VERSION:=2.5.16
+PKG_VERSION:=2.5.17
PKG_RELEASE:=1
PORT_VERSION:=0.12.0
PKG_MAINTAINER:=Leonardo Medici <leonardo_medici@me.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/gphoto
-PKG_HASH:=e757416d1623e01a9d0d294b2e790162e434c0964f50d3b7ff1a3424b62a2906
+PKG_HASH:=417464f0a313fa937e8a71cdf18a371cf01e750830195cd63ae31da0d092b555
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=COPYING
-Index: libgphoto2-2.5.16/configure.ac
+Index: libgphoto2-2.5.17/configure.ac
===================================================================
---- libgphoto2-2.5.16.orig/configure.ac
-+++ libgphoto2-2.5.16/configure.ac
+--- libgphoto2-2.5.17.orig/configure.ac
++++ libgphoto2-2.5.17/configure.ac
@@ -209,7 +209,6 @@ ALL_LINGUAS="cs da de es eu fr hu it ja
GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2_CURRENT_MIN}],[The gPhoto Team],[${MAIL_GPHOTO_TRANSLATION}])
AM_GNU_GETTEXT_VERSION([0.14.1])
AM_ICONV()
GP_GETTEXT_FLAGS()
-Index: libgphoto2-2.5.16/libgphoto2_port/configure.ac
+Index: libgphoto2-2.5.17/libgphoto2_port/configure.ac
===================================================================
---- libgphoto2-2.5.16.orig/libgphoto2_port/configure.ac
-+++ libgphoto2-2.5.16/libgphoto2_port/configure.ac
+--- libgphoto2-2.5.17.orig/libgphoto2_port/configure.ac
++++ libgphoto2-2.5.17/libgphoto2_port/configure.ac
@@ -124,7 +124,6 @@ GP_GETTEXT_HACK([${PACKAGE}-${LIBGPHOTO2
ALL_LINGUAS="cs da de es eu fi fr it ja nl pl pt_BR ru sk sr sv uk vi zh_CN zh_TW"
AM_GNU_GETTEXT_VERSION([0.14.1])
-Index: libgphoto2-2.5.16/Makefile.am
+Index: libgphoto2-2.5.17/Makefile.am
===================================================================
---- libgphoto2-2.5.16.orig/Makefile.am
-+++ libgphoto2-2.5.16/Makefile.am
+--- libgphoto2-2.5.17.orig/Makefile.am
++++ libgphoto2-2.5.17/Makefile.am
@@ -8,7 +8,7 @@ bin_SCRIPTS = gphoto2-config
EXTRA_DIST = HACKING MAINTAINERS TESTERS installcheck.mk
EXTRA_DIST += libgphoto2.pc.in
pkgconfig_DATA = libgphoto2.pc
-Index: libgphoto2-2.5.16/Makefile.in
+Index: libgphoto2-2.5.17/Makefile.in
===================================================================
---- libgphoto2-2.5.16.orig/Makefile.in
-+++ libgphoto2-2.5.16/Makefile.in
+--- libgphoto2-2.5.17.orig/Makefile.in
++++ libgphoto2-2.5.17/Makefile.in
@@ -482,7 +482,7 @@ EXTRA_DIST = HACKING MAINTAINERS TESTERS
INSTALL README.in README README.packaging
pkgconfig_DATA = libgphoto2.pc
noinst_DATA = libgphoto2-uninstalled.pc
doc_DATA = AUTHORS COPYING NEWS ABOUT-NLS ChangeLog README \
-Index: libgphoto2-2.5.16/configure.ac
+Index: libgphoto2-2.5.17/configure.ac
===================================================================
---- libgphoto2-2.5.16.orig/configure.ac
-+++ libgphoto2-2.5.16/configure.ac
+--- libgphoto2-2.5.17.orig/configure.ac
++++ libgphoto2-2.5.17/configure.ac
@@ -635,20 +635,11 @@ gphoto-m4/Makefile
libgphoto2/Makefile
libgphoto2.pc
],[
dnl This relies on this code being called for each of the above files
dnl with ac_file set to the filename.
-Index: libgphoto2-2.5.16/libgphoto2_port/Makefile.am
+Index: libgphoto2-2.5.17/libgphoto2_port/Makefile.am
===================================================================
---- libgphoto2-2.5.16.orig/libgphoto2_port/Makefile.am
-+++ libgphoto2-2.5.16/libgphoto2_port/Makefile.am
+--- libgphoto2-2.5.17.orig/libgphoto2_port/Makefile.am
++++ libgphoto2-2.5.17/libgphoto2_port/Makefile.am
@@ -25,7 +25,7 @@ udevscript_PROGRAMS =
bin_SCRIPTS = gphoto2-port-config
########################################################################
-Index: libgphoto2-2.5.16/libgphoto2_port/Makefile.in
+Index: libgphoto2-2.5.17/libgphoto2_port/Makefile.in
===================================================================
---- libgphoto2-2.5.16.orig/libgphoto2_port/Makefile.in
-+++ libgphoto2-2.5.16/libgphoto2_port/Makefile.in
+--- libgphoto2-2.5.17.orig/libgphoto2_port/Makefile.in
++++ libgphoto2-2.5.17/libgphoto2_port/Makefile.in
@@ -574,7 +574,7 @@ EXTRA_LTLIBRARIES = disk.la ptpip.la ser
bin_SCRIPTS = gphoto2-port-config
########################################################################
# All iolibs are defined as EXTRA_LTLIBRARIES. This requires that
-Index: libgphoto2-2.5.16/libgphoto2_port/configure.ac
+Index: libgphoto2-2.5.17/libgphoto2_port/configure.ac
===================================================================
---- libgphoto2-2.5.16.orig/libgphoto2_port/configure.ac
-+++ libgphoto2-2.5.16/libgphoto2_port/configure.ac
+--- libgphoto2-2.5.17.orig/libgphoto2_port/configure.ac
++++ libgphoto2-2.5.17/libgphoto2_port/configure.ac
@@ -512,13 +512,10 @@ AC_SUBST([AM_LDFLAGS])
# ---------------------------------------------------------------------------
AC_CONFIG_FILES([
--- /dev/null
+#
+# Copyright (C) 2018 Michael Heimpold <mhei@heimpold.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libgpiod
+PKG_VERSION:=1.0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@KERNEL/software/libs/libgpiod/
+PKG_HASH:=972924195367f5fb045c023d65340c4b7dfc8764499516be446553865208dedc
+
+PKG_LICENSE:=LGPL-2.1+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+ifneq ($(CONFIG_PACKAGE_gpiod-tools),)
+CONFIGURE_ARGS += --enable-tools
+endif
+
+define Package/libgpiod
+ SECTION:=libs
+ CATEGORY:=Libraries
+ URL:=https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
+ TITLE:=Library for interacting with Linux's GPIO character device
+ DEPENDS:=@GPIO_SUPPORT @(LINUX_4_9||LINUX_4_14)
+endef
+
+define Package/libgpiod/description
+ C library for interacting with the linux GPIO character device
+ (gpiod stands for GPIO device).
+endef
+
+define Package/gpiod-tools
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=Tools for interacting with GPIO pins
+ DEPENDS:=+libgpiod
+endef
+
+define Package/gpiod-tools/description
+ Tools for interacting with the linux GPIO character device
+ (gpiod stands for GPIO device).
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/gpiod.h $(1)/usr/include/
+
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.{so*,a} $(1)/usr/lib/
+
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libgpiod.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libgpiod/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgpiod.so* $(1)/usr/lib/
+endef
+
+define Package/gpiod-tools/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libgpiod))
+$(eval $(call BuildPackage,gpiod-tools))
include $(TOPDIR)/rules.mk
PKG_NAME:=libhttp-parser
-PKG_VERSION:=2.7.1
+PKG_VERSION:=2.8.0
PKG_RELEASE=1
PKG_MAINTAINER:=Ramanathan Sivagurunathan <ramzthecoder@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE-MIT
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=20e6acc415ae8a47f39c6821685dbba09d99ff5079902fe1a0f580c2c88ae18a
+PKG_MIRROR_HASH:=83acea397da4cdb9192c27abbd53a9eb8e5a9e1bcea2873b499f7ccc0d68f518
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=git://github.com/joyent/http-parser.git
+PKG_SOURCE_URL:=git://github.com/nodejs/http-parser.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A library to parse http request and response
- URL:=https://github.com/joyent/http-parser
+ URL:=https://github.com/nodejs/http-parser
endef
define Package/libhttp-parser/description
$(INSTALL_DATA) $(PKG_BUILD_DIR)/http_parser.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libhttp_parser.so.* $(1)/usr/lib/
- ( cd $(1)/usr/lib ; ln -s libhttp_parser.so.* libhttp_parser.so )
+ ( cd $(1)/usr/lib ; \
+ ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so ; \
+ ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so.2.8 )
endef
define Package/libhttp-parser/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libhttp_parser.so.* $(1)/usr/lib/
- ( cd $(1)/usr/lib ; ln -s libhttp_parser.so.* libhttp_parser.so )
+ ( cd $(1)/usr/lib ; \
+ ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so ; \
+ ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so.2.8 )
endef
$(eval $(call BuildPackage,libhttp-parser))
--- /dev/null
+#
+# Copyright (C) 2017-2018 Daniel Engberg <daniel.engberg.lists@pyret.net>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libidn2
+PKG_VERSION:=2.0.4
+PKG_RELEASE:=1
+PKG_MAINTAINER:=Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+PKG_LICENSE:=GPL-2.0-or-later LGPL-3.0-or-later
+PKG_LICENSE_FILES:=COPYING COPYINGv2 COPYING.LESSERv3
+
+PKG_SOURCE_URL:=@GNU/libidn
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=644b6b03b285fb0ace02d241d59483d98bc462729d8bb3608d5cad5532f3d2f0
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/idn2/Default
+ SECTION:=net
+ CATEGORY:=Network
+ URL:=http://www.gnu.org/software/libidn/
+endef
+
+define Package/idn2/Default/description
+ Libidn2 is a free software implementation of IDNA2008,
+ Punycode and TR46 in library form. It contains
+ functionality to convert internationalized domain
+ names to and from ASCII Compatible Encoding (ACE),
+ following the IDNA2008 and TR46 standards.
+endef
+
+define Package/idn2
+ $(call Package/idn2/Default)
+ SUBMENU:=IP Addresses and Names
+ TITLE:=GNU IDN2 (Internationalized Domain Name) tool
+ DEPENDS:=+libidn2
+endef
+
+define Package/idn2/description
+$(call Package/idn2/Default/description)
+
+ Command line tool using libidn2
+
+endef
+
+define Package/libidn2
+ SECTION:=libs
+ CATEGORY:=Libraries
+ DEPENDS:=+libunistring $(ICONV_DEPENDS) $(INTL_DEPENDS)
+ TITLE:=International domain name library (IDNA2008, Punycode and TR46)
+ URL:=https://www.gnu.org/software/libidn/#libidn2
+endef
+
+define Package/libidn2/description
+$(call Package/idn2/Default/description)
+
+ Library only package
+
+endef
+
+CONFIGURE_ARGS += \
+ --disable-rpath \
+ --disable-doc
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/idn2.h $(1)/usr/include
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libidn2.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/idn2/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+define Package/libidn2/install
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,idn2))
+$(eval $(call BuildPackage,libidn2))
#
-# Copyright (C) 2017 Michael Heimpold <mhei@heimpold.de>
+# Copyright (C) 2017-2018 Michael Heimpold <mhei@heimpold.de>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=libiio
-PKG_VERSION:=0.11
+PKG_VERSION:=0.14
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/analogdevicesinc/libiio/tar.gz/v$(PKG_VERSION)?
-PKG_HASH:=0174111b028d84f18fb3716b22834a372a1f2575938f87e20e5cbd76747d0fdb
+PKG_HASH:=12063db7a9366aa00bfd789db30afaddb29686bc29b3ce1e5d4adfe1c3b42527
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=COPYING.txt
CMAKE_INSTALL:=1
+PKG_CONFIG_DEPENDS:= \
+ CONFIG_IPV6 \
+ CONFIG_LIBIIO_LOCAL_BACKEND \
+ CONFIG_LIBIIO_NETWORK_BACKEND \
+ CONFIG_LIBIIO_USB_BACKEND \
+ CONFIG_LIBIIO_XML_BACKEND
+
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
+CMAKE_OPTIONS += -DWITH_DOC=OFF
+CMAKE_OPTIONS += -DENABLE_IPV6=$(if $(CONFIG_IPV6),ON,OFF)
+CMAKE_OPTIONS += -DENABLE_AIO=OFF
+CMAKE_OPTIONS += -DWITH_LOCAL_BACKEND=$(if $(CONFIG_LIBIIO_LOCAL_BACKEND),ON,OFF)
+CMAKE_OPTIONS += -DWITH_LOCAL_CONFIG=OFF
+CMAKE_OPTIONS += -DWITH_NETWORK_BACKEND=$(if $(CONFIG_LIBIIO_NETWORK_BACKEND),ON,OFF)
+# serial backend requires libserial which is not packaged yet
+CMAKE_OPTIONS += -DWITH_SERIAL_BACKEND=OFF
+CMAKE_OPTIONS += -DWITH_USB_BACKEND=$(if $(CONFIG_LIBIIO_USB_BACKEND),ON,OFF)
+CMAKE_OPTIONS += -DWITH_XML_BACKEND=$(if $(CONFIG_LIBIIO_XML_BACKEND),ON,OFF)
+
define Package/libiio
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Library for interfacing with Linux IIO devices
URL:=https://github.com/analogdevicesinc/libiio
- DEPENDS:=+PACKAGE_libaio:libaio +PACKAGE_libusb-1.0:libusb-1.0 \
- +PACKAGE_libavahi-common:libavahi-common +PACKAGE_libavahi-client:libavahi-client +libxml2
+ DEPENDS:=\
+ +LIBIIO_USB_BACKEND:libusb-1.0 \
+ +LIBIIO_NETWORK_BACKEND:libavahi-client \
+ +LIBIIO_XML_BACKEND:libxml2
+ MENU:=1
+endef
+
+define Package/libiio/config
+config LIBIIO_LOCAL_BACKEND
+ bool "Enable local backend"
+ depends on PACKAGE_libiio
+ default y
+
+config LIBIIO_NETWORK_BACKEND
+ bool "Enable network backend"
+ depends on PACKAGE_libiio
+ select LIBIIO_XML_BACKEND
+ default n
+
+config LIBIIO_USB_BACKEND
+ bool "Enable USB backend"
+ depends on PACKAGE_libiio
+ select LIBIIO_XML_BACKEND
+ default n
+
+config LIBIIO_XML_BACKEND
+ bool "Enable XML backend"
+ depends on PACKAGE_libiio
+ default n
endef
define Package/libiio/description
+++ /dev/null
---- a/CMakeLists.txt 2017-10-23 22:24:46.000000000 +0200
-+++ b/CMakeLists.txt 2017-11-18 20:31:27.943838662 +0100
-@@ -111,7 +111,7 @@
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
-- if (${LIBIIO_GIT_REPO} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
-+ if ("${LIBIIO_GIT_REPO}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/libimobiledevice/Default
TITLE:=A library that talks to Apple devices.
PKG_NAME:=libmad
PKG_VERSION:=0.15.1b
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/mad \
CATEGORY:=Libraries
TITLE:=An high-quality MPEG audio decoding library
URL:=http://www.underbit.com/products/mad/
- DEPENDS:=@BUILD_PATENTED
endef
define Package/libmad/description
include $(TOPDIR)/rules.mk
PKG_NAME:=libmicrohttpd
-PKG_VERSION:=0.9.55
+PKG_VERSION:=0.9.59
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/libmicrohttpd
-PKG_HASH:=0c1cab8dc9f2588bd3076a28f77a7f8de9560cbf2d80e53f9a8696ada80ed0f8
+PKG_HASH:=9b9ccd7d0b11b0e179f1f58dc2caa3e0c62c8609e1e1dc7dcaadf941b67d923c
PKG_MAINTAINER:=Alexander Couzens <lynxis@fe80.eu>
include $(TOPDIR)/rules.mk
PKG_NAME:=libnatpmp
-PKG_VERSION:=20140401
+PKG_VERSION:=20150609
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://miniupnp.free.fr/files
-PKG_HASH:=b2ce5e626a21c795cba2d118f26e54aaa89de29d4611c440fafc49a2a5bedabb
+PKG_SOURCE_URL:=https://miniupnp.tuxfamily.org/files
+PKG_HASH:=e1aa9c4c4219bc06943d6b2130f664daee213fb262fcb94dd355815b8f4536b0
PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
PKG_LICENSE:=BSD-3c
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/libsearpc
SECTION:=libs
include $(TOPDIR)/rules.mk
PKG_NAME:=libsoup
-PKG_VERSION:=2.54.1
-PKG_RELEASE:=2
+PKG_VERSION:=2.60.3
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.54
-PKG_HASH:=47b42c232034734d66e5f093025843a5d8cc4b2357c011085a2fd04ef02dd633
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.60
+PKG_HASH:=1b0dc762f23abe4e0d29b77370e539fd35f31d8e8e0318d6ddccff395be68a22
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
#
-# Copyright (C) 2014-2016 OpenWrt.org
-#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# updated to work with latest source from abrasive
include $(TOPDIR)/rules.mk
PKG_NAME:=libsoxr
-PKG_VERSION:=0.1.1
-PKG_RELEASE:=3
+PKG_VERSION:=0.1.3
+PKG_RELEASE:=1
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=git://git.code.sf.net/p/soxr/code
-PKG_SOURCE_VERSION:=$(PKG_VERSION)
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=939259d5c02bbe55cf8329e7bd05ce4d660e37d5c97fcbb0fdeef04f11a63e7f
+PKG_SOURCE_URL:=@SF/project/soxr/
+PKG_SOURCE:=soxr-$(PKG_VERSION)-Source.tar.xz
+PKG_HASH:=b111c15fdc8c029989330ff559184198c161100a59312f5dc19ddeb9b5a15889
+PKG_BUILD_DIR:=$(BUILD_DIR)/soxr-$(PKG_VERSION)-Source
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
Mike Brady <mikebrady@eircom.net>
PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=LICENCE
-PKG_FIXUP:=libtool
-PKG_REMOVE_FILES:=autogen.sh
-
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
--- /dev/null
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -134,7 +134,7 @@ if (WITH_AVFFT)
+ endif ()
+ endif ()
+
+-if (WITH_AVFFT OR (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" AND SIMD32_FOUND AND WITH_CR32))
++if (WITH_AVFFT)
+ find_package (LibAVUtil)
+ if (AVUTIL_FOUND)
+ include_directories (${AVUTIL_INCLUDE_DIRS})
--- /dev/null
+if PACKAGE_libssh2
+
+choice
+ prompt "Choose crypto backend"
+ default LIBSSH2_MBEDTLS
+
+ config LIBSSH2_MBEDTLS
+ bool "mbedtls"
+
+ config LIBSSH2_OPENSSL
+ bool "openssl"
+
+endchoice
+
+endif
#
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=libssh2
-PKG_VERSION:=1.7.0
-PKG_RELEASE:=1
+PKG_VERSION:=1.8.0
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.libssh2.org/download
-PKG_HASH:=e4561fd43a50539a8c2ceb37841691baf03ecb7daf043766da1b112e4280d584
+PKG_SOURCE_URL:=https://www.libssh2.org/download
+PKG_HASH:=39f34e2f6835f4b992cafe8625073a88e5a28ba78f83e8099610a7b3af4676d4
+
+PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_LICENSE:=BSD
PKG_LICENSE_FILES:=COPYING
+PKG_CONFIG_DEPENDS:= \
+ CONFIG_LIBSSH2_MBEDTLS \
+ CONFIG_LIBSSH2_OPENSSL
+
include $(INCLUDE_DIR)/package.mk
define Package/libssh2
SECTION:=libs
CATEGORY:=Libraries
TITLE:=SSH2 library
- URL:=http://www.libssh2.org/
- DEPENDS:=+libopenssl +zlib
+ URL:=https://www.libssh2.org/
+ DEPENDS:=+LIBSSH2_MBEDTLS:libmbedtls +LIBSSH2_OPENSSL:libopenssl +zlib
MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
endef
libssh2 is a client-side C library implementing the SSH2 protocol.
endef
-TARGET_CFLAGS += $(FPIC)
+define Package/libssh2/config
+ source "$(SOURCE)/Config.in"
+endef
CONFIGURE_ARGS += \
--disable-examples-build \
- --with-libssl-prefix=$(STAGING_DIR)/usr
+ --disable-silent-rules \
+ $(if $(CONFIG_LIBSSH2_MBEDTLS),--with-mbedtls --with-libmbedtls-prefix=$(STAGING_DIR)/usr) \
+ $(if $(CONFIG_LIBSSH2_OPENSSL),--with-openssl --with-libssl-prefix=$(STAGING_DIR)/usr) \
+ --with-libz-prefix=$(STAGING_DIR)/usr
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
- $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libssh2.so* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libssh2.pc $(1)/usr/lib/pkgconfig/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libssh2.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libssh2/install
--- /dev/null
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -386,9 +386,9 @@ AC_DEFUN([LIBSSH2_CHECKFOR_MBEDTLS], [
+
+ old_LDFLAGS=$LDFLAGS
+ old_CFLAGS=$CFLAGS
+- if test -n "$use_mbedtls" && test "$use_mbedtls" != "no"; then
+- LDFLAGS="$LDFLAGS -L$use_mbedtls/lib"
+- CFLAGS="$CFLAGS -I$use_mbedtls/include"
++ if test -n "$with_libmbedtls_prefix" && test "$use_mbedtls" != "no"; then
++ LDFLAGS="$LDFLAGS -L$with_libmbedtls_prefix/lib"
++ CFLAGS="$CFLAGS -I$with_libmbedtls_prefix/include"
+ fi
+
+ AC_LIB_HAVE_LINKFLAGS([mbedtls], [], [
+@@ -412,9 +412,9 @@ AC_DEFUN([LIBSSH2_CHECKFOR_GCRYPT], [
+
+ old_LDFLAGS=$LDFLAGS
+ old_CFLAGS=$CFLAGS
+- if test -n "$use_libgcrypt" && test "$use_libgcrypt" != "no"; then
+- LDFLAGS="$LDFLAGS -L$use_libgcrypt/lib"
+- CFLAGS="$CFLAGS -I$use_libgcrypt/include"
++ if test -n "$with_libgcrypt_prefix" && test "$use_libgcrypt" != "no"; then
++ LDFLAGS="$LDFLAGS -L$with_libgcrypt_prefix/lib"
++ CFLAGS="$CFLAGS -I$with_libgcrypt_prefix/include"
+ fi
+ AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [
+ #include <gcrypt.h>
include $(TOPDIR)/rules.mk
PKG_NAME:=talloc
-PKG_VERSION:=2.1.7
+PKG_VERSION:=2.1.11
MAJOR_VERSION:=2
-PKG_RELEASE:=2
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.samba.org/ftp/talloc/
-PKG_HASH:=19154e728e48d29c7398f470b0a59d093edc836156b41ffe20d247d6ec9fa006
+PKG_HASH:=639eb35556a0af999123c4d883e79be05ff9f00ab4f9e4ac2e5775f9c5eeeed3
PKG_MAINTAINER:=Lucile Quirion <lucile.quirion@savoirfairelinux.com>
PKG_LICENSE:=LGPL-3.0+
$(CP) $(PKG_BUILD_DIR)/bin/default/libtalloc.so $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_BUILD_DIR)/bin/default/talloc.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libtalloc/install
CATEGORY:=Libraries
TITLE:=An ASN.1 and DER structures manipulation library
MAINTAINER:=Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
- URL:=ftp://ftp.gnu.org/gnu/libtasn1/
+ URL:=https://www.gnu.org/software/libtasn1/
endef
define Package/libtasn1/description
--- /dev/null
+#
+# Copyright (C) 2006-2018 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libtirpc
+PKG_VERSION:=1.0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=@SF/libtirpc
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_HASH:=86c3a78fc1bddefa96111dd233124c703b22a78884203c55c3e06b3be6a0fd5e
+
+PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
+PKG_LICENSE:=BSD-3-Clause
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libtirpc
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=Library TI RPC for RPC bindings
+ URL:=http://libtirpc.sourceforge.net/
+ DEPENDS:=+libpthread
+endef
+
+CONFIGURE_ARGS += --disable-gssapi
+# Info from Buildroot Makefile
+# getrpcby{number,name} are only provided if 'GQ' is defined
+TARGET_CFLAGS += -DGQ
+#CONFIGURE_VARS += \
+# GSSGLUE_LIBS="-lkrb5 -lk5crypto -l:libcom_err.so.3 -lkeyutils -lresolv -gssapi_krb5" \
+# GSSGLUE_CFLAGS=-I$(STAGING_DIR)/usr/include/krb5/
+
+#EXTRA_LDFLAGS := -lgssapi_krb5
+
+define Package/libtirpc/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtirpc.so* $(1)/usr/lib
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtirpc.{a,so*} $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include
+ $(SED) 's,/usr,${STAGING_DIR}/usr,g' $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtirpc.pc
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libtirpc.pc $(1)/usr/lib/pkgconfig/libtirpc.pc
+endef
+
+$(eval $(call BuildPackage,libtirpc))
--- /dev/null
+From 15adb318818f5d0ac609ef2b87643dd760487cb6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Mon, 20 Jul 2015 20:30:11 +0200
+Subject: [PATCH 1/1] Disable parts of TIRPC requiring NIS support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[yann.morin.1998@free.fr: update for 0.3.1]
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+[joerg.krause@embedded.rocks: update for 0.3.2]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+[peda@axentia.se: update for 1.0.1]
+Signed-off-by: Peter Rosin <peda@axentia.se>
+[bernd.kuhls@t-online.de: update for 1.0.2]
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ src/Makefile.am | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 6cc567a..9834f9a 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -24,7 +24,7 @@ libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c cln
+ rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \
+ svc_auth_des.c \
+ svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
+- auth_time.c auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
++ auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
+
+ ## XDR
+ libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
+@@ -41,8 +41,8 @@ if GSS
+ libtirpc_la_CFLAGS = -DHAVE_RPCSEC_GSS $(GSSAPI_CFLAGS)
+ endif
+
+-libtirpc_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c
+-libtirpc_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c
++#libtirpc_la_SOURCES += key_call.c key_prot_xdr.c getpublickey.c
++#libtirpc_la_SOURCES += netname.c netnamer.c rpcdname.c rtime.c
+
+ CLEANFILES = cscope.* *~
+ DISTCLEANFILES = Makefile.in
+--
+2.4.6
+
--- /dev/null
+From 7aa1fe6a0f9280571117c30c03c2cc521cd86ec3 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sat, 23 Jun 2012 21:58:07 +0200
+Subject: [PATCH] uClibc without RPC support and musl does not install rpcent.h
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+[yann.morin.1998@free.fr: update for 0.3.1]
+Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
+[joerg.krause@embedded.rocks: musl fix]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+[bernd.kuhls@t-online.de: update for 1.0.2]
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ tirpc/rpc/rpcent.h | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tirpc/rpc/rpcent.h b/tirpc/rpc/rpcent.h
+index 147f909..4a58180 100644
+--- a/tirpc/rpc/rpcent.h
++++ b/tirpc/rpc/rpcent.h
+@@ -48,8 +48,9 @@
+ extern "C" {
+ #endif
+
+-/* These are defined in /usr/include/rpc/netdb.h */
+-#if !defined(__GLIBC__) || defined(__UCLIBC__)
++/* These are defined in /usr/include/rpc/netdb.h, unless we are using
++ the C library without RPC support. */
++#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_RPC__) || !defined(__GLIBC__)
+ struct rpcent {
+ char *r_name; /* name of server for this rpc program */
+ char **r_aliases; /* alias list */
+--
+1.9.1
+
--- /dev/null
+From 79975eb4104667be85abd06874c258438826b674 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Fri, 24 Jul 2015 14:45:52 +0200
+Subject: [PATCH] Disable DES authentification support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+uClibc and musl does not provide DES authentication.
+
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+[peda@axentia.se: update for 1.0.1]
+Signed-off-by: Peter Rosin <peda@axentia.se>
+[bernd.kuhls@t-online.de: update for 1.0.2]
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ src/Makefile.am | 2 +-
+ src/rpc_soc.c | 32 --------------------------------
+ 2 files changed, 1 insertion(+), 33 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 960a522..3a88e31 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -22,9 +22,8 @@ libtirpc_la_SOURCES = auth_none.c auth_unix.c authunix_prot.c bindresvport.c cln
+ pmap_prot.c pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c \
+ rpc_callmsg.c rpc_generic.c rpc_soc.c rpcb_clnt.c rpcb_prot.c \
+ rpcb_st_xdr.c svc.c svc_auth.c svc_dg.c svc_auth_unix.c svc_auth_none.c \
+- svc_auth_des.c \
+ svc_generic.c svc_raw.c svc_run.c svc_simple.c svc_vc.c getpeereid.c \
+- auth_des.c authdes_prot.c debug.c des_crypt.c des_impl.c
++ debug.c
+
+ ## XDR
+ libtirpc_la_SOURCES += xdr.c xdr_rec.c xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr_stdio.c xdr_sizeof.c
+diff --git a/src/svc_auth.c b/src/svc_auth.c
+--- a/src/svc_auth.c
++++ b/src/svc_auth.c
+@@ -114,9 +114,6 @@ _gss_authenticate(rqst, msg, no_dispatch)
+ case AUTH_SHORT:
+ dummy = _svcauth_short(rqst, msg);
+ return (dummy);
+- case AUTH_DES:
+- dummy = _svcauth_des(rqst, msg);
+- return (dummy);
+ #ifdef HAVE_RPCSEC_GSS
+ case RPCSEC_GSS:
+ dummy = _svcauth_gss(rqst, msg, no_dispatch);
+diff --git a/src/rpc_soc.c b/src/rpc_soc.c
+index e146ed4..161a1ec 100644
+--- a/src/rpc_soc.c
++++ b/src/rpc_soc.c
+@@ -522,86 +521,6 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
+ }
+
+ /*
+- * Create the client des authentication object. Obsoleted by
+- * authdes_seccreate().
+- */
+-AUTH *
+-authdes_create(servername, window, syncaddr, ckey)
+- char *servername; /* network name of server */
+- u_int window; /* time to live */
+- struct sockaddr *syncaddr; /* optional hostaddr to sync with */
+- des_block *ckey; /* optional conversation key to use */
+-{
+- AUTH *nauth;
+- char hostname[NI_MAXHOST];
+-
+- if (syncaddr) {
+- /*
+- * Change addr to hostname, because that is the way
+- * new interface takes it.
+- */
+- switch (syncaddr->sa_family) {
+- case AF_INET:
+- if (getnameinfo(syncaddr, sizeof(struct sockaddr_in), hostname,
+- sizeof hostname, NULL, 0, 0) != 0)
+- goto fallback;
+- break;
+- case AF_INET6:
+- if (getnameinfo(syncaddr, sizeof(struct sockaddr_in6), hostname,
+- sizeof hostname, NULL, 0, 0) != 0)
+- goto fallback;
+- break;
+- default:
+- goto fallback;
+- }
+- nauth = authdes_seccreate(servername, window, hostname, ckey);
+- return (nauth);
+- }
+-fallback:
+- return authdes_seccreate(servername, window, NULL, ckey);
+-}
+-
+-/*
+- * Create the client des authentication object. Obsoleted by
+- * authdes_pk_seccreate().
+- */
+-extern AUTH *authdes_pk_seccreate(const char *, netobj *, u_int, const char *,
+- const des_block *, nis_server *);
+-
+-AUTH *
+-authdes_pk_create(servername, pkey, window, syncaddr, ckey)
+- char *servername; /* network name of server */
+- netobj *pkey; /* public key */
+- u_int window; /* time to live */
+- struct sockaddr *syncaddr; /* optional hostaddr to sync with */
+- des_block *ckey; /* optional conversation key to use */
+-{
+- AUTH *nauth;
+- char hostname[NI_MAXHOST];
+-
+- if (syncaddr) {
+- /*
+- * Change addr to hostname, because that is the way
+- * new interface takes it.
+- */
+- switch (syncaddr->sa_family) {
+- case AF_INET:
+- if (getnameinfo(syncaddr, sizeof(struct sockaddr_in), hostname,
+- sizeof hostname, NULL, 0, 0) != 0)
+- goto fallback;
+- break;
+- default:
+- goto fallback;
+- }
+- nauth = authdes_pk_seccreate(servername, pkey, window, hostname, ckey, NULL);
+- return (nauth);
+- }
+-fallback:
+- return authdes_pk_seccreate(servername, pkey, window, NULL, ckey, NULL);
+-}
+-
+-
+-/*
+ * Create a client handle for a unix connection. Obsoleted by clnt_vc_create()
+ */
+ CLIENT *
+--
+2.4.6
+
--- /dev/null
+--- a/tirpc/rpc/types.h 2018-03-27
++++ b/tirpc/rpc/types.h 2018-03-27
+@@ -66,7 +66,7 @@ typedef int32_t rpc_inline_t;
+ #define mem_free(ptr, bsize) free(ptr)
+
+
+-#if defined __APPLE_CC__ || defined __FreeBSD__
++#if defined __APPLE_CC__ || defined __FreeBSD__ || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+ # define __u_char_defined
+ # define __daddr_t_defined
+ #endif
--- /dev/null
+#
+# Copyright (C) 2014-2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libuhttpd
+PKG_VERSION:=2.0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/libuhttpd.git
+PKG_MIRROR_HASH:=f20e4081ba1bbea277a3c86f28fa451d54546817a58814fff91470550a5b8e5d
+CMAKE_INSTALL:=1
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/libuhttpd/default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ SUBMENU:=Networking
+ TITLE:=libuhttpd
+ DEPENDS:=+libubox +liblua
+endef
+
+define Package/libuhttpd-nossl
+ $(Package/libuhttpd/default)
+ TITLE += (NO SSL)
+ VARIANT:=nossl
+endef
+
+define Package/libuhttpd-openssl
+ $(Package/libuhttpd/default)
+ TITLE += (openssl)
+ DEPENDS += +libustream-openssl
+ VARIANT:=openssl
+endef
+
+define Package/libuhttpd-wolfssl
+ $(Package/libuhttpd/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libustream-wolfssl
+ VARIANT:=wolfssl
+endef
+
+define Package/libuhttpd-mbedtls
+ $(Package/libuhttpd/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libustream-mbedtls
+ VARIANT:=mbedtls
+endef
+
+ifeq ($(BUILD_VARIANT),nossl)
+ CMAKE_OPTIONS += -DUHTTPD_SSL_SUPPORT=off
+endif
+
+define Package/libuhttpd/default/install
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libuhttpd.so* $(1)/usr/lib/
+endef
+
+Package/libuhttpd-nossl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-openssl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-wolfssl/install = $(Package/libuhttpd/default/install)
+Package/libuhttpd-mbedtls/install = $(Package/libuhttpd/default/install)
+
+$(eval $(call BuildPackage,libuhttpd-nossl))
+$(eval $(call BuildPackage,libuhttpd-mbedtls))
+$(eval $(call BuildPackage,libuhttpd-wolfssl))
+$(eval $(call BuildPackage,libuhttpd-openssl))
include $(TOPDIR)/rules.mk
PKG_NAME:=libuv
-PKG_VERSION:=1.17.0
+PKG_VERSION:=1.19.2
PKG_RELEASE:=1
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://dist.libuv.org/dist/v$(PKG_VERSION)/
-PKG_HASH:=ab9eb5355eb868e970a02022e0371d819251df6bbb88aada630cfcf8ac7b1c9b
+PKG_HASH:=7cbcf2017e7116cf9da8ec1c6a146d578536b1e479458438873c991f984a53d7
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
--- /dev/null
+#
+# Copyright (C) 2018 Jianhui Zhao
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libuwsc
+PKG_VERSION:=2.0.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/libuwsc.git
+PKG_MIRROR_HASH:=e0c4f8603a3059c49aec06fdd21e53ebc247855c26ace9ab3b50caf29846a610
+CMAKE_INSTALL:=1
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/libuwsc/default
+ SECTION:=libs
+ CATEGORY:=Libraries
+ SUBMENU:=Networking
+ TITLE:=Lightweight WebSocket client library
+ DEPENDS:=+libubox
+endef
+
+define Package/libuwsc-nossl
+ $(Package/libuwsc/default)
+ TITLE += (NO SSL)
+ VARIANT:=nossl
+endef
+
+define Package/libuwsc-openssl
+ $(Package/libuwsc/default)
+ TITLE += (openssl)
+ DEPENDS += +libustream-openssl
+ VARIANT:=openssl
+endef
+
+define Package/libuwsc-wolfssl
+ $(Package/libuwsc/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libustream-wolfssl
+ VARIANT:=wolfssl
+endef
+
+define Package/libuwsc-mbedtls
+ $(Package/libuwsc/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libustream-mbedtls
+ VARIANT:=mbedtls
+endef
+
+ifeq ($(BUILD_VARIANT),nossl)
+ CMAKE_OPTIONS += -DUWSC_SSL_SUPPORT=off
+endif
+
+define Package/libuwsc/default/install
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libuwsc.so* $(1)/usr/lib/
+endef
+
+Package/libuwsc-nossl/install = $(Package/libuwsc/default/install)
+Package/libuwsc-openssl/install = $(Package/libuwsc/default/install)
+Package/libuwsc-wolfssl/install = $(Package/libuwsc/default/install)
+Package/libuwsc-mbedtls/install = $(Package/libuwsc/default/install)
+
+$(eval $(call BuildPackage,libuwsc-nossl))
+$(eval $(call BuildPackage,libuwsc-mbedtls))
+$(eval $(call BuildPackage,libuwsc-wolfssl))
+$(eval $(call BuildPackage,libuwsc-openssl))
#
-# Copyright (C) 2008-2015 OpenWrt.org
-#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libvorbis
-PKG_VERSION:=1.3.5
+PKG_VERSION:=1.3.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://downloads.xiph.org/releases/vorbis/
-PKG_HASH:=54f94a9527ff0a88477be0a71c0bab09a4c3febe0ed878b24824906cd4b0e1d1
+PKG_HASH:=af00bb5a784e7c9e69f56823de4637c350643deedaf333d0fa86ecdba6fcb415
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=BSD-3-Clause
fee, royalty or patent concerns.
endef
+ifneq ($(findstring arm,$(CONFIG_ARCH)),)
+ TARGET_CFLAGS += -flto
+ TARGET_CXX_FLAGS += -flto
+ TARGET_LDFLAGS += -flto
+endif
+
CONFIGURE_ARGS+= \
--disable-oggtest \
#
-# Copyright (C) 2006-2016 OpenWrt.org
-#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_NAME:=libvorbisidec
PKG_REV:=20150104
PKG_VERSION:=1.0.3-$(PKG_REV)
-PKG_RELEASE:=1
+PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.xiph.org/tremor.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=b56ffce0c0773ec5ca04c466bc00b1bbcaf65aef
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MIRROR_HASH:=45a3ae74fffa32a9e0255132ec2cc4d5413af32699562a89278bc0e561bfbed7
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_MIRROR_HASH:=a5095464c58c5e0909025bf4cdfdcdc07742f545b696829c97514481b9ba64db
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
$(CP) $(PKG_INSTALL_DIR)/usr/include/tremor $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libvorbisidec.{a,so*} $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
endef
define Package/libvorbisidec/install
include $(TOPDIR)/rules.mk
PKG_NAME:=libvpx
-PKG_VERSION:=1.6.1
+PKG_VERSION:=1.7.0
PKG_RELEASE:=1
PKG_REV:=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz
-PKG_MIRROR_HASH:=3c1e9ef2b40f71daa5c75e83dc682dc50acce597a34cd17d167f46ff2f6d08b7
+PKG_MIRROR_HASH:=be50ff18464d614a08726597ecbd72d1f11ec69ec04df2d9acdf646ecd9adcca
PKG_SOURCE_URL:=https://chromium.googlesource.com/webm/libvpx
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=$(PKG_REV)
include $(TOPDIR)/rules.mk
PKG_NAME:=libxml2
-PKG_VERSION:=2.9.7
+PKG_VERSION:=2.9.8
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://gd.tuwien.ac.at/languages/libxml/ \
- http://xmlsoft.org/sources/ \
- ftp://fr.rpmfind.net/pub/libxml/
-PKG_HASH:=f63c5e7d30362ed28b38bfa1ac6313f9a80230720b7fb6c80575eeab3ff5900c
+PKG_SOURCE_URL:=http://xmlsoft.org/sources/
+PKG_HASH:=0b74e51595654f958148759cfef0993114ddccccbb6f31aee018f3558e8e2732
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
#
-# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2014 - 2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=libxslt
-PKG_VERSION:=1.1.31
-PKG_RELEASE:=1
+PKG_VERSION:=1.1.32
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:= \
http://xmlsoft.org/sources/ \
ftp://fr.rpmfind.net/pub/libxml/
-PKG_HASH:=db25e96b6b801144277e67c05b10560ac09dfff82ccd53a154ce86e43622f3ab
+PKG_HASH:=526ecd0abaf4a7789041622c3950c0e7f2c4c8835471515fd77eec684a355460
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING
define Package/xsltproc
SECTION:=utils
CATEGORY:=Utilities
- DEPENDS:=+libxml2 +libxslt +libexslt
+ DEPENDS:=+libxslt +PACKAGE_xsltproc:libexslt
TITLE:=Gnome XSLT xsltproc Utility
URL:=http://xmlsoft.org/XSLT/
endef
endef
CONFIGURE_ARGS+= \
+ --disable-silent-rules \
--enable-shared \
--enable-static \
--without-python \
--without-mem-debug \
--without-debugger \
-TARGET_CFLAGS += $(FPIC)
-
define Build/InstallDev/Xslt
$(INSTALL_DIR) $(1)/usr/bin $(2)/bin $(1)/usr/include/libxslt \
$(1)/usr/include/libexslt $(1)/usr/lib \
define Package/libxslt/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/libxslt.so.* \
+ $(PKG_INSTALL_DIR)/usr/lib/libxslt.so* \
$(1)/usr/lib/
endef
define Package/libexslt/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
- $(PKG_INSTALL_DIR)/usr/lib/libexslt.so.* \
+ $(PKG_INSTALL_DIR)/usr/lib/libexslt.so* \
$(1)/usr/lib/
endef
--- /dev/null
+Index: libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23/src/extensions.c
+===================================================================
+--- libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23.orig/src/extensions.c
++++ libyang-0.14.53-2698bd6484526facbf82b1263810b938b82a2f23/src/extensions.c
+@@ -123,11 +123,14 @@ lyext_load_plugins(void)
+
+ /* and construct the filepath */
+ asprintf(&str, "%s/%s", pluginsdir, file->d_name);
+-
+- /* load the plugin - first, try if it is already loaded... */
+- dlhandler = dlopen(str, RTLD_NOW | RTLD_NOLOAD);
+- dlerror(); /* Clear any existing error */
+- if (dlhandler) {
++ /* load the plugin */
++ dlhandler = dlopen(str, RTLD_NOW);
++ if (!dlhandler) {
++ LOGERR(LY_ESYS, "Loading \"%s\" as a plugin failed (%s).", str, dlerror());
++ free(str);
++ continue;
++ }
++ if (ly_set_contains(&dlhandlers, dlhandler) != -1) {
+ /* the plugin is already loaded */
+ LOGVRB("Extension plugin \"%s\" already loaded.", str);
+ free(str);
+@@ -137,14 +140,6 @@ lyext_load_plugins(void)
+ continue;
+ }
+
+- /* ... and if not, load it */
+- dlhandler = dlopen(str, RTLD_NOW);
+- if (!dlhandler) {
+- LOGERR(LY_ESYS, "Loading \"%s\" as an extension plugin failed (%s).", str, dlerror());
+- free(str);
+- continue;
+- }
+- LOGVRB("Extension plugin \"%s\" successfully loaded.", str);
+ free(str);
+ dlerror(); /* Clear any existing error */
+
+@@ -156,6 +151,7 @@ lyext_load_plugins(void)
+ dlclose(dlhandler);
+ continue;
+ }
++ LOGVRB("Plugin \"%s\" successfully loaded.", str)
+
+ for(u = 0; plugin[u].name; u++) {
+ /* check extension implementations for collisions */
include $(TOPDIR)/rules.mk
PKG_NAME:=p11-kit
-PKG_VERSION:=0.23.1
+PKG_VERSION:=0.23.10
PKG_RELEASE:=1
PKG_MAINTAINER:=Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=e57371669f3b157141b86c429bd9c29741994b2f5ff115fcb8a03e751b0f6ac4
-PKG_SOURCE_URL:=http://p11-glue.freedesktop.org/releases/
+PKG_HASH:=f9212a3f225ef543e13fae9945527d66c0cbb67246320035dd94fab2bce5ae43
+PKG_SOURCE_URL:=https://github.com/p11-glue/$(PKG_NAME)/releases/download/$(PKG_VERSION)
PKG_INSTALL:=1
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A library that provides a way to load and enumerate PKCS11 modules.
- URL:=http://p11-glue.freedesktop.org/p11-kit.html
+ URL:=https://p11-glue.github.io/p11-glue/p11-kit.html
DEPENDS:=+libtasn1 +libpthread
endef
endef
CONFIGURE_ARGS+= \
- --without-libffi
+ --without-libffi \
+ --disable-trust-module
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/p11-kit-1/p11-kit/
--- /dev/null
+#
+# Copyright (C) 2018 Yousong Zhou <yszhou4tech@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pixman
+PKG_VERSION:=0.34.0
+PKG_RELEASE:=1
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e
+PKG_SOURCE_URL:=https://www.cairographics.org/releases
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=COPYING
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+
+define Package/pixman
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE:=a low-level software library for pixel manipulation
+ URL:=http://www.pixman.org/
+endef
+
+define Package/pixman/description
+ Pixman is a low-level software library for pixel manipulation, providing
+ features such as image compositing and trapezoid rasterization. Important
+ users of pixman are the cairo graphics library and the X server.
+endef
+
+define Package/pixman/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpixman*.so* $(1)/usr/lib
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,pixman))
--- /dev/null
+--- a/configure.ac.orig 2016-11-22 20:44:21.205150763 +0800
++++ b/configure.ac 2016-11-22 20:44:55.505161500 +0800
+@@ -720,7 +720,6 @@ dnl Check if assembler is gas compatible
+ have_mips_dspr2=no
+ AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler)
+ xserver_save_CFLAGS=$CFLAGS
+-CFLAGS="-mdspr2 $CFLAGS"
+
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #if !(defined(__mips__) && __mips_isa_rev >= 2)
--- /dev/null
+--- a/pixman/pixman-private.h.orig 2016-11-22 22:10:33.574769654 +0800
++++ b/pixman/pixman-private.h 2016-11-22 22:10:47.638774056 +0800
+@@ -1,5 +1,3 @@
+-#include <float.h>
+-
+ #ifndef PIXMAN_PRIVATE_H
+ #define PIXMAN_PRIVATE_H
+
+@@ -17,6 +15,8 @@
+
+ #ifndef __ASSEMBLER__
+
++#include <float.h>
++
+ #ifndef PACKAGE
+ # error config.h must be included before pixman-private.h
+ #endif
include $(TOPDIR)/rules.mk
PKG_NAME:=postgresql
-PKG_VERSION:=9.6.6
+PKG_VERSION:=9.6.8
PKG_RELEASE:=1
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=PostgreSQL
http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
-PKG_HASH:=399cdffcb872f785ba67e25d275463d74521566318cfef8fe219050d063c8154
+PKG_HASH:=eafdb3b912e9ec34bdd28b651d00226a6253ba65036cb9a41cad2d9e82e3eb70
PKG_USE_MIPS16:=0
PKG_FIXUP:=autoreconf
define Package/libpq
SECTION:=libs
CATEGORY:=Libraries
- DEPENDS:=+zlib +libreadline +libpthread +libncursesw
+ DEPENDS:=+libpthread
TITLE:=PostgreSQL client library
URL:=http://www.postgresql.org/
SUBMENU:=database
define Package/pgsql-cli
SECTION:=utils
CATEGORY:=Utilities
- DEPENDS:=+libpq +librt
+ DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
TITLE:=Command Line Interface (CLI) to PostgreSQL databases
URL:=http://www.postgresql.org/
SUBMENU:=database
define Package/pgsql-cli-extra
SECTION:=utils
CATEGORY:=Utilities
- DEPENDS:=+libpq +librt
+ DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
TITLE:=Command Line extras for PostgreSQL databases
URL:=http://www.postgresql.org/
SUBMENU:=database
define Package/pgsql-server
SECTION:=utils
CATEGORY:=Utilities
- DEPENDS:=+libpq +librt +pgsql-cli
+ DEPENDS:=+pgsql-cli
TITLE:=PostgreSQL databases Server
URL:=http://www.postgresql.org/
SUBMENU:=database
--without-tcl \
--with-zlib="yes" \
--enable-depend \
- $(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
-
-EXTRA_CFLAGS:= -I$(PKG_BUILD_DIR)/src/include/
+ $(if $(CONFIG_arc),--disable-spinlocks)
# Need a native ecpg, pg_config and zic for build
define Host/Compile
$(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
endef
-TARGET_CFLAGS += $(FPIC) -lpthread
-
# because PROFILE means something else in the project Makefile
unexport PROFILE
--- /dev/null
+menu "Configuration"
+ depends on PACKAGE_libsqlite3
+
+config SQLITE_FTS3
+ bool
+ prompt "Enable FTS3"
+ help
+ "Enable support for full-text search version 3"
+ default y
+
+config SQLITE_RTREE
+ bool
+ prompt "Enable RTREE"
+ help
+ "Enable support for the R*Tree index extension"
+ default y
+
+endmenu
include $(TOPDIR)/rules.mk
PKG_NAME:=sqlite
-PKG_VERSION:=3210000
+PKG_VERSION:=3230100
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-autoconf-$(PKG_VERSION).tar.gz
-PKG_HASH:=d7dd516775005ad87a57f428b6f86afd206cb341722927f104d3f0cf65fbbbe3
-PKG_SOURCE_URL:=http://www.sqlite.org/2017/
+PKG_HASH:=92842b283e5e744eff5da29ed3c69391de7368fccc4d0ee6bf62490ce555ef25
+PKG_SOURCE_URL:=http://www.sqlite.org/2018/
PKG_LICENSE:=PUBLICDOMAIN
PKG_LICENSE_FILES:=
PKG_INSTALL:=1
+PKG_CONFIG_DEPENDS := \
+ CONFIG_SQLITE_FTS3 \
+ CONFIG_SQLITE_RTREE
+
include $(INCLUDE_DIR)/package.mk
define Package/sqlite3/Default
$(call Package/sqlite3/Default)
SECTION:=libs
CATEGORY:=Libraries
- DEPENDS:=+libpthread
+ DEPENDS:=+libpthread +zlib
TITLE+= (library)
endef
programs.
endef
+define Package/libsqlite3/config
+ source "$(SOURCE)/Config.in"
+endef
+
define Package/sqlite3-cli
$(call Package/sqlite3/Default)
SECTION:=utils
-DHAVE_ISNAN=1 \
-DHAVE_MALLOC_USABLE_SIZE=1
+ifneq ($(CONFIG_SQLITE_FTS3),y)
+TARGET_CFLAGS += -USQLITE_ENABLE_FTS3
+endif
+
+ifneq ($(CONFIG_SQLITE_RTREE),y)
+TARGET_CFLAGS += -USQLITE_ENABLE_RTREE
+endif
+
CONFIGURE_ARGS += \
--enable-shared \
--enable-static \
- --disable-editline
+ --disable-editline \
+ --disable-static-shell
CONFIGURE_VARS += \
config_BUILD_CC="$(HOSTCC)" \
#
-# Copyright (C) 2006-2017 OpenWrt.org
+# Copyright (C) 2006-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=tiff
-PKG_VERSION:=4.0.8
-PKG_RELEASE:=1
+PKG_VERSION:=4.0.9
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://download.osgeo.org/libtiff
-PKG_HASH:=59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910
+PKG_SOURCE_URL:=https://download.osgeo.org/libtiff
+PKG_HASH:=6e7bdeec2c310734e734d19aae3a71ebe37a4d842e0e23dbb1b8921c0026cfcd
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh aclocal.m4
DEPENDS:=+libtiff
endef
-TARGET_CFLAGS += $(FPIC)
-
-define Build/Configure
- $(call Build/Configure/Default, \
- $(if $(CONFIG_PACKAGE_libtiffxx), \
- --enable-cxx, \
- --disable-cxx \
- ) \
- --disable-lzma \
- --enable-ccitt \
- --enable-packbits \
- --enable-lzw \
- --enable-thunder \
- --enable-next \
- --enable-logluv \
- --enable-mdi \
- --enable-zlib \
- --enable-jpeg \
- --disable-old-jpeg \
- --disable-jbig \
- --without-x \
- )
+CONFIGURE_ARGS += \
+ $(if $(CONFIG_PACKAGE_libtiffxx),--enable-cxx,--disable-cxx) \
+ --disable-lzma \
+ --enable-ccitt \
+ --enable-packbits \
+ --enable-lzw \
+ --enable-thunder \
+ --enable-next \
+ --enable-logluv \
+ --enable-mdi \
+ --enable-zlib \
+ --enable-jpeg \
+ --disable-old-jpeg \
+ --disable-jbig \
+ --without-x
+
+define Build/InstallDev/hxx
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.hxx $(1)/usr/include/
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/{lib,include}
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
+ $(if $(CONFIG_PACKAGE_libtiffxx), $(call Build/InstallDev/hxx,$(1)))
endef
define Package/libtiff/install
$(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiff.so.* $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiff.so* $(1)/usr/lib/
endef
define Package/libtiffxx/install
$(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiffxx.so.* $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiffxx.so* $(1)/usr/lib/
endef
define Package/tiff-utils/install
--- a/libtiff/tiffiop.h
+++ b/libtiff/tiffiop.h
-@@ -284,7 +284,7 @@ struct tiff {
+@@ -287,7 +287,7 @@ struct tiff {
*/
#if defined(HAVE_FSEEKO)
# define fseek(stream,offset,whence) fseeko(stream,offset,whence)
+++ /dev/null
-diff -pur tiff-4.0.4/tools/tiffsplit.c tiff-4.0.4_patch/tools/tiffsplit.c
---- tiff-4.0.4/tools/tiffsplit.c 2015-05-28 15:10:26.000000000 +0200
-+++ tiff-4.0.4_patch/tools/tiffsplit.c 2016-02-12 19:15:30.532005041 +0100
-@@ -179,8 +179,9 @@ tiffcp(TIFF* in, TIFF* out)
- TIFFSetField(out, TIFFTAG_JPEGTABLES, count, table);
- }
- }
-+ uint32 count = 0;
- CopyField(TIFFTAG_PHOTOMETRIC, shortv);
-- CopyField(TIFFTAG_PREDICTOR, shortv);
-+ CopyField2(TIFFTAG_PREDICTOR, count, shortv);
- CopyField(TIFFTAG_THRESHHOLDING, shortv);
- CopyField(TIFFTAG_FILLORDER, shortv);
- CopyField(TIFFTAG_ORIENTATION, shortv);
-@@ -188,7 +189,7 @@ tiffcp(TIFF* in, TIFF* out)
- CopyField(TIFFTAG_MAXSAMPLEVALUE, shortv);
- CopyField(TIFFTAG_XRESOLUTION, floatv);
- CopyField(TIFFTAG_YRESOLUTION, floatv);
-- CopyField(TIFFTAG_GROUP3OPTIONS, longv);
-+ CopyField2(TIFFTAG_GROUP3OPTIONS, count, longv);
- CopyField(TIFFTAG_GROUP4OPTIONS, longv);
- CopyField(TIFFTAG_RESOLUTIONUNIT, shortv);
- CopyField(TIFFTAG_PLANARCONFIG, shortv);
+++ /dev/null
-From 02669064e927074819ce1ed39aba0fccaa167717 Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Mon, 29 May 2017 10:12:54 +0000
-Subject: [PATCH] * libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter
- clamping to avoid int32 overflow in TIFFYCbCrtoRGB(). Fixes
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844 Credit to OSS Fuzz
-
----
- ChangeLog | 7 +++++++
- libtiff/tif_color.c | 6 +++---
- 2 files changed, 10 insertions(+), 3 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index ee8d9d08..61116596 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,10 @@
-+2017-05-29 Even Rouault <even.rouault at spatialys.com>
-+
-+ * libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid
-+ int32 overflow in TIFFYCbCrtoRGB().
-+ Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844
-+ Credit to OSS Fuzz
-+
- 2017-05-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
-
- * configure.ac: libtiff 4.0.8 released.
-diff --git a/libtiff/tif_color.c b/libtiff/tif_color.c
-index 055ed3b2..10a5e66e 100644
---- a/libtiff/tif_color.c
-+++ b/libtiff/tif_color.c
-@@ -275,10 +275,10 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
- for (i = 0, x = -128; i < 256; i++, x++) {
- int32 Cr = (int32)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F,
- refBlackWhite[5] - 128.0F, 127),
-- -128.0F * 64, 128.0F * 64);
-+ -128.0F * 32, 128.0F * 32);
- int32 Cb = (int32)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F,
- refBlackWhite[3] - 128.0F, 127),
-- -128.0F * 64, 128.0F * 64);
-+ -128.0F * 32, 128.0F * 32);
-
- ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
- ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
-@@ -286,7 +286,7 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
- ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
- ycbcr->Y_tab[i] =
- (int32)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
-- -128.0F * 64, 128.0F * 64);
-+ -128.0F * 32, 128.0F * 32);
- }
- }
-
+++ /dev/null
-From 468988860e0dae62ebbf991627c74bcbb4bd256f Mon Sep 17 00:00:00 2001
-From: erouault <erouault>
-Date: Mon, 29 May 2017 11:29:06 +0000
-Subject: [PATCH] * libtiff/tif_getimage.c: initYCbCrConversion(): stricter
- validation for refBlackWhite coefficients values. To avoid invalid
- float->int32 conversion (when refBlackWhite[0] == 2147483648.f) Fixes
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1907 Credit to OSS Fuzz
-
----
- ChangeLog | 8 ++++++++
- libtiff/tif_getimage.c | 2 +-
- 2 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index a2ddaac2..04881ba7 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,5 +1,13 @@
- 2017-05-29 Even Rouault <even.rouault at spatialys.com>
-
-+ * libtiff/tif_getimage.c: initYCbCrConversion(): stricter validation for
-+ refBlackWhite coefficients values. To avoid invalid float->int32 conversion
-+ (when refBlackWhite[0] == 2147483648.f)
-+ Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1907
-+ Credit to OSS Fuzz
-+
-+2017-05-29 Even Rouault <even.rouault at spatialys.com>
-+
- * libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid
- int32 overflow in TIFFYCbCrtoRGB().
- Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844
-diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
-index dc373abc..a209a7a7 100644
---- a/libtiff/tif_getimage.c
-+++ b/libtiff/tif_getimage.c
-@@ -2241,7 +2241,7 @@ DECLARESepPutFunc(putseparate8bitYCbCr11tile)
-
- static int isInRefBlackWhiteRange(float f)
- {
-- return f >= (float)(-0x7FFFFFFF + 128) && f <= (float)0x7FFFFFFF;
-+ return f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF;
- }
-
- static int
+++ /dev/null
-commit 40448d58fbfad52d2dde5bd18daa30b17fe35fcd
-Author: erouault <erouault>
-Date: Thu Jun 1 12:44:04 2017 +0000
-
- * libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
- and use it in TIFFReadDirectory() so as to ignore fields whose tag is a
- codec-specified tag but this codec is not enabled. This avoids TIFFGetField()
- to behave differently depending on whether the codec is enabled or not, and
- thus can avoid stack based buffer overflows in a number of TIFF utilities
- such as tiffsplit, tiffcmp, thumbnail, etc.
- Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch
- (http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog.
- Fixes:
- http://bugzilla.maptools.org/show_bug.cgi?id=2580
- http://bugzilla.maptools.org/show_bug.cgi?id=2693
- http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095)
- http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554)
- http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318)
- http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128)
- http://bugzilla.maptools.org/show_bug.cgi?id=2441
- http://bugzilla.maptools.org/show_bug.cgi?id=2433
-
-diff --git a/ChangeLog b/ChangeLog
-index 04881ba7..ebd1a3c0 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,23 @@
-+2017-06-01 Even Rouault <even.rouault at spatialys.com>
-+
-+ * libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
-+ and use it in TIFFReadDirectory() so as to ignore fields whose tag is a
-+ codec-specified tag but this codec is not enabled. This avoids TIFFGetField()
-+ to behave differently depending on whether the codec is enabled or not, and
-+ thus can avoid stack based buffer overflows in a number of TIFF utilities
-+ such as tiffsplit, tiffcmp, thumbnail, etc.
-+ Patch derived from 0063-Handle-properly-CODEC-specific-tags.patch
-+ (http://bugzilla.maptools.org/show_bug.cgi?id=2580) by Raphaël Hertzog.
-+ Fixes:
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2580
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2693
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2625 (CVE-2016-10095)
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2564 (CVE-2015-7554)
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2561 (CVE-2016-5318)
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2499 (CVE-2014-8128)
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2441
-+ http://bugzilla.maptools.org/show_bug.cgi?id=2433
-+
- 2017-05-29 Even Rouault <even.rouault at spatialys.com>
-
- * libtiff/tif_getimage.c: initYCbCrConversion(): stricter validation for
-diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h
-index 6af5f3dc..5a380767 100644
---- a/libtiff/tif_dir.h
-+++ b/libtiff/tif_dir.h
-@@ -1,4 +1,4 @@
--/* $Id: tif_dir.h,v 1.54 2011-02-18 20:53:05 fwarmerdam Exp $ */
-+/* $Id: tif_dir.h,v 1.55 2017-06-01 12:44:04 erouault Exp $ */
-
- /*
- * Copyright (c) 1988-1997 Sam Leffler
-@@ -291,6 +291,7 @@ struct _TIFFField {
- extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32);
- extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32, TIFFDataType);
- extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32, TIFFDataType);
-+extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
-
- #if defined(__cplusplus)
- }
-diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
-index 23ad0020..4904f540 100644
---- a/libtiff/tif_dirinfo.c
-+++ b/libtiff/tif_dirinfo.c
-@@ -1,4 +1,4 @@
--/* $Id: tif_dirinfo.c,v 1.126 2016-11-18 02:52:13 bfriesen Exp $ */
-+/* $Id: tif_dirinfo.c,v 1.127 2017-06-01 12:44:04 erouault Exp $ */
-
- /*
- * Copyright (c) 1988-1997 Sam Leffler
-@@ -956,6 +956,109 @@ TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32 n)
- return 0;
- }
-
-+int
-+_TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
-+{
-+ /* Filter out non-codec specific tags */
-+ switch (tag) {
-+ /* Shared tags */
-+ case TIFFTAG_PREDICTOR:
-+ /* JPEG tags */
-+ case TIFFTAG_JPEGTABLES:
-+ /* OJPEG tags */
-+ case TIFFTAG_JPEGIFOFFSET:
-+ case TIFFTAG_JPEGIFBYTECOUNT:
-+ case TIFFTAG_JPEGQTABLES:
-+ case TIFFTAG_JPEGDCTABLES:
-+ case TIFFTAG_JPEGACTABLES:
-+ case TIFFTAG_JPEGPROC:
-+ case TIFFTAG_JPEGRESTARTINTERVAL:
-+ /* CCITT* */
-+ case TIFFTAG_BADFAXLINES:
-+ case TIFFTAG_CLEANFAXDATA:
-+ case TIFFTAG_CONSECUTIVEBADFAXLINES:
-+ case TIFFTAG_GROUP3OPTIONS:
-+ case TIFFTAG_GROUP4OPTIONS:
-+ break;
-+ default:
-+ return 1;
-+ }
-+ /* Check if codec specific tags are allowed for the current
-+ * compression scheme (codec) */
-+ switch (tif->tif_dir.td_compression) {
-+ case COMPRESSION_LZW:
-+ if (tag == TIFFTAG_PREDICTOR)
-+ return 1;
-+ break;
-+ case COMPRESSION_PACKBITS:
-+ /* No codec-specific tags */
-+ break;
-+ case COMPRESSION_THUNDERSCAN:
-+ /* No codec-specific tags */
-+ break;
-+ case COMPRESSION_NEXT:
-+ /* No codec-specific tags */
-+ break;
-+ case COMPRESSION_JPEG:
-+ if (tag == TIFFTAG_JPEGTABLES)
-+ return 1;
-+ break;
-+ case COMPRESSION_OJPEG:
-+ switch (tag) {
-+ case TIFFTAG_JPEGIFOFFSET:
-+ case TIFFTAG_JPEGIFBYTECOUNT:
-+ case TIFFTAG_JPEGQTABLES:
-+ case TIFFTAG_JPEGDCTABLES:
-+ case TIFFTAG_JPEGACTABLES:
-+ case TIFFTAG_JPEGPROC:
-+ case TIFFTAG_JPEGRESTARTINTERVAL:
-+ return 1;
-+ }
-+ break;
-+ case COMPRESSION_CCITTRLE:
-+ case COMPRESSION_CCITTRLEW:
-+ case COMPRESSION_CCITTFAX3:
-+ case COMPRESSION_CCITTFAX4:
-+ switch (tag) {
-+ case TIFFTAG_BADFAXLINES:
-+ case TIFFTAG_CLEANFAXDATA:
-+ case TIFFTAG_CONSECUTIVEBADFAXLINES:
-+ return 1;
-+ case TIFFTAG_GROUP3OPTIONS:
-+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
-+ return 1;
-+ break;
-+ case TIFFTAG_GROUP4OPTIONS:
-+ if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
-+ return 1;
-+ break;
-+ }
-+ break;
-+ case COMPRESSION_JBIG:
-+ /* No codec-specific tags */
-+ break;
-+ case COMPRESSION_DEFLATE:
-+ case COMPRESSION_ADOBE_DEFLATE:
-+ if (tag == TIFFTAG_PREDICTOR)
-+ return 1;
-+ break;
-+ case COMPRESSION_PIXARLOG:
-+ if (tag == TIFFTAG_PREDICTOR)
-+ return 1;
-+ break;
-+ case COMPRESSION_SGILOG:
-+ case COMPRESSION_SGILOG24:
-+ /* No codec-specific tags */
-+ break;
-+ case COMPRESSION_LZMA:
-+ if (tag == TIFFTAG_PREDICTOR)
-+ return 1;
-+ break;
-+
-+ }
-+ return 0;
-+}
-+
- /* vim: set ts=8 sts=8 sw=8 noet: */
-
- /*
-diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
-index 772ebaf7..acde78b5 100644
---- a/libtiff/tif_dirread.c
-+++ b/libtiff/tif_dirread.c
-@@ -1,4 +1,4 @@
--/* $Id: tif_dirread.c,v 1.208 2017-04-27 15:46:22 erouault Exp $ */
-+/* $Id: tif_dirread.c,v 1.209 2017-06-01 12:44:04 erouault Exp $ */
-
- /*
- * Copyright (c) 1988-1997 Sam Leffler
-@@ -3580,6 +3580,10 @@ TIFFReadDirectory(TIFF* tif)
- goto bad;
- dp->tdir_tag=IGNORE;
- break;
-+ default:
-+ if( !_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag) )
-+ dp->tdir_tag=IGNORE;
-+ break;
- }
- }
- }
+++ /dev/null
-From fe8d7165956b88df4837034a9161dc5fd20cf67a Mon Sep 17 00:00:00 2001
-From: Even Rouault <even.rouault@spatialys.com>
-Date: Mon, 26 Jun 2017 15:19:59 +0000
-Subject: [PATCH] * libtiff/tif_jbig.c: fix memory leak in error code path of
- JBIGDecode() Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2706 Reported
- by team OWL337
-
-* libtiff/tif_jpeg.c: error out at decoding time if anticipated libjpeg
----
- ChangeLog | 8 +++++++-
- libtiff/tif_jbig.c | 1 +
- 2 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index bc5096e7..ecd70534 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,9 @@
-+2017-06-26 Even Rouault <even.rouault at spatialys.com>
-+
-+ * libtiff/tif_jbig.c: fix memory leak in error code path of JBIGDecode()
-+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2706
-+ Reported by team OWL337
-+
- 2017-06-01 Even Rouault <even.rouault at spatialys.com>
-
- * libtiff/tif_dirinfo.c, tif_dirread.c: add _TIFFCheckFieldIsValidForCodec(),
-diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
-index 5f5f75e2..c75f31d9 100644
---- a/libtiff/tif_jbig.c
-+++ b/libtiff/tif_jbig.c
-@@ -94,6 +94,7 @@ static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
- jbg_strerror(decodeStatus)
- #endif
- );
-+ jbg_dec_free(&decoder);
- return 0;
- }
-
+++ /dev/null
-From 1077fad562e03d1cad591dd10163dd80ad63ab0e Mon Sep 17 00:00:00 2001
-From: Even Rouault <even.rouault@spatialys.com>
-Date: Fri, 30 Jun 2017 13:11:18 +0000
-Subject: [PATCH] * libtiff/tif_read.c, tiffiop.h: add a
- _TIFFReadEncodedStripAndAllocBuffer() function, variant of
- TIFFReadEncodedStrip() that allocates the decoded buffer only after a first
- successful TIFFFillStrip(). This avoids excessive memory allocation on
- corrupted files. * libtiff/tif_getimage.c: use
- _TIFFReadEncodedStripAndAllocBuffer(). Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2708 and
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2433 . Credit to OSS
- Fuzz
-
----
- ChangeLog | 11 +++++++
- libtiff/tif_getimage.c | 59 ++++++++++++++++++++++----------------
- libtiff/tif_read.c | 78 +++++++++++++++++++++++++++++++++++++++++++-------
- libtiff/tiffiop.h | 5 ++++
- 4 files changed, 118 insertions(+), 35 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index c969f9e2..6f085e09 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,14 @@
-+2017-06-30 Even Rouault <even.rouault at spatialys.com>
-+
-+ * libtiff/tif_read.c, tiffiop.h: add a _TIFFReadEncodedStripAndAllocBuffer()
-+ function, variant of TIFFReadEncodedStrip() that allocates the
-+ decoded buffer only after a first successful TIFFFillStrip(). This avoids
-+ excessive memory allocation on corrupted files.
-+ * libtiff/tif_getimage.c: use _TIFFReadEncodedStripAndAllocBuffer().
-+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2708 and
-+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2433 .
-+ Credit to OSS Fuzz
-+
- 2017-06-26 Even Rouault <even.rouault at spatialys.com>
-
- * libtiff/tif_jbig.c: fix memory leak in error code path of JBIGDecode()
-diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
-index cee8e930..cc6e8f30 100644
---- a/libtiff/tif_getimage.c
-+++ b/libtiff/tif_getimage.c
-@@ -905,26 +905,22 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- tileContigRoutine put = img->put.contig;
- uint32 row, y, nrow, nrowsub, rowstoread;
- tmsize_t pos;
-- unsigned char* buf;
-+ unsigned char* buf = NULL;
- uint32 rowsperstrip;
- uint16 subsamplinghor,subsamplingver;
- uint32 imagewidth = img->width;
- tmsize_t scanline;
- int32 fromskew, toskew;
- int ret = 1, flip;
-+ tmsize_t maxstripsize;
-
- TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor, &subsamplingver);
- if( subsamplingver == 0 ) {
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Invalid vertical YCbCr subsampling");
- return (0);
- }
--
-- buf = (unsigned char*) _TIFFmalloc(TIFFStripSize(tif));
-- if (buf == 0) {
-- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
-- return (0);
-- }
-- _TIFFmemset(buf, 0, TIFFStripSize(tif));
-+
-+ maxstripsize = TIFFStripSize(tif);
-
- flip = setorientation(img);
- if (flip & FLIP_VERTICALLY) {
-@@ -946,11 +942,12 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- nrowsub = nrow;
- if ((nrowsub%subsamplingver)!=0)
- nrowsub+=subsamplingver-nrowsub%subsamplingver;
-- if (TIFFReadEncodedStrip(tif,
-+ if (_TIFFReadEncodedStripAndAllocBuffer(tif,
- TIFFComputeStrip(tif,row+img->row_offset, 0),
-- buf,
-+ (void**)(&buf),
-+ maxstripsize,
- ((row + img->row_offset)%rowsperstrip + nrowsub) * scanline)==(tmsize_t)(-1)
-- && img->stoponerr)
-+ && (buf == NULL || img->stoponerr))
- {
- ret = 0;
- break;
-@@ -994,8 +991,8 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- {
- TIFF* tif = img->tif;
- tileSeparateRoutine put = img->put.separate;
-- unsigned char *buf;
-- unsigned char *p0, *p1, *p2, *pa;
-+ unsigned char *buf = NULL;
-+ unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
- uint32 row, y, nrow, rowstoread;
- tmsize_t pos;
- tmsize_t scanline;
-@@ -1014,15 +1011,6 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "Integer overflow in %s", "gtStripSeparate");
- return (0);
- }
-- p0 = buf = (unsigned char *)_TIFFmalloc(bufsize);
-- if (buf == 0) {
-- TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for tile buffer");
-- return (0);
-- }
-- _TIFFmemset(buf, 0, bufsize);
-- p1 = p0 + stripsize;
-- p2 = p1 + stripsize;
-- pa = (alpha?(p2+stripsize):NULL);
-
- flip = setorientation(img);
- if (flip & FLIP_VERTICALLY) {
-@@ -1040,7 +1028,6 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- case PHOTOMETRIC_MINISBLACK:
- case PHOTOMETRIC_PALETTE:
- colorchannels = 1;
-- p2 = p1 = p0;
- break;
-
- default:
-@@ -1056,7 +1043,31 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
- rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
- nrow = (row + rowstoread > h ? h - row : rowstoread);
- offset_row = row + img->row_offset;
-- if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
-+ if( buf == NULL )
-+ {
-+ if (_TIFFReadEncodedStripAndAllocBuffer(
-+ tif, TIFFComputeStrip(tif, offset_row, 0),
-+ (void**) &buf, bufsize,
-+ ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
-+ && (buf == NULL || img->stoponerr))
-+ {
-+ ret = 0;
-+ break;
-+ }
-+ p0 = buf;
-+ if( colorchannels == 1 )
-+ {
-+ p2 = p1 = p0;
-+ pa = (alpha?(p0+3*stripsize):NULL);
-+ }
-+ else
-+ {
-+ p1 = p0 + stripsize;
-+ p2 = p1 + stripsize;
-+ pa = (alpha?(p2+stripsize):NULL);
-+ }
-+ }
-+ else if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
- p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)==(tmsize_t)(-1)
- && img->stoponerr)
- {
-diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c
-index fc0072e7..047305ab 100644
---- a/libtiff/tif_read.c
-+++ b/libtiff/tif_read.c
-@@ -442,18 +442,17 @@ TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
- }
-
- /*
-- * Read a strip of data and decompress the specified
-- * amount into the user-supplied buffer.
-+ * Calculate the strip size according to the number of
-+ * rows in the strip (check for truncated last strip on any
-+ * of the separations).
- */
--tmsize_t
--TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
-+static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF* tif, uint32 strip, uint16* pplane)
- {
- static const char module[] = "TIFFReadEncodedStrip";
- TIFFDirectory *td = &tif->tif_dir;
- uint32 rowsperstrip;
- uint32 stripsperplane;
- uint32 stripinplane;
-- uint16 plane;
- uint32 rows;
- tmsize_t stripsize;
- if (!TIFFCheckRead(tif,0))
-@@ -465,23 +464,37 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
- (unsigned long)td->td_nstrips);
- return((tmsize_t)(-1));
- }
-- /*
-- * Calculate the strip size according to the number of
-- * rows in the strip (check for truncated last strip on any
-- * of the separations).
-- */
-+
- rowsperstrip=td->td_rowsperstrip;
- if (rowsperstrip>td->td_imagelength)
- rowsperstrip=td->td_imagelength;
- stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
- stripinplane=(strip%stripsperplane);
-- plane=(uint16)(strip/stripsperplane);
-+ if( pplane ) *pplane=(uint16)(strip/stripsperplane);
- rows=td->td_imagelength-stripinplane*rowsperstrip;
- if (rows>rowsperstrip)
- rows=rowsperstrip;
- stripsize=TIFFVStripSize(tif,rows);
- if (stripsize==0)
- return((tmsize_t)(-1));
-+ return stripsize;
-+}
-+
-+/*
-+ * Read a strip of data and decompress the specified
-+ * amount into the user-supplied buffer.
-+ */
-+tmsize_t
-+TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
-+{
-+ static const char module[] = "TIFFReadEncodedStrip";
-+ TIFFDirectory *td = &tif->tif_dir;
-+ tmsize_t stripsize;
-+ uint16 plane;
-+
-+ stripsize=TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
-+ if (stripsize==((tmsize_t)(-1)))
-+ return((tmsize_t)(-1));
-
- /* shortcut to avoid an extra memcpy() */
- if( td->td_compression == COMPRESSION_NONE &&
-@@ -510,6 +523,49 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
- return(stripsize);
- }
-
-+/* Variant of TIFFReadEncodedStrip() that does
-+ * * if *buf == NULL, *buf = _TIFFmalloc(bufsizetoalloc) only after TIFFFillStrip() has
-+ * suceeded. This avoid excessive memory allocation in case of truncated
-+ * file.
-+ * * calls regular TIFFReadEncodedStrip() if *buf != NULL
-+ */
-+tmsize_t
-+_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
-+ void **buf, tmsize_t bufsizetoalloc,
-+ tmsize_t size_to_read)
-+{
-+ tmsize_t this_stripsize;
-+ uint16 plane;
-+
-+ if( *buf != NULL )
-+ {
-+ return TIFFReadEncodedStrip(tif, strip, *buf, size_to_read);
-+ }
-+
-+ this_stripsize=TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
-+ if (this_stripsize==((tmsize_t)(-1)))
-+ return((tmsize_t)(-1));
-+
-+ if ((size_to_read!=(tmsize_t)(-1))&&(size_to_read<this_stripsize))
-+ this_stripsize=size_to_read;
-+ if (!TIFFFillStrip(tif,strip))
-+ return((tmsize_t)(-1));
-+
-+ *buf = _TIFFmalloc(bufsizetoalloc);
-+ if (*buf == NULL) {
-+ TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
-+ return((tmsize_t)(-1));
-+ }
-+ _TIFFmemset(*buf, 0, bufsizetoalloc);
-+
-+ if ((*tif->tif_decodestrip)(tif,*buf,this_stripsize,plane)<=0)
-+ return((tmsize_t)(-1));
-+ (*tif->tif_postdecode)(tif,*buf,this_stripsize);
-+ return(this_stripsize);
-+
-+
-+}
-+
- static tmsize_t
- TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
- const char* module)
-diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h
-index 846ade03..7f0b90f7 100644
---- a/libtiff/tiffiop.h
-+++ b/libtiff/tiffiop.h
-@@ -365,6 +365,11 @@ extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
- extern double _TIFFUInt64ToDouble(uint64);
- extern float _TIFFUInt64ToFloat(uint64);
-
-+extern tmsize_t
-+_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
-+ void **buf, tmsize_t bufsizetoalloc,
-+ tmsize_t size_to_read);
-+
- extern int TIFFInitDumpMode(TIFF*, int);
- #ifdef PACKBITS_SUPPORT
- extern int TIFFInitPackBits(TIFF*, int);
+++ /dev/null
-From 6173a57d39e04d68b139f8c1aa499a24dbe74ba1 Mon Sep 17 00:00:00 2001
-From: Even Rouault <even.rouault@spatialys.com>
-Date: Fri, 30 Jun 2017 17:29:44 +0000
-Subject: [PATCH] * libtiff/tif_dirwrite.c: in
- TIFFWriteDirectoryTagCheckedXXXX() functions associated with LONG8/SLONG8
- data type, replace assertion that the file is BigTIFF, by a non-fatal error.
- Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2712 Reported by team
- OWL337
-
----
- ChangeLog | 8 ++++++++
- libtiff/tif_dirwrite.c | 20 ++++++++++++++++----
- 2 files changed, 24 insertions(+), 4 deletions(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index 6f085e09..77a64385 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,5 +1,13 @@
- 2017-06-30 Even Rouault <even.rouault at spatialys.com>
-
-+ * libtiff/tif_dirwrite.c: in TIFFWriteDirectoryTagCheckedXXXX()
-+ functions associated with LONG8/SLONG8 data type, replace assertion that
-+ the file is BigTIFF, by a non-fatal error.
-+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2712
-+ Reported by team OWL337
-+
-+2017-06-30 Even Rouault <even.rouault at spatialys.com>
-+
- * libtiff/tif_read.c, tiffiop.h: add a _TIFFReadEncodedStripAndAllocBuffer()
- function, variant of TIFFReadEncodedStrip() that allocates the
- decoded buffer only after a first successful TIFFFillStrip(). This avoids
-diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
-index 2967da58..8d6686ba 100644
---- a/libtiff/tif_dirwrite.c
-+++ b/libtiff/tif_dirwrite.c
-@@ -2111,7 +2111,10 @@ TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
- {
- uint64 m;
- assert(sizeof(uint64)==8);
-- assert(tif->tif_flags&TIFF_BIGTIFF);
-+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
-+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","LONG8 not allowed for ClassicTIFF");
-+ return(0);
-+ }
- m=value;
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8(&m);
-@@ -2124,7 +2127,10 @@ TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* di
- {
- assert(count<0x20000000);
- assert(sizeof(uint64)==8);
-- assert(tif->tif_flags&TIFF_BIGTIFF);
-+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
-+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","LONG8 not allowed for ClassicTIFF");
-+ return(0);
-+ }
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8(value,count);
- return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_LONG8,count,count*8,value));
-@@ -2136,7 +2142,10 @@ TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
- {
- int64 m;
- assert(sizeof(int64)==8);
-- assert(tif->tif_flags&TIFF_BIGTIFF);
-+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
-+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","SLONG8 not allowed for ClassicTIFF");
-+ return(0);
-+ }
- m=value;
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)(&m));
-@@ -2149,7 +2158,10 @@ TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* d
- {
- assert(count<0x20000000);
- assert(sizeof(int64)==8);
-- assert(tif->tif_flags&TIFF_BIGTIFF);
-+ if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
-+ TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","SLONG8 not allowed for ClassicTIFF");
-+ return(0);
-+ }
- if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8((uint64*)value,count);
- return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG8,count,count*8,value));
+++ /dev/null
-From 9c45d2395863b793528518d64ddb97d8fdc200dd Mon Sep 17 00:00:00 2001
-From: Even Rouault <even.rouault@spatialys.com>
-Date: Tue, 11 Jul 2017 08:55:07 +0000
-Subject: [PATCH] * libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of
- old-style LZW compressed files.
-
----
- ChangeLog | 5 +++++
- libtiff/tif_lzw.c | 4 ++++
- 2 files changed, 9 insertions(+)
-
-diff --git a/ChangeLog b/ChangeLog
-index b0c84977..c5c74af7 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,8 @@
-+2017-07-11 Even Rouault <even.rouault at spatialys.com>
-+
-+ * libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW
-+ compressed files.
-+
- 2017-06-30 Even Rouault <even.rouault at spatialys.com>
-
- * libtiff/tif_dirwrite.c: in TIFFWriteDirectoryTagCheckedXXXX()
-diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c
-index a2d01c90..f62b9e58 100644
---- a/libtiff/tif_lzw.c
-+++ b/libtiff/tif_lzw.c
-@@ -655,6 +655,9 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
- }
-
- bp = (unsigned char *)tif->tif_rawcp;
-+#ifdef LZW_CHECKEOS
-+ sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3);
-+#endif
- nbits = sp->lzw_nbits;
- nextdata = sp->lzw_nextdata;
- nextbits = sp->lzw_nextbits;
-@@ -764,6 +767,7 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
- }
- }
-
-+ tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp );
- tif->tif_rawcp = (uint8*) bp;
- sp->lzw_nbits = (unsigned short)nbits;
- sp->lzw_nextdata = nextdata;
+++ /dev/null
-From 69bfeec247899776b1b396651adb47436e5f1556 Mon Sep 17 00:00:00 2001
-From: Even Rouault <even.rouault@spatialys.com>
-Date: Sat, 15 Jul 2017 11:13:46 +0000
-Subject: [PATCH] * tools/tiff2pdf.c: prevent heap buffer overflow write in
- "Raw" mode on PlanarConfig=Contig input images. Fixes
- http://bugzilla.maptools.org/show_bug.cgi?id=2715 Reported by team OWL337
-
----
- ChangeLog | 7 +++++++
- tools/tiff2pdf.c | 7 ++++++-
- 2 files changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/ChangeLog b/ChangeLog
-index b4771234..1b5490f3 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,10 @@
-+2017-07-15 Even Rouault <even.rouault at spatialys.com>
-+
-+ * tools/tiff2pdf.c: prevent heap buffer overflow write in "Raw"
-+ mode on PlanarConfig=Contig input images.
-+ Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2715
-+ Reported by team OWL337
-+
- 2017-07-11 Even Rouault <even.rouault at spatialys.com>
-
- * libtiff/tif_lzw.c: fix 4.0.8 regression in the decoding of old-style LZW
-diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
-index db196e04..cd1e2358 100644
---- a/tools/tiff2pdf.c
-+++ b/tools/tiff2pdf.c
-@@ -1737,7 +1737,12 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
- return;
-
- t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
-- if(t2p->pdf_nopassthrough==0){
-+ /* It seems that T2P_TRANSCODE_RAW mode doesn't support separate->contig */
-+ /* conversion. At least t2p_read_tiff_size and t2p_read_tiff_size_tile */
-+ /* do not take into account the number of samples, and thus */
-+ /* that can cause heap buffer overflows such as in */
-+ /* http://bugzilla.maptools.org/show_bug.cgi?id=2715 */
-+ if(t2p->pdf_nopassthrough==0 && t2p->tiff_planar!=PLANARCONFIG_SEPARATE){
- #ifdef CCITT_SUPPORT
- if(t2p->tiff_compression==COMPRESSION_CCITTFAX4
- ){
--- /dev/null
+From c6f41df7b581402dfba3c19a1e3df4454c551a01 Mon Sep 17 00:00:00 2001
+From: Even Rouault <even.rouault@spatialys.com>
+Date: Sun, 31 Dec 2017 15:09:41 +0100
+Subject: [PATCH] libtiff/tif_print.c: TIFFPrintDirectory(): fix null pointer dereference on corrupted file. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2770
+
+---
+ libtiff/tif_print.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/libtiff/tif_print.c
++++ b/libtiff/tif_print.c
+@@ -667,13 +667,13 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd,
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
+ fprintf(fd, " %3lu: [%8I64u, %8I64u]\n",
+ (unsigned long) s,
+- (unsigned __int64) td->td_stripoffset[s],
+- (unsigned __int64) td->td_stripbytecount[s]);
++ td->td_stripoffset ? (unsigned __int64) td->td_stripoffset[s] : 0,
++ td->td_stripbytecount ? (unsigned __int64) td->td_stripbytecount[s] : 0);
+ #else
+ fprintf(fd, " %3lu: [%8llu, %8llu]\n",
+ (unsigned long) s,
+- (unsigned long long) td->td_stripoffset[s],
+- (unsigned long long) td->td_stripbytecount[s]);
++ td->td_stripoffset ? (unsigned long long) td->td_stripoffset[s] : 0,
++ td->td_stripbytecount ? (unsigned long long) td->td_stripbytecount[s] : 0);
+ #endif
+ }
+ }
--- /dev/null
+--- a/libtiff/tif_dir.c
++++ b/libtiff/tif_dir.c
+@@ -1067,6 +1067,9 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va
+ if (td->td_samplesperpixel - td->td_extrasamples > 1) {
+ *va_arg(ap, uint16**) = td->td_transferfunction[1];
+ *va_arg(ap, uint16**) = td->td_transferfunction[2];
++ } else {
++ *va_arg(ap, uint16**) = NULL;
++ *va_arg(ap, uint16**) = NULL;
+ }
+ break;
+ case TIFFTAG_REFERENCEBLACKWHITE:
+--- a/tools/tiff2pdf.c
++++ b/tools/tiff2pdf.c
+@@ -237,7 +237,7 @@ typedef struct {
+ float tiff_whitechromaticities[2];
+ float tiff_primarychromaticities[6];
+ float tiff_referenceblackwhite[2];
+- float* tiff_transferfunction[3];
++ uint16* tiff_transferfunction[3];
+ int pdf_image_interpolate; /* 0 (default) : do not interpolate,
+ 1 : interpolate */
+ uint16 tiff_transferfunctioncount;
+@@ -1047,6 +1047,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF*
+ uint16 pagen=0;
+ uint16 paged=0;
+ uint16 xuint16=0;
++ uint16 tiff_transferfunctioncount=0;
++ uint16* tiff_transferfunction[3];
+
+ directorycount=TIFFNumberOfDirectories(input);
+ t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE)));
+@@ -1147,26 +1149,48 @@ void t2p_read_tiff_init(T2P* t2p, TIFF*
+ }
+ #endif
+ if (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,
+- &(t2p->tiff_transferfunction[0]),
+- &(t2p->tiff_transferfunction[1]),
+- &(t2p->tiff_transferfunction[2]))) {
+- if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
+- (t2p->tiff_transferfunction[2] != (float*) NULL) &&
+- (t2p->tiff_transferfunction[1] !=
+- t2p->tiff_transferfunction[0])) {
+- t2p->tiff_transferfunctioncount = 3;
+- t2p->tiff_pages[i].page_extra += 4;
+- t2p->pdf_xrefcount += 4;
+- } else {
+- t2p->tiff_transferfunctioncount = 1;
+- t2p->tiff_pages[i].page_extra += 2;
+- t2p->pdf_xrefcount += 2;
+- }
+- if(t2p->pdf_minorversion < 2)
+- t2p->pdf_minorversion = 2;
++ &(tiff_transferfunction[0]),
++ &(tiff_transferfunction[1]),
++ &(tiff_transferfunction[2]))) {
++
++ if((tiff_transferfunction[1] != (uint16*) NULL) &&
++ (tiff_transferfunction[2] != (uint16*) NULL)
++ ) {
++ tiff_transferfunctioncount=3;
++ } else {
++ tiff_transferfunctioncount=1;
++ }
+ } else {
+- t2p->tiff_transferfunctioncount=0;
++ tiff_transferfunctioncount=0;
+ }
++
++ if (i > 0){
++ if (tiff_transferfunctioncount != t2p->tiff_transferfunctioncount){
++ TIFFError(
++ TIFF2PDF_MODULE,
++ "Different transfer function on page %d",
++ i);
++ t2p->t2p_error = T2P_ERR_ERROR;
++ return;
++ }
++ }
++
++ t2p->tiff_transferfunctioncount = tiff_transferfunctioncount;
++ t2p->tiff_transferfunction[0] = tiff_transferfunction[0];
++ t2p->tiff_transferfunction[1] = tiff_transferfunction[1];
++ t2p->tiff_transferfunction[2] = tiff_transferfunction[2];
++ if(tiff_transferfunctioncount == 3){
++ t2p->tiff_pages[i].page_extra += 4;
++ t2p->pdf_xrefcount += 4;
++ if(t2p->pdf_minorversion < 2)
++ t2p->pdf_minorversion = 2;
++ } else if (tiff_transferfunctioncount == 1){
++ t2p->tiff_pages[i].page_extra += 2;
++ t2p->pdf_xrefcount += 2;
++ if(t2p->pdf_minorversion < 2)
++ t2p->pdf_minorversion = 2;
++ }
++
+ if( TIFFGetField(
+ input,
+ TIFFTAG_ICCPROFILE,
+@@ -1827,10 +1851,9 @@ void t2p_read_tiff_data(T2P* t2p, TIFF*
+ &(t2p->tiff_transferfunction[0]),
+ &(t2p->tiff_transferfunction[1]),
+ &(t2p->tiff_transferfunction[2]))) {
+- if((t2p->tiff_transferfunction[1] != (float*) NULL) &&
+- (t2p->tiff_transferfunction[2] != (float*) NULL) &&
+- (t2p->tiff_transferfunction[1] !=
+- t2p->tiff_transferfunction[0])) {
++ if((t2p->tiff_transferfunction[1] != (uint16*) NULL) &&
++ (t2p->tiff_transferfunction[2] != (uint16*) NULL)
++ ) {
+ t2p->tiff_transferfunctioncount=3;
+ } else {
+ t2p->tiff_transferfunctioncount=1;
include $(TOPDIR)/rules.mk
PKG_NAME:=vips
-PKG_VERSION:=7.42.1
-PKG_RELEASE:=1
+PKG_VERSION:=8.6.1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.vips.ecs.soton.ac.uk/supported/7.42/
-PKG_HASH:=5ee272b11e4ca61c148d7392cbc01ad35f577b503727f479e38923e5bcfe6abf
+PKG_SOURCE_URL:=https://github.com/jcupitt/libvips/releases/download/v8.6.1/
+PKG_HASH:=f9ba6235ebc3e4d20af5f1604436bcd9686a3fecbe40838325d542f0c21a9270
PKG_FIXUP:=autoreconf
PKG_CHECK_FORMAT_SECURITY:=0
TITLE:=An image manipulation library
URL:=http://www.vips.ecs.soton.ac.uk/
MAINTAINER:=W. Michael Petullo <mike@flyn.org>
- DEPENDS:=+glib2 +libexif +libjpeg +libpng +libxml2 $(INTL_DEPENDS)
+ DEPENDS:=+glib2 +libexif +libexpat +libjpeg +libpng +giflib +libstdcpp +libxml2 $(INTL_DEPENDS)
endef
TARGET_LDFLAGS+= \
+++ /dev/null
-diff -u --recursive --new-file vips-7.42.1-vanilla/configure.ac vips-7.42.1/configure.ac
---- vips-7.42.1-vanilla/configure.ac 2014-12-29 17:45:59.576995574 -0500
-+++ vips-7.42.1/configure.ac 2014-12-29 17:59:03.698808601 -0500
-@@ -264,7 +264,6 @@
- AC_PROG_AWK
- AC_PROG_CC
- AC_PROG_CC_STDC
--AC_PROG_CXX
- AC_C_CONST
- AC_C_RESTRICT
- AC_PROG_RANLIB
-@@ -272,19 +271,6 @@
- AC_PROG_LN_S
- AM_WITH_DMALLOC
-
--# vips_PROG_CXX_WORKS
--# Check whether the C++ compiler works.
--AC_DEFUN([vips_PROG_CXX_WORKS],
-- [AC_REQUIRE([AC_PROG_CXX])dnl
-- AC_CACHE_CHECK([whether the C++ compiler works],
-- [vips_cv_prog_cxx_works],
-- [AC_LANG_PUSH([C++])
-- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
-- [vips_cv_prog_cxx_works=yes],
-- [vips_cv_prog_cxx_works=no])
-- AC_LANG_POP([C++])])
--])
--
- # option to build without C++
- # handy for some embedded applications
- # also, including C++ source causes link problems on some
-@@ -292,24 +278,8 @@
- AC_ARG_ENABLE(cxx,
- AS_HELP_STRING([--enable-cxx], [build C++ components (default: test)]))
-
--if test x"$enable_cxx" != x"no"; then
-- vips_PROG_CXX_WORKS
-- if test x"$vips_cv_prog_cxx_works" = x"yes"; then
-- AC_DEFINE(ENABLE_CXX,1,[build C++ components])
-- AM_CONDITIONAL(ENABLE_CXX, true)
-- # need -lstdc++ for (eg.) the C++ format loaders
-- # this gets added to vips.pc to help mingw and friends link programs
-- # using libvips
-- if test x"$vips_needs_stdcpp" != x"no"; then
-- VIPS_CXX_LIBS="-lstdc++"
-- fi
-- enable_cxx=yes
-- fi
--fi
--
- if test x"$enable_cxx" != x"yes"; then
- AM_CONDITIONAL(ENABLE_CXX, false)
-- VIPS_CXX_LIBS=""
- enable_cxx=no
- fi
-
-@@ -817,7 +787,6 @@
- AC_SUBST(VIPS_CFLAGS)
- AC_SUBST(VIPS_INCLUDES)
- AC_SUBST(VIPS_LIBS)
--AC_SUBST(VIPS_CXX_LIBS)
- AC_SUBST(PACKAGES_USED)
- AC_SUBST(EXTRA_LIBS_USED)
-
-@@ -850,12 +819,6 @@
- libvips/create/Makefile
- libvips/resample/Makefile
- libvips/video/Makefile
-- libvipsCC/include/Makefile
-- libvipsCC/include/vips/Makefile
-- libvipsCC/Makefile
-- cplusplus/include/Makefile
-- cplusplus/include/vips/Makefile
-- cplusplus/Makefile
- tools/Makefile
- tools/batch_crop
- tools/batch_image_convert
-@@ -866,7 +829,6 @@
- test/Makefile
- test/variables.sh
- swig/Makefile
-- swig/vipsCC/Makefile
- man/Makefile
- doc/Makefile
- doc/reference/Makefile
-diff -u --recursive --new-file vips-7.42.1-vanilla/libvips/Makefile.am vips-7.42.1/libvips/Makefile.am
---- vips-7.42.1-vanilla/libvips/Makefile.am 2014-12-29 17:45:59.590996100 -0500
-+++ vips-7.42.1/libvips/Makefile.am 2014-12-29 17:59:32.053375826 -0500
-@@ -33,14 +33,6 @@
- # empty means default to C linking
- libvips_la_SOURCES =
-
--# if we have C++ components enabled, make sure we link the top-level with c++
--#
--# sadly the if/endif isn't enough to stop automake detecting a c++ link even
--# when c++ is disabled ... comment out this line if you have linking problems
--if ENABLE_CXX
--nodist_EXTRA_libvips_la_SOURCES = resample/dummy2.cc
--endif
--
- # DLLs need dependant libs there too ... put @VIPS_LIBS@ at the end
- libvips_la_LIBADD = \
- resample/libresample.la \
-diff -u --recursive --new-file vips-7.42.1-vanilla/libvips/resample/Makefile.am vips-7.42.1/libvips/resample/Makefile.am
---- vips-7.42.1-vanilla/libvips/resample/Makefile.am 2014-12-29 17:45:59.591996138 -0500
-+++ vips-7.42.1/libvips/resample/Makefile.am 2014-12-29 18:01:57.107188019 -0500
-@@ -1,30 +1,3 @@
--# only build the C++ stuff if ENABLE_CXX
--# you'd think we could just define a couple of variables, but that seems to
--# confuse libtool and make it link the library with g++
--# instead, have two completely different paths
--if ENABLE_CXX
--
--libresample_la_SOURCES = \
-- affine.c \
-- quadratic.c \
-- resample.c \
-- similarity.c \
-- resize.c \
-- presample.h \
-- shrink.c \
-- interpolate.c \
-- transform.c \
-- bicubic.cpp \
-- lbb.cpp \
-- nohalo.cpp \
-- vsqbs.cpp \
-- templates.h
--
--EXTRA_DIST = \
-- dummy2.cc
--
--else
--
- libresample_la_SOURCES = \
- resample.c \
- similarity.c \
-@@ -36,16 +9,6 @@
- quadratic.c \
- transform.c
-
--EXTRA_DIST = \
-- dummy2.cc \
-- bicubic.cpp \
-- lbb.cpp \
-- nohalo.cpp \
-- vsqbs.cpp \
-- templates.h
--
--endif
--
- noinst_LTLIBRARIES = libresample.la
-
- AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
--- /dev/null
+diff -u --recursive vips-8.6.1-vanilla/configure.ac vips-8.6.1/configure.ac
+--- vips-8.6.1-vanilla/configure.ac 2018-01-13 17:27:19.375813474 -0500
++++ vips-8.6.1/configure.ac 2018-01-13 17:27:38.486871756 -0500
+@@ -53,9 +53,6 @@
+ AC_SUBST(LIBRARY_REVISION)
+ AC_SUBST(LIBRARY_AGE)
+
+-# init introspection support
+-GOBJECT_INTROSPECTION_CHECK([1.30.0])
+-
+ # gir needs a list of source files to scan for introspection
+ #
+ # build with a glob and a list of files to exclude from scanning
+diff -u --recursive vips-8.6.1-vanilla/libvips/Makefile.am vips-8.6.1/libvips/Makefile.am
+--- vips-8.6.1-vanilla/libvips/Makefile.am 2018-01-13 17:27:19.366813446 -0500
++++ vips-8.6.1/libvips/Makefile.am 2018-01-13 17:27:57.256929001 -0500
+@@ -70,56 +70,3 @@
+ echo "#define VIPS_SONAME \"$$dlname\"" >> soname.h && \
+ cp soname.h $(DESTDIR)$(pkgincludedir) && \
+ rm soname.h
+-
+--include $(INTROSPECTION_MAKEFILE)
+-INTROSPECTION_GIRS =
+-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+-
+-if HAVE_INTROSPECTION
+-
+-AM_CPPFLAGS = \
+- -I${top_srcdir}/libvips/include \
+- @VIPS_CFLAGS@ \
+- @VIPS_INCLUDES@ \
+- @INTROSPECTION_CFLAGS@
+-AM_LDFLAGS = \
+- @INTROSPECTION_LIBS@ \
+- @LDFLAGS@
+-LDADD = @INTROSPECTION_LIBS@ @VIPS_CFLAGS@ libvips.la @VIPS_LIBS@
+-
+-noinst_PROGRAMS = \
+- introspect
+-introspect_SOURCES = \
+- introspect.c
+-
+-# we can't get the _SOURCES lists from the subdirs directly, we get passed it
+-# by configure instead
+-introspection_sources = @vips_introspection_sources@
+-
+-# we make the vips8 API
+-Vips-8.0.gir: introspect
+-Vips_8_0_gir_INCLUDES = GObject-2.0
+-Vips_8_0_gir_CFLAGS = $(INCLUDES) -I${top_srcdir}/libvips/include
+-Vips_8_0_gir_LIBS = libvips.la
+-Vips_8_0_gir_FILES = $(introspection_sources)
+-INTROSPECTION_GIRS += Vips-8.0.gir
+-
+-# don't use
+-# --warn-all --verbose
+-# too annoying
+-Vips_8_0_gir_SCANNERFLAGS = \
+- --program=./introspect$(EXEEXT) \
+- --identifier-prefix=Vips \
+- --identifier-prefix=vips \
+- --symbol-prefix=vips \
+- --c-include=vips/vips.h
+-
+-girdir = $(datadir)/gir-1.0
+-gir_DATA = $(INTROSPECTION_GIRS)
+-
+-typelibdir = $(libdir)/girepository-1.0
+-typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+-
+-CLEANFILES += $(gir_DATA) $(typelib_DATA)
+-endif
include $(TOPDIR)/rules.mk
PKG_NAME:=dovecot
-PKG_VERSION:=2.2.33.2
-PKG_RELEASE:=2
+PKG_VERSION:=2.2.35
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.dovecot.org/releases/2.2
-PKG_HASH:=fe1e3b78609a56ee22fc209077e4b75348fa1bbd54c46f52bde2472a4c4cee84
+PKG_HASH:=cce15db2fc5233386b63a3cf21c465c09e6e55014ed66c4f184b7d221a47180c
PKG_LICENSE:=LGPL-2.1 MIT BSD-3-Clause Unique
PKG_LICENSE_FILES:=COPYING COPYING.LGPL COPYING.MIT
PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
PKG_NAME:=mailman
PKG_RELEASE:=1
-PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/mailman/ http://ftp.gnu.org/gnu/mailman/
+PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
PKG_VERSION:=2.1.23
PKG_HASH:=b022ca6f8534621c9dbe50c983948688bc4623214773b580c2c78e4a7ae43e69
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
include $(TOPDIR)/rules.mk
PKG_NAME:=mutt
-PKG_VERSION:=1.9.1
+PKG_VERSION:=1.9.4
PKG_RELEASE:=1
PKG_SOURCE_URL:=ftp://ftp.mutt.org/pub/mutt/ \
https://bitbucket.org/mutt/mutt/downloads/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=749b83a96373c6e2101ebe8c4b9a651735e02c478edb750750a5146a15d91bb1
+PKG_HASH:=f4d1bf26350c1ac81b551f98e5a4fd80d7fecd86919aa8165e69fde87de1b5df
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=GPL
define Package/mutt
SECTION:=mail
CATEGORY:=Mail
- DEPENDS:=+libopenssl +libncursesw +zlib
+ DEPENDS:=+libopenssl +libncursesw +terminfo +zlib
TITLE:=Console mail client
URL:=http://www.mutt.org/
endef
--- /dev/null
+#
+# Copyright (C) 2017 Val Kulkov <val.kulkov@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v3.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=opendkim
+PKG_VERSION:=2.10.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_HASH:=43a0ba57bf942095fe159d0748d8933c6b1dd1117caf0273fa9a0003215e681b
+PKG_MAINTAINER:=Val Kulkov <val.kulkov@gmail.com>
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=LICENSE LICENSE.Sendmail
+
+PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=openssl
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/opendkim
+ SECTION:=mail
+ CATEGORY:=Mail
+ DEPENDS:=+libopendkim
+ TITLE:=Open source milter for providing DKIM service
+ URL:=http://opendkim.org/
+ USERID:=opendkim:opendkim
+endef
+
+define Package/opendkim/description
+ The OpenDKIM daemon application and the opendkim-genkey Perl script for generating public/private key pairs.
+endef
+
+define Package/libopendkim
+ SECTION:=mail
+ CATEGORY:=Libraries
+ DEPENDS:=+libopenssl +libmilter-sendmail
+ TITLE:=Library for signing and verifying DKIM signatures
+ URL:=http://opendkim.org/
+endef
+
+define Package/libopendkim/description
+ Library for signing and verifying DomainKeys Identified Mail (DKIM) signatures.
+endef
+
+define Package/opendkim-tools
+ SECTION:=mail
+ CATEGORY:=Mail
+ DEPENDS:=+libopendkim
+ TITLE:=genzone, testkey and testmsg tools for OpenDKIM
+ URL:=http://opendkim.org/
+endef
+
+define Package/opendkim-tools/description
+ opendkim-genzone, opendkim-testkey and opendkim-testmsg tools.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+ --without-db \
+ --without-gcov \
+ --without-gprof \
+ --without-lcov \
+ --with-milter=$(STAGING_DIR)/usr
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opendkim $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opendkim-{genkey,genzone,testkey,testmsg} $(1)/usr/sbin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopendkim.so* $(1)/usr/lib/
+endef
+
+define Package/opendkim/conffiles
+/etc/opendkim.conf
+/etc/opendkim/
+endef
+
+define Package/opendkim/install
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/opendkim $(1)/etc/init.d
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opendkim $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opendkim-genkey $(1)/usr/sbin/opendkim-genkey.pl
+ $(INSTALL_BIN) ./files/opendkim-genkey $(1)/usr/sbin/
+ $(INSTALL_DATA) ./files/opendkim.conf.simple $(1)/etc/opendkim/
+ $(INSTALL_BIN) ./files/opendkim.init $(1)/etc/init.d/opendkim
+endef
+
+define Package/libopendkim/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopendkim.so* $(1)/usr/lib/
+endef
+
+define Package/opendkim-tools/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/opendkim-{genzone,testkey,testmsg} $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,opendkim))
+$(eval $(call BuildPackage,libopendkim))
+$(eval $(call BuildPackage,opendkim-tools))
--- /dev/null
+#!/bin/sh
+
+if [ -x /usr/bin/perl ]; then
+ /usr/sbin/opendkim-genkey.pl
+else
+ echo ""
+ echo "Perl is required for running this script. Install Perl or run"
+ echo "this script on another computer that has Perl with File::Basename"
+ echo "and Getopt::Long modules installed."
+ echo ""
+fi
--- /dev/null
+# The default location of the OpenDKIM configuration file is
+# /etc/opendkim.conf
+
+# Enable to obtain very detailed logging about the logic behind
+# the filter's decision to either sign a message or verify it
+#LogWhy yes
+
+# Log to syslog
+Syslog yes
+# Log additional entries indicating successful signing or
+# verification of messages
+SyslogSuccess yes
+
+# the canonicalization method(s) to be used when signing messages
+Canonicalization relaxed/relaxed
+
+# A set of domains whose mail should be signed by this filter.
+# Mail from other domains will be verified rather than being signed
+Domain example.com
+
+# Defines the name of the selector to be used when signing messages
+Selector default
+KeyFile /etc/openkim/example.com.private
+
+UserID opendkim:opendkim
+Socket inet:8891@localhost
+
+# if using a UNIX socket, make sure that /var/run/opendkim is writable
+# to the opendkim user
+#Socket local:/var/run/opendkim/opendkim
+
+ReportAddress postmaster@example.com
+SendReports yes
+
+## Hosts to sign email for - 127.0.0.1 is default
+## See the OPERATION section of opendkim(8) for more information
+#
+# InternalHosts 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
+
+## For secondary mailservers - indicates not to sign or verify messages
+## from these hosts
+#
+# PeerList X.X.X.X
+
+PidFile /var/run/opendkim.pid
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=54
+STOP=54
+USE_PROCD=1
+
+start_service() {
+ chown opendkim.opendkim /etc/opendkim/*.private
+ procd_open_instance
+ procd_set_param command /usr/sbin/opendkim -f
+ procd_set_param respawn
+ procd_set_param file /etc/opendkim.conf
+ procd_close_instance
+}
+
PKG_NAME:=postfix
PKG_RELEASE:=1
-PKG_VERSION:=3.2.4
+PKG_VERSION:=3.3.0
PKG_SOURCE_URL:= \
https://cdn.postfix.johnriley.me/mirrors/postfix-release/official/ \
ftp://ftp.porcupine.org/mirrors/postfix-release/official/
-PKG_HASH:=ec55ebaa2aa464792af8d5ee103eb68b27a42dc2b36a02fee42dafbf9740c7f6
+PKG_HASH:=7942e89721e30118d7050675b0d976955e3160e21f7898b85a79cac4f4baef39
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_MAINTAINER:=Denis Shulyaka <Shulyaka@gmail.com>
PKG_LICENSE:=IPL-1.0
diff -rupN postfix-2.8.1/src/smtpd/smtpd_check.c postfix-2.8.1_patched/src/smtpd/smtpd_check.c
--- postfix-2.8.1/src/smtpd/smtpd_check.c 2011-01-04 22:03:50.000000000 +0300
+++ postfix-2.8.1_patched/src/smtpd/smtpd_check.c 2011-03-06 19:35:39.000000000 +0300
-@@ -5302,7 +5302,7 @@ char *smtpd_check_queue(SMTPD_STATE *s
+@@ -5322,7 +5322,7 @@ char *smtpd_check_queue(SMTPD_STATE *s
*/
#define BLOCKS(x) ((x) / fsbuf.block_size)
+++ /dev/null
-This patch fixes the runtime error when libmilter is used with Postfix:
-"unix_send_fd: your system has no support for file descriptor passing"
-
-The issue has been fixed upstream in 20170618 update to Postfix v.3.3:
-http://postfix.1071664.n5.nabble.com/Fix-check-for-file-descriptor-passing-td90983.html
-
-This patch must be removed before compiling Postfix v.3.3.*
-
---- a/src/util/sys_defs.h
-+++ b/src/util/sys_defs.h
-@@ -804,7 +804,7 @@ extern int initgroups(const char *, int)
- #define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
- #endif
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \
-- || (__GLIBC__ < 2)
-+ || (defined(__GLIBC__) && __GLIBC__ < 2)
- #define CANT_USE_SEND_RECV_MSG
- #define DEF_SMTP_CACHE_DEMAND 0
- #else
diff -Naur postfix-2.10.2/conf/post-install postfix-2.10.2_patched/conf/post-install
--- postfix-2.10.2/conf/post-install 2013-06-13 18:07:46.000000000 +0400
+++ postfix-2.10.2_patched/conf/post-install 2013-11-19 21:17:49.572820573 +0400
-@@ -361,10 +361,10 @@
+@@ -366,10 +366,10 @@
# Sanity checks
case $setgid_group in
no) echo $0: Error: setgid_group no longer accepts \"no\" values. 1>&2
-@@ -372,7 +372,7 @@
+@@ -377,7 +377,7 @@
esac
for path in "$daemon_directory" "$command_directory" "$queue_directory" \
"$meta_directory"
do
case "$path" in
-@@ -381,7 +381,7 @@
+@@ -386,7 +386,7 @@
esac
done
--- a/src/util/dict_db.c 2017-07-16 16:56:00.819659962 +0300
+++ b/src/util/dict_db.c 2017-07-16 16:58:31.011401358 +0300
-@@ -733,8 +733,8 @@
+@@ -740,8 +740,8 @@
msg_fatal("create DB database: %m");
if (db == 0)
msg_panic("db_create null result");
- msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
+// if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
+// msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
+ db_base_buf = vstring_alloc(100);
#if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
- if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
--- a/makedefs 2016-01-28 12:30:14.444082390 -0500
+++ b/makedefs 2016-01-28 13:44:02.092006512 -0500
-@@ -210,7 +210,7 @@ error() {
+@@ -213,7 +213,7 @@ error() {
case $# in
# Officially supported usage.
RELEASE=`(uname -r) 2>/dev/null`
# No ${x%%y} support in Solaris 11 /bin/sh
RELEASE_MAJOR=`expr "$RELEASE" : '\([0-9]*\)'` || exit 1
-@@ -224,6 +224,15 @@ case $# in
+@@ -227,6 +227,15 @@ case $# in
esac
case "$SYSTEM.$RELEASE" in
diff -Naur postfix-2.11.1/conf/post-install postfix-2.11.1.patched/conf/post-install
--- postfix-2.11.1/conf/post-install 2014-10-05 20:43:58.597876946 +0400
+++ postfix-2.11.1.patched/conf/post-install 2014-10-11 16:28:01.258874097 +0400
-@@ -321,7 +321,7 @@
+@@ -326,7 +326,7 @@
case `uname -s` in
HP-UX*) FMT=cat;;
SunOS*) FMT=fake_fmt;;
diff -Naur a/conf/post-install b/conf/post-install
--- a/conf/post-install 2015-12-28 00:00:45.000000000 +0000
+++ b/conf/post-install 2017-08-01 22:42:30.476896711 +0000
-@@ -561,15 +561,16 @@
+@@ -566,15 +566,16 @@
then
set_permission=1
fi
PKG_LICENSE_FILES:=LICENSE
PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=openssl
include $(INCLUDE_DIR)/package.mk
config FFMPEG_CUSTOM_MINIDLNA_SUPPORT
bool "Include support for minidlna"
- depends on FFMPEG_CUSTOM_PATENTED
select FFMPEG_CUSTOM_DECODER_aac
select FFMPEG_CUSTOM_DECODER_ac3
select FFMPEG_CUSTOM_DECODER_flac
- select FFMPEG_CUSTOM_DECODER_h264
- select FFMPEG_CUSTOM_DECODER_hevc
+ select FFMPEG_CUSTOM_DECODER_h264 if (BUILD_PATENTED)
+ select FFMPEG_CUSTOM_DECODER_hevc if (BUILD_PATENTED)
select FFMPEG_CUSTOM_DECODER_jpegls
select FFMPEG_CUSTOM_DECODER_mp2
select FFMPEG_CUSTOM_DECODER_mp3
select FFMPEG_CUSTOM_DECODER_mpegvideo
select FFMPEG_CUSTOM_DECODER_png
select FFMPEG_CUSTOM_DECODER_opus
- select FFMPEG_CUSTOM_DECODER_vc1
+ select FFMPEG_CUSTOM_DECODER_vc1 if (BUILD_PATENTED)
select FFMPEG_CUSTOM_DECODER_vorbis
select FFMPEG_CUSTOM_DECODER_wmav1
select FFMPEG_CUSTOM_DECODER_wmav2
config FFMPEG_CUSTOM_AUDIO_DEC_SUPPORT
bool "Include support for most audio decoding requirements"
- depends on FFMPEG_CUSTOM_PATENTED
select FFMPEG_CUSTOM_DECODER_aac
select FFMPEG_CUSTOM_DECODER_aac_latm
select FFMPEG_CUSTOM_DECODER_ac3
select FFMPEG_CUSTOM_DECODER_amrnb
select FFMPEG_CUSTOM_DECODER_amrwb
select FFMPEG_CUSTOM_DECODER_ape
- select FFMPEG_CUSTOM_DECODER_atrac3
+ select FFMPEG_CUSTOM_DECODER_atrac3 if (BUILD_PATENTED)
select FFMPEG_CUSTOM_DECODER_flac
select FFMPEG_CUSTOM_DECODER_mp2
select FFMPEG_CUSTOM_DECODER_mp3
config FFMPEG_CUSTOM_ENCODER_ac3
bool "AC3"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_ENCODER_jpegls
bool "JPEG-LS"
config FFMPEG_CUSTOM_ENCODER_mpeg2video
bool "MPEG-2 Video"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_ENCODER_mpeg4
bool "MPEG-4"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_ENCODER_pcm_s16be
bool "PCM signed 16-bit big-endian"
config FFMPEG_CUSTOM_DECODER_aac
bool "AAC (Advanced Audio Coding)"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_SELECT_adpcm
bool "ADPCM (multiple types)"
config FFMPEG_CUSTOM_DECODER_ac3
bool "AC3"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_DECODER_alac
bool "ALAC"
config FFMPEG_CUSTOM_DECODER_mpeg2video
bool "MPEG-2 Video"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_DECODER_mpeg4
bool "MPEG-4"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_DECODER_mpc7
bool "Musepack 7"
config FFMPEG_CUSTOM_DECODER_wmav1
bool "WMAv1"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_DECODER_wmav2
bool "WMAv2"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_DECODER_zlib
bool "Zlib"
config FFMPEG_CUSTOM_MUXER_ac3
bool "AC3"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_MUXER_ffm
bool "FFM (ffserver live feed)"
config FFMPEG_CUSTOM_PARSER_aac
bool "AAC (Advanced Audio Coding)"
- depends on FFMPEG_CUSTOM_PATENTED
config FFMPEG_CUSTOM_PARSER_ac3
bool "AC3"
#
-# Copyright (C) 2006-2017 OpenWrt.org
-# Copyright (C) 2017 Ian Leonard <antonlacon@gmail.com>
+# Copyright (C) 2017-2018 Ian Leonard <antonlacon@gmail.com>
+# Copyright (C) 2018 Ted Hess <thess@kitschensync.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=ffmpeg
-PKG_VERSION:=3.2.9
-PKG_RELEASE:=1
+PKG_VERSION:=3.2.10
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://ffmpeg.org/releases/
-PKG_HASH:=1131d37890ed3dcbc3970452b200a56ceb36b73eaa51d1c23c770c90f928537f
+PKG_HASH:=3c1626220c7b68ff6be7312559f77f3c65ff6809daf645d4470ac0189926bdbc
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
Ian Leonard <antonlacon@gmail.com>
file http icecast pipe rtp tcp udp
FFMPEG_MINI_DECODERS:= \
- aac \
ac3 \
flac \
- h264 \
- hevc \
jpegls \
mp2 \
mp3 \
mpegvideo \
opus \
png \
- vc1 \
vorbis \
- wmav1 \
- wmav2 \
+
+FFMPEG_PATENTED_MINI_DECODERS:= \
+ h264 \
+ hevc \
+ vc1 \
FFMPEG_MINI_DEMUXERS:= \
avi \
file
FFMPEG_AUDIO_DECODERS:= \
- aac \
- aac_latm \
ac3 \
adpcm_* \
alac \
pcm_* \
vorbis \
wavpack \
- wmav1 \
- wmav2 \
- wmalossless \
- wmapro \
zlib \
FFMPEG_AUDIO_DEMUXERS:= \
- aac \
ac3 \
aiff \
amr \
FFMPEG_AUDIO_PROTOCOLS:= \
file http icecast rtp tcp udp
+FFMPEG_PATENTED_DECODERS:= \
+ atrac3 \
+ h264 \
+ hevc \
+ vc1 \
+
+FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENDED_DECODERS)
+
+FFMPEG_PATENTED_MUXERS:= \
+ h264 \
+ hevc \
+ vc1 \
+
+FFMPEG_PATENTED_DEMUXERS:=$(FFMPEG_PATENTED_MUXERS)
+
+FFMPEG_PATENTED_PARSERS:= \
+ h264 \
+ hevc \
+ vc1 \
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
- $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
+ $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
$(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
define Package/ffmpeg/Default/description
FFmpeg is a a software package that can record, convert and stream digital
audio and video in numerous formats.
+
+ FFmpeg licensing / patent issues are complex. It is the reponsibility of the
+ user to understand any requirements in this regard with its usage. See:
+ https://ffmpeg.org/legal.html for further information.
endef
define Package/libffmpeg-audio-dec
$(call Package/libffmpeg/Default)
TITLE+= (audio)
- DEPENDS+= @BUILD_PATENTED
VARIANT:=audio-dec
endef
define Package/libffmpeg-full
$(call Package/libffmpeg/Default)
TITLE+= (full)
- DEPENDS+= @BUILD_PATENTED +alsa-lib +PACKAGE_libopus:libopus
+ DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus
ifeq ($(CONFIG_SOFT_FLOAT),y)
DEPENDS+= +PACKAGE_shine:shine
else
- DEPENDS+= +PACKAGE_lame-lib:lame-lib +PACKAGE_libx264:libx264
+ DEPENDS+= +PACKAGE_lame-lib:lame-lib +PACKAGE_libx264:libx264 +PACKAGE_fdk-aac:fdk-aac
+
endif
VARIANT:=full
endef
define Package/libffmpeg-mini
$(call Package/libffmpeg/Default)
TITLE+= (mini)
- DEPENDS+= @BUILD_PATENTED
VARIANT:=mini
endef
endif
ifeq ($(BUILD_VARIANT),full)
+
+ FFMPEG_DISABLE= \
+ $(foreach c, $(2), \
+ --disable-$(1)="$(c)" \
+ )
+
FFMPEG_CONFIGURE+= \
--enable-avresample \
+ $(if $(CONFIG_BUILD_PATENTED),, \
+ $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
+ $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
+ $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
+ $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
+ $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
$(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
ifeq ($(CONFIG_SOFT_FLOAT),y)
FFMPEG_CONFIGURE+= \
else
FFMPEG_CONFIGURE+= --enable-small
endif
- FFMPEG_CONFIGURE+= \
- --enable-gpl \
- \
- $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame) \
- $(if $(CONFIG_PACKAGE_libx264),--enable-libx264)
+ FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
+ # x264 support and fdk-aac support can't coexist and be distributed.
+ # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
+ ifeq ($(CONFIG_PACKAGE_libx264),y)
+ FFMPEG_CONFIGURE+= \
+ --enable-gpl \
+ --enable-libx264
+ else
+ FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
+ endif
endif
endif
--disable-everything \
$(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
$(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
- $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS))
+ $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
+ $(if $(CONFIG_BUILD_PATENTED), \
+ $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
endif
ifneq ($(CONFIG_TARGET_x86),)
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
endef
-# Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
+# Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
define Build/InstallDev/full
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
-ifneq ($(CONFIG_SOFT_FLOAT),y)
+ifeq ($(CONFIG_PACKAGE_libx264),y)
$(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
endef
-# Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc)
+# Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
define Package/libffmpeg-full/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
-ifneq ($(CONFIG_SOFT_FLOAT),y)
+ifeq ($(CONFIG_PACKAGE_libx264),y)
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
endif
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=gphoto2
-PKG_VERSION:=2.5.15
+PKG_VERSION:=2.5.17
PKG_RELEASE:=1
PKG_MAINTAINER:=Leonardo Medici <leonardo_medici@me.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/gphoto
-PKG_HASH:=ae571a227983dc9997876702a73af5431d41f287ea0f483cda897c57a6084a77
+PKG_HASH:=aa571039240c68a053be710ca41645aed0239fa2f0b737b8ec767fef29e3544f
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
-Index: gphoto2-2.5.15/Makefile.am
+Index: gphoto2-2.5.17/Makefile.am
===================================================================
---- gphoto2-2.5.15.orig/Makefile.am
-+++ gphoto2-2.5.15/Makefile.am
+--- gphoto2-2.5.17.orig/Makefile.am
++++ gphoto2-2.5.17/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = gphoto-m4 contrib doc gphoto2 packaging po tests
+SUBDIRS = gphoto-m4 contrib doc gphoto2 packaging tests
ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4
EXTRA_DIST = README.md
-Index: gphoto2-2.5.15/Makefile.in
+Index: gphoto2-2.5.17/Makefile.in
===================================================================
---- gphoto2-2.5.15.orig/Makefile.in
-+++ gphoto2-2.5.15/Makefile.in
+--- gphoto2-2.5.17.orig/Makefile.in
++++ gphoto2-2.5.17/Makefile.in
@@ -389,7 +389,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4
EXTRA_DIST = README.md
all: config.h
-Index: gphoto2-2.5.15/configure.ac
+Index: gphoto2-2.5.17/configure.ac
===================================================================
---- gphoto2-2.5.15.orig/configure.ac
-+++ gphoto2-2.5.15/configure.ac
+--- gphoto2-2.5.17.orig/configure.ac
++++ gphoto2-2.5.17/configure.ac
@@ -58,10 +58,7 @@ dnl ------------------------------------
GP_GETTEXT_HACK([],[Lutz Müller and others],[${MAIL_GPHOTO_TRANSLATION}])
ALL_LINGUAS="az cs da de en_GB es eu fi fr hu id is it ja nl pa pl pt_BR ro ru rw sk sr sv uk vi zh_CN zh_TW"
-Index: gphoto2-2.5.15/Makefile.am
+Index: gphoto2-2.5.17/Makefile.am
===================================================================
---- gphoto2-2.5.15.orig/Makefile.am
-+++ gphoto2-2.5.15/Makefile.am
+--- gphoto2-2.5.17.orig/Makefile.am
++++ gphoto2-2.5.17/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = gphoto-m4 contrib doc gphoto2 packaging tests
+SUBDIRS = gphoto-m4 contrib gphoto2 packaging
ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4
EXTRA_DIST = README.md
-Index: gphoto2-2.5.15/Makefile.in
+Index: gphoto2-2.5.17/Makefile.in
===================================================================
---- gphoto2-2.5.15.orig/Makefile.in
-+++ gphoto2-2.5.15/Makefile.in
+--- gphoto2-2.5.17.orig/Makefile.in
++++ gphoto2-2.5.17/Makefile.in
@@ -389,7 +389,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4
EXTRA_DIST = README.md
all: config.h
-Index: gphoto2-2.5.15/configure.ac
+Index: gphoto2-2.5.17/configure.ac
===================================================================
---- gphoto2-2.5.15.orig/configure.ac
-+++ gphoto2-2.5.15/configure.ac
+--- gphoto2-2.5.17.orig/configure.ac
++++ gphoto2-2.5.17/configure.ac
@@ -407,16 +407,10 @@ AC_CONFIG_FILES([
Makefile
gphoto2/Makefile
include $(TOPDIR)/rules.mk
PKG_NAME:=grilo-plugins
-PKG_VERSION:=0.3.2
+PKG_VERSION:=0.3.5
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNOME/grilo-plugins/0.3/
-PKG_HASH:=791b89289781272c001545931a8f58f499d14e46e038a9caa82dfe2494301afd
+PKG_HASH:=2977827b8ecb3e15535236180e57dc35e85058d111349bdb6a1597e62a5068fb
PKG_BUILD_DEPENDS:=glib2 grilo
+++ /dev/null
-From 3cd7fb6af73ca7fdef2557ad31b5c4180534d775 Mon Sep 17 00:00:00 2001
-From: "W. Michael Petullo" <mike@flyn.org>
-Date: Sat, 9 Jul 2016 09:50:00 -0400
-Subject: [PATCH] dmap: Add album disc number mapping
-
-Signed-off-by: W. Michael Petullo <mike@flyn.org>
----
- src/dmap/grl-daap-db.c | 7 +++++++
- src/dmap/grl-daap.c | 1 +
- 2 files changed, 8 insertions(+)
-
-diff --git a/src/dmap/grl-daap-db.c b/src/dmap/grl-daap-db.c
-index 4850073..5bcd804 100644
---- a/src/dmap/grl-daap-db.c
-+++ b/src/dmap/grl-daap-db.c
-@@ -161,6 +161,7 @@ grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
-
- gint duration = 0;
- gint32 bitrate = 0,
-+ disc = 0,
- track = 0;
- gchar *id_s = NULL,
- *title = NULL,
-@@ -186,6 +187,8 @@ grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
- &title,
- "track",
- &track,
-+ "disc",
-+ &disc,
- "location",
- &url,
- "has-video",
-@@ -217,6 +220,10 @@ grl_daap_db_add (DMAPDb *_db, DMAPRecord *_record)
- grl_media_set_bitrate (media, bitrate);
- grl_media_set_track_number (media, track);
-
-+ if (disc != 0) {
-+ grl_media_set_album_disc_number (media, disc);
-+ }
-+
- if (album) {
- grl_media_set_album (media, album);
- }
-diff --git a/src/dmap/grl-daap.c b/src/dmap/grl-daap.c
-index 59aa981..796234d 100644
---- a/src/dmap/grl-daap.c
-+++ b/src/dmap/grl-daap.c
-@@ -365,6 +365,7 @@ grl_daap_source_supported_keys (GrlSource *source)
-
- if (!keys) {
- keys = grl_metadata_key_list_new (GRL_METADATA_KEY_ALBUM,
-+ GRL_METADATA_KEY_ALBUM_DISC_NUMBER,
- GRL_METADATA_KEY_ARTIST,
- GRL_METADATA_KEY_BITRATE,
- GRL_METADATA_KEY_DURATION,
---
-2.7.4
-
--- /dev/null
+diff -u --recursive grilo-plugins-0.3.5-vanilla/configure grilo-plugins-0.3.5/configure
+--- grilo-plugins-0.3.5-vanilla/configure 2018-01-07 21:45:18.874540074 -0500
++++ grilo-plugins-0.3.5/configure 2018-01-07 21:46:31.145749381 -0500
+@@ -638,8 +638,6 @@
+ LTLIBOBJS
+ LIBOBJS
+ YELP_HELP_RULES
+-XMLLINT
+-ITSTOOL
+ HELP_DIR
+ YELP_LC_DIST
+ YELP_LC_MEDIA_LINKS
+@@ -1084,9 +1082,7 @@
+ GOM_CFLAGS
+ GOM_LIBS
+ TRACKER_SPARQL_CFLAGS
+-TRACKER_SPARQL_LIBS
+-ITSTOOL
+-XMLLINT'
++TRACKER_SPARQL_LIBS'
+
+
+ # Initialize some variables set by options.
+@@ -1855,8 +1851,6 @@
+ C compiler flags for TRACKER_SPARQL, overriding pkg-config
+ TRACKER_SPARQL_LIBS
+ linker flags for TRACKER_SPARQL, overriding pkg-config
+- ITSTOOL Path to the `itstool` command
+- XMLLINT Path to the `xmllint` command
+
+ Use these variables to override the choices made by `configure' or to help
+ it to find libraries and programs with nonstandard names/locations.
+@@ -16976,89 +16970,6 @@
+
+
+
+-# Extract the first word of "itstool", so it can be a program name with args.
+-set dummy itstool; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_prog_ITSTOOL+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if test -n "$ITSTOOL"; then
+- ac_cv_prog_ITSTOOL="$ITSTOOL" # Let the user override the test.
+-else
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_prog_ITSTOOL="itstool"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+-fi
+-fi
+-ITSTOOL=$ac_cv_prog_ITSTOOL
+-if test -n "$ITSTOOL"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ITSTOOL" >&5
+-$as_echo "$ITSTOOL" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+-
+-if test x"$ITSTOOL" = x; then
+- as_fn_error $? "itstool not found" "$LINENO" 5
+-fi
+-
+-
+-# Extract the first word of "xmllint", so it can be a program name with args.
+-set dummy xmllint; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_prog_XMLLINT+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- if test -n "$XMLLINT"; then
+- ac_cv_prog_XMLLINT="$XMLLINT" # Let the user override the test.
+-else
+-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_prog_XMLLINT="xmllint"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+-fi
+-fi
+-XMLLINT=$ac_cv_prog_XMLLINT
+-if test -n "$XMLLINT"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5
+-$as_echo "$XMLLINT" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+-
+-if test x"$XMLLINT" = x; then
+- as_fn_error $? "xmllint not found" "$LINENO" 5
+-fi
+-
+ YELP_HELP_RULES='
+ HELP_ID ?=
+ HELP_POT ?=
bool "Include support for common audio/video decoders"
default y
select GST1_LIBAV_DECODER_aac if GST1_LIBAV_PATENTED
- select GST1_LIBAV_DECODER_ac3 if GST1_LIBAV_PATENTED
+ select GST1_LIBAV_DECODER_ac3
select GST1_LIBAV_DECODER_h264 if GST1_LIBAV_PATENTED
select GST1_LIBAV_DECODER_atrac3 if GST1_LIBAV_PATENTED
select GST1_LIBAV_DECODER_jpegls
- select GST1_LIBAV_DECODER_mp3 if GST1_LIBAV_PATENTED
+ select GST1_LIBAV_DECODER_mp3
select GST1_LIBAV_DECODER_mpeg1video
- select GST1_LIBAV_DECODER_mpeg2video if GST1_LIBAV_PATENTED
+ select GST1_LIBAV_DECODER_mpeg2video
select GST1_LIBAV_DECODER_mpeg4 if GST1_LIBAV_PATENTED
select GST1_LIBAV_DECODER_mpeg4aac if GST1_LIBAV_PATENTED
select GST1_LIBAV_DECODER_mpegvideo
select GST1_LIBAV_PARSER_mpeg4video
select GST1_LIBAV_DEMUXER_ac3
select GST1_LIBAV_DEMUXER_h264 if GST1_LIBAV_PATENTED
- select GST1_LIBAV_DEMUXER_mp3 if GST1_LIBAV_PATENTED
- select GST1_LIBAV_DEMUXER_mpegvideo if GST1_LIBAV_PATENTED
+ select GST1_LIBAV_DEMUXER_mp3
+ select GST1_LIBAV_DEMUXER_mpegvideo
select GST1_LIBAV_DEMUXER_ogg
comment "Encoders ---"
config GST1_LIBAV_ENCODER_ac3
bool "AC3"
- depends on GST1_LIBAV_PATENTED
select GST1_LIBAV_PARSER_ac3
config GST1_LIBAV_ENCODER_jpegls
config GST1_LIBAV_ENCODER_mpeg2video
bool "MPEG-2 Video"
- depends on GST1_LIBAV_PATENTED
config GST1_LIBAV_ENCODER_mpeg4
bool "MPEG-4"
config GST1_LIBAV_DECODER_ac3
bool "AC3"
- depends on GST1_LIBAV_PATENTED
select GST1_LIBAV_PARSER_ac3
config GST1_LIBAV_DECODER_atrac3
config GST1_LIBAV_DECODER_mp2
bool "MP2 (MPEG Audio Layer 2)"
- depends on GST1_LIBAV_PATENTED
config GST1_LIBAV_DECODER_mp3
bool "MP3 (MPEG Audio Layer 2)"
- depends on GST1_LIBAV_PATENTED
config GST1_LIBAV_DECODER_mpegvideo
bool "MPEG Video"
config GST1_LIBAV_DECODER_mpeg2video
bool "MPEG-2 Video"
- depends on GST1_LIBAV_PATENTED
config GST1_LIBAV_DECODER_mpeg4
bool "MPEG-4"
config GST1_LIBAV_MUXER_ac3
bool "AC3"
- depends on GST1_LIBAV_PATENTED
config GST1_LIBAV_MUXER_ffm
bool "FFM (ffserver live feed)"
include $(TOPDIR)/rules.mk
PKG_NAME:=gst1-libav
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_SOURCE:=gst-libav-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-libav
-PKG_HASH:=e4d2f315f478d47281fbfdfbd590a63d23704ca37911d7142d5992616f4b28d3
+PKG_HASH:=2a56aa5d2d8cd912f2bce17f174713d2c417ca298f1f9c28ee66d4aa1e1d9e62
PKG_LICENSE:=GPL-2.0 LGPL-2.0
PKG_LICENSE_FILES:=COPYING COPYING.LIB
include $(TOPDIR)/rules.mk
PKG_NAME:=gst1-plugins-bad
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-bad-$(PKG_VERSION)
PKG_SOURCE:=gst-plugins-bad-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-bad/
-PKG_HASH:=c5806040bb83b43be86ce592e6a19c5d83d7776f7d9f434eb4b911c4efff3573
+PKG_HASH:=0c7857be16686d5c1ba6e34bd338664d3d4599d32714a8eca5c8a41a101e2d08
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
$(eval $(call GstBuildPlugin,asfmux,asf muxing support,rtp,,))
$(eval $(call GstBuildPlugin,autoconvert,autoconvert support,,,))
$(eval $(call GstBuildPlugin,bayer,bayer support,video,,))
-$(eval $(call GstBuildPlugin,camerabin2,camerabin support,basecamerabinsrc photography pbutils app,,))
-$(eval $(call GstBuildPlugin,dataurisrc,dataurisrc support,,,))
+$(eval $(call GstBuildPlugin,camerabin,camerabin support,basecamerabinsrc photography pbutils app,,))
+#$(eval $(call GstBuildPlugin,dataurisrc,dataurisrc support,,,))
$(eval $(call GstBuildPlugin,debugutilsbad,debugutils support,video,,))
$(eval $(call GstBuildPlugin,dvdspu,dvdspu support,video,,))
$(eval $(call GstBuildPlugin,fbdevsink,fbdev support,video,,))
$(eval $(call GstBuildPlugin,opusparse,OPUS streams library,pbutils,,+libopus))
$(eval $(call GstBuildPlugin,pcapparse,pcapparse support,,,))
$(eval $(call GstBuildPlugin,pnm,pnm support,video,,))
-$(eval $(call GstBuildPlugin,rawparse,rawparse support,audio video,,))
+#$(eval $(call GstBuildPlugin,rawparse,rawparse support,audio video,,))
$(eval $(call GstBuildPlugin,rfbsrc,librfb support,video,,))
$(eval $(call GstBuildPlugin,sdpelem,sdp support,rtp sdp,,))
$(eval $(call GstBuildPlugin,segmentclip,segmentclip support,audio,,))
---- a/configure.ac
-+++ b/configure.ac
-@@ -3841,7 +3841,6 @@ ext/xvid/Makefile
- ext/zbar/Makefile
+diff -u --recursive gst-plugins-bad-1.12.4-vanilla/configure.ac gst-plugins-bad-1.12.4/configure.ac
+--- gst-plugins-bad-1.12.4-vanilla/configure.ac 2018-02-11 19:43:06.962320214 -0500
++++ gst-plugins-bad-1.12.4/configure.ac 2018-02-11 19:43:48.643416395 -0500
+@@ -3717,7 +3717,6 @@
ext/dtls/Makefile
ext/webrtcdsp/Makefile
+ ext/ttml/Makefile
-po/Makefile.in
docs/Makefile
docs/plugins/Makefile
docs/libs/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -2,11 +2,11 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-d
+diff -u --recursive gst-plugins-bad-1.12.4-vanilla/Makefile.am gst-plugins-bad-1.12.4/Makefile.am
+--- gst-plugins-bad-1.12.4-vanilla/Makefile.am 2018-02-11 19:43:06.987320271 -0500
++++ gst-plugins-bad-1.12.4/Makefile.am 2018-02-11 19:43:55.023431118 -0500
+@@ -2,11 +2,11 @@
SUBDIRS = \
gst-libs gst sys ext pkgconfig \
---- a/configure.ac
-+++ b/configure.ac
-@@ -3739,37 +3739,6 @@ sys/wasapi/Makefile
- sys/wininet/Makefile
+diff -u --recursive gst-plugins-bad-1.12.4-vanilla/configure.ac gst-plugins-bad-1.12.4/configure.ac
+--- gst-plugins-bad-1.12.4-vanilla/configure.ac 2018-02-11 19:46:16.942758605 -0500
++++ gst-plugins-bad-1.12.4/configure.ac 2018-02-11 19:46:38.356808019 -0500
+@@ -3619,38 +3619,6 @@
+ sys/wasapi/Makefile
sys/winks/Makefile
sys/winscreencap/Makefile
-tests/Makefile
-tests/examples/camerabin2/Makefile
-tests/examples/codecparsers/Makefile
-tests/examples/directfb/Makefile
+-tests/examples/audiomixmatrix/Makefile
-tests/examples/gl/Makefile
-tests/examples/gl/cocoa/Makefile
-tests/examples/gl/clutter/Makefile
ext/voamrwbenc/Makefile
ext/voaacenc/Makefile
ext/assrender/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -2,11 +2,11 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-d
+diff -u --recursive gst-plugins-bad-1.12.4-vanilla/Makefile.am gst-plugins-bad-1.12.4/Makefile.am
+--- gst-plugins-bad-1.12.4-vanilla/Makefile.am 2018-02-11 19:46:16.980758692 -0500
++++ gst-plugins-bad-1.12.4/Makefile.am 2018-02-11 19:46:49.443833603 -0500
+@@ -2,11 +2,11 @@
SUBDIRS = \
gst-libs gst sys ext pkgconfig \
include $(TOPDIR)/rules.mk
PKG_NAME:=gst1-plugins-base
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-base-$(PKG_VERSION)
PKG_SOURCE:=gst-plugins-base-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-base/
-PKG_HASH:=1c401a79bd1e4521c6ef1b66579bddedd9136e164e54792aab4bfcf3485bf9a7
+PKG_HASH:=4c306b03df0212f1b8903784e29bb3493319ba19ebebf13b0c56a17870292282
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_gst1-mod-alsa \
---- a/configure.ac
-+++ b/configure.ac
-@@ -963,7 +963,6 @@ docs/design/Makefile
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/configure.ac gst-plugins-base-1.12.4/configure.ac
+--- gst-plugins-base-1.12.4-vanilla/configure.ac 2018-02-11 09:52:04.704954684 -0500
++++ gst-plugins-base-1.12.4/configure.ac 2018-02-11 09:53:01.444071594 -0500
+@@ -964,7 +964,6 @@
docs/libs/Makefile
docs/plugins/Makefile
docs/version.entities
common/Makefile
common/m4/Makefile
m4/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -13,7 +13,6 @@ SUBDIRS = \
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/Makefile.am gst-plugins-base-1.12.4/Makefile.am
+--- gst-plugins-base-1.12.4-vanilla/Makefile.am 2018-02-11 09:52:04.704954684 -0500
++++ gst-plugins-base-1.12.4/Makefile.am 2018-02-11 09:53:08.156085423 -0500
+@@ -13,7 +13,6 @@
tools \
tests \
docs \
common \
m4
-@@ -24,7 +23,6 @@ DIST_SUBDIRS = \
+@@ -24,7 +23,6 @@
gst sys ext \
tools \
tests \
---- a/configure.ac
-+++ b/configure.ac
-@@ -940,24 +940,6 @@ pkgconfig/gstreamer-video.pc
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/configure.ac gst-plugins-base-1.12.4/configure.ac
+--- gst-plugins-base-1.12.4-vanilla/configure.ac 2018-02-11 09:54:25.065243893 -0500
++++ gst-plugins-base-1.12.4/configure.ac 2018-02-11 09:55:12.112340832 -0500
+@@ -942,24 +942,6 @@
pkgconfig/gstreamer-video-uninstalled.pc
pkgconfig/gstreamer-plugins-base.pc
pkgconfig/gstreamer-plugins-base-uninstalled.pc
-tests/icles/Makefile
-tests/icles/playback/Makefile
docs/Makefile
- docs/design/Makefile
docs/libs/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -11,7 +11,6 @@ SUBDIRS = \
+ docs/plugins/Makefile
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/Makefile.am gst-plugins-base-1.12.4/Makefile.am
+--- gst-plugins-base-1.12.4-vanilla/Makefile.am 2018-02-11 09:54:25.091243946 -0500
++++ gst-plugins-base-1.12.4/Makefile.am 2018-02-11 09:55:19.994357073 -0500
+@@ -11,7 +11,6 @@
gst-libs \
gst sys $(SUBDIRS_EXT) \
tools \
docs \
common \
m4
-@@ -22,7 +21,6 @@ DIST_SUBDIRS = \
+@@ -22,7 +21,6 @@
gst-libs \
gst sys ext \
tools \
---- a/configure.ac
-+++ b/configure.ac
-@@ -940,11 +940,6 @@ pkgconfig/gstreamer-video.pc
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/configure.ac gst-plugins-base-1.12.4/configure.ac
+--- gst-plugins-base-1.12.4-vanilla/configure.ac 2018-02-11 09:55:52.832424735 -0500
++++ gst-plugins-base-1.12.4/configure.ac 2018-02-11 09:56:25.417491876 -0500
+@@ -942,10 +942,6 @@
pkgconfig/gstreamer-video-uninstalled.pc
pkgconfig/gstreamer-plugins-base.pc
pkgconfig/gstreamer-plugins-base-uninstalled.pc
-docs/Makefile
--docs/design/Makefile
-docs/libs/Makefile
-docs/plugins/Makefile
-docs/version.entities
common/Makefile
common/m4/Makefile
m4/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -11,13 +11,11 @@ SUBDIRS = \
+diff -u --recursive gst-plugins-base-1.12.4-vanilla/Makefile.am gst-plugins-base-1.12.4/Makefile.am
+--- gst-plugins-base-1.12.4-vanilla/Makefile.am 2018-02-11 09:55:52.832424735 -0500
++++ gst-plugins-base-1.12.4/Makefile.am 2018-02-11 09:56:32.742506969 -0500
+@@ -11,13 +11,11 @@
gst-libs \
gst sys $(SUBDIRS_EXT) \
tools \
include $(TOPDIR)/rules.mk
PKG_NAME:=gst1-plugins-good
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-good-$(PKG_VERSION)
PKG_SOURCE:=gst-plugins-good-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-good/
-PKG_HASH:=be053f6ed716eeb517cec148cec637cdce571c6e04d5c21409e2876fb76c7639
+PKG_HASH:=649f49bec60892d47ee6731b92266974c723554da1c6649f21296097715eb957
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
$(eval $(call GstBuildPlugin,multifile,multiple files access,video,,))
$(eval $(call GstBuildPlugin,multipart,multipart stream handling,,,))
$(eval $(call GstBuildPlugin,navigationtest,navigationtest support,video,,))
-$(eval $(call GstBuildPlugin,oss4audio,OSS 4 audio support,audio tag,,))
+$(eval $(call GstBuildPlugin,oss4,OSS 4 audio support,audio tag,,))
$(eval $(call GstBuildPlugin,ossaudio,OSS audio support,audio,,))
$(eval $(call GstBuildPlugin,png,png support,video,,+libpng))
#$(eval $(call GstBuildPlugin,pulse,pulse support,audio pbutils tag video,,))
$(eval $(call GstBuildPlugin,shapewipe,shapewipe support,video,,))
#$(eval $(call GstBuildPlugin,shout2,shout2 support,,,))
$(eval $(call GstBuildPlugin,smpte,smpte support,video,,))
-$(eval $(call GstBuildPlugin,souphttpsrc,soup input,audio tag,,+libsoup))
+$(eval $(call GstBuildPlugin,soup,soup input,audio tag,,+libsoup))
$(eval $(call GstBuildPlugin,spectrum,spectrum data output,audio fft,,))
#$(eval $(call GstBuildPlugin,speex,speex support,audio tag,,))
#$(eval $(call GstBuildPlugin,sty4menc,sty4menc support,video,,))
---- a/configure.ac
-+++ b/configure.ac
-@@ -1061,7 +1061,6 @@ sys/sunaudio/Makefile
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/configure.ac gst-plugins-good-1.12.4/configure.ac
+--- gst-plugins-good-1.12.4-vanilla/configure.ac 2018-02-11 10:34:37.773144289 -0500
++++ gst-plugins-good-1.12.4/configure.ac 2018-02-11 10:35:17.103223474 -0500
+@@ -1061,7 +1061,6 @@
sys/v4l2/Makefile
sys/waveform/Makefile
sys/ximage/Makefile
tests/Makefile
tests/check/Makefile
tests/examples/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -4,7 +4,6 @@ ALWAYS_SUBDIRS = \
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/Makefile.am gst-plugins-good-1.12.4/Makefile.am
+--- gst-plugins-good-1.12.4-vanilla/Makefile.am 2018-02-11 10:34:37.786144315 -0500
++++ gst-plugins-good-1.12.4/Makefile.am 2018-02-11 10:35:23.529236411 -0500
+@@ -4,7 +4,6 @@
gst sys ext \
tests \
docs \
---- a/configure.ac
-+++ b/configure.ac
-@@ -1061,21 +1061,6 @@ sys/sunaudio/Makefile
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/configure.ac gst-plugins-good-1.12.4/configure.ac
+--- gst-plugins-good-1.12.4-vanilla/configure.ac 2018-02-11 10:36:40.335391048 -0500
++++ gst-plugins-good-1.12.4/configure.ac 2018-02-11 10:37:22.304475546 -0500
+@@ -1061,20 +1061,6 @@
sys/v4l2/Makefile
sys/waveform/Makefile
sys/ximage/Makefile
-tests/examples/equalizer/Makefile
-tests/examples/jack/Makefile
-tests/examples/level/Makefile
--tests/examples/pulse/Makefile
-tests/examples/rtp/Makefile
-tests/examples/shapewipe/Makefile
-tests/examples/spectrum/Makefile
common/Makefile
common/m4/Makefile
m4/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -2,7 +2,6 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-d
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/Makefile.am gst-plugins-good-1.12.4/Makefile.am
+--- gst-plugins-good-1.12.4-vanilla/Makefile.am 2018-02-11 10:36:40.335391048 -0500
++++ gst-plugins-good-1.12.4/Makefile.am 2018-02-11 10:37:37.242505621 -0500
+@@ -2,7 +2,6 @@
ALWAYS_SUBDIRS = \
gst sys ext \
---- a/configure.ac
-+++ b/configure.ac
-@@ -1064,9 +1064,6 @@ sys/ximage/Makefile
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/configure.ac gst-plugins-good-1.12.4/configure.ac
+--- gst-plugins-good-1.12.4-vanilla/configure.ac 2018-02-11 10:37:22.304475546 -0500
++++ gst-plugins-good-1.12.4/configure.ac 2018-02-11 10:38:15.248581736 -0500
+@@ -1064,9 +1064,6 @@
common/Makefile
common/m4/Makefile
m4/Makefile
-docs/version.entities
pkgconfig/Makefile
pkgconfig/gstreamer-plugins-good-uninstalled.pc
- gst-plugins-good.spec
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -2,7 +2,6 @@ DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-d
+ )
+diff -u --recursive gst-plugins-good-1.12.4-vanilla/Makefile.am gst-plugins-good-1.12.4/Makefile.am
+--- gst-plugins-good-1.12.4-vanilla/Makefile.am 2018-02-11 10:37:37.242505621 -0500
++++ gst-plugins-good-1.12.4/Makefile.am 2018-02-11 10:38:28.838608856 -0500
+@@ -2,7 +2,6 @@
ALWAYS_SUBDIRS = \
gst sys ext \
include $(TOPDIR)/rules.mk
PKG_NAME:=gst1-plugins-ugly
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_BUILD_DIR:=$(BUILD_DIR)/gst-plugins-ugly-$(PKG_VERSION)
PKG_SOURCE:=gst-plugins-ugly-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gst-plugins-ugly/
-PKG_HASH:=d6edc046350809c967f5b058c5c2e534d99d1d69fe1b26acd849e87781a7d7fc
+PKG_HASH:=1c165b8d888ed350acd8e6ac9f6fe06508e6fcc0a3afc6ccc9fbeb30df9be522
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_gst1-mod-asf \
CONFIG_PACKAGE_gst1-mod-lame \
- CONFIG_PACKAGE_gst1-mod-mad \
+ CONFIG_PACKAGE_gst1-mod-mpg123 \
CONFIG_PACKAGE_gst1-mod-mpeg2dec \
PKG_FIXUP:=autoreconf
--disable-dvdsub \
--disable-iec958 \
$(call GST_COND_SELECT,lame) \
- $(call GST_COND_SELECT,mad) \
+ $(call GST_COND_SELECT,mpg123) \
$(call GST_COND_SELECT,mpeg2dec) \
--disable-mpegaudioparse \
--disable-mpegstream \
$(eval $(call GstBuildPlugin,asf,ASF demuxer,audio video riff rtp rtsp sdp tag,,))
$(eval $(call GstBuildPlugin,lame,MP3 encoder (using LAME),audio,,+lame-lib))
-$(eval $(call GstBuildPlugin,mad,MP3 decoder (using MAD),audio tag,,+libid3tag +libmad))
+$(eval $(call GstBuildPlugin,mpg123,MP3 decoder (using mpg123),audio tag,,+libid3tag +mpg123))
$(eval $(call GstBuildPlugin,mpeg2dec,MPEG decoder,video,,+libmpeg2))
$(eval $(call BuildPackage,gstreamer1-plugins-ugly))
---- a/configure.ac
-+++ b/configure.ac
-@@ -482,7 +482,6 @@ tests/Makefile
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/configure.ac gst-plugins-ugly-1.12.4/configure.ac
+--- gst-plugins-ugly-1.12.4-vanilla/configure.ac 2018-02-11 20:18:05.152825587 -0500
++++ gst-plugins-ugly-1.12.4/configure.ac 2018-02-11 20:18:33.859767165 -0500
+@@ -474,7 +474,6 @@
tests/check/Makefile
tests/files/Makefile
m4/Makefile
-po/Makefile.in
pkgconfig/Makefile
pkgconfig/gstreamer-plugins-ugly-uninstalled.pc
- gst-plugins-ugly.spec
---- a/Makefile.am
-+++ b/Makefile.am
+ )
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/Makefile.am gst-plugins-ugly-1.12.4/Makefile.am
+--- gst-plugins-ugly-1.12.4-vanilla/Makefile.am 2018-02-11 20:18:05.157825577 -0500
++++ gst-plugins-ugly-1.12.4/Makefile.am 2018-02-11 20:18:23.491788265 -0500
@@ -1,7 +1,7 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
SUBDIRS = \
- gst-libs gst ext docs m4 tests common pkgconfig po
+ gst-libs gst ext docs m4 tests common pkgconfig
-
- # include before EXTRA_DIST for win32 assignment
- include $(top_srcdir)/common/win32.mak
+
+ EXTRA_DIST = \
+ depcomp \
---- a/configure.ac
-+++ b/configure.ac
-@@ -478,9 +478,6 @@ ext/x264/Makefile
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/configure.ac gst-plugins-ugly-1.12.4/configure.ac
+--- gst-plugins-ugly-1.12.4-vanilla/configure.ac 2018-02-11 20:19:01.875710150 -0500
++++ gst-plugins-ugly-1.12.4/configure.ac 2018-02-11 20:19:27.117658780 -0500
+@@ -470,9 +470,6 @@
docs/Makefile
docs/plugins/Makefile
docs/version.entities
m4/Makefile
pkgconfig/Makefile
pkgconfig/gstreamer-plugins-ugly-uninstalled.pc
---- a/Makefile.am
-+++ b/Makefile.am
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/Makefile.am gst-plugins-ugly-1.12.4/Makefile.am
+--- gst-plugins-ugly-1.12.4-vanilla/Makefile.am 2018-02-11 20:19:01.875710150 -0500
++++ gst-plugins-ugly-1.12.4/Makefile.am 2018-02-11 20:19:34.402643954 -0500
@@ -1,7 +1,7 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
SUBDIRS = \
- gst-libs gst ext docs m4 tests common pkgconfig
+ gst-libs gst ext docs m4 common pkgconfig
-
- # include before EXTRA_DIST for win32 assignment
- include $(top_srcdir)/common/win32.mak
+
+ EXTRA_DIST = \
+ depcomp \
---- a/configure.ac
-+++ b/configure.ac
-@@ -475,9 +475,6 @@ ext/mpg123/Makefile
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/configure.ac gst-plugins-ugly-1.12.4/configure.ac
+--- gst-plugins-ugly-1.12.4-vanilla/configure.ac 2018-02-11 20:19:47.318617668 -0500
++++ gst-plugins-ugly-1.12.4/configure.ac 2018-02-11 20:19:56.171599652 -0500
+@@ -467,9 +467,6 @@
ext/sidplay/Makefile
ext/twolame/Makefile
ext/x264/Makefile
m4/Makefile
pkgconfig/Makefile
pkgconfig/gstreamer-plugins-ugly-uninstalled.pc
---- a/Makefile.am
-+++ b/Makefile.am
+diff -u --recursive gst-plugins-ugly-1.12.4-vanilla/Makefile.am gst-plugins-ugly-1.12.4/Makefile.am
+--- gst-plugins-ugly-1.12.4-vanilla/Makefile.am 2018-02-11 20:19:47.318617668 -0500
++++ gst-plugins-ugly-1.12.4/Makefile.am 2018-02-11 20:20:03.662584407 -0500
@@ -1,7 +1,7 @@
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
SUBDIRS = \
- gst-libs gst ext docs m4 common pkgconfig
+ gst-libs gst ext m4 common pkgconfig
-
- # include before EXTRA_DIST for win32 assignment
- include $(top_srcdir)/common/win32.mak
+
+ EXTRA_DIST = \
+ depcomp \
include $(TOPDIR)/rules.mk
PKG_NAME:=gstreamer1
-PKG_VERSION:=1.10.5
+PKG_VERSION:=1.12.4
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org> \
PKG_BUILD_DIR:=$(BUILD_DIR)/gstreamer-$(PKG_VERSION)
PKG_SOURCE:=gstreamer-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://gstreamer.freedesktop.org/src/gstreamer/
-PKG_HASH:=bc06243600817f637029da29d089d5908d1d266542f68bf6626a10c5f05f1f1d
+PKG_HASH:=5a8704aa4c2eeb04da192c4a9942f94f860ac1a585de90d9f914bac26a970674
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=autogen.sh aclocal.m4
--disable-tests \
--disable-valgrind \
--disable-gst-tracer-hooks \
+ --with-unwind=no \
--without-libiconv-prefix \
--without-libintl-prefix \
--without-x \
---- a/configure.ac
-+++ b/configure.ac
-@@ -1047,7 +1047,6 @@ libs/gst/net/Makefile
+diff -u --recursive gstreamer-1.12.4-vanilla/configure.ac gstreamer-1.12.4/configure.ac
+--- gstreamer-1.12.4-vanilla/configure.ac 2018-02-10 17:37:16.379378242 -0500
++++ gstreamer-1.12.4/configure.ac 2018-02-10 17:40:18.742109326 -0500
+@@ -1083,7 +1083,6 @@
plugins/Makefile
plugins/elements/Makefile
plugins/tracers/Makefile
tests/Makefile
tests/benchmarks/Makefile
tests/check/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -9,7 +9,6 @@ aclocal_DATA = gst-element-check-@GST_AP
+diff -u --recursive gstreamer-1.12.4-vanilla/Makefile.am gstreamer-1.12.4/Makefile.am
+--- gstreamer-1.12.4-vanilla/Makefile.am 2018-02-10 17:37:16.390378286 -0500
++++ gstreamer-1.12.4/Makefile.am 2018-02-10 17:40:29.112150898 -0500
+@@ -9,7 +9,6 @@
SUBDIRS = pkgconfig \
gst libs plugins tests \
docs \
m4 \
common \
data
-@@ -22,7 +21,6 @@ endif
+@@ -22,7 +21,6 @@
DIST_SUBDIRS = pkgconfig \
gst libs plugins tools tests \
docs \
---- a/configure.ac
-+++ b/configure.ac
-@@ -1047,21 +1047,6 @@ libs/gst/net/Makefile
+diff -u --recursive gstreamer-1.12.4-vanilla/configure.ac gstreamer-1.12.4/configure.ac
+--- gstreamer-1.12.4-vanilla/configure.ac 2018-02-10 17:43:59.957864211 -0500
++++ gstreamer-1.12.4/configure.ac 2018-02-10 17:44:19.772930084 -0500
+@@ -1083,20 +1083,6 @@
plugins/Makefile
plugins/elements/Makefile
plugins/tracers/Makefile
-tests/examples/controller/Makefile
-tests/examples/stepping/Makefile
-tests/examples/helloworld/Makefile
--tests/examples/manual/Makefile
-tests/examples/memory/Makefile
-tests/examples/netclock/Makefile
-tests/examples/ptp/Makefile
tools/Makefile
common/Makefile
common/m4/Makefile
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -7,7 +7,7 @@ aclocaldir = $(datadir)/aclocal
+diff -u --recursive gstreamer-1.12.4-vanilla/Makefile.am gstreamer-1.12.4/Makefile.am
+--- gstreamer-1.12.4-vanilla/Makefile.am 2018-02-10 17:43:59.959864217 -0500
++++ gstreamer-1.12.4/Makefile.am 2018-02-10 17:44:30.298965075 -0500
+@@ -7,7 +7,7 @@
aclocal_DATA = gst-element-check-@GST_API_VERSION@.m4
SUBDIRS = pkgconfig \
docs \
m4 \
common \
-@@ -19,7 +19,7 @@ endif
+@@ -19,7 +19,7 @@
# These are all the possible subdirs
DIST_SUBDIRS = pkgconfig \
---- a/configure.ac
-+++ b/configure.ac
-@@ -1050,18 +1050,6 @@ plugins/tracers/Makefile
+diff -u --recursive gstreamer-1.12.4-vanilla/configure.ac gstreamer-1.12.4/configure.ac
+--- gstreamer-1.12.4-vanilla/configure.ac 2018-02-10 17:45:28.053157030 -0500
++++ gstreamer-1.12.4/configure.ac 2018-02-10 17:45:47.703222322 -0500
+@@ -1086,12 +1086,6 @@
tools/Makefile
common/Makefile
common/m4/Makefile
-docs/Makefile
--docs/design/Makefile
--docs/faq/Makefile
-docs/gst/Makefile
-docs/gst/gstreamer.types
-docs/libs/Makefile
-docs/plugins/Makefile
--docs/manual/Makefile
--docs/pwg/Makefile
--docs/slides/Makefile
--docs/xsl/Makefile
-docs/version.entities
m4/Makefile
pkgconfig/Makefile
stamp.h
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -8,7 +8,6 @@ aclocal_DATA = gst-element-check-@GST_AP
+diff -u --recursive gstreamer-1.12.4-vanilla/Makefile.am gstreamer-1.12.4/Makefile.am
+--- gstreamer-1.12.4-vanilla/Makefile.am 2018-02-10 17:45:28.053157030 -0500
++++ gstreamer-1.12.4/Makefile.am 2018-02-10 17:45:58.940259656 -0500
+@@ -8,7 +8,6 @@
SUBDIRS = pkgconfig \
gst libs plugins \
m4 \
common \
data
-@@ -20,7 +19,6 @@ endif
+@@ -20,7 +19,6 @@
# These are all the possible subdirs
DIST_SUBDIRS = pkgconfig \
gst libs plugins tools \
+++ /dev/null
---- a/configure.ac
-+++ b/configure.ac
-@@ -826,20 +826,6 @@ if test "x$BUILD_EXAMPLES" = "xyes"; the
- fi
- AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
-
--dnl libunwind is optionally used by the leaks tracer
--PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no)
--
--dnl Check for backtrace() from libc
--AC_CHECK_FUNC(backtrace, [
-- AC_CHECK_HEADERS([execinfo.h], [
-- AC_DEFINE(HAVE_BACKTRACE,1,[Have backtrace])
-- ], [], [])
--])
--
--if test "x$HAVE_UNWIND" = "xyes"; then
-- AC_DEFINE(HAVE_UNWIND, 1, [libunwind available])
--fi
--
- dnl building of unit test libraries
- AC_ARG_ENABLE(check,
- AS_HELP_STRING([--disable-check],[disable building unit test libraries]),
include $(TOPDIR)/rules.mk
PKG_NAME:=lcdgrilo
-PKG_VERSION:=0.0.10
+PKG_VERSION:=0.0.12
PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.flyn.org/projects/lcdgrilo
-PKG_HASH:=f5e6635864bd2156557e894ab0f95ea50c01fefebb6225d9b39c95622efd67a2
+PKG_SOURCE_URL:=https://www.flyn.org/projects/lcdgrilo
+PKG_HASH:=2e5028fff7a90b1a3688c466f048e978a52d9a4da20a382546d5e5bd42e2fc6a
PKG_BUILD_DEPENDS:=vala
PKG_INSTALL:=1
PKG_NAME:=minidlna
PKG_VERSION:=1.2.1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE_URL:=@SF/minidlna
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
minidlna_cfg_addstr $cfg friendly_name
minidlna_cfg_addstr $cfg db_dir
minidlna_cfg_addstr $cfg log_dir
+ minidlna_cfg_addstr $cfg log_level 'error'
minidlna_cfg_addbool $cfg inotify '1'
minidlna_cfg_addbool $cfg enable_tivo '0'
minidlna_cfg_addbool $cfg wide_links '0'
include $(TOPDIR)/rules.mk
PKG_NAME:=tvheadend
-PKG_VERSION:=4.0.9
+PKG_VERSION:=4.0.10
PKG_RELEASE:=1
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=c18e3803d6e36348442ccf3b0ac4868948692491c7dd646d48576f5aec09cdd8
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.xz
+PKG_MIRROR_HASH:=afe42bcf683e8576ca8ccd4755ea308f79195e92f7c30fc5961973e238f49105
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/tvheadend/tvheadend.git
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
--disable-libav \
--enable-bundle
+TARGET_CFLAGS += -Wno-error=pointer-compare
+
define Build/Prepare
$(call Build/Prepare/Default)
echo 'Tvheadend $(shell echo $(PKG_SOURCE_VERSION) | sed "s/^v//")~openwrt$(PKG_RELEASE)' \
include $(TOPDIR)/rules.mk
PKG_NAME:=youtube-dl
-PKG_VERSION:=2017.09.11
+PKG_VERSION:=2018.03.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://yt-dl.org/downloads/$(PKG_VERSION)/
-PKG_HASH:=8b6defdd7cb9a8228eca2ef03a8c203a3ccba1ed97cb700f11b40a3af548212a
+PKG_HASH:=4bfadccb19e379ce38f5601c72dacf0ac5e03881230afee6df2152ab42fa75c5
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=Unlicense
include $(TOPDIR)/rules.mk
PKG_NAME:=acme
-PKG_SOURCE_VERSION:=7b40cbe8c1a52041351524bcde4b37665a7cdf79
-PKG_VERSION:=1.6
-PKG_RELEASE:=3
+PKG_VERSION:=2.7.8
+PKG_RELEASE:=2
PKG_LICENSE:=GPLv3
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz
-PKG_MIRROR_HASH:=008c6f779bcbbccbde9cdd2b37b07f7a1f5a0678ee9533ce3060690b63edf2c0
-PKG_SOURCE_URL:=git://github.com/Neilpang/acme.sh.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
+PKG_SOURCE_URL:=https://github.com/Neilpang/acme.sh
+PKG_SOURCE_VERSION:=521d8c4b1f374c52ab1452d399a4d4910465e9fe
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz
+PKG_MIRROR_HASH:=03e24eb41513b4d28dc42f5ae5c91be0030094149cbdbf9cdf9b6f87db9e36c0
+PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
+
LUCI_DIR:=/usr/lib/lua/luci
include $(INCLUDE_DIR)/package.mk
CATEGORY:=Network
DEPENDS:=+curl +ca-bundle +openssl-util +netcat
TITLE:=ACME (Letsencrypt) client
- PKGARCH:=all
- MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
endef
define Package/acme/description
$(INSTALL_BIN) $(PKG_BUILD_DIR)/acme.sh $(1)/usr/lib/acme/acme.sh
endef
+define Package/acme-dnsapi
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+acme
+ TITLE:=DNS API integration for ACME (Letsencrypt) client
+endef
+
+define Package/acme-dnsapi/description
+ This package provides DNS API integration for ACME (Letsencrypt) client.
+endef
+
+define Package/acme-dnsapi/install
+ $(INSTALL_DIR) $(1)/usr/lib/acme/dnsapi
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/dnsapi/*.sh $(1)/usr/lib/acme/dnsapi
+endef
+
define Package/luci-app-acme
SECTION:=luci
CATEGORY:=LuCI
TITLE:=ACME package - LuCI interface
- MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
- PKGARCH:=all
DEPENDS:= lua luci-base +acme luci-app-uhttpd
SUBMENU:=3. Applications
endef
$(eval $(call BuildPackage,acme))
+$(eval $(call BuildPackage,acme-dnsapi))
$(eval $(call BuildPackage,luci-app-acme))
"Note that all domain names must point at the router in the global DNS."))
dom.datatype = "list(string)"
+dns = cs:option(Value, "dns", translate("DNS API"),
+ translate("To use DNS mode to issue certificates, set this to the name of a DNS API supported by acme.sh. " ..
+ "See https://github.com/Neilpang/acme.sh/tree/master/dnsapi for the list of available APIs. " ..
+ "In DNS mode, the domain name does not have to resolve to the router IP. " ..
+ "DNS mode is also the only mode that supports wildcard certificates. " ..
+ "Using this mode requires the acme-dnsapi package to be installed."))
+dns.rmempty = false
+
+cred = cs:option(DynamicList, "credentials", translate("DNS API credentials"),
+ translate("The credentials for the DNS API mode selected above. " ..
+ "See https://github.com/Neilpang/acme.sh/tree/master/dnsapi#how-to-use-dns-api for the format of credentials required by each API. " ..
+ "Add multiple entries here in KEY=VAL shell variable format to supply multiple credential variables."))
+cred.datatype = "list(string)"
+
return m
local moved_staging=0
local failed_dir
local webroot
+ local dns
config_get_bool enabled "$section" enabled 0
config_get_bool use_staging "$section" use_staging
config_get domains "$section" domains
config_get keylength "$section" keylength
config_get webroot "$section" webroot
+ config_get dns "$section" dns
[ "$enabled" -eq "1" ] || return
set -- $domains
main_domain=$1
- [ -n "$webroot" ] || pre_checks "$main_domain" || return 1
+ [ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
log "Running ACME for $main_domain"
[ -n "$ACCOUNT_EMAIL" ] && acme_args="$acme_args --accountemail $ACCOUNT_EMAIL"
[ "$use_staging" -eq "1" ] && acme_args="$acme_args --staging"
- if [ -z "$webroot" ]; then
+ if [ -n "$dns" ]; then
+ log "Using dns mode"
+ acme_args="$acme_args --dns $dns"
+ elif [ -z "$webroot" ]; then
log "Using standalone mode"
acme_args="$acme_args --standalone"
else
acme_args="$acme_args --webroot $webroot"
fi
+ handle_credentials() {
+ local credential="$1"
+ eval export $credential
+ }
+ config_list_foreach "$section" credentials handle_credentials
+
if ! $ACME --home "$STATE_DIR" --issue $acme_args; then
failed_dir="$STATE_DIR/${main_domain}.failed-$(date +%s)"
err "Issuing cert for $main_domain failed. Moving state to $failed_dir"
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
-PKG_VERSION:=3.4.3
+PKG_VERSION:=3.5.1
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
* => daily updates, approx. 150 entries
* [reg_cn](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt)
* => regional blocklist for China, daily updates, approx. 1.600 entries
+ * [reg_cz](https://raw.githubusercontent.com/qxstyles/turris-hole-czech-block-list/master/turris-hole-czech-block-list)
+ * => regional blocklist for Czechia, maintained by Turris Omnia Users, infrequent updates, approx. 100 entries
* [reg_de](https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt)
* => regional blocklist for Germany, daily updates, approx. 9.200 entries
* [reg_id](https://easylist-downloads.adblockplus.org/abpindo+easylist.txt)
* simple but yet powerful adblock engine: adblock does not use error prone external iptables rulesets, http pixel server instances and things like that
* supports five different dns backends / blocklist formats: dnsmasq, unbound, named (bind), kresd and dnscrypt-proxy
* supports six different download utilities: uclient-fetch, wget, curl, aria2c, wget-nossl, busybox-wget
+* Really fast downloads & list processing as they are handled in parallel as background jobs in a configurable 'Download Queue'
* provides 'http only' mode without installed ssl library for all non-SSL blocklist sources
* supports a wide range of router modes, even AP modes are supported
* full IPv4 and IPv6 support
-* provides top level domain compression ('tld compression'), this feature removes thousands of needless host entries from the blocklist and lowers the memory footprint for the dns backends
+* provides top level domain compression ('tld compression'), this feature removes thousands of needless host entries from the blocklist and lowers the memory footprint for the dns backend
* blocklist source parsing by fast & flexible regex rulesets
* overall duplicate removal in central blocklist 'adb_list.overall'
* additional whitelist for manual overrides, located by default in /etc/adblock/adblock.whitelist
* minimal status & error logging to syslog, enable debug logging to receive more output
* procd based init system support (start/stop/restart/reload/suspend/resume/query/status)
* procd network interface trigger support or classic time based startup
-* keep the dns cache intact after adblock processing (currently supported by unbound and named)
+* keep the dns cache intact after adblock processing (currently supported by unbound, named and kresd)
* conditional dns backend restarts by old/new blocklist comparison with sha256sum (default) or md5sum
* suspend & resume adblock actions temporarily without blocklist reloading
* output comprehensive runtime information via LuCI or via 'status' init command
* optional: force overall sort / duplicate removal for low memory devices (handle with care!)
* optional: automatic blocklist backup & restore, they will be used in case of download errors or during startup in backup mode
* optional: 'backup mode' to re-use blocklist backups during startup, get fresh lists only via reload or restart action
-* optional: 'whitelist mode' to block access to all domains except those explicitly listed in the whitelist file
+* optional: 'Jail' blocklist generation which builds an additional list (/tmp/adb_list.jail) to block access to all domains except those listed in the whitelist file. You can use this restrictive blocklist manually e.g. for guest wifi or kidsafe configurations
* optional: send notification emails in case of a processing error or if the overall domain count is ≤ 0
-* optional: add new adblock sources on your own via uci config
+* optional: add new adblock sources on your own, see example below
## Prerequisites
-* [LEDE project](https://www.lede-project.org), tested with latest stable release (LEDE 17.01) and with current LEDE snapshot
+* [OpenWrt](https://openwrt.org), tested with the stable release series (17.01.x) and with the latest OpenWrt snapshot
* a usual setup with an enabled dns backend at minimum - dump AP modes without a working dns backend are _not_ supported
* a download utility:
* to support all blocklist sources a full version (with ssl support) of 'wget', 'uclient-fetch' with one of the 'libustream-*' ssl libraries, 'aria2c' or 'curl' is required
## Installation & Usage
* install 'adblock' (_opkg install adblock_)
-* at minimum configure the appropriate dns backend ('dnsmasq' by default) and enable the adblock service in _/etc/config/adblock_
+* at minimum configure the appropriate dns backend ('dnsmasq' by default), the donwload utility and enable the adblock service in _/etc/config/adblock_
* control the adblock service manually with _/etc/init.d/adblock_ start/stop/restart/reload/suspend/resume/status or use the LuCI frontend
## LuCI adblock companion package
## Tweaks
* **runtime information:** the adblock status is available via _/etc/init.d/adblock status_ (see example below)
* **debug logging:** for script debugging please set the config option 'adb\_debug' to '1' and check the runtime output with _logread -e "adblock"_
-* **storage expansion:** to process and store all blocklist sources at once it might helpful to enlarge your temp directory with a swap partition => see [openwrt wiki](https://wiki.openwrt.org/doc/uci/fstab) for further details
+* **storage expansion:** to process and store all blocklist sources at once it might helpful to enlarge your temp directory with a swap partition => see [OpenWrt Wiki](https://wiki.openwrt.org/doc/uci/fstab) for further details
* **add white- / blacklist entries:** add domain white- or blacklist entries to always-allow or -deny certain (sub) domains, by default both lists are empty and located in _/etc/adblock_. Please add one domain per line - ip addresses, wildcards & regex are _not_ allowed (see example below)
* **backup & restore blocklists:** enable this feature, to restore automatically the latest compressed backup of your blocklists in case of any processing error (e.g. a single blocklist source is not available during update). Please use an (external) solid partition and _not_ your volatile router temp directory for this
+* **download queue size:** for further download & list processing performance improvements you can raise the 'adb\_maxqueue' value, e.g. '8' or '16' should be safe
* **scheduled list updates:** for a scheduled call of the adblock service add an appropriate crontab entry (see example below)
-* **change startup behaviour:** by default the startup will be triggered by the 'wan' procd interface trigger. Choose 'none' to disable automatic startups, 'timed' to use a classic timeout (default 30 sec.) or select another trigger interface.
+* **change startup behaviour:** by default the startup will be triggered by the 'wan' procd interface trigger. Choose 'none' to disable automatic startups, 'timed' to use a classic timeout (default 30 sec.) or select another trigger interface
* **suspend & resume adblocking:** to quickly switch the adblock service 'on' or 'off', simply use _/etc/init.d/adblock [suspend|resume]_
-* **domain query:** to query the active blocklist for a specific domain, please run _/etc/init.d/adblock query `<DOMAIN>`_ (see example below)
+* **domain query:** to query the active blocklist for a certain domain, please use the LuCI frontend or run _/etc/init.d/adblock query `<DOMAIN>`_ (see example below)
* **add new list sources:** you could add new blocklist sources on your own via uci config, all you need is a source url and an awk one-liner (see example below)
* **disable active dns probing in windows 10:** to prevent a yellow exclamation mark on your internet connection icon (which wrongly means connected, but no internet), please change the following registry key/value from "1" to "0" _HKLM\SYSTEM\CurrentControlSet\Services\NlaSvc\Parameters\Internet\EnableActiveProbing_
* adb\_trigger => set the startup trigger to a certain interface, to 'timed' or to 'none' (default: 'wan')
* the following options apply to the 'extra' config section:
- * adb\_triggerdelay => additional trigger delay in seconds before adblock processing begins (default: '1')
- * adb\_forcedns => force dns requests to local resolver (default: '0', disabled)
- * adb\_forcesrt => force overall sort on low memory devices with less than 64 MB RAM (default: '0', disabled)
- * adb\_backup_mode => do not automatically update blocklists during startup, use backups instead (default: '0', disabled)
- * adb\_whitelist_mode => block access to all domains except those explicitly listed in the whitelist file (default: '0', disabled)
- * adb\_dnsflush => flush DNS cache after adblock processing, i.e. enable the old restart behavior (default: '0', disabled)
- * adb\_notify => send notification emails in case of a processing error or if the overall domain count is ≤ 0 (default: '0', disabled)
- * adb\_notifycnt => Raise minimum domain count email notification trigger (default: '0')
+ * adb\_triggerdelay => additional trigger delay in seconds before adblock processing begins (int/default: '2')
+ * adb\_forcedns => force dns requests to local resolver (bool/default: '0', disabled)
+ * adb\_forcesrt => force overall sort on low memory devices with less than 64 MB RAM (bool/default: '0', disabled)
+ * adb\_backup_mode => do not automatically update blocklists during startup, use backups instead (bool/default: '0', disabled)
+ * adb\maxqueue => size of the download queue to handle downloads & list processing in parallel (int/default: '4')
+ * adb\_jail => builds an additional 'Jail' list (/tmp/adb_list.jail) to block access to all domains except those listed in the whitelist file (bool/default: '0', disabled)
+ * adb\_dnsflush => flush DNS cache after adblock processing, i.e. enable the old restart behavior (bool/default: '0', disabled)
+ * adb\_notify => send notification emails in case of a processing error or if the overall domain count is ≤ 0 (bool/default: '0', disabled)
+ * adb\_notifycnt => Raise minimum domain count email notification trigger (int/default: '0')
## Examples
**change default dns backend to 'unbound':**
**change default dns backend to 'dnscrypt-proxy':**
The required 'blacklist' option of dnscrypt-proxy is not enabled by default, because the package will be compiled without plugins support.
-Take a custom LEDE build with plugins support to use this feature. Adblock deposits the final blocklist 'adb_list.overall' in '/tmp'.
+Take a custom OpenWrt build with plugins support to use this feature. Adblock deposits the final blocklist 'adb_list.overall' in '/tmp'.
To use the blocklist please modify '/etc/config/dnscrypt-proxy' per instance:
<pre><code>
list blacklist 'domains:/tmp/adb_list.overall'
/etc/init.d/adblock status
::: adblock runtime information
+ adblock_status : enabled
- + adblock_version : 3.4.0
- + overall_domains : 5167 (normal/backup mode)
- + fetch_utility : wget (built-in)
+ + adblock_version : 3.5.0
+ + overall_domains : 102324 (normal mode)
+ + fetch_utility : /usr/bin/wget (built-in)
+ dns_backend : kresd (/etc/kresd)
- + last_rundate : 27.12.2017 20:52:35
- + system_release : Turris Omnia, OpenWrt omnia 15.05/3.9.1
+ + last_rundate : 30.01.2018 21:24:11
+ + system_release : Turris Omnia, OpenWrt omnia 15.05/3.9.4
</code></pre>
**cronjob for a regular block list update (/etc/crontabs/root):**
The query function checks against the submitted (sub-)domain and recurses automatically to the upper top level domain. For every (sub-)domain it returns the first ten relevant results.
<pre><code>
/etc/init.d/adblock query www.example.google.com
-::: max. ten results for domain 'www.example.google.com'
+::: results for domain 'www.example.google.com'
- no match
-::: max. ten results for domain 'example.google.com'
+::: results for domain 'example.google.com'
- no match
-::: max. ten results for domain 'google.com'
+::: results for domain 'google.com'
+ + ads.google.com
+ + adservices.google.com
+ + adwords.google.com
+ + ampcid.google.com
+ analytics.google.com
+ + gg.google.com
+ + google.com.analytics.kdgsrltkcun.com
+ googleadapis.l.google.com
- + pagead.l.google.com
- + partnerad.l.google.com
- + ssl-google-analytics.l.google.com
- + video-stats.video.google.com
- + www-google-analytics.l.google.com
+ + id.google.com
+ + pagead-googlehosted.l.google.com
+ + [...]
</code></pre>
**add a new blocklist source:**
config source 'reg_ro'
option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/rolist+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on romanian ads plus generic easylist additions, weekly updates, approx. 9.400 entries'
</code></pre>
option adb_forcesrt '0'
option adb_forcedns '0'
option adb_backup '0'
+ option adb_maxqueue '4'
config source 'adaway'
- option enabled '1'
option adb_src 'https://adaway.org/hosts.txt'
- option adb_src_rset '\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'focus on mobile ads, infrequent updates, approx. 400 entries'
+ option enabled '1'
config source 'adguard'
- option enabled '0'
option adb_src 'https://filters.adtidy.org/windows/filters/15.txt'
- option adb_src_rset 'BEGIN{FS=\"[/|^|\r]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+([\/\^\r]|$)/{print tolower(\$3)}'
- option adb_src_desc 'combined adguard dns filter list, frequent updates, approx. 15.700 entries'
+ option adb_src_rset 'BEGIN{FS=\"[/|^|\r]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([\/\^\r]|$)/{print tolower(\$3)}'
+ option adb_src_desc 'combined adguard dns filter list, frequent updates, approx. 17.000 entries'
+ option enabled '0'
config source 'bitcoin'
- option enabled '0'
option adb_src 'https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt'
- option adb_src_rset '\$0~/^0\.0\.0\.0[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
- option adb_src_desc 'focus on malicious bitcoin mining sites, infrequent updates, approx. 20 entries'
+ option adb_src_rset '/^0\.0\.0\.0[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_desc 'focus on malicious bitcoin mining sites, infrequent updates, approx. 80 entries'
+ option enabled '0'
config source 'blacklist'
- option enabled '1'
option adb_src '/etc/adblock/adblock.blacklist'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'static local domain blacklist, always deny these domains'
+ option enabled '1'
config source 'disconnect'
- option enabled '1'
option adb_src 'https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
- option adb_src_desc 'mozilla driven blocklist, numerous updates on the same day, approx. 4.600 entries'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_desc 'mozilla driven blocklist, numerous updates on the same day, approx. 4.700 entries'
+ option enabled '1'
config source 'dshield'
- option enabled '0'
option adb_src 'https://www.dshield.org/feeds/suspiciousdomains_Low.txt'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'generic blocklist, daily updates, approx. 3.500 entries'
+ option enabled '0'
config source 'feodo'
- option enabled '0'
option adb_src 'https://feodotracker.abuse.ch/blocklist/?download=domainblocklist'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'focus on feodo botnet, daily updates, approx. 0-10 entries'
+ option enabled '0'
config source 'hphosts'
- option enabled '0'
option adb_src 'https://hosts-file.net/ad_servers.txt'
- option adb_src_rset '\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|\$)+/{print tolower(\$2)}'
option adb_src_desc 'broad blocklist, monthly updates, approx. 19.200 entries'
+ option enabled '0'
config source 'malware'
- option enabled '0'
option adb_src 'https://mirror.espoch.edu.ec/malwaredomains/justdomains'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'broad blocklist, daily updates, approx. 18.300 entries'
+ option enabled '0'
config source 'malwarelist'
- option enabled '0'
option adb_src 'http://www.malwaredomainlist.com/hostslist/hosts.txt'
- option adb_src_rset '\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'focus on malware, daily updates, approx. 1.200 entries'
+ option enabled '0'
config source 'openphish'
- option enabled '0'
option adb_src 'https://openphish.com/feed.txt'
- option adb_src_rset 'BEGIN{FS=\"/\"}\$0~/^http[s]?:\/\/([[:alnum:]_-]+\.){1,}[[:alpha:]]+(\/|$)/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"/\"}/^http[s]?:\/\/([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+(\/|$)/{print tolower(\$3)}'
option adb_src_desc 'focus on phishing, numerous updates on the same day, approx. 2.400 entries'
+ option enabled '0'
config source 'ransomware'
- option enabled '0'
option adb_src 'https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|\r|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'focus on ransomware, numerous updates on the same day, approx. 1900 entries'
+ option enabled '0'
config source 'reg_cn'
- option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on chinese ads plus generic easylist additions, daily updates, approx. 11.700 entries'
+ option enabled '0'
-config source 'reg_de'
+config source 'reg_cz'
+ option adb_src 'https://raw.githubusercontent.com/qxstyles/turris-hole-czech-block-list/master/turris-hole-czech-block-list'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_desc 'focus on czech ads maintained by Turris Omnia Users, infrequent updates, approx. 100 entries'
option enabled '0'
+
+config source 'reg_de'
option adb_src 'https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on german ads plus generic easylist additions, daily updates, approx. 9.200 entries'
+ option enabled '0'
config source 'reg_id'
- option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/abpindo+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on indonesian ads plus generic easylist additions, weekly updates, approx. 9.600 entries'
+ option enabled '0'
config source 'reg_nl'
- option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/easylistdutch+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on dutch ads plus generic easylist additions, weekly updates, approx. 9.400 entries'
+ option enabled '0'
config source 'reg_pl'
- option enabled '0'
option adb_src 'http://adblocklist.org/adblock-pxf-polish.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on polish ads, daily updates, approx. 90 entries'
+ option enabled '0'
config source 'reg_ro'
- option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/rolist+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on romanian ads plus generic easylist additions, weekly updates, approx. 9.400 entries'
+ option enabled '0'
config source 'reg_ru'
- option enabled '0'
option adb_src 'https://easylist-downloads.adblockplus.org/ruadlist+easylist.txt'
- option adb_src_rset 'BEGIN{FS=\"[|^]\"}\$0~/^\|\|([[:alnum:]_-]+\.){1,}[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
+ option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
option adb_src_desc 'focus on russian ads plus generic easylist additions, weekly updates, approx. 14.500 entries'
+ option enabled '0'
config source 'shalla'
- option enabled '0'
option adb_src 'http://www.shallalist.de/Downloads/shallalist.tar.gz'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'broad blocklist subdivided in different categories, daily updates, approx. 31.700 entries'
list adb_src_cat 'adv'
list adb_src_cat 'costtraps'
list adb_src_cat 'spyware'
list adb_src_cat 'tracker'
list adb_src_cat 'warez'
+ option enabled '0'
config source 'spam404'
- option enabled '0'
option adb_src 'https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)+/{print tolower(\$1)}'
option adb_src_desc 'generic blocklist, infrequent updates, approx. 6.000 entries'
+ option enabled '0'
config source 'sysctl'
- option enabled '0'
option adb_src 'http://sysctl.org/cameleon/hosts'
- option adb_src_rset '\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'broad blocklist, weekly updates, approx. 16.500 entries'
+ option enabled '0'
config source 'whocares'
- option enabled '0'
option adb_src 'http://someonewhocares.org/hosts/hosts'
- option adb_src_rset '\$0~/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'broad blocklist, weekly updates, approx. 10.000 entries'
+ option enabled '0'
config source 'winspy'
- option enabled '0'
option adb_src 'https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/win10/spy.txt'
- option adb_src_rset '\$0~/^0\.0\.0\.0[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^0\.0\.0\.0[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'focus on windows spy & telemetry domains, infrequent updates, approx. 300 entries'
+ option enabled '0'
config source 'winhelp'
- option enabled '0'
option adb_src 'http://winhelp2002.mvps.org/hosts.txt'
- option adb_src_rset '\$0~/^0\.0\.0\.0[[:space:]]+([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
+ option adb_src_rset '/^0\.0\.0\.0[[:space:]]+([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'broad blocklist, infrequent updates, approx. 13.000 entries'
+ option enabled '0'
config source 'yoyo'
- option enabled '1'
option adb_src 'https://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'focus on ad related domains, weekly updates, approx. 2.400 entries'
+ option enabled '1'
config source 'zeus'
- option enabled '0'
option adb_src 'https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist'
- option adb_src_rset '\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
+ option adb_src_rset '/^([^([:space:]|#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'focus on zeus botnet, daily updates, approx. 400 entries'
+ option enabled '0'
then
if [ -n "${adb_boot}" ]
then
- local trigger="$(uci_get adblock.global.adb_trigger)"
+ local trigger="$(uci_get adblock global adb_trigger)"
if [ "${trigger}" != "timed" ]
then
return 0
status()
{
- local key keylist value rtfile="$(uci_get adblock.extra.adb_rtfile)"
+ local key keylist value rtfile="$(uci_get adblock extra adb_rtfile)"
rtfile="${rtfile:-"/tmp/adb_runtime.json"}"
if [ -s "${rtfile}" ]
service_triggers()
{
- local trigger="$(uci_get adblock.global.adb_trigger)"
- local delay="$(uci_get adblock.extra.adb_triggerdelay)"
+ local trigger="$(uci_get adblock global adb_trigger)"
+ local delay="$(uci_get adblock extra adb_triggerdelay)"
if [ "${trigger}" != "none" ] && [ "${trigger}" != "timed" ]
then
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-mail_ver="1.0.1"
+mail_ver="1.0.2"
mail_daemon="$(command -v msmtp)"
mail_profile="adb_notify"
-mail_debug="--debug"
+#mail_debug="--debug"
mail_rc=1
+# mail daemon check
+#
if [ ! -x "${mail_daemon}" ]
then
mail_daemon="$(command -v sendmail)"
fi
+# info preparation
+#
+sys_info="$(strings /etc/banner 2>/dev/null; ubus call system board | sed -e 's/\"release\": {//' | sed -e 's/^[ \t]*//' | sed -e 's/[{}\",]//g' | sed -e 's/[ ]/ \t/' | sed '/^$/d' 2>/dev/null)"
+adb_info="$(/etc/init.d/adblock status 2>/dev/null)"
if [ -f "/var/log/messages" ]
then
- logfile="$(cat /var/log/messages | grep "adblock-")"
+ log_info="$(awk '/adblock-/{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"↵"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}' /var/log/messages)"
else
- logfile="$(logread -e "adblock-")"
+ log_info="$(logread -e "adblock-" | awk '{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"↵"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
fi
# mail header
mail_sender="no-reply@adblock"
mail_receiver="!!!ChangeMe!!!"
mail_topic="adblock notification"
-mail_head="From: ${mail_sender}\nTo: ${mail_receiver}\nSubject: ${mail_topic}\nReply-to: ${mail_sender}\n\n"
+mail_head="From: ${mail_sender}\nTo: ${mail_receiver}\nSubject: ${mail_topic}\nReply-to: ${mail_sender}\nMime-Version: 1.0\nContent-Type: text/html\nContent-Disposition: inline\n\n"
# mail body
#
-mail_text="adblock status, generated at $(date 2>&1)!"
-mail_text="${mail_text}\n++\n++ System Information ++\n++\n$(cat /etc/banner 2>&1)"
-mail_text="${mail_text}\n\n++\n++ Adblock Information ++\n++\n$(/etc/init.d/adblock status 2>&1)"
-mail_text="${mail_text}\n\n++\n++ Logfile Information ++\n++\n${logfile}\n++\n++\n"
+mail_text="<html><body><pre style='display:block;font-family:monospace;font-size:1rem;padding:20;background-color:#f3eee5;white-space:pre'>"
+mail_text="${mail_text}\n<strong>++\n++ System Information ++\n++</strong>\n${sys_info}"
+mail_text="${mail_text}\n\n<strong>++\n++ Adblock Information ++\n++</strong>\n${adb_info}"
+mail_text="${mail_text}\n\n<strong>++\n++ Logfile Information ++\n++</strong>\n${log_info}"
+mail_text="${mail_text}</pre></body></html>"
# send mail
#
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-adb_ver="3.4.3"
+adb_ver="3.5.1"
adb_sysver="unknown"
adb_enabled=0
adb_debug=0
adb_backup_mode=0
-adb_whitelist_mode=0
adb_forcesrt=0
adb_forcedns=0
+adb_jail=0
+adb_maxqueue=4
adb_notify=0
adb_notifycnt=0
adb_triggerdelay=0
adb_dns="dnsmasq"
adb_dnsprefix="adb_list"
adb_dnsfile="${adb_dnsprefix}.overall"
+adb_dnsjail="${adb_dnsprefix}.jail"
adb_dnsflush=0
adb_whitelist="/etc/adblock/adblock.whitelist"
adb_rtfile="/tmp/adb_runtime.json"
adb_dnsuser="${adb_dnsuser:-"dnsmasq"}"
adb_dnsdir="${adb_dnsdir:-"/tmp"}"
adb_dnsheader=""
- adb_dnsformat="awk '{print \"server=/\"\$0\"/\"}'"
- if [ ${adb_whitelist_mode} -eq 1 ]
+ adb_dnsdeny="awk '{print \"server=/\"\$0\"/\"}'"
+ if [ ${adb_jail} -eq 1 ]
then
- adb_dnsformat="awk '{print \"server=/\"\$0\"/#\"}'"
- adb_dnsblock="server=/#/"
+ adb_dnsallow="awk '{print \"server=/\"\$0\"/#\"}'"
+ adb_dnshalt="server=/#/"
fi
;;
unbound)
adb_dnsuser="${adb_dnsuser:-"unbound"}"
adb_dnsdir="${adb_dnsdir:-"/var/lib/unbound"}"
adb_dnsheader=""
- adb_dnsformat="awk '{print \"local-zone: \042\"\$0\"\042 static\"}'"
- if [ ${adb_whitelist_mode} -eq 1 ]
+ adb_dnsdeny="awk '{print \"local-zone: \042\"\$0\"\042 static\"}'"
+ if [ ${adb_jail} -eq 1 ]
then
- adb_dnsformat="awk '{print \"local-zone: \042\"\$0\"\042 transparent\"}'"
- adb_dnsblock="local-zone: \".\" static"
+ adb_dnsallow="awk '{print \"local-zone: \042\"\$0\"\042 transparent\"}'"
+ adb_dnshalt="local-zone: \".\" static"
fi
;;
named)
adb_dnsuser="${adb_dnsuser:-"bind"}"
adb_dnsdir="${adb_dnsdir:-"/var/lib/bind"}"
adb_dnsheader="\$TTL 2h"$'\n'"@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)"$'\n'" IN NS localhost."
- adb_dnsformat="awk '{print \"\"\$0\" CNAME .\n*.\"\$0\" CNAME .\"}'"
- if [ ${adb_whitelist_mode} -eq 1 ]
+ adb_dnsdeny="awk '{print \"\"\$0\" CNAME .\n*.\"\$0\" CNAME .\"}'"
+ if [ ${adb_jail} -eq 1 ]
then
- adb_dnsformat="awk '{print \"\"\$0\" CNAME rpz-passthru.\n*.\"\$0\" CNAME rpz-passthru.\"}'"
- adb_dnsblock="* CNAME ."
+ adb_dnsallow="awk '{print \"\"\$0\" CNAME rpz-passthru.\n*.\"\$0\" CNAME rpz-passthru.\"}'"
+ adb_dnshalt="* CNAME ."
fi
;;
kresd)
adb_dnsuser="${adb_dnsuser:-"root"}"
adb_dnsdir="${adb_dnsdir:-"/etc/kresd"}"
adb_dnsheader="\$TTL 2h"$'\n'"@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)"$'\n'" IN NS localhost."
- adb_dnsformat="awk '{print \"\"\$0\" CNAME .\n*.\"\$0\" CNAME .\"}'"
- if [ ${adb_whitelist_mode} -eq 1 ]
+ adb_dnsdeny="awk '{print \"\"\$0\" CNAME .\n*.\"\$0\" CNAME .\"}'"
+ if [ ${adb_jail} -eq 1 ]
then
- adb_dnsformat="awk '{print \"\"\$0\" CNAME rpz-passthru.\n*.\"\$0\" CNAME rpz-passthru.\"}'"
- adb_dnsblock="* CNAME ."
+ adb_dnsallow="awk '{print \"\"\$0\" CNAME rpz-passthru.\n*.\"\$0\" CNAME rpz-passthru.\"}'"
+ adb_dnshalt="* CNAME ."
fi
;;
dnscrypt-proxy)
adb_dnsuser="${adb_dnsuser:-"nobody"}"
adb_dnsdir="${adb_dnsdir:-"/tmp"}"
adb_dnsheader=""
- adb_dnsformat="awk '{print \$0}'"
+ adb_dnsdeny="awk '{print \$0}'"
;;
esac
exit 0
fi
- if [ "${adb_dns}" = "dnsmasq" ] && [ ${adb_dnsinstance} -ne 0 ]
- then
- adb_dnsfile="${adb_dnsprefix}.overall.${adb_dnsinstance}"
- fi
-
if [ -d "${adb_dnsdir}" ] && [ ! -f "${adb_dnsdir}/${adb_dnsfile}" ]
then
printf '%s\n' "${adb_dnsheader}" > "${adb_dnsdir}/${adb_dnsfile}"
cnt=$((cnt+1))
done
- if [ -z "${adb_dns}" ] || [ -z "${adb_dnsformat}" ] || [ ! -x "$(command -v ${adb_dns})" ] || [ ! -d "${adb_dnsdir}" ]
+ if [ -z "${adb_dns}" ] || [ -z "${adb_dnsdeny}" ] || [ ! -x "$(command -v ${adb_dns})" ] || [ ! -d "${adb_dnsdir}" ]
then
f_log "err" "'${adb_dns}' not running, DNS backend not found"
fi
if [ -z "${adb_tmpdir}" ]
then
adb_tmpdir="$(mktemp -p /tmp -d)"
- adb_tmpload="$(mktemp -tu)"
- adb_tmpfile="$(mktemp -tu)"
+ adb_tmpload="$(mktemp -p ${adb_tmpdir} -tu)"
+ adb_tmpfile="$(mktemp -p ${adb_tmpdir} -tu)"
fi
if [ ! -s "${adb_pidfile}" ]
then
if [ -d "${adb_tmpdir}" ]
then
rm -rf "${adb_tmpdir}"
- rm -f "${adb_tmpload}"
- rm -f "${adb_tmpfile}"
fi
> "${adb_pidfile}"
}
else
adb_cnt="$(wc -l 2>/dev/null < "${adb_dnsdir}/${adb_dnsfile}")"
fi
+ elif [ "${mode}" = "whitelist" ] && [ -s "${adb_tmpdir}/tmp.whitelist" ]
+ then
+ adb_cnt="$(wc -l 2>/dev/null < "${adb_tmpdir}/tmp.whitelist")"
elif [ -s "${adb_tmpfile}" ]
then
adb_cnt="$(wc -l 2>/dev/null < "${adb_tmpfile}")"
uci -q set resolver.kresd.keep_cache="1"
elif [ ${adb_enabled} -eq 0 ] || ([ ${adb_dnsflush} -eq 1 ] && [ "$(uci -q get resolver.kresd.keep_cache)" = "1" ])
then
- uci -q delete resolver.kresd.keep_cache
+ uci -q set resolver.kresd.keep_cache="0"
fi
;;
esac
cnt=$((cnt+1))
sleep 1
done
- f_log "debug" "f_dnsup::: cache_util: ${cache_util:-"-"}, cache_rc: ${cache_rc:-"-"}, cache_flush: ${adb_dnsflush}, cache_cnt: ${cnt}, out_rc: ${adb_rc}"
+ f_log "debug" "f_dnsup::: cache_util: ${cache_util:-"-"}, cache_rc: ${cache_rc:-"-"}, cache_flush: ${adb_dnsflush}, cache_cnt: ${cnt}, rc: ${adb_rc}"
+ return ${adb_rc}
}
# backup/restore/remove blocklists
#
f_list()
{
- local mode="${1}" in_rc="${adb_rc}"
+ local file mode="${1}" in_rc="${adb_rc}"
case "${mode}" in
backup)
if [ -d "${adb_backupdir}" ]
then
- gzip -cf "${adb_tmpfile}" > "${adb_backupdir}/${adb_dnsprefix}.${src_name}.gz" 2>/dev/null
+ gzip -cf "${adb_tmpfile}" 2>/dev/null > "${adb_backupdir}/${adb_dnsprefix}.${src_name}.gz"
adb_rc=${?}
fi
;;
restore)
if [ -d "${adb_backupdir}" ] && [ -f "${adb_backupdir}/${adb_dnsprefix}.${src_name}.gz" ]
then
- gunzip -cf "${adb_backupdir}/${adb_dnsprefix}.${src_name}.gz" > "${adb_tmpfile}" 2>/dev/null
+ gunzip -cf "${adb_backupdir}/${adb_dnsprefix}.${src_name}.gz" 2>/dev/null > "${adb_tmpfile}"
adb_rc=${?}
fi
;;
adb_rc=${?}
;;
merge)
- if [ -s "${adb_tmpfile}" ]
- then
- cat "${adb_tmpfile}" >> "${adb_tmpdir}/${adb_dnsfile}"
- adb_rc=${?}
- fi
+ for file in "${adb_tmpfile}".*
+ do
+ cat "${file}" 2>/dev/null >> "${adb_tmpdir}/${adb_dnsfile}"
+ if [ ${?} -ne 0 ]
+ then
+ adb_rc=${?}
+ break
+ fi
+ rm -f "${file}"
+ done
+ adb_tmpfile="${adb_tmpdir}/${adb_dnsfile}"
;;
final)
if [ -s "${adb_tmpdir}/tmp.whitelist" ]
then
- grep -vf "${adb_tmpdir}/tmp.whitelist" "${adb_tmpdir}/${adb_dnsfile}" | eval "${adb_dnsformat}" > "${adb_dnsdir}/${adb_dnsfile}"
+ grep -vf "${adb_tmpdir}/tmp.whitelist" "${adb_tmpdir}/${adb_dnsfile}" | eval "${adb_dnsdeny}" > "${adb_dnsdir}/${adb_dnsfile}"
else
- eval "${adb_dnsformat}" "${adb_tmpdir}/${adb_dnsfile}" > "${adb_dnsdir}/${adb_dnsfile}"
+ eval "${adb_dnsdeny}" "${adb_tmpdir}/${adb_dnsfile}" > "${adb_dnsdir}/${adb_dnsfile}"
fi
if [ ${?} -eq 0 ] && [ -n "${adb_dnsheader}" ]
then
;;
esac
f_count "${mode}"
- f_log "debug" "f_list ::: mode: ${mode}, cnt: ${adb_cnt}, in_rc: ${in_rc}, out_rc: ${adb_rc}"
+ f_log "debug" "f_list ::: name: ${src_name:-"-"}, mode: ${mode}, cnt: ${adb_cnt}, in_rc: ${in_rc}, out_rc: ${adb_rc}"
}
# top level domain compression
#
f_tld()
{
- local cnt cnt_srt cnt_tld source="${1}" temp="${adb_tmpload}"
+ local cnt cnt_srt cnt_tld source="${1}" temp="${1}.tld"
cnt="$(wc -l 2>/dev/null < "${source}")"
- awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "${source}" 2>/dev/null | sort -u > "${temp}"
- cnt_srt="$(wc -l 2>/dev/null < "${temp}")"
- awk '{if(NR==1){tld=$NF};while(getline){if($NF!~tld"\\."){print tld;tld=$NF}}print tld}' "${temp}" 2>/dev/null |\
- awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' 2>/dev/null | sort > "${source}"
- cnt_tld="$(wc -l 2>/dev/null < "${source}")"
- f_log "debug" "f_tld ::: source: ${source}, cnt: ${cnt}, cnt_srt: ${cnt_srt}, cnt_tld: ${cnt_tld}"
+ sort -u "${source}" > "${temp}"
+ if [ ${?} -eq 0 ]
+ then
+ cnt_srt="$(wc -l 2>/dev/null < "${temp}")"
+ awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "${temp}" > "${source}"
+ if [ ${?} -eq 0 ]
+ then
+ sort "${source}" > "${temp}"
+ if [ ${?} -eq 0 ]
+ then
+ awk '{if(NR==1){tld=$NF};while(getline){if($NF!~tld"\\."){print tld;tld=$NF}}print tld}' "${temp}" > "${source}"
+ if [ ${?} -eq 0 ]
+ then
+ awk -F "." '{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "${source}" > "${temp}"
+ if [ ${?} -eq 0 ]
+ then
+ sort "${temp}" > "${source}"
+ if [ ${?} -eq 0 ]
+ then
+ cnt_tld="$(wc -l 2>/dev/null < "${source}")"
+ else
+ cat "${temp}" > "${source}"
+ fi
+ fi
+ else
+ cat "${temp}" > "${source}"
+ fi
+ fi
+ else
+ cat "${temp}" > "${source}"
+ fi
+ fi
+ rm -f "${temp}"
+ f_log "debug" "f_tld ::: source: ${source}, cnt: ${cnt:-"-"}, cnt_srt: ${cnt_srt:-"-"}, cnt_tld: ${cnt_tld:-"-"}"
}
# blocklist hash compare
then
f_temp
f_dnsup
- f_jsnup
+ f_jsnup "${mode}"
f_log "info" "${mode} adblock processing"
f_rmtemp
exit 0
#
f_query()
{
- local search result cnt
- local domain="${1}"
- local tld="${domain#*.}"
+ local search result field=1 domain="${1}" tld="${1#*.}"
if [ -z "${domain}" ] || [ "${domain}" = "${tld}" ]
then
printf "%s\n" "::: invalid domain input, please submit a single domain, e.g. 'doubleclick.net'"
else
- cd "${adb_dnsdir}"
+ case "${adb_dns}" in
+ dnsmasq)
+ field=2
+ ;;
+ unbound)
+ field=3
+ ;;
+ esac
while [ "${domain}" != "${tld}" ]
do
search="${domain//./\.}"
- if [ "${adb_dns}" = "dnsmasq" ] || [ "${adb_dns}" = "unbound" ]
- then
- result="$(awk -F '/|\"' "/[\/\"\.]${search}/{i++;{printf(\" + %s\n\",\$2)};if(i>9){exit}}" "${adb_dnsfile}")"
- else
- result="$(awk "/(^[^\*][[:alpha:]]*[\.]+${search}|^${search})/{i++;{printf(\" + %s\n\",\$1)};if(i>9){exit}}" "${adb_dnsfile}")"
- fi
- printf "%s\n" "::: results for domain '${domain}' (max. 10)"
+ result="$(awk -F '/|\"| ' "/^($search|[^\*].*[\/\"\. ]+${search})/{i++;{printf(\" + %s\n\",\$${field})};if(i>9){printf(\" + %s\n\",\"[...]\");exit}}" "${adb_dnsdir}/${adb_dnsfile}")"
+ printf "%s\n" "::: results for domain '${domain}'"
printf "%s\n" "${result:-" - no match"}"
domain="${tld}"
tld="${domain#*.}"
#
f_jsnup()
{
- local bg_pid rundate status="${1}" mode="normal mode"
+ local bg_pid rundate="$(/bin/date "+%d.%m.%Y %H:%M:%S")" status="${1:-"enabled"}" mode="normal mode" no_mail=0
- if [ -z "${status}" ]
+ if [ ${adb_rc} -gt 0 ]
then
- rundate="$(/bin/date "+%d.%m.%Y %H:%M:%S")"
- if [ ${adb_rc} -gt 0 ]
- then
- status="error"
- elif [ ${adb_enabled} -eq 0 ]
- then
- status="disabled"
- elif [ -s "${adb_dnsdir}/.${adb_dnsfile}" ]
- then
- status="paused"
- else
- status="enabled"
- f_count
- fi
+ status="error"
+ fi
+ if [ ${adb_enabled} -eq 0 ]
+ then
+ status="disabled"
+ fi
+ if [ "${status}" = "suspend" ]
+ then
+ status="paused"
+ fi
+ if [ "${status}" = "resume" ]
+ then
+ no_mail=1
+ status="enabled"
+ fi
+ if [ "${status}" = "enabled" ]
+ then
+ f_count
fi
if [ ${adb_backup_mode} -eq 1 ]
then
- mode="normal/backup mode"
- elif [ ${adb_whitelist_mode} -eq 1 ]
- then
- mode="whitelist mode"
+ mode="backup mode"
fi
if [ -z "${adb_fetchinfo}" ] && [ -s "${adb_rtfile}" ]
json_close_object
json_dump > "${adb_rtfile}"
- if [ ${adb_notify} -eq 1 ] && [ -x /etc/adblock/adblock.notify ] && ([ "${status}" = "error" ] ||\
- ([ "${status}" = "enabled" ] && [ ${adb_whitelist_mode} -eq 0 ] && [ ${adb_cnt} -le ${adb_notifycnt} ]))
+ if [ ${adb_notify} -eq 1 ] && [ ${no_mail} -eq 0 ] && [ -x /etc/adblock/adblock.notify ] && \
+ ([ "${status}" = "error" ] || ([ "${status}" = "enabled" ] && [ ${adb_cnt} -le ${adb_notifycnt} ]))
then
(/etc/adblock/adblock.notify >/dev/null 2>&1) &
bg_pid=${!}
#
f_main()
{
- local src_name src_rset src_log src_arc enabled url mem_total="$(awk '/^MemTotal/ {print int($2/1000)}' "/proc/meminfo")"
+ local tmp_load tmp_file src_name src_rset src_arc src_log mem_total mem_free enabled url cnt=1
- f_log "debug" "f_main ::: dns: ${adb_dns}, fetch_util: ${adb_fetchinfo}, backup: ${adb_backup}, backup_mode: ${adb_backup_mode}, whitelist_mode: ${adb_whitelist_mode}, force_srt: ${adb_forcesrt}, force_dns: ${adb_forcedns}, mem_total: ${mem_total}"
+ mem_total="$(awk '/^MemTotal/ {print int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
+ mem_free="$(awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
+ tmp_load="${adb_tmpload}"
+ tmp_file="${adb_tmpfile}"
> "${adb_dnsdir}/.${adb_dnsfile}"
> "${adb_tmpdir}/tmp.whitelist"
+ f_log "debug" "f_main ::: dns: ${adb_dns}, fetch_util: ${adb_fetchinfo}, backup: ${adb_backup}, backup_mode: ${adb_backup_mode}, dns_jail: ${adb_jail}, force_srt: ${adb_forcesrt}, force_dns: ${adb_forcedns}, mem_total: ${mem_total:-0}, mem_free: ${mem_free:-0}, max_queue: ${adb_maxqueue}"
# prepare whitelist entries
#
if [ -s "${adb_whitelist}" ]
then
- if [ ${adb_whitelist_mode} -eq 1 ] && [ "${adb_dns}" != "dnscrypt-proxy" ]
+ adb_whitelist_rset="/^([^([:space:]|\#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{gsub(\"\\\.\",\"\\\.\",\$1);print tolower(\"^\"\$1\"\\\|\\\.\"\$1)}"
+ awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
+ f_list whitelist
+ if [ ${adb_jail} -eq 1 ] && [ "${adb_dns}" != "dnscrypt-proxy" ]
then
- adb_whitelist_rset="\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}"
- else
- adb_whitelist_rset="\$0~/^([[:alnum:]_-]+\.){1,}[[:alpha:]]+([[:space:]]|$)/{gsub(\"\\\.\",\"\\\.\",\$1);print tolower(\"^\"\$1\"\\\|\\\.\"\$1)}"
+ adb_whitelist_rset="/^([^([:space:]|\#|\*|\/).]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}"
+ awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.dnsjail"
fi
- awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
fi
- # whitelist mode processing
+ # build 'dnsjail' list
#
- if [ ${adb_whitelist_mode} -eq 1 ] && [ "${adb_dns}" != "dnscrypt-proxy" ]
+ if [ ${adb_jail} -eq 1 ] && [ "${adb_dns}" != "dnscrypt-proxy" ]
then
- f_hash
- f_tld "${adb_tmpdir}/tmp.whitelist"
- eval "${adb_dnsformat}" "${adb_tmpdir}/tmp.whitelist" > "${adb_dnsdir}/${adb_dnsfile}"
- printf '%s\n' "${adb_dnsblock}" >> "${adb_dnsdir}/${adb_dnsfile}"
+ f_tld "${adb_tmpdir}/tmp.dnsjail"
+ eval "${adb_dnsallow}" "${adb_tmpdir}/tmp.dnsjail" > "/tmp/${adb_dnsjail}"
+ printf '%s\n' "${adb_dnshalt}" >> "/tmp/${adb_dnsjail}"
if [ -n "${adb_dnsheader}" ]
then
- printf '%s\n' "${adb_dnsheader}" | cat - "${adb_dnsdir}/${adb_dnsfile}" > "${adb_tmpdir}/${adb_dnsfile}"
- cat "${adb_tmpdir}/${adb_dnsfile}" > "${adb_dnsdir}/${adb_dnsfile}"
- fi
- f_hash
- if [ ${?} -eq 1 ]
- then
- f_dnsup
- fi
- f_jsnup
- if [ ${adb_rc} -eq 0 ]
- then
- f_log "info" "whitelist with overall ${adb_cnt} domains loaded successfully (${adb_sysver})"
- return 0
- else
- f_log "err" "dns backend restart with active whitelist failed"
+ printf '%s\n' "${adb_dnsheader}" | cat - "/tmp/${adb_dnsjail}" > "${adb_tmpdir}/tmp.dnsjail"
+ cat "${adb_tmpdir}/tmp.dnsjail" > "/tmp/${adb_dnsjail}"
fi
fi
- # normal & backup mode processing
+ # main loop
#
for src_name in ${adb_sources}
do
eval "enabled=\"\${enabled_${src_name}}\""
eval "url=\"\${adb_src_${src_name}}\""
eval "src_rset=\"\${adb_src_rset_${src_name}}\""
- > "${adb_tmpload}"
- > "${adb_tmpfile}"
- adb_rc=1
+ adb_tmpload="${tmp_load}.${src_name}"
+ adb_tmpfile="${tmp_file}.${src_name}"
# basic pre-checks
#
f_list restore
if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpfile}" ]
then
- f_list merge
+ if ([ ${mem_total} -lt 64 ] || [ ${mem_free} -lt 40 ]) && [ ${adb_forcesrt} -eq 0 ]
+ then
+ f_tld "${adb_tmpfile}"
+ fi
continue
fi
fi
- # download blocklist
+ # download queue processing
#
if [ "${src_name}" = "blacklist" ]
then
if [ -s "${url}" ]
then
- cat "${url}" > "${adb_tmpload}"
- adb_rc=${?}
+ (
+ src_log="$(cat "${url}" > "${adb_tmpload}" 2>&1)"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpload}" ]
+ then
+ awk "${src_rset}" "${adb_tmpload}" 2>/dev/null > "${adb_tmpfile}"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpfile}" ]
+ then
+ rm -f "${adb_tmpload}"
+ f_list download
+ if ([ ${mem_total} -lt 64 ] || [ ${mem_free} -lt 40 ]) && [ ${adb_forcesrt} -eq 0 ]
+ then
+ f_tld "${adb_tmpfile}"
+ fi
+ fi
+ else
+ src_log="$(printf '%s' "${src_log}" | awk '{ORS=" ";print $0}')"
+ f_log "debug" "f_main ::: name: ${src_name}, url: ${url}, rc: ${adb_rc}, log: ${src_log:-"-"}"
+ fi
+ ) &
+ else
+ continue
fi
elif [ "${src_name}" = "shalla" ]
then
- src_arc="${adb_tmpdir}/shallalist.tar.gz"
- src_log="$("${adb_fetchutil}" ${adb_fetchparm} "${src_arc}" "${url}" 2>&1)"
- adb_rc=${?}
- if [ ${adb_rc} -eq 0 ]
- then
- for category in ${adb_src_cat_shalla}
- do
- tar -xOzf "${src_arc}" "BL/${category}/domains" >> "${adb_tmpload}"
- adb_rc=${?}
- if [ ${adb_rc} -ne 0 ]
- then
- break
- fi
- done
- fi
- rm -f "${src_arc}"
- rm -rf "${adb_tmpdir}/BL"
+ (
+ src_arc="${adb_tmpdir}"/shallalist.tar.gz
+ src_log="$("${adb_fetchutil}" ${adb_fetchparm} "${src_arc}" "${url}" 2>&1)"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${src_arc}" ]
+ then
+ for category in ${adb_src_cat_shalla}
+ do
+ tar -xOzf "${src_arc}" "BL/${category}/domains" >> "${adb_tmpload}"
+ adb_rc=${?}
+ if [ ${adb_rc} -ne 0 ]
+ then
+ break
+ fi
+ done
+ else
+ src_log="$(printf '%s' "${src_log}" | awk '{ORS=" ";print $0}')"
+ f_log "debug" "f_main ::: name: ${src_name}, url: ${url}, rc: ${adb_rc}, log: ${src_log:-"-"}"
+ fi
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpload}" ]
+ then
+ rm -f "${src_arc}"
+ awk "${src_rset}" "${adb_tmpload}" 2>/dev/null > "${adb_tmpfile}"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpfile}" ]
+ then
+ rm -f "${adb_tmpload}"
+ f_list download
+ if [ ${adb_backup} -eq 1 ]
+ then
+ f_list backup
+ fi
+ if ([ ${mem_total} -lt 64 ] || [ ${mem_free} -lt 40 ]) && [ ${adb_forcesrt} -eq 0 ]
+ then
+ f_tld "${adb_tmpfile}"
+ fi
+ elif [ ${adb_backup} -eq 1 ]
+ then
+ f_list restore
+ fi
+ elif [ ${adb_backup} -eq 1 ]
+ then
+ f_list restore
+ fi
+ ) &
else
- src_log="$("${adb_fetchutil}" ${adb_fetchparm} "${adb_tmpload}" "${url}" 2>&1)"
- adb_rc=${?}
+ (
+ src_log="$("${adb_fetchutil}" ${adb_fetchparm} "${adb_tmpload}" "${url}" 2>&1)"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpload}" ]
+ then
+ awk "${src_rset}" "${adb_tmpload}" 2>/dev/null > "${adb_tmpfile}"
+ adb_rc=${?}
+ if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpfile}" ]
+ then
+ rm -f "${adb_tmpload}"
+ f_list download
+ if [ ${adb_backup} -eq 1 ]
+ then
+ f_list backup
+ fi
+ if ([ ${mem_total} -lt 64 ] || [ ${mem_free} -lt 40 ]) && [ ${adb_forcesrt} -eq 0 ]
+ then
+ f_tld "${adb_tmpfile}"
+ fi
+ elif [ ${adb_backup} -eq 1 ]
+ then
+ f_list restore
+ fi
+ else
+ src_log="$(printf '%s' "${src_log}" | awk '{ORS=" ";print $0}')"
+ f_log "debug" "f_main ::: name: ${src_name}, url: ${url}, rc: ${adb_rc}, log: ${src_log:-"-"}"
+ if [ ${adb_backup} -eq 1 ]
+ then
+ f_list restore
+ fi
+ fi
+ ) &
fi
- if [ ${adb_rc} -ne 0 ] && [ "${src_name}" != "blacklist" ]
+ hold=$(( cnt % adb_maxqueue ))
+ if [ ${hold} -eq 0 ]
then
- f_log "debug" "f_main ::: url: ${url}, rc: ${adb_rc}, src_log: ${src_log:-"-"}"
- fi
-
- # check download result and prepare list output
- #
- if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpload}" ]
- then
- awk "${src_rset}" "${adb_tmpload}" 2>/dev/null > "${adb_tmpfile}"
- if [ -s "${adb_tmpfile}" ]
- then
- if [ ${mem_total} -lt 64 ] && [ ${adb_forcesrt} -eq 0 ]
- then
- f_tld "${adb_tmpfile}"
- fi
- if [ ${adb_backup} -eq 1 ] && [ "${src_name}" != "blacklist" ]
- then
- f_list backup
- fi
- elif [ ${adb_backup} -eq 1 ]
- then
- f_list restore
- fi
- elif [ ${adb_backup} -eq 1 ] && [ "${src_name}" != "blacklist" ]
- then
- f_list restore
- fi
-
- # list merge
- #
- if [ ${adb_rc} -eq 0 ] && [ -s "${adb_tmpfile}" ]
- then
- f_list merge
- if [ ${adb_rc} -ne 0 ]
- then
- f_list remove
- fi
- else
- f_list remove
+ wait
fi
+ cnt=$(( cnt + 1 ))
done
+ # list merge
+ #
+ wait
+ src_name="overall"
+ adb_tmpfile="${tmp_file}"
+ f_list merge
+
# overall sort and conditional dns restart
#
f_hash
if [ -s "${adb_tmpdir}/${adb_dnsfile}" ]
then
- if [ ${mem_total} -ge 64 ] || [ ${adb_forcesrt} -eq 1 ]
+ if ([ ${mem_total} -ge 64 ] && [ ${mem_free} -ge 40 ]) || [ ${adb_forcesrt} -eq 1 ]
then
f_tld "${adb_tmpdir}/${adb_dnsfile}"
fi
> "${adb_dnsdir}/${adb_dnsfile}"
fi
chown "${adb_dnsuser}" "${adb_dnsdir}/${adb_dnsfile}" 2>/dev/null
-
f_hash
if [ ${?} -eq 1 ]
then
f_dnsup
fi
f_jsnup
- if [ ${adb_rc} -eq 0 ]
+ if [ ${?} -eq 0 ]
then
f_log "info" "blocklist with overall ${adb_cnt} domains loaded successfully (${adb_sysver})"
else
PKG_NAME:=aircrack-ng
PKG_VERSION:=1.2-rc1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
Bash script designed to turn wireless cards into monitor mode.
endef
+TARGET_CFLAGS += -std=gnu89
+
MAKE_FLAGS += prefix=/usr \
libnl=true \
sqlite=false \
--- /dev/null
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ariang
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/mayswind/AriaNg-DailyBuild
+PKG_SOURCE_DATE:=2018-02-21
+PKG_SOURCE_VERSION:=f71a67cbb034aebcd076db3fadc1b9d8cdc470c7
+PKG_MIRROR_HASH:=13b07acbe29a68929295a82deb5a0122d8a56e328f783b6bc1efe9c72b99a702
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ariang
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Download Manager
+ DEPENDS:=+uhttpd +aria2
+ TITLE:=AriaNg is a web frontend making aria2 easier to use.
+ URL:=https://github.com/mayswind/AriaNg
+ PKGARCH:=all
+endef
+
+define Package/ariang/description
+ AriaNg is a web frontend making aria2 easier to use. AriaNg is written in pure html & javascript, thus it does not need any compilers or runtime environment.
+endef
+
+define Build/Compile
+endef
+
+define Package/ariang/install
+ $(INSTALL_DIR) \
+ $(1)/www/ariang
+
+ $(CP) \
+ $(PKG_BUILD_DIR)/{langs,css,js,fonts} \
+ $(PKG_BUILD_DIR)/index.html \
+ $(PKG_BUILD_DIR)/index.manifest \
+ $(PKG_BUILD_DIR)/LICENSE \
+ $(PKG_BUILD_DIR)/favicon.ico \
+ $(1)/www/ariang
+endef
+
+$(eval $(call BuildPackage,ariang))
PKG_NAME:=autossh
PKG_VERSION:=1.4e
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://www.harding.motd.ca/autossh/
option gatetime '0'
option monitorport '20000'
option poll '600'
+ option enabled '0'
[ "$ACTION" = "ifdown" ] && {
/etc/init.d/autossh stop
}
-
+
}
config_get gatetime "$section" 'gatetime'
config_get monitorport "$section" 'monitorport'
config_get poll "$section" 'poll'
+ config_get_bool enabled "$section" 'enabled' '1'
+
+ [ "$enabled" = 1 ] || exit 0
export AUTOSSH_GATETIME="${gatetime:-30}"
export AUTOSSH_POLL="${poll:-600}"
PKG_NAME:=bcp38
PKG_VERSION:=5
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_LICENCE:=GPL-3.0+
include $(INCLUDE_DIR)/package.mk
$(INSTALL_BIN) ./files/run.sh $(1)/usr/lib/bcp38/run.sh
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/bcp38.defaults $(1)/etc/uci-defaults/bcp38
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/bcp38.init $(1)/etc/init.d/bcp38
endef
define Package/bcp38/postinst
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=20
+
+USE_PROCD=1
+NAME=bcp38
+
+service_triggers()
+{
+ procd_add_config_trigger "config.change" "bcp38" /etc/init.d/firewall reload
+}
include $(TOPDIR)/rules.mk
PKG_NAME:=bind
-PKG_VERSION:=9.11.2
-PKG_RELEASE:=3
+PKG_VERSION:=9.11.2-P1
+PKG_RELEASE:=1
USERID:=bind=57:bind=57
PKG_MAINTAINER:=Noah Meyerhans <frodo@morgul.net>
PKG_SOURCE_URL:= \
http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION) \
http://ftp.isc.org/isc/bind9/$(PKG_VERSION)
-PKG_HASH:=7f46ad8620f7c3b0ac375d7a5211b15677708fda84ce25d7aeb7222fe2e3c77a
+PKG_HASH:=cec31548832fca3f85d95178d4019b7d702039e8595d4c93914feba337df1212
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=aclocal.m4 libtool.m4
--- /dev/null
+From d5daf15c2098040b8b01753d3cdce8c1c79fc528 Mon Sep 17 00:00:00 2001
+From: David Seifert <soap@gentoo.org>
+Date: Fri, 10 Feb 2017 21:30:49 +0100
+Subject: [PATCH] Use `static inline` instead of `inline`
+
+`inline` by itself is not portably guaranteed to emit
+an external definition when needed in C99. The current
+code base implicitly relies on GNU89 inline semantics,
+which _always_ emit an external definition. More recent
+versions of GCC and Clang switch to C99/C11 inline semantics
+by default, which fails with undefined references.
+
+See also:
+* http://www.greenend.org.uk/rjk/tech/inline.html
+* https://clang.llvm.org/compatibility.html#inline
+* http://blahg.josefsipek.net/?p=529
+---
+ src/bwm-ng.c | 4 ++--
+ src/help.c | 4 ++--
+ src/options.c | 16 ++++++++--------
+ src/output.c | 22 +++++++++++-----------
+ src/process.c | 28 ++++++++++++++--------------
+ 5 files changed, 37 insertions(+), 37 deletions(-)
+
+diff --git a/src/bwm-ng.c b/src/bwm-ng.c
+index ad94ccd..c2ab0db 100644
+--- a/src/bwm-ng.c
++++ b/src/bwm-ng.c
+@@ -26,7 +26,7 @@
+
+ /* handle interrupt signal */
+ void sigint(int sig) FUNCATTR_NORETURN;
+-inline void init(void);
++static inline void init(void);
+
+ /* clear stuff and exit */
+ #ifdef __STDC__
+@@ -98,7 +98,7 @@ void sigint(int sig) {
+ deinit(0, NULL);
+ }
+
+-inline void init(void) {
++static inline void init(void) {
+ if_count=0;
+ delay=500;
+ #if EXTENDED_STATS
+diff --git a/src/help.c b/src/help.c
+index 7fd9ca4..4853297 100644
+--- a/src/help.c
++++ b/src/help.c
+@@ -24,9 +24,9 @@
+ #include "global_vars.h"
+ #include "help.h"
+
+-inline void print_help_line(const char *short_c,const char * long_c,const char *descr);
++static inline void print_help_line(const char *short_c,const char * long_c,const char *descr);
+
+-inline void print_help_line(const char *short_c,const char * long_c,const char *descr) {
++static inline void print_help_line(const char *short_c,const char * long_c,const char *descr) {
+ #ifdef LONG_OPTIONS
+ printf(" %-23s",long_c);
+ #else
+diff --git a/src/options.c b/src/options.c
+index 1b65eeb..30dccb4 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -30,12 +30,12 @@ static char* getToken(char** str, const char* delims);
+ char *trim_whitespace(char *str);
+ int read_config(const char *config_file);
+ #endif
+-inline int str2output_unit(char *optarg);
++static inline int str2output_unit(char *optarg);
+ #if EXTENDED_STATS
+-inline int str2output_type(char *optarg);
++static inline int str2output_type(char *optarg);
+ #endif
+-inline int str2out_method(char *optarg);
+-inline int str2in_method(char *optarg);
++static inline int str2out_method(char *optarg);
++static inline int str2in_method(char *optarg);
+
+ #ifdef CONFIG_FILE
+ /******************************************************************************
+@@ -65,7 +65,7 @@ static char* getToken(char** str, const char* delims) {
+ /******************************************************************************/
+ #endif
+
+-inline int str2output_unit(char *optarg) {
++static inline int str2output_unit(char *optarg) {
+ if (optarg) {
+ if (!strcasecmp(optarg,"bytes")) return BYTES_OUT;
+ if (!strcasecmp(optarg,"bits")) return BITS_OUT;
+@@ -76,7 +76,7 @@ inline int str2output_unit(char *optarg) {
+ }
+
+ #if EXTENDED_STATS
+-inline int str2output_type(char *optarg) {
++static inline int str2output_type(char *optarg) {
+ if (optarg) {
+ if (!strcasecmp(optarg,"rate")) return RATE_OUT;
+ if (!strcasecmp(optarg,"max")) return MAX_OUT;
+@@ -87,7 +87,7 @@ inline int str2output_type(char *optarg) {
+ }
+ #endif
+
+-inline int str2out_method(char *optarg) {
++static inline int str2out_method(char *optarg) {
+ if (optarg) {
+ if (!strcasecmp(optarg,"plain")) return PLAIN_OUT;
+ #ifdef HAVE_CURSES
+@@ -109,7 +109,7 @@ inline int str2out_method(char *optarg) {
+ }
+
+
+-inline int str2in_method(char *optarg) {
++static inline int str2in_method(char *optarg) {
+ if (optarg) {
+ #ifdef PROC_NET_DEV
+ if (!strcasecmp(optarg,"proc")) return PROC_IN;
+diff --git a/src/output.c b/src/output.c
+index 653e444..1425b3c 100644
+--- a/src/output.c
++++ b/src/output.c
+@@ -25,13 +25,13 @@
+ #include "output.h"
+
+ inline static const char *output_type2str(void);
+-inline const char *input2str(void);
+-inline const char *show_all_if2str(void);
+-inline ullong direction2value(char mode,struct inout_long stats);
++static inline const char *input2str(void);
++static inline const char *show_all_if2str(void);
++static inline ullong direction2value(char mode,struct inout_long stats);
+ #if EXTENDED_STATS
+-inline double direction_max2value(char mode,struct inouttotal_double stats,int items);
++static inline double direction_max2value(char mode,struct inouttotal_double stats,int items);
+ #endif
+-inline char *dyn_byte_value2str(double value,char *str,int buf_size);
++static inline char *dyn_byte_value2str(double value,char *str,int buf_size);
+ char *values2str(char mode,t_iface_speed_stats stats,t_iface_stats full_stats,float multiplier,char *str,int buf_size);
+
+ inline static const char *output_type2str(void) {
+@@ -59,7 +59,7 @@ inline static const char *output_type2str(void) {
+ }
+
+
+-inline const char *input2str(void) {
++static inline const char *input2str(void) {
+ switch (input_method) {
+ #ifdef SYSCTL
+ case SYSCTL_IN:
+@@ -121,7 +121,7 @@ inline const char *input2str(void) {
+ return "";
+ }
+
+-inline const char *show_all_if2str(void) {
++static inline const char *show_all_if2str(void) {
+ switch (show_all_if) {
+ case 1:
+ return " (all)";
+@@ -262,7 +262,7 @@ int print_header(int option) {
+ }
+
+
+-inline ullong direction2value(char mode,struct inout_long stats) {
++static inline ullong direction2value(char mode,struct inout_long stats) {
+ switch (mode) {
+ case 0:
+ return stats.in;
+@@ -275,7 +275,7 @@ inline ullong direction2value(char mode,struct inout_long stats) {
+ }
+
+ #if EXTENDED_STATS
+-inline double direction_max2value(char mode,struct inouttotal_double stats,int items) {
++static inline double direction_max2value(char mode,struct inouttotal_double stats,int items) {
+ switch (mode) {
+ case 0:
+ return (double)(stats.in/items);
+@@ -288,7 +288,7 @@ inline double direction_max2value(char mode,struct inouttotal_double stats,int i
+ }
+ #endif
+
+-inline char *dyn_byte_value2str(double value,char *str,int buf_size) {
++static inline char *dyn_byte_value2str(double value,char *str,int buf_size) {
+ if (dynamic) {
+ if (value<1024)
+ snprintf(str,buf_size,"%15.2f ",value);
+@@ -306,7 +306,7 @@ inline char *dyn_byte_value2str(double value,char *str,int buf_size) {
+ return str;
+ }
+
+-inline char *dyn_bit_value2str(double value,char *str,int buf_size) {
++static inline char *dyn_bit_value2str(double value,char *str,int buf_size) {
+ if (dynamic) {
+ if (value<1000)
+ snprintf(str,buf_size,"%15.2f ",value);
+diff --git a/src/process.c b/src/process.c
+index 59eccf0..d06c6dd 100644
+--- a/src/process.c
++++ b/src/process.c
+@@ -26,19 +26,19 @@
+
+ short show_iface(char *instr, char *searchstr,char iface_is_up);
+ #if HAVE_GETTIMEOFDAY
+-inline long tvdiff(struct timeval newer, struct timeval older);
++static inline long tvdiff(struct timeval newer, struct timeval older);
+ float get_time_delay(int iface_num);
+ #endif
+-inline ullong calc_new_values(ullong new, ullong old);
++static inline ullong calc_new_values(ullong new, ullong old);
+ t_iface_speed_stats convert2calced_values(t_iface_speed_stats new, t_iface_speed_stats old);
+ t_iface_speed_stats convert2calced_disk_values(t_iface_speed_stats new, t_iface_speed_stats old);
+ #if EXTENDED_STATS
+-inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data);
+-inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data);
+-inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier);
++static inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data);
++static inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data);
++static inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier);
+ void save_avg(struct t_avg *avg,struct iface_speed_stats calced_stats,float multiplier);
+-inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values);
+-inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier);
++static inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values);
++static inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier);
+ #endif
+
+ /* returns the whether to show the iface or not
+@@ -74,7 +74,7 @@ short show_iface(char *instr, char *searchstr,char iface_is_up) {
+
+ #if HAVE_GETTIMEOFDAY
+ /* Returns: the time difference in milliseconds. */
+-inline long tvdiff(struct timeval newer, struct timeval older) {
++static inline long tvdiff(struct timeval newer, struct timeval older) {
+ return labs((newer.tv_sec-older.tv_sec)*1000+
+ (newer.tv_usec-older.tv_usec)/1000);
+ }
+@@ -95,7 +95,7 @@ float get_time_delay(int iface_num) {
+ #endif
+
+ /* basically new-old, but handles "overflow" of source aswell */
+-inline ullong calc_new_values(ullong new, ullong old) {
++static inline ullong calc_new_values(ullong new, ullong old) {
+ /* FIXME: WRAP_AROUND _might_ be wrong for libstatgrab, where the type is always long long */
+ return (new>=old) ? (ullong)(new-old) : (ullong)((
+ #ifdef HAVE_LIBKSTAT
+@@ -136,13 +136,13 @@ t_iface_speed_stats convert2calced_disk_values(t_iface_speed_stats new, t_iface_
+
+ #if EXTENDED_STATS
+ /* sub old values from cached for avg stats */
+-inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data) {
++static inline void sub_avg_values(struct inouttotal_double *values,struct inouttotal_double data) {
+ values->in-=data.in;
+ values->out-=data.out;
+ values->total-=data.total;
+ }
+
+-inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data) {
++static inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_double data) {
+ values->in+=data.in;
+ values->out+=data.out;
+ values->total+=data.total;
+@@ -151,7 +151,7 @@ inline void add_avg_values(struct inouttotal_double *values,struct inouttotal_do
+
+ /* put new-old bytes in inout_long struct into a inouttotal_double struct
+ * and add values to cached .value struct */
+-inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier) {
++static inline void save_avg_values(struct inouttotal_double *values,struct inouttotal_double *data,struct inout_long calced_stats,float multiplier) {
+ data->in=calced_stats.in*multiplier;
+ data->out=calced_stats.out*multiplier;
+ data->total=(calced_stats.in+calced_stats.out)*multiplier;
+@@ -201,13 +201,13 @@ void save_avg(struct t_avg *avg,struct iface_speed_stats calced_stats,float mult
+ }
+
+ /* add current in and out bytes to totals struct */
+-inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values) {
++static inline void save_sum(struct inout_long *stats,struct inout_long new_stats_values) {
+ stats->in+=new_stats_values.in;
+ stats->out+=new_stats_values.out;
+ }
+
+ /* lookup old max values and save new if higher */
+-inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier) {
++static inline void save_max(struct inouttotal_double *stats,struct inout_long calced_stats,float multiplier) {
+ if (multiplier*calced_stats.in > stats->in)
+ stats->in=multiplier*calced_stats.in;
+ if (multiplier*calced_stats.out>stats->out)
include $(TOPDIR)/rules.mk
PKG_NAME:=chrony
-PKG_VERSION:=3.2
-PKG_RELEASE:=1
+PKG_VERSION:=3.3
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://download.tuxfamily.org/chrony/
-PKG_HASH:=329f6718dd8c3ece3eee78be1f4821cbbeb62608e7d23f25da293cfa433c4116
+PKG_HASH:=0d1fb2d5875032f2d5a86f3770374c87ee4c941916f64171e81f7684f2a73128
PKG_MAINTAINER:=Miroslav Lichvar <mlichvar0@gmail.com>
PKG_LICENSE:=GPL-2.0
--chronyrundir=/var/run/chrony \
--disable-readline \
--disable-rtc \
+ --disable-sechash \
--with-user=chrony
CONFIGURE_VARS+=CPPFLAGS=-DNDEBUG
include $(TOPDIR)/rules.mk
PKG_NAME:=clamav
-PKG_VERSION:=0.99.2
-PKG_RELEASE:=3
+PKG_VERSION:=0.100.0
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr> \
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.clamav.net/downloads/production/
-PKG_HASH:=167bd6a13e05ece326b968fdb539b05c2ffcfef6018a274a10aeda85c2c0027a
+PKG_HASH:=c5c5edaf75a3c53ac0f271148fd6447310bce53f448ec7e6205124a25918f65c
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
define Package/clamav/Default
SECTION:=net
- DEPENDS:=+libpthread +uclibcxx +zlib +libcurl +libopenssl +libltdl +libpcre2 +USE_MUSL:musl-fts
+ DEPENDS:=+libpthread +uclibcxx +zlib +libcurl +libjson-c +libopenssl +libltdl +libpcre2 +USE_MUSL:musl-fts
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=ClamAV
config COOVACHILLI_NOSSL
bool "No SSL support"
-config COOVACHILLI_MATRIXSSL
- bool "MatrixSSL"
-
config COOVACHILLI_CYASSL
bool "CyaSSL"
#
-# Copyright (C) 2007-2014 OpenWrt.org
+# Copyright (C) 2007-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=coova-chilli
PKG_VERSION:=1.3.0+20141128
-PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
+PKG_MAINTAINER:=Jaehoon You <teslamint@gmail.com>
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=COPYING
-PKG_RELEASE:=4
+PKG_RELEASE:=6
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://github.com/coova/coova-chilli
COOVACHILLI_UAMDOMAINFILE \
COOVACHILLI_LARGELIMITS \
COOVACHILLI_NOSSL \
- COOVACHILLI_MATRIXSSL \
COOVACHILLI_CYASSL \
COOVACHILLI_OPENSSL
SUBMENU:=Captive Portals
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl
+ DEPENDS:=+kmod-tun +librt +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl
TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
URL:=http://www.coova.org/CoovaChilli
MENU:=1
$(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \
$(if $(CONFIG_COOVACHILLI_LARGELIMITS),--enable,--disable)-largelimits \
$(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \
- $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \
$(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyassl \
$(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \
$(if $(CONFIG_PACKAGE_kmod-ipt-coova),--with-nfcoova) \
#!/bin/sh /etc/rc.common
-START=30
-STOP=90
+START=90
+STOP=89
+USE_PROCD=1
+
+service_triggers() {
+ procd_add_reload_trigger "chilli"
+}
config_cb() {
- chilli_inst=$2
- if [ "$chilli_inst" != "" ]
- then
- rm -f /var/run/chilli_${chilli_inst}.*
- chilli_conf=/var/run/chilli_${chilli_inst}.conf
- eval "start_chilli_$chilli_inst=1"
- fi
+ local chilli_inst="$2"
+ if [ "$chilli_inst" != "" ]; then
+ chilli_conf="/var/run/chilli_${chilli_inst}.conf"
+ if [ -e "$chilli_conf" ]; then
+ rm -f "$chilli_conf"
+ fi
+ eval "start_chilli_$chilli_inst=1"
+ fi
}
option_cb() {
- case "$1" in
- # UCI settings
- network)
- . /lib/functions/network.sh
- local ifname
- network_get_device ifname $2
- echo "dhcpif=\"$ifname\"" >> $chilli_conf
- ;;
- disabled)
- eval "start_chilli_$chilli_inst=0"
- ;;
- # boolean settings
- dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
- [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
- ;;
- *)
- echo "$1=\"$2\"" >> $chilli_conf
- ;;
- esac
+ case "$1" in
+ # UCI settings
+ network)
+ . /lib/functions/network.sh
+ local ifname
+ network_get_device ifname "$2"
+ echo "dhcpif=\"$ifname\"" >> "$chilli_conf"
+ ;;
+ disabled)
+ [ "$(config_get_bool "$1")" = "1" ] && eval "start_chilli_$chilli_inst=0"
+ ;;
+ # boolean settings
+ debug|dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
+ [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> "$chilli_conf"
+ ;;
+ *)
+ echo "$1=\"$2\"" >> "$chilli_conf"
+ ;;
+ esac
}
start_chilli() {
- local cfg="$1"
- local start_chilli=$(eval "echo \$start_chilli_$cfg")
- [ "$start_chilli" = "0" ] && return
- local base=/var/run/chilli_${cfg}
- chilli -c ${base}.conf \
- --pidfile ${base}.pid \
- --cmdsocket ${base}.sock \
- --unixipc ${base}.ipc &
-}
-
-start() {
- config_load chilli
- config_foreach start_chilli chilli
-}
-
-stop() {
- ls /var/run/chilli*.pid 2>/dev/null && {
- kill $(cat /var/run/chilli*.pid)
- sleep 1
- killall -9 chilli
- rm -f /var/run/chilli*
- }
+ local cfg="$1"
+ local start_chilli=$(eval "echo \$start_chilli_$cfg")
+ [ "$start_chilli" = "0" ] && return
+ local base="/var/run/chilli_${cfg}"
+
+ procd_open_instance "$cfg"
+ procd_set_param command /usr/sbin/chilli
+ procd_set_param file "${base}.conf"
+ procd_append_param command --fg --conf "${base}.conf" --pidfile "${base}.pid" --cmdsocket "${base}.sock" --unixipc "${base}.ipc"
+ procd_set_param respawn
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_close_instance
+}
+
+start_service() {
+ config_load chilli
+ config_foreach start_chilli chilli
+}
+
+stop_service() {
+ rm -f /var/run/chilli_*
+}
+
+reload_chilli() {
+ local pid
+ local cfg="$1"
+ local base="/var/run/chilli_${cfg}"
+ if [ -f "${base}.pid" ]; then
+ pid="$(cat "${base}.pid")"
+ [ -f "/var/run/chilli.${pid}.cfg.bin" ] && rm -f "/var/run/chilli.${pid}.cfg.bin"
+ chilli_query -s "${base}.sock" reload
+ fi
+}
+
+reload_service() {
+ config_load chilli
+ config_foreach reload_chilli chilli
}
--- /dev/null
+--- a/src/chilli.c
++++ b/src/chilli.c
+@@ -4297,8 +4297,10 @@ static int chilliauth_cb(struct radius_t
+ while (!differ && r1 > 0 && r2 > 0);
+ }
+
+- if (newfd) safe_close(newfd); newfd=0;
+- if (oldfd) safe_close(oldfd); oldfd=0;
++ if (newfd) safe_close(newfd);
++ newfd=0;
++ if (oldfd) safe_close(oldfd);
++ oldfd=0;
+
+ if (differ) {
+ log_dbg("Writing out new hs.conf file with administraive-user settings");
+--- a/src/redir.c
++++ b/src/redir.c
+@@ -3176,9 +3176,11 @@ pid_t redir_fork(int in, int out) {
+ }
+
+ #if defined(F_DUPFD)
+- if (fcntl(in,F_GETFL,0) == -1) return -1; safe_close(0);
++ if (fcntl(in,F_GETFL,0) == -1) return -1;
++ safe_close(0);
+ if (fcntl(in,F_DUPFD,0) == -1) return -1;
+- if (fcntl(out,F_GETFL,1) == -1) return -1; safe_close(1);
++ if (fcntl(out,F_GETFL,1) == -1) return -1;
++ safe_close(1);
+ if (fcntl(out,F_DUPFD,1) == -1) return -1;
+ #else
+ if (dup2(in,0) == -1) return -1;
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/danish
SECTION:=net
#
-# Copyright (C) 2008-2017 OpenWrt.org
+# Copyright (C) 2008-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
#
PKG_VERSION:=2.7.7
# Release == build
# increase on changes of services files or tld_names.dat
-PKG_RELEASE:=1
+PKG_RELEASE:=5
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
# (Loosely) based on the script on the one posted by exobyte in the forums here:
# http://forum.openwrt.org/viewtopic.php?id=14040
# extended and partial rewritten
-#.2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+#.2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
#
# function timeout
# copied from http://www.ict.griffith.edu.au/anthony/software/timeout.sh
. /lib/functions/network.sh
# GLOBAL VARIABLES #
-VERSION="2.7.6-13"
+VERSION="2.7.7-2"
SECTION_ID="" # hold config's section name
VERBOSE=0 # default mode is log to console, but easily changed with parameter
MYPROG=$(basename $0) # my program call name
UPDFILE="" # store UPTIME of last update
DATFILE="" # save stdout data of WGet and other external programs called
ERRFILE="" # save stderr output of WGet and other external programs called
+IPFILE="" # store registered IP for read by LuCI status
TLDFILE=/usr/share/public_suffix_list.dat.gz # TLD file used by split_FQDN
CHECK_SECONDS=0 # calculated seconds out of given
# CURL_SSL not empty then SSL support available
CURL_SSL=$($(which curl) -V 2>/dev/null | grep "Protocols:" | grep -F "https")
# CURL_PROXY not empty then Proxy support available
-CURL_PROXY=$(find /lib /usr/lib -name libcurl.so* -exec grep -i "all_proxy" {} 2>/dev/null \;)
+CURL_PROXY=$(find /lib /usr/lib -name libcurl.so* -exec strings {} 2>/dev/null \; | grep -im1 "all_proxy")
UCLIENT_FETCH=$(which uclient-fetch)
# UCLIENT_FETCH_SSL not empty then SSL support available
[ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG"
# write to logfile
if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then
- echo -e "$__MSG" >> $LOGFILE
+ [ -n "$password" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$password/*password*/g" )
+ [ -n "$URL_PASS" ] && __MSG=$( printf "%s" "$__MSG" | sed -e "s/$URL_PASS/*URL_PASS*/g" )
+ printf "%s\n" "$__MSG" >> $LOGFILE
# VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines
[ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE
fi
while : ; do
if [ -n "$ip_network" ]; then
# set correct program
+ network_flush_cache # force re-read data from ubus
[ $use_ipv6 -eq 0 ] && __RUNPROG="network_get_ipaddr" \
|| __RUNPROG="network_get_ipaddr6"
eval "$__RUNPROG __DATA $ip_network" || \
fi
[ -n "$__DATA" ] && {
write_log 7 "Registered IP '$__DATA' detected"
+ [ -z "$IPFILE" ] || echo "$__DATA" > $IPFILE
eval "$1=\"$__DATA\"" # valid data found
return 0 # leave here
}
write_log 4 "NO valid IP found"
__ERR=127
fi
+ [ -z "$IPFILE" ] || echo "" > $IPFILE
[ -n "$LUCI_HELPER" ] && return $__ERR # no retry if called by LuCI helper script
[ -n "$2" ] && return $__ERR # $2 is given -> no retry
# /usr/lib/ddns/dynamic_dns_lucihelper.sh
#
#.Distributed under the terms of the GNU General Public License (GPL) version 2.0
-#.2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+#.2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
# This script is used by luci-app-ddns
#
# variables in small chars are read from /etc/config/ddns as parameter given here
get_registered_ip)
[ -z "$lookup_host" ] && usage_err "command 'get_registered_ip': 'lookup_host' not set"
write_log 7 "-----> get_registered_ip IP"
+ [ -z "$SECTION" ] || IPFILE="$ddns_rundir/$SECTION.ip"
IP=""
get_registered_ip IP
__RET=$?
# (Loosely) based on the script on the one posted by exobyte in the forums here:
# http://forum.openwrt.org/viewtopic.php?id=14040
# extended and partial rewritten
-#.2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+#.2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
#
# variables in small chars are read from /etc/config/ddns
# variables in big chars are defined inside these scripts as global vars
UPDFILE="$ddns_rundir/$SECTION_ID.update" # last update successful send (system uptime)
DATFILE="$ddns_rundir/$SECTION_ID.dat" # save stdout data of WGet and other extern programs called
ERRFILE="$ddns_rundir/$SECTION_ID.err" # save stderr output of WGet and other extern programs called
+IPFILE="$ddns_rundir/$SECTION_ID.ip" #
LOGFILE="$ddns_logdir/$SECTION_ID.log" # log file
# VERBOSE > 1 delete logfile if exist to create an empty one
"dnsdynamic.org" "http://[USERNAME]:[PASSWORD]@www.dnsdynamic.org/api/?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
+"dnsever.com" "http://[USERNAME]:[PASSWORD]@dyna.dnsever.com/update.php?host[[DOMAIN]]"
+
"dnsexit.com" "http://update.dnsexit.com/RemoteUpdate.sv?login=[USERNAME]&password=[PASSWORD]&host=[DOMAIN]&myip=[IP]"
"dnshome.de" "http://[USERNAME]:[PASSWORD]@www.dnshome.de/dyndns.php?hostname=[DOMAIN]&ip=[IP]"
"dynv6.com" "http://dynv6.com/api/update?hostname=[DOMAIN]&token=[PASSWORD]&ipv4=[IP]" "updated|unchanged"
-"easydns.com" "http://[USERNAME]:[PASSWORD]@api.cp.easydns.com/dyn/generic.php?hostname=[DOMAIN]&myip=[IP]" "NOERROR"
+"easydns.com" "http://[USERNAME]:[PASSWORD]@api.cp.easydns.com/dyn/generic.php?hostname=[DOMAIN]&myip=[IP]" "OK|NOERROR"
"editdns.net" "http://dyndns-free.editdns.net/api/dynLinux.php?p=[PASSWORD]&r=[DOMAIN]"
"mydns.jp" "http://www.mydns.jp/directip.html?MID=[USERNAME]&PWD=[PASSWORD]&IPV4ADDR=[IP]"
+"myip.co.ua" "http://[USERNAME]:[PASSWORD]@myip.co.ua/update?hostname=[DOMAIN]&myip=[IP]" "good"
+
"myonlineportal.net" "http://[USERNAME]:[PASSWORD]@myonlineportal.net/updateddns?hostname=[DOMAIN]&ip=[IP]" "good|nochg"
"mythic-beasts.com" "http://dnsapi4.mythic-beasts.com/?domain=[USERNAME]&password=[PASSWORD]&command=REPLACE%20[DOMAIN]%2060%20A%20DYNAMIC_IP&origin=."
"dyn.com" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
-"dynu.com" "http://api.dynu.com/nic/update?hostname=[DOMAIN]&myipv6=[IP]&username=[USERNAME]&password=[PASSWORD]"
+"dynu.com" "http://api.dynu.com/nic/update?hostname=[DOMAIN]&myipv6=[IP]&username=[USERNAME]&password=[PASSWORD]"
"dynv6.com" "http://dynv6.com/api/update?hostname=[DOMAIN]&token=[PASSWORD]&ipv6=[IP]" "updated|unchanged"
# script for sending updates to cloudflare.com
#.based on Ben Kulbertis cloudflare-update-record.sh found at http://gist.github.com/benkulbertis
#.and on George Johnson's cf-ddns.sh found at https://github.com/gstuartj/cf-ddns.sh
-#.2016-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+#.2016-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
# CloudFlare API documentation at https://api.cloudflare.com/
#
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
#
# using following options from /etc/config/ddns
-# option username - your cloudflare e-mail
-# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
-# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
+# option username - your cloudflare e-mail
+# option password - cloudflare api key, you can get it from cloudflare.com/my-account/
+# option domain - "hostname@yourdomain.TLD" # syntax changed to remove split_FQDN() function and tld_names.dat.gz
+# option param_opt - Whether the record is receiving the performance and security benefits of Cloudflare (not empty => false)
#
# variable __IP already defined with the ip-address to use for update
#
[ $use_https -eq 0 ] && use_https=1 # force HTTPS
# used variables
-local __HOST __DOMAIN __TYPE __URLBASE __PRGBASE __RUNPROG __DATA __IPV6 __ZONEID __RECID
+local __HOST __DOMAIN __TYPE __URLBASE __PRGBASE __RUNPROG __DATA __IPV6 __ZONEID __RECID __PROXIED
local __URLBASE="https://api.cloudflare.com/client/v4"
# split __HOST __DOMAIN from $domain
}
# update is needed
-# let's build data to send,
+# let's build data to send
+# set proxied parameter (default "true")
+[ -z "$param_opt" ] && __PROXIED="true" || {
+ __PROXIED="false"
+ write_log 7 "Cloudflare 'proxied' disabled"
+}
+
# use file to work around " needed for json
cat > $DATFILE << EOF
-{"id":"$__ZONEID","type":"$__TYPE","name":"$__HOST","content":"$__IP"}
+{"id":"$__ZONEID","type":"$__TYPE","name":"$__HOST","content":"$__IP","proxied":$__PROXIED}
EOF
# let's complete transfer command
#
# script for sending updates to godaddy.com
#.based on GoDaddy.sh v1.0 by Nazar78 @ TeaNazaR.com
-#.2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+#.2017-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
# GoDaddy Documentation at https://developer.godaddy.com/doc
#
# This script is parsed by dynamic_dns_functions.sh inside send_update() function
write_log 7 "$(cat $DATFILE)"
return 1
}
+ return 0
}
# Build base command to use
+++ /dev/null
-menu "Configuration"
- depends on PACKAGE_ethtool
-
- config ETHTOOL_PRETTY_DUMP
- bool "Enable pretty printing"
-
-endmenu
+++ /dev/null
-#
-# Copyright (C) 2006-2014 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=ethtool
-PKG_VERSION:=4.13
-PKG_RELEASE:=1
-
-PKG_MAINTAINER:=Matthias Schiffer <mschiffer@universe-factory.net>
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
-PKG_HASH:=b7c1a380007d30eaf261a63b3cfc000f9d93f9eb7626dcd48b5d2a733af99cba
-
-PKG_LICENSE:=GPL-2.0
-PKG_LICENSE_FILES:=COPYING
-
-PKG_FIXUP:=autoreconf
-PKG_INSTALL:=1
-PKG_BUILD_PARALLEL:=1
-
-PKG_CONFIG_DEPENDS:=ETHTOOL_PRETTY_DUMP
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/ethtool
- SECTION:=net
- CATEGORY:=Network
- TITLE:=Display or change ethernet card settings
- URL:=http://www.kernel.org/pub/software/network/ethtool/
-endef
-
-define Package/ethtool/description
- ethtool is a small utility for examining and tuning your ethernet-based
- network interface
-endef
-
-define Package/ethtool/config
- source "$(SOURCE)/Config.in"
-endef
-
-ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
-CONFIGURE_ARGS += --enable-pretty-dump
-else
-CONFIGURE_ARGS += --disable-pretty-dump
-endif
-
-define Package/ethtool/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
-endef
-
-$(eval $(call BuildPackage,ethtool))
#
-# Copyright (C) 2009-2016 OpenWrt.org
+# Copyright (C) 2009-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=git
-PKG_VERSION:=2.15.1
+PKG_VERSION:=2.16.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/software/scm/git/
-PKG_HASH:=999c90fd7d45066992cdb87dda35bdff6dfc1d01496118ea718dfb866da4045c
+PKG_HASH:=d65d99e9e5b081c1f14ea018973806e942a2eb7d0da2ebc01bd2525adee62d48
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
$(RM) $(PKG_INSTALL_DIR)/usr/bin/git-cvsserver
$(CP) $(PKG_INSTALL_DIR)/usr/bin/git-* $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/lib/git-core
- $(LN) /usr/bin/git $(1)/usr/lib/git-core/git
+ ln $(1)/usr/bin/git $(1)/usr/lib/git-core/git
+ ln $(1)/usr/bin/git-shell $(1)/usr/lib/git-core/git-shell
+ ln $(1)/usr/bin/git-upload-pack $(1)/usr/lib/git-core/git-upload-pack
+ $(INSTALL_DIR) $(1)/usr/share/git-core/templates
( cd $(PKG_INSTALL_DIR); $(TAR) \
--exclude=usr/lib/git-core/git-http-backend \
--exclude=usr/lib/git-core/git-http-fetch \
--exclude=usr/lib/git-core/git-remote-ftps \
--exclude=usr/lib/git-core/git-remote-http \
--exclude=usr/lib/git-core/git-remote-https \
+ --exclude=usr/lib/git-core/git \
+ --exclude=usr/lib/git-core/git-shell \
+ --exclude=usr/lib/git-core/git-upload-pack \
-cf - \
usr/lib/git-core \
+ usr/share/git-core/templates \
) | ( cd $(1); $(TAR) -xf - )
- $(INSTALL_DIR) $(1)/usr/share/git-core/templates
endef
define Package/git-http/install
--- a/configure.ac
+++ b/configure.ac
-@@ -926,7 +926,8 @@ AC_RUN_IFELSE(
+@@ -925,7 +925,8 @@ AC_RUN_IFELSE(
FILE *f = fopen(".", "r");
return f)]])],
[ac_cv_fread_reads_directories=no],
])
if test $ac_cv_fread_reads_directories = yes; then
FREAD_READS_DIRECTORIES=UnfortunatelyYes
-@@ -960,7 +961,8 @@ AC_RUN_IFELSE(
+@@ -959,7 +960,8 @@ AC_RUN_IFELSE(
if (snprintf(buf, 3, "%s", "12345") != 5
|| strcmp(buf, "12")) return 1]])],
[ac_cv_snprintf_returns_bogus=no],
])
if test $ac_cv_snprintf_returns_bogus = yes; then
SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
-@@ -983,7 +985,8 @@ yippeeyeswehaveit
+@@ -982,7 +984,8 @@ yippeeyeswehaveit
#endif
]),
[ac_cv_sane_mode_bits=yes],
--- a/Makefile
+++ b/Makefile
-@@ -1197,7 +1197,7 @@ else
+@@ -1234,7 +1234,7 @@ else
endif
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
ifeq "$(curl_check)" "072200"
include $(TOPDIR)/rules.mk
PKG_NAME:=gnunet
-PKG_SOURCE_VERSION:=d052903c8f8062f758636a9ce24568cda5e13c37
-PKG_MIRROR_HASH:=c6a6476c39d90874593911490a8a2a35ddcac9fb0bb2d9908daf239d9b57479e
+PKG_SOURCE_VERSION:=b673e9c3ed4a211b974bc602b893a427533566d7
+PKG_MIRROR_HASH:=89bc8cb5813bd38e0006d91fcd091b0eef533d6ff8462c800bf37d2e19966beb
-PKG_VERSION:=0.10.2-git-20171231-$(PKG_SOURCE_VERSION)
+PKG_VERSION:=0.10.2-git-20180205-$(PKG_SOURCE_VERSION)
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
USERID_gns:=gnunet=958:gnunetdns=452
BIN_gns:=gns gns-import.sh namecache namestore resolver
LIB_gns:=gns gnsrecord namecache namestore
-PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns gnsrecord_identity
+PLUGIN_gns:=block_dns block_gns gnsrecord_conversation gnsrecord_dns gnsrecord_gns
LIBEXEC_gns:=dns2gns helper-dns service-dns service-gns service-namecache service-namestore service-resolver service-zonemaster
CONF_gns:=dns gns namecache namestore resolver zonemaster
PKG_NAME:=gnurl
PKG_VERSION:=7.57.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://gnunet.org/sites/default/files
$(call Package/gnurl/Default)
SECTION:=libs
CATEGORY:=Libraries
- DEPENDS:=+libgnutls +libidn +zlib
+ DEPENDS:=+libgnutls +libidn2 +zlib
TITLE:=A client-side HTTP/HTTPS transfer library
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=haproxy
-PKG_VERSION:=1.7.9
-PKG_RELEASE:=02
+PKG_VERSION:=1.8.4
+PKG_RELEASE:=01
PKG_SOURCE:=haproxy-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.haproxy.org/download/1.7/src/
-PKG_HASH:=1072337e54fa188dc6e0cfe3ba4c2200b07082e321cbfe5a0882d85d54db068e
+PKG_SOURCE_URL:=https://www.haproxy.org/download/1.8/src/
+PKG_HASH:=e305b0a4e7dec08072841eef6ac6dcd1b5586b1eff09c2d51e152a912e8884a6
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0
SECTION:=net
CATEGORY:=Network
TITLE:=The Reliable, High Performance TCP/HTTP Load Balancer
- URL:=http://haproxy.1wt.eu/
+ URL:=https://www.haproxy.org/
endef
define Download/lua534
FILE:=lua-5.3.4.tar.gz
- URL:=http://www.lua.org/ftp/
+ URL:=https://www.lua.org/ftp/
HASH:=f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c
endef
endef
define Package/haproxy
- DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncursesw +libreadline +@OPENSSL_WITH_DEPRECATED +@OPENSSL_WITH_EC +@OPENSSL_WITH_EC2M +@OPENSSL_WITH_DTLS +@OPENSSL_WITH_COMPRESSION +@OPENSSL_WITH_NPN +@OPENSSL_WITH_PSK +@OPENSSL_WITH_SRP +@OPENSSL_ENGINE_DIGEST +@OPENSSL_ENGINE_CRYPTO
+ DEPENDS+= +libpcre +libltdl +zlib +libpthread +libopenssl +libncursesw +libreadline +libatomic +@OPENSSL_WITH_DEPRECATED +@OPENSSL_WITH_EC +@OPENSSL_WITH_EC2M +@OPENSSL_WITH_DTLS +@OPENSSL_WITH_COMPRESSION +@OPENSSL_WITH_NPN +@OPENSSL_WITH_PSK +@OPENSSL_WITH_SRP +@OPENSSL_ENGINE_DIGEST +@OPENSSL_ENGINE_CRYPTO
TITLE+= (with SSL support)
VARIANT:=ssl
define Package/haproxy-nossl
TITLE+= (without SSL support)
VARIANT:=nossl
- DEPENDS+= +libpcre +libltdl +zlib +libpthread
+ DEPENDS+= +libpcre +libltdl +zlib +libpthread +libatomic
TITLE+= (without SSL support)
$(call Package/haproxy/Default)
endef
endef
ENABLE_LUA:=y
+ENABLE_REGPARM:=n
+
ifeq ($(CONFIG_mips),y)
ENABLE_LUA:=n
endif
+ifeq ($(CONFIG_mipsel),y)
+ ENABLE_LUA:=n
+endif
+
+ifeq ($(CONFIG_TARGET_x86),y)
+ ENABLE_REGPARM:=y
+endif
ifeq ($(CONFIG_avr32),y)
LINUX_TARGET:=linux26
ifeq ($(BUILD_VARIANT),ssl)
ADDON+=USE_OPENSSL=1
ADDON+=ADDLIB="-lcrypto -lm "
-else ifeq ($(CONFIG_mips),n)
+endif
+
+ifeq ($(ENABLE_LUA),y)
ADDON+=USE_LUA=1
ADDON+=LUA_LIB_NAME="lua534"
ADDON+=LUA_INC="$(STAGING_DIR)/lua-5.3.4/include"
ADDON+=LUA_LIB="$(STAGING_DIR)/lua-5.3.4/lib"
-else
- ADDON+=ADDLIB="-lm"
+endif
+
+ifeq ($(ENABLE_REGPARM),y)
+ ADDON+=USE_REGPARM=1
endif
ifeq ($(ENABLE_LUA),y)
CC="$(TARGET_CC)" \
PCREDIR="$(STAGING_DIR)/usr/" \
SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530 " \
- USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_REGPARM=1 \
- USE_ZLIB=yes USE_PCRE=1 USE_PCRE_JIT=1\
+ USE_LINUX_TPROXY=1 USE_LINUX_SPLICE=1 USE_TFO=1 \
+ USE_ZLIB=yes USE_PCRE=1 USE_PCRE_JIT=1 USE_GETADDRINFO=1 \
VERSION="$(PKG_VERSION)-patch$(PKG_RELEASE)" \
- $(ADDON)
- CFLAGS="$(TARGET_CFLAGS) -fno-align-jumps -fno-align-functions -fno-align-labels -fno-align-loops -pipe -fomit-frame-pointer -fhonour-copts" \
- LD="$(TARGET_LD)" \
- LDFLAGS="$(TARGET_LDFLAGS) -lcurses -lreadline" \
- GNOREGIT=1
+ $(ADDON) \
+ LD="$(TARGET_CC)" \
+ LDFLAGS="$(TARGET_LDFLAGS) -latomic" \
+ IGNOREGIT=1
$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" \
+++ /dev/null
-From 912e8f18ef274fdda0a522b2aa8255bddd00fb7b Mon Sep 17 00:00:00 2001
-From: Willy Tarreau <w@1wt.eu>
-Date: Wed, 30 Aug 2017 07:35:35 +0200
-Subject: [PATCH] BUG/MEDIUM: connection: remove useless flag CO_FL_DATA_RD_SH
-
-This flag is both confusing and wrong. It is supposed to report the
-fact that the data layer has received a shutdown, but in fact this is
-reported by CO_FL_SOCK_RD_SH which is set by the transport layer after
-this condition is detected. The only case where the flag above is set
-is in the stream interface where CF_SHUTR is also set on the receiving
-channel.
-
-In addition, it was checked in the health checks code (while never set)
-and was always test jointly with CO_FL_SOCK_RD_SH everywhere, except in
-conn_data_read0_pending() which incorrectly doesn't match the second
-time it's called and is fortunately protected by an extra check on
-(ic->flags & CF_SHUTR).
-
-This patch gets rid of the flag completely. Now conn_data_read0_pending()
-accurately reports the fact that the transport layer has detected the end
-of the stream, regardless of the fact that this state was already consumed,
-and the stream interface watches ic->flags&CF_SHUTR to know if the channel
-was already closed by the upper layer (which it already used to do).
-
-The now unused conn_data_read0() function was removed.
-(cherry picked from commit 54e917cfa1e7b0539550ae32c48c76da2f169041)
-
-[wt: this happens to fix a real bug which occasionally strikes when
- using http-reuse in the rare case where a server shuts down after
- providing its response but before the connection is put back into
- the idle pool, and it gets immediately recycled for another request,
- without first passing through the idle handler, and the already
- reported shutdown is never reported to the second transaction,
- causing a loop to last for as long as the server timeout]
----
- contrib/debug/flags.c | 1 -
- include/proto/connection.h | 8 +-------
- include/types/connection.h | 2 +-
- src/checks.c | 4 ++--
- src/stream_interface.c | 11 +++++------
- 5 files changed, 9 insertions(+), 17 deletions(-)
-
-diff --git a/contrib/debug/flags.c b/contrib/debug/flags.c
-index bc71bde9..19327f34 100644
---- a/contrib/debug/flags.c
-+++ b/contrib/debug/flags.c
-@@ -117,7 +117,6 @@ void show_conn_flags(unsigned int f)
- SHOW_FLAG(f, CO_FL_SOCK_WR_SH);
- SHOW_FLAG(f, CO_FL_SOCK_RD_SH);
- SHOW_FLAG(f, CO_FL_DATA_WR_SH);
-- SHOW_FLAG(f, CO_FL_DATA_RD_SH);
- SHOW_FLAG(f, CO_FL_WAKE_DATA);
- SHOW_FLAG(f, CO_FL_INIT_DATA);
- SHOW_FLAG(f, CO_FL_ADDR_TO_SET);
-diff --git a/include/proto/connection.h b/include/proto/connection.h
-index fce60259..eb68322a 100644
---- a/include/proto/connection.h
-+++ b/include/proto/connection.h
-@@ -413,12 +413,6 @@ static inline void conn_sock_read0(struct connection *c)
- fdtab[c->t.sock.fd].linger_risk = 0;
- }
-
--static inline void conn_data_read0(struct connection *c)
--{
-- c->flags |= CO_FL_DATA_RD_SH;
-- __conn_data_stop_recv(c);
--}
--
- static inline void conn_sock_shutw(struct connection *c)
- {
- c->flags |= CO_FL_SOCK_WR_SH;
-@@ -450,7 +444,7 @@ static inline void conn_data_shutw_hard(struct connection *c)
- /* detect sock->data read0 transition */
- static inline int conn_data_read0_pending(struct connection *c)
- {
-- return (c->flags & (CO_FL_DATA_RD_SH | CO_FL_SOCK_RD_SH)) == CO_FL_SOCK_RD_SH;
-+ return (c->flags & CO_FL_SOCK_RD_SH) != 0;
- }
-
- /* detect data->sock shutw transition */
-diff --git a/include/types/connection.h b/include/types/connection.h
-index 02eac932..90e8e073 100644
---- a/include/types/connection.h
-+++ b/include/types/connection.h
-@@ -90,7 +90,7 @@ enum {
- CO_FL_WAKE_DATA = 0x00008000, /* wake-up data layer upon activity at the transport layer */
-
- /* flags used to remember what shutdown have been performed/reported */
-- CO_FL_DATA_RD_SH = 0x00010000, /* DATA layer was notified about shutr/read0 */
-+ /* unused : 0x00010000 */
- CO_FL_DATA_WR_SH = 0x00020000, /* DATA layer asked for shutw */
- CO_FL_SOCK_RD_SH = 0x00040000, /* SOCK layer was notified about shutr/read0 */
- CO_FL_SOCK_WR_SH = 0x00080000, /* SOCK layer asked for shutw */
-diff --git a/src/checks.c b/src/checks.c
-index ca3881a5..6c5e3cbc 100644
---- a/src/checks.c
-+++ b/src/checks.c
-@@ -839,7 +839,7 @@ static void event_srv_chk_r(struct connection *conn)
- done = 0;
-
- conn->xprt->rcv_buf(conn, check->bi, check->bi->size);
-- if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_DATA_RD_SH)) {
-+ if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH)) {
- done = 1;
- if ((conn->flags & CO_FL_ERROR) && !check->bi->i) {
- /* Report network errors only if we got no other data. Otherwise
-@@ -2892,7 +2892,7 @@ static void tcpcheck_main(struct connection *conn)
- goto out_end_tcpcheck;
-
- if (conn->xprt->rcv_buf(conn, check->bi, check->bi->size) <= 0) {
-- if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_DATA_RD_SH)) {
-+ if (conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH)) {
- done = 1;
- if ((conn->flags & CO_FL_ERROR) && !check->bi->i) {
- /* Report network errors only if we got no other data. Otherwise
-diff --git a/src/stream_interface.c b/src/stream_interface.c
-index 836487bd..aba49c94 100644
---- a/src/stream_interface.c
-+++ b/src/stream_interface.c
-@@ -1060,14 +1060,14 @@ static void si_conn_recv_cb(struct connection *conn)
- if (conn->flags & CO_FL_ERROR)
- return;
-
-- /* stop here if we reached the end of data */
-- if (conn_data_read0_pending(conn))
-- goto out_shutdown_r;
--
- /* maybe we were called immediately after an asynchronous shutr */
- if (ic->flags & CF_SHUTR)
- return;
-
-+ /* stop here if we reached the end of data */
-+ if (conn_data_read0_pending(conn))
-+ goto out_shutdown_r;
-+
- cur_read = 0;
-
- if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !ic->buf->o &&
-@@ -1153,7 +1153,7 @@ static void si_conn_recv_cb(struct connection *conn)
- * that if such an event is not handled above in splice, it will be handled here by
- * recv().
- */
-- while (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_DATA_RD_SH | CO_FL_WAIT_ROOM | CO_FL_HANDSHAKE))) {
-+ while (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_RD_SH | CO_FL_WAIT_ROOM | CO_FL_HANDSHAKE)) && !(ic->flags & CF_SHUTR)) {
- max = channel_recv_max(ic);
-
- if (!max) {
-@@ -1267,7 +1267,6 @@ static void si_conn_recv_cb(struct connection *conn)
- if (ic->flags & CF_AUTO_CLOSE)
- channel_shutw_now(ic);
- stream_sock_read0(si);
-- conn_data_read0(conn);
- return;
- }
-
---
-2.13.5
-
--- /dev/null
+From 2fcd544272a5498ffa49544e9f06b51bc93e55d1 Mon Sep 17 00:00:00 2001
+From: Olivier Houchard <ohouchard@haproxy.com>
+Date: Tue, 13 Feb 2018 15:17:23 +0100
+Subject: [PATCH] BUG/MEDIUM: ssl: Don't always treat SSL_ERROR_SYSCALL as
+ unrecovarable.
+
+Bart Geesink reported some random errors appearing under the form of
+termination flags SD in the logs for connections involving SSL traffic
+to reach the servers.
+
+Tomek Gacek and Mateusz Malek finally narrowed down the problem to commit
+c2aae74 ("MEDIUM: ssl: Handle early data with OpenSSL 1.1.1"). It happens
+that the special case of SSL_ERROR_SYSCALL isn't handled anymore since
+this commit.
+
+SSL_read() might return <= 0, and SSL_get_erro() return SSL_ERROR_SYSCALL,
+without meaning the connection is gone. Before flagging the connection
+as in error, check the errno value.
+
+This should be backported to 1.8.
+
+(cherry picked from commit 7e2e505006feb8f3b4a7f9e0ac5e89b5a8c4895e)
+Signed-off-by: Willy Tarreau <w@1wt.eu>
+---
+ src/ssl_sock.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/ssl_sock.c b/src/ssl_sock.c
+index aecf3dd..f118724 100644
+--- a/src/ssl_sock.c
++++ b/src/ssl_sock.c
+@@ -5437,6 +5437,12 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
+ break;
+ } else if (ret == SSL_ERROR_ZERO_RETURN)
+ goto read0;
++ /* For SSL_ERROR_SYSCALL, make sure the error is
++ * unrecoverable before flagging the connection as
++ * in error.
++ */
++ if (ret == SSL_ERROR_SYSCALL && (!errno || errno == EAGAIN))
++ goto clear_ssl_error;
+ /* otherwise it's a real error */
+ goto out_error;
+ }
+@@ -5451,11 +5457,12 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
+ conn_sock_read0(conn);
+ goto leave;
+ out_error:
++ conn->flags |= CO_FL_ERROR;
++clear_ssl_error:
+ /* Clear openssl global errors stack */
+ ssl_sock_dump_errors(conn);
+ ERR_clear_error();
+
+- conn->flags |= CO_FL_ERROR;
+ goto leave;
+ }
+
+--
+1.7.10.4
+
--- /dev/null
+From f7fa1d461aa71bbc8a6c23fdcfc305f2e52ce5dd Mon Sep 17 00:00:00 2001
+From: Christopher Faulet <cfaulet@haproxy.com>
+Date: Mon, 19 Feb 2018 14:25:15 +0100
+Subject: [PATCH] BUG/MEDIUM: ssl: Shutdown the connection for reading on
+ SSL_ERROR_SYSCALL
+
+When SSL_read returns SSL_ERROR_SYSCALL and errno is unset or set to EAGAIN, the
+connection must be shut down for reading. Else, the connection loops infinitly,
+consuming all the CPU.
+
+The bug was introduced in the commit 7e2e50500 ("BUG/MEDIUM: ssl: Don't always
+treat SSL_ERROR_SYSCALL as unrecovarable."). This patch must be backported in
+1.8 too.
+
+(cherry picked from commit 4ac77a98cda3d0f9b1d9de7bbbda2c91357f0767)
+Signed-off-by: Willy Tarreau <w@1wt.eu>
+---
+ src/ssl_sock.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/src/ssl_sock.c b/src/ssl_sock.c
+index f118724..a065bbb 100644
+--- a/src/ssl_sock.c
++++ b/src/ssl_sock.c
+@@ -5437,10 +5437,9 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
+ break;
+ } else if (ret == SSL_ERROR_ZERO_RETURN)
+ goto read0;
+- /* For SSL_ERROR_SYSCALL, make sure the error is
+- * unrecoverable before flagging the connection as
+- * in error.
+- */
++ /* For SSL_ERROR_SYSCALL, make sure to clear the error
++ * stack before shutting down the connection for
++ * reading. */
+ if (ret == SSL_ERROR_SYSCALL && (!errno || errno == EAGAIN))
+ goto clear_ssl_error;
+ /* otherwise it's a real error */
+@@ -5453,16 +5452,19 @@ static int ssl_sock_to_buf(struct connection *conn, struct buffer *buf, int coun
+ conn_cond_update_sock_polling(conn);
+ return done;
+
++ clear_ssl_error:
++ /* Clear openssl global errors stack */
++ ssl_sock_dump_errors(conn);
++ ERR_clear_error();
+ read0:
+ conn_sock_read0(conn);
+ goto leave;
++
+ out_error:
+ conn->flags |= CO_FL_ERROR;
+-clear_ssl_error:
+ /* Clear openssl global errors stack */
+ ssl_sock_dump_errors(conn);
+ ERR_clear_error();
+-
+ goto leave;
+ }
+
+--
+1.7.10.4
+
--- /dev/null
+From 8a5949f2d74c3a3a6c6da25449992c312b183ef3 Mon Sep 17 00:00:00 2001
+From: Christopher Faulet <cfaulet@haproxy.com>
+Date: Fri, 2 Feb 2018 15:54:15 +0100
+Subject: [PATCH] BUG/MEDIUM: http: Switch the HTTP response in tunnel mode as
+ earlier as possible
+
+When the body length is undefined (no Content-Length or Transfer-Encoding
+headers), The reponse remains in ending mode, waiting the request is done. So,
+most of time this is not a problem because the resquest is done before the
+response. But when a client sends data to a server that replies without waiting
+all the data, it is really not desirable to wait the end of the request to
+finish the response.
+
+This bug was introduced when the tunneling of the request and the reponse was
+refactored, in commit 4be980391 ("MINOR: http: Switch requests/responses in
+TUNNEL mode only by checking txn flag").
+
+This patch should be backported in 1.8 and 1.7.
+
+(cherry picked from commit fd04fcf5edb0a24cd29ce8f4d4dc2aa3a0e2e82c)
+Signed-off-by: Willy Tarreau <w@1wt.eu>
+---
+ src/proto_http.c | 15 +++++----------
+ 1 file changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/src/proto_http.c b/src/proto_http.c
+index 64bd410..29880ea 100644
+--- a/src/proto_http.c
++++ b/src/proto_http.c
+@@ -4634,16 +4634,8 @@ int http_sync_res_state(struct stream *s)
+ * let's enforce it now that we're not expecting any new
+ * data to come. The caller knows the stream is complete
+ * once both states are CLOSED.
+- *
+- * However, there is an exception if the response length
+- * is undefined. In this case, we switch in TUNNEL mode.
+ */
+- if (!(txn->rsp.flags & HTTP_MSGF_XFER_LEN)) {
+- channel_auto_read(chn);
+- txn->rsp.msg_state = HTTP_MSG_TUNNEL;
+- chn->flags |= CF_NEVER_WAIT;
+- }
+- else if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
++ if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
+ channel_shutr_now(chn);
+ channel_shutw_now(chn);
+ }
+@@ -6241,6 +6233,8 @@ http_msg_forward_body(struct stream *s, struct http_msg *msg)
+ /* The server still sending data that should be filtered */
+ if (!(chn->flags & CF_SHUTR) && HAS_DATA_FILTERS(s, chn))
+ goto missing_data_or_waiting;
++ msg->msg_state = HTTP_MSG_TUNNEL;
++ goto ending;
+ }
+
+ msg->msg_state = HTTP_MSG_ENDING;
+@@ -6262,7 +6256,8 @@ http_msg_forward_body(struct stream *s, struct http_msg *msg)
+ /* default_ret */ 1,
+ /* on_error */ goto error,
+ /* on_wait */ goto waiting);
+- msg->msg_state = HTTP_MSG_DONE;
++ if (msg->msg_state == HTTP_MSG_ENDING)
++ msg->msg_state = HTTP_MSG_DONE;
+ return 1;
+
+ missing_data_or_waiting:
+--
+1.7.10.4
+
--- /dev/null
+From 7ccf7c9791f2b2329f3940d1347618af3a77bebc Mon Sep 17 00:00:00 2001
+From: Emeric Brun <ebrun@haproxy.com>
+Date: Mon, 19 Feb 2018 15:59:48 +0100
+Subject: [PATCH] BUG/MEDIUM: ssl/sample: ssl_bc_* fetch keywords are broken.
+
+Since the split between connections and conn-stream objects, this
+keywords are broken.
+
+This patch must be backported in 1.8
+
+(cherry picked from commit eb8def9f34c37537d56a69fcd211d4c4c8006bea)
+Signed-off-by: Willy Tarreau <w@1wt.eu>
+---
+ src/ssl_sock.c | 31 ++++++++++++++-----------------
+ 1 file changed, 14 insertions(+), 17 deletions(-)
+
+diff --git a/src/ssl_sock.c b/src/ssl_sock.c
+index 4d0d5db..d832d76 100644
+--- a/src/ssl_sock.c
++++ b/src/ssl_sock.c
+@@ -6580,8 +6580,8 @@ smp_fetch_ssl_x_key_alg(const struct arg *args, struct sample *smp, const char *
+ static int
+ smp_fetch_ssl_fc(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+
+ smp->data.type = SMP_T_BOOL;
+ smp->data.u.sint = (conn && conn->xprt == &ssl_sock);
+@@ -6625,8 +6625,8 @@ smp_fetch_ssl_fc_is_resumed(const struct arg *args, struct sample *smp, const ch
+ static int
+ smp_fetch_ssl_fc_cipher(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+
+ smp->flags = 0;
+ if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
+@@ -6651,9 +6651,8 @@ smp_fetch_ssl_fc_cipher(const struct arg *args, struct sample *smp, const char *
+ static int
+ smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
+-
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+ int sint;
+
+ smp->flags = 0;
+@@ -6676,8 +6675,8 @@ smp_fetch_ssl_fc_alg_keysize(const struct arg *args, struct sample *smp, const c
+ static int
+ smp_fetch_ssl_fc_use_keysize(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+
+ smp->flags = 0;
+ if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
+@@ -6747,8 +6746,8 @@ smp_fetch_ssl_fc_alpn(const struct arg *args, struct sample *smp, const char *kw
+ static int
+ smp_fetch_ssl_fc_protocol(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+
+ smp->flags = 0;
+ if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
+@@ -6773,9 +6772,8 @@ static int
+ smp_fetch_ssl_fc_session_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+ #if OPENSSL_VERSION_NUMBER > 0x0090800fL
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
+-
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+ SSL_SESSION *ssl_sess;
+
+ smp->flags = SMP_F_CONST;
+@@ -6917,9 +6915,8 @@ static int
+ smp_fetch_ssl_fc_unique_id(const struct arg *args, struct sample *smp, const char *kw, void *private)
+ {
+ #if OPENSSL_VERSION_NUMBER > 0x0090800fL
+- struct connection *conn = objt_conn((kw[4] != 'b') ? smp->sess->origin :
+- smp->strm ? smp->strm->si[1].end : NULL);
+-
++ struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
++ smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
+ int finished_len;
+ struct chunk *finished_trash;
+
+--
+1.7.10.4
+
include $(TOPDIR)/rules.mk
PKG_NAME:=https_dns_proxy
-PKG_VERSION:=2017-01-07
-PKG_RELEASE=2
+PKG_VERSION:=2018-04-23
+PKG_RELEASE=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=befd075fd8175bb5322de8eeb8c7be218fd4ec255814cbf07051216f613fe2e6
+PKG_MIRROR_HASH:=24b7e4238c37e646f33eee3a374f6b7beb5c167b9c5008cc13b51e5f1f3a44ea
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=c62ce3f6807a4067230a8bc5ea5a829f532de785
+PKG_SOURCE_VERSION:=bea68401330e611f6e9b75cec84e2dc4e81e52de
PKG_MAINTAINER:=Aaron Drew <aarond10@gmail.com>
PKG_LICENSE:=MIT
SECTION:=net
CATEGORY:=Network
TITLE:=DNS over HTTPS proxy server
- DEPENDS:=+libcares +libcurl +libev
+ DEPENDS:=+libcares +libcurl +libev +ca-bundle
endef
define Package/https_dns_proxy/install
option listen_port '5053'
option user 'nobody'
option group 'nogroup'
+ option subnet_addr ''
+ option proxy_server ''
+ option url_prefix 'https://dns.google.com/resolve?'
config_get listen_port "$cfg" listen_port
config_get user "$cfg" user
config_get group "$cfg" group
+ config_get subnet_addr "$cfg" subnet_addr
+ config_get proxy_server "$cfg" proxy_server
+ config_get url_prefix "$cfg" url_prefix
+
+ if [ -n "$subnet_addr" ]; then
+ subnet_param="-e $subnet_addr"
+ fi
+
+ if [ -n "$proxy_server" ]; then
+ proxy_param="-t $proxy_server"
+ fi
+
+ if [ -z "$url_prefix" ]; then
+ url_prefix="https://dns.google.com/resolve?"
+ fi
procd_open_instance
procd_set_param command ${PROG} \
-a "$listen_addr" -p "$listen_port" \
- -u "$user" -g "$group"
+ -u "$user" -g "$group" $subnet_param $proxy_param \
+ -r "$url_prefix"
procd_set_param respawn
procd_close_instance
}
include $(TOPDIR)/rules.mk
PKG_NAME:=i2pd
-PKG_VERSION:=2.17.0
-PKG_RELEASE:=2
+PKG_VERSION:=2.18.0
+PKG_RELEASE:=1
PKG_BUILD_PARALLEL:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MIRROR_HASH:=1a04826b54e649ebb341d3feacdd05c0415335679d1aa787a74ea5995d419378
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/PurpleI2P/i2pd.git
PKG_SOURCE_VERSION:=$(PKG_VERSION)
-PKG_MIRROR_HASH:=d389615366e603468c6d213e6545dfea99090d4a83aac121b6e2e4e5d0aac925
PKG_LICENSE:=BSD-3-clause
include $(INCLUDE_DIR)/package.mk
#
-# Copyright (C) 2017 Daniel Engberg <daniel.engberg.lists@pyret.net>
+# Copyright (C) 2017-2018 Daniel Engberg <daniel.engberg.lists@pyret.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=inadyn
-PKG_VERSION=2.2
+PKG_VERSION:=2.3
PKG_RELEASE:=1
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net>
+PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/troglobit/inadyn/releases/download/v$(PKG_VERSION)
-PKG_HASH:=27aed84a3d04591540b01ef91a5af4b02cbd0e0c20db36a2660453780bd645f6
+PKG_HASH:=4a98b80d8565b9e4cb32b19b7a8b06a22a7d9a6f4f03a5298a8d441b6187c760
PKG_FIXUP:=autoreconf
CATEGORY:=Network
DEPENDS:=+confuse +libopenssl +ca-certificates
TITLE:=A Dynamic DNS client with SSL/TLS support
- URL:=https://github.com/troglobit/inadyn
+ URL:=http://troglobit.com/project/inadyn/
SUBMENU:=IP Addresses and Names
endef
define Package/inadyn/description
- Suitable for embedded systems, written in C.
+ Inadyn is a small and simple Dynamic DNS, DDNS, client with HTTPS support
endef
define Package/inadyn/conffiles
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://fedorahosted.org/releases/i/p/iptraf-ng/
+PKG_SOURCE_URL:=https://infrastructure.fedoraproject.org/infra/hosted-content/$(PKG_NAME)/$(PKG_NAME)
PKG_HASH:=79140cf07c0cceb1b5723242847a73aa86f5e4f9dccfe8970fda6801d347eb09
PKG_LICENSE:=GPL-2.0
CATEGORY:=Network
DEPENDS:=+libncurses
TITLE:=A console-based network monitoring program
- URL:=https://fedorahosted.org/iptraf-ng/
+ URL:=https://infrastructure.fedoraproject.org/infra/hosted-content/iptraf-ng/
endef
define Package/iptraf-ng/description
include $(TOPDIR)/rules.mk
PKG_NAME:=irssi
-PKG_VERSION:=1.0.6
+PKG_VERSION:=1.1.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=https://github.com/irssi/irssi/releases/download/1.0.6/
-PKG_HASH:=029e884f3ebf337f7266d8ed4e1a035ca56d9f85015d74c868b488f279de8585
+PKG_SOURCE_URL:=https://github.com/irssi/irssi/releases/download/1.1.1/
+PKG_HASH:=784807e7a1ba25212347f03e4287cff9d0659f076edfb2c6b20928021d75a1bf
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_NAME:=isc-dhcp
UPSTREAM_NAME:=dhcp
-PKG_VERSION:=4.3.6
+PKG_VERSION:=4.4.1
PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/$(PKG_VERSION) \
http://ftp.funet.fi/pub/mirrors/ftp.isc.org/isc/dhcp/$(PKG_VERSION) \
http://ftp.iij.ad.jp/pub/network/isc/dhcp/$(PKG_VERSION)
-PKG_HASH:=a41eaf6364f1377fe065d35671d9cf82bbbc8f21207819b2b9f33f652aec6f1b
+PKG_HASH:=2a22508922ab367b4af4664a0472dc220cc9603482cf3c16d9aff14f3a76b608
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
+DISABLE_NLS:=
+
define Package/isc-dhcp/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=ISC's DHCP
URL:=https://www.isc.org/software/dhcp
+ DEPENDS:=+zlib
endef
define Package/isc-dhcp-relay-ipv4
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dhcrelay $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/config
- $(INSTALL_DATA) ./files/etc/config/dhcrelay $(1)/etc/config
+ $(INSTALL_DATA) ./files/dhcrelay.conf $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/dhcrelay4.init $(1)/etc/init.d/dhcrelay4
endef
if [ -n "$gateway" ] ; then
echo " option routers $gateway;"
fi
+ config_list_foreach "$cfg" "dhcp_option" append_dhcp_options
echo "}"
done
}
config_foreach static_host_add host "$@"
}
+typeof() {
+ echo "$1" | awk '
+/^\d+\.\d+\.\d+\.\d+$/ { print "ip\n"; next; }
+/^(true|false)$/ { print "bool\n"; next; }
+/^\d+$/ { print "integer\n"; next; }
+/^"[^"]*"$/ { print "string\n"; next; }
+ { print "other\n"; next; }
+'
+}
+
+append_dhcp_options() {
+ local tuple="$1"
+
+ # strip redundant "option:" prefix
+ tuple="${tuple#option:}"
+
+ local tag="${tuple%%,*}"
+ local values="${tuple#$tag,}"
+
+ local formatted value
+ local IFS=$', \n'
+ for value in $values; do
+ # detect type of $value and quote if necessary
+ case $(typeof "$value") in
+ ip|bool|integer|string)
+ ;;
+ other)
+ value="\"$value\""
+ ;;
+ esac
+ formatted="$formatted${formatted:+, }$value"
+ done
+ echo " option $tag $formatted;"
+}
+
gen_dhcp_subnet() {
+ local cfg="$1"
+
echo "subnet $NETWORK netmask $NETMASK {"
echo " range $START $END;"
echo " option subnet-mask $netmask;"
fi
echo " option routers $gateway;"
echo " option domain-name-servers $DNS;"
+ config_list_foreach "$cfg" "dhcp_option" append_dhcp_options
echo "}"
}
gateway="$IP"
fi
- gen_dhcp_subnet >> $config_file
+ gen_dhcp_subnet "$cfg" >> $config_file
}
general_config() {
config_get max_lease_time "isc_dhcpd" "max_lease_time" 86400
config_get log_facility "isc_dhcpd" "log_facility"
+ config_get domain "isc_dhcpd" "domain"
+
[ $always_broadcast -eq 1 ] && echo "always-broadcast true;"
[ $authoritative -eq 1 ] && echo "authoritative;"
[ $boot_unknown_clients -eq 0 ] && echo "boot-unknown-clients false;"
fi
echo "default-lease-time $default_lease_time;"
echo "max-lease-time $max_lease_time;"
+
+ [ -n "$domain" ] && echo "option domain-name \"$domain\";"
}
start_service() {
touch $lease_file
fi
- dhcp_ifs=""
+ local domain dhcp_ifs
if [ -e "/etc/dhcpd.conf" ] ; then
config_file="/etc/dhcpd.conf"
--- /dev/null
+
+config dhcrelay ipv4
+ option 'enabled' '0'
+
+ # IP address of the server
+ option 'dhcpserver' '192.0.2.10'
+
+ # network interfaces to listen on (e.g. lan or wan)
+ option 'interfaces' ''
+ option 'upstream_interfaces' ''
+ option 'downstream_interfaces' ''
+
+ # What to do about packets that already have a relay option:
+ # 'append': Forward and append our own relay option
+ # 'replace': Forward, but replace theirs with ours (default)
+ # 'forward': Forward without changes
+ # 'discard': Don't forward
+ option 'relay_mode' ''
+
+ # enable RFC3527 link selection sub-option and use the IP address of
+ # the specified network interface as "uplink" IP address (e.g. wan)
+ option 'link_selection' ''
+
+config dhcrelay ipv6
+# option dhcpserver '2001:db8:1::1'
+ option upper 'eth1'
+ list lower 'eth0.2'
+ list lower 'eth0.3'
+
append args "-i $ifname"
fi
done
+ config_get interfaces ipv4 upstream_interfaces
+ for net in $interfaces; do
+ if network_get_device ifname "$net"; then
+ append args "-iu $ifname"
+ fi
+ done
+ config_get interfaces ipv4 downstream_interfaces
+ for net in $interfaces; do
+ if network_get_device ifname "$net"; then
+ append args "-id $ifname"
+ fi
+ done
# link selection sub-option (RFC3527)
local link_selection
+++ /dev/null
-
-config dhcrelay ipv4
- option 'enabled' '0'
-
- # IP address of the server
- option 'dhcpserver' '192.0.2.10'
-
- # network interfaces to listen on (e.g. lan or wan)
- option 'interfaces' ''
-
- # What to do about packets that already have a relay option:
- # 'append': Forward and append our own relay option
- # 'replace': Forward, but replace theirs with ours (default)
- # 'forward': Forward without changes
- # 'discard': Don't forward
- option 'relay_mode' ''
-
- # enable RFC3527 link selection sub-option and use the IP address of
- # the specified network interface as "uplink" IP address (e.g. wan)
- option 'link_selection' ''
-
-config dhcrelay ipv6
-# option dhcpserver '2001:db8:1::1'
- option upper 'eth1'
- list lower 'eth0.2'
- list lower 'eth0.3'
-
-diff --git a/bind/Makefile.in b/bind/Makefile.in
-index bd784c6..5950d19 100644
--- a/bind/Makefile.in
+++ b/bind/Makefile.in
-@@ -85,13 +85,13 @@ bind2:
- echo Bind export libraries already installed ; \
- else \
- echo Building BIND Export libraries - this takes some time. ;\
-- (cd ${bindsrcdir}/lib/export ; \
-- echo building in `pwd` ; \
-- MAKE=${GMAKE} ${GMAKE} >> ${binddir}/build.log) ; \
-+ (cd ${bindsrcdir}/lib/export/dns ; \
-+ echo building gen using ${BUILD_CC} in `pwd` ; \
-+ $(MAKE) CC=${BUILD_CC} CFLAGS="-O2" LIBS="" gen) ; \
- \
- echo Installing BIND Export libraries to ${binddir}. ; \
- (cd ${bindsrcdir}/lib/export ; \
-- MAKE=${GMAKE} ${GMAKE} install > ${binddir}/install.log) ; \
-+ $(MAKE) DESTDIR="" install > ${binddir}/build.log) ; \
- fi
-
- clean:
-@@ -100,6 +100,7 @@ clean:
+@@ -116,5 +116,6 @@ uninstall-bind: all
# Include the following so that this Makefile is happy when the parent
# tries to use them.
+install-exec:
- distdir:
-
+ check distdir distclean dvi installcheck:
--- a/bind/Makefile.in
+++ b/bind/Makefile.in
-@@ -63,8 +63,14 @@
- else \
- echo Configuring BIND Export libraries for DHCP. ; \
+@@ -56,7 +56,12 @@ bind1:
+ echo Configuring BIND libraries for DHCP. ; \
rm -rf ${cleandirs} ${cleanfiles} ; \
-- (cd ${bindsrcdir} && \
+ (cd ${bindsrcdir} && \
- ./configure ${bindconfig} > ${binddir}/configure.log); \
-+ (cd ${bindsrcdir} && export CC=${CROSS_CC} && \
-+ ./configure --disable-atomic --disable-kqueue \
++ export CC=${CROSS_CC} && \
++ ./configure ${bindconfig} --disable-atomic \
++ --disable-kqueue --disable-epoll --disable-kqueue \
+ --disable-epoll --disable-devpoll --without-openssl \
-+ --without-libxml2 --enable-exportlib \
-+ --enable-threads=no \
-+ --with-export-includedir=${binddir}/include \
-+ --with-export-libdir=${binddir}/lib --with-gssapi=no \
-+ --without-randomdev > ${binddir}/configure.log); \
++ --without-libxml2 --disable-threads --without-gssapi \
++ --without-randomdev > ${binddir}/configure.log); \
fi
atf:
include $(TOPDIR)/rules.mk
PKG_NAME:=jool
-PKG_VERSION:=2017.03.09
+PKG_VERSION:=2018.01.17
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/NICMx/Jool.git
-PKG_SOURCE_VERSION:=997a81bb5f5e9d82aa122fd37b7c890e44a245dd
+PKG_SOURCE_VERSION:=9dfaf22e49f7905d94af9b73f9bee22c26d7dd4a
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.xz
-PKG_MIRROR_HASH:=a2c41119be251d4d962234fc78d7122568a5e62484969cc4e80229a0c7422fd4
+PKG_MIRROR_HASH:=79b558561f06f3df01a541b1d39b7d3d88f91d0ee6b8ce3abf91ebbed737225a
PKG_BUILD_DIR=$(KERNEL_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_BUILD_PARALLEL:=1
--- /dev/null
+menu "Configuration"
+ depends on PACKAGE_kadnode
+
+config KADNODE_ENABLE_LPD
+ bool "Enable Local Peer Discovery"
+ depends on PACKAGE_kadnode
+ default y
+
+config KADNODE_ENABLE_CMD
+ bool "Enable Command Console"
+ depends on PACKAGE_kadnode
+ default y
+
+config KADNODE_ENABLE_DNS
+ bool "Enable the local DNS server"
+ depends on PACKAGE_kadnode
+ default y
+
+config KADNODE_ENABLE_TLS
+ bool "Enable TLS authentication support"
+ depends on PACKAGE_kadnode
+ default y
+
+config KADNODE_ENABLE_BOB
+ bool "Enable BOB authentication support"
+ depends on PACKAGE_kadnode
+ default y
+
+config KADNODE_ENABLE_UPNP
+ bool "Enable UPnP support to add port forwardings on other routers"
+ depends on PACKAGE_kadnode
+ default n
+
+config KADNODE_ENABLE_NATPMP
+ bool "Enable NAT-PMP support to add port forwardings on other routers"
+ depends on PACKAGE_kadnode
+ default n
+
+config KADNODE_ENABLE_DEBUG
+ bool "Build in debug mode"
+ depends on PACKAGE_kadnode
+ default n
+
+endmenu
--- /dev/null
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+
+PKG_NAME:=kadnode
+PKG_VERSION:=2.2.0
+PKG_RELEASE:=2
+
+PKG_LICENSE:=MIT
+
+PKG_SOURCE_URL:=https://codeload.github.com/mwarning/KadNode/tar.gz/v$(PKG_VERSION)?
+PKG_SOURCE:=KadNode-$(PKG_VERSION).tar.gz
+PKG_HASH:=1b3ccaa01cbb7548ef268d8b562059452826dc774529303c494418d1a450ca97
+PKG_BUILD_DIR:=$(BUILD_DIR)/KadNode-$(PKG_VERSION)
+
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/kadnode
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=P2P DNS Resolver
+ SUBMENU:=IP Addresses and Names
+ URL:=https://github.com/mwarning/KadNode
+ MENU:=1
+ DEPENDS:=+KADNODE_ENABLE_BOB:libmbedtls +KADNODE_ENABLE_TLS:libmbedtls +KADNODE_ENABLE_UPNP:libminiupnpc +KADNODE_ENABLE_NATPMP:libnatpmp
+ MAINTAINER:=Moritz Warning <moritzwarning@web.de>
+endef
+
+define Package/kadnode/description
+ A P2P DNS system based on the BitTorrent network. It can be used as a decentralized DynDNS service.
+endef
+
+define Package/kadnode/config
+ source "$(SOURCE)/Config.in"
+endef
+
+FEATURES =
+
+ifeq ($(CONFIG_KADNODE_ENABLE_CMD),y)
+FEATURES += cmd
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_LPD),y)
+FEATURES += lpd
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_TLS),y)
+FEATURES += tls
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_BOB),y)
+FEATURES += bob
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_DNS),y)
+FEATURES += dns
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_UPNP),y)
+FEATURES += upnp
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_NATPMP),y)
+FEATURES += natpmp
+endif
+
+ifeq ($(CONFIG_KADNODE_ENABLE_DEBUG),y)
+FEATURES += debug
+endif
+
+MAKE_FLAGS += FEATURES="$(FEATURES)"
+
+# Make binary smaller
+TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
+define Package/kadnode/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/kadnode $(1)/usr/bin/
+ifeq ($(CONFIG_KADNODE_ENABLE_CMD),y)
+ $(LN) /usr/bin/kadnode $(1)/usr/bin/kadnode-ctl
+endif
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) files/kadnode.init $(1)/etc/init.d/kadnode
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_CONF) files/kadnode.config $(1)/etc/config/kadnode
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_BIN) files/kadnode.postinst $(1)/etc/uci-defaults/99_kadnode
+endef
+
+$(eval $(call BuildPackage,kadnode))
--- /dev/null
+##
+## KadNode is a P2P DNS resolver to resolve domains using the BitTorrent network.
+##
+
+config kadnode
+ option enabled 1
+
+
+## ECC Key usage:
+## 1. Create public/secret key pair with `kadnode --bob-create-key /etc/kadnode_secret.pem`
+## 2. Put the secret key file on the router that you want to resolve to and use it for option bob_load_key.
+## 3. Use the public key hex output with .p2p attached on other devices to resovle to the router IP address via kadnode.
+
+## Secret key for public key links
+# list bob_load_key '/etc/kadnode_secret.pem'
+
+
+## TLS usage:
+## For resolving domains, put credentials on the router and use option tls_client_cert.
+## For announcing domains, put the certificates and secret key on router and use option tls_server_cert.
+
+## Folder of CA certificates
+## Install package 'ca-certificates' for the official CA set.
+# list tls_client_cert '/etc/ssl/certs'
+
+## Server credentials
+# list tls_server_cert '/ect/mynode.crt,/etc/mynode.key'
+
+
+## Add domains to be announced.
+## Note: Only needed in special situations since tls_server_cert and bob_load_key announce automatically its associated domains.
+# list announce 'web.myname.p2p'
+
+## Load and store good nodes every 24h and on start/shutdown.
+# option peerfile '/etc/kadnode/peers.txt'
+
+## Add static peers addresses.
+ list peer 'bttracker.debian.org:6881'
+ list peer 'router.bittorrent.com:6881'
+
+## Bind the DHT to this port.
+# option port '6881'
+
+## Limit DHT communication to this interface.
+# option ifname 'eth0'
+
+## Verbosity: quiet, verbose or debug
+# option verbosity 'quiet'
+
+## Local port to accept forwarded requests.
+# option dns_port '3535'
+
+## Disable multicast peer discovery on the LAN.
+# option lpd_disable '1'
+
+## Disable port forwarding when this router is behind another
+## router in a private network that supports UPnP/NAT-PMP.
+# option fwd_disable '1'
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=95
+USE_PROCD=1
+PROG=/usr/bin/kadnode
+OPTS=""
+
+
+boot()
+{
+ # Wait for the loopback interface to be ready
+ ubus -t 30 wait_for network.interface network.loopback 2>/dev/null
+ rc_procd start_service
+}
+
+xappend() {
+ local name="$2" value="$1"
+ OPTS="$OPTS--${name//_/-} ${value//'/\\'}
+"
+}
+
+append_opts_list() {
+ local name cfg="$1"; shift
+ for name in $*; do
+ config_list_foreach "$cfg" "$name" xappend "$name"
+ done
+}
+
+append_opts() {
+ local name value cfg="$1"; shift
+ for name in $*; do
+ config_get value "$cfg" "$name"
+ [ -n "$value" ] && xappend "$value" "$name"
+ done
+}
+
+append_opts_boolean() {
+ local name value cfg="$1"; shift
+ for name in $*; do
+ config_get_bool value "$cfg" "$name" 0
+ [ $value -gt 0 ] && xappend '' $name
+ done
+}
+
+section_enabled() {
+ config_get_bool enabled "$1" 'enabled' 0
+ [ $enabled -gt 0 ]
+}
+
+start_instance() {
+ local cfg="$1"
+ local CONFIG_FILE=/tmp/kadnode.${cfg}.conf
+
+ section_enabled "$cfg" || return
+
+ OPTS=""
+
+ append_opts "$cfg" lpd_addr dns_server dns_port verbosity peerfile config \
+ query_tld user port ifname cmd_port
+
+ append_opts_list "$cfg" announce peer tls_client_cert tls_server_cert bob_load_key
+
+ append_opts_boolean "$cfg" dns_proxy_enable lpd_disable fwd_disable ipv4 ipv6
+
+ # Close stdin when cmd feature is present
+ if [ $($PROG --version | grep -c cmd) -eq 1 ]; then
+ xappend "" "cmd_disable_stdin"
+ fi
+
+ echo "$OPTS" > $CONFIG_FILE
+
+ procd_open_instance
+ procd_set_param command $PROG
+ procd_set_param file $CONFIG_FILE
+ procd_set_param stderr 1
+ procd_set_param stdout 1
+ procd_append_param command --config $CONFIG_FILE
+ procd_close_instance
+}
+
+stop_instance() {
+ local cfg="$1"
+ local CONFIG_FILE=/tmp/kadnode.${cfg}.conf
+
+ rm -f $CONFIG_FILE
+}
+
+start_service() {
+ config_load 'kadnode'
+ config_foreach start_instance 'kadnode'
+}
+
+stop_service() {
+ config_load 'kadnode'
+ config_foreach stop_instance 'kadnode'
+}
--- /dev/null
+#!/bin/sh
+
+uci add_list dhcp.@dnsmasq[0].server='/p2p/::1#3535'
+uci commit dhcp
+
+exit 0
--- /dev/null
+From 12f6ca15b1b80f7fedb3ae3cf9067a8045a9a8fd Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Wed, 2 May 2018 19:54:37 +0200
+Subject: [PATCH] LFLAGS => LDFLAGS
+
+---
+ Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 62be30a..ae994fc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,7 +2,7 @@
+ CC ?= gcc
+ CFLAGS ?= -Os -Wall -Wwrite-strings -pedantic
+ CFLAGS += -std=gnu99 -I/usr/local/include
+-LFLAGS += -L/usr/local/lib -lc
++LDFLAGS += -L/usr/local/lib -lc
+ FEATURES ?= dns lpd tls bob cmd debug nss #natpmp upnp
+
+ OBJS = build/searches.o build/kad.o build/log.o \
+@@ -30,7 +30,7 @@ endif
+ ifeq ($(findstring bob,$(FEATURES)),bob)
+ OBJS += build/ext-bob.o
+ CFLAGS += -DBOB
+- LFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
++ LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
+ endif
+
+ ifeq ($(findstring cmd,$(FEATURES)),cmd)
+@@ -56,20 +56,20 @@ endif
+ ifeq ($(findstring tls,$(FEATURES)),tls)
+ OBJS += build/ext-tls-client.o build/ext-tls-server.o
+ CFLAGS += -DTLS
+- LFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
++ LDFLAGS += -lmbedtls -lmbedx509 -lmbedcrypto
+ endif
+
+ ifeq ($(findstring upnp,$(FEATURES)),upnp)
+ OBJS += build/upnp.o
+ CFLAGS += -DFWD_UPNP
+- LFLAGS += -Wl,-Bdynamic -lminiupnpc
++ LDFLAGS += -Wl,-Bdynamic -lminiupnpc
+ ENABLE_FORWARDING = 1
+ endif
+
+ ifeq ($(findstring natpmp,$(FEATURES)),natpmp)
+ OBJS += build/natpmp.o
+ CFLAGS += -DFWD_NATPMP
+- LFLAGS += -Wl,-Bdynamic -lnatpmp
++ LDFLAGS += -Wl,-Bdynamic -lnatpmp
+ ENABLE_FORWARDING = 1
+ endif
+
+@@ -94,7 +94,7 @@ libkadnode.so: build/libkadnode.o $(OBJS)
+ $(CC) -shared $(OBJS) build/libkadnode.o -o build/libkadnode.so
+
+ kadnode: build/main.o $(OBJS) $(EXTRA)
+- $(CC) build/main.o $(OBJS) -o build/kadnode $(LFLAGS)
++ $(CC) build/main.o $(OBJS) -o build/kadnode $(LDFLAGS)
+ ln -s kadnode build/kadnode-ctl 2> /dev/null || true
+
+ clean:
+--
+2.17.0
+
PKG_NAME:=keepalived
PKG_VERSION:=1.3.9
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:= http://www.keepalived.org/software
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=COPYING
-PKG_MAINTAINER:=Ben Kelly <ben@benjii.net>
+PKG_MAINTAINER:=Ben Kelly <ben@benjii.net> \
+ Florian Eckert <fe@dev.tdt.de>
PKG_INSTALL:=1
CATEGORY:=Network
TITLE:=Failover and monitoring daemon for LVS clusters
URL:=http://www.keepalived.org/
- DEPENDS:=+PACKAGE_libnl-genl:libnl-genl +libopenssl +libip4tc +IPV6:libip6tc +libxtables
+ DEPENDS:= \
+ +PACKAGE_libnl-genl:libnl-genl \
+ +libopenssl \
+ +libip4tc \
+ +IPV6:libip6tc \
+ +libxtables \
+ +kmod-macvlan
endef
define Package/keepalived/description
# Default indent
[ -z "$indent" ] && indent=$INDENT_1
- # If no address or device exit
- [ -z "$address" -o -z "$device" ] && return 0
+ # If no address exit
+ [ -z "$address" ] && return 0
- # Add IP address/netmask and device
- printf "$indent$address dev $device" >> $KEEPALIVED_CONF
- # Add scope
- [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
+ if [ -z "$device" ]; then
+ printf "$indent$address" >> $KEEPALIVED_CONF
+ else
+ # Add IP address/netmask and device
+ printf "$indent$address dev $device" >> $KEEPALIVED_CONF
+ # Add scope
+ [ -n "$scope" ] && printf " scope $scope" >> $KEEPALIVED_CONF
+ fi
printf "\n" >> $KEEPALIVED_CONF
}
printf "$INDENT_1}\n" >> $KEEPALIVED_CONF
}
- print_elems_indent $1 $INDENT_1 use_vmac state interface \
+ print_elems_indent $1 $INDENT_1 state interface \
mcast_src_ip unicast_src_ip virtual_router_id version priority \
advert_int preempt_delay debug \
lvs_sync_daemon_interface garp_master_delay garp_master_refresh \
garp_master_repeat garp_master_refresh_repeat \
no_val_vmac_xmit_base no_val_native_ipv6 no_val_accept \
- no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt
+ no_val_dont_track_primary no_val_smtp_alert no_val_nopreempt \
+ no_val_use_vmac
print_notify "INSTANCE" "$name" notify_backup notify_master \
- notify_fault notify_stop notify
+ notify_fault notify_stop
# Handle virtual_ipaddress & virtual_ipaddress_excluded lists
for opt in virtual_ipaddress virtual_ipaddress_excluded; do
rm -f $KEEPALIVED_CONF
# First line
- printf "! Configuration File for keepalived (autogenerated via init script)\n\n" > $KEEPALIVED_CONF
+ printf "! Configuration file for keepalived (autogenerated via init script)\n" > $KEEPALIVED_CONF
+ printf "! Written %s\n\n" "$(date +'%c')" >> $KEEPALIVED_CONF
[ -f /etc/config/keepalived ] || return 0
config_load 'keepalived'
return 0
}
-service_running() {
- pgrep -x /usr/sbin/keepalived &> /dev/null
-}
-
-conf_md5() {
- echo "$(md5sum $KEEPALIVED_CONF | awk '{print $1}')"
+service_triggers() {
+ procd_add_reload_trigger "keepalived"
}
reload_service() {
- local cur_md5="$(conf_md5)"
- running && {
- process_config
-
- # Return without performing the reload if config
- # file md5sum has not changed
- local new_md5="$(conf_md5)"
- [ "$new_md5" == "$cur_md5" ] && return 0;
-
- # SIGHUP is used by keepalived to do init.d reload
- # Get the oldest process (assumption is that it's the parent process)
- PID=$(pgrep -o /usr/sbin/keepalived)
- kill -SIGHUP $PID
- return 0
- }
- return 1
+ process_config
+ #SIGHUP is used by keepalived to do init.d reload
+ procd_send_signal keepalived
}
start_service() {
include $(TOPDIR)/rules.mk
PKG_NAME:=knot
-PKG_VERSION:=2.6.4
+PKG_VERSION:=2.6.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/
-PKG_HASH:=1d0d37b5047ecd554d927519d5565c29c1ba9b501c100eb5f3a5af184d75386a
+PKG_HASH:=9119d8a56828a596d246431492be8c015f918de65ba793d76071122567c3080a
PKG_MAINTAINER:=Daniel Salzman <daniel.salzman@nic.cz>
PKG_LICENSE:=GPL-3.0 LGPL-2.0 0BSD MIT OLDAP-2.8
include $(TOPDIR)/rules.mk
PKG_NAME:=knxd
-PKG_VERSION:=0.14.18
+PKG_VERSION:=0.14.24
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/knxd/knxd.git
-PKG_SOURCE_VERSION:=5e707fdb7430009a299d3ad849aecf9ccbc8fdf6
+PKG_SOURCE_VERSION:=d29f7047a8b20a7ac57c3c9ad349c12be60f9fee
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=96d5dd7b1513ccf871aed2bdd2601ca2a2f2d1005462fb1c631e5683e2e86e4e
+PKG_MIRROR_HASH:=07857ce8c7c8be965b1baf81566671ab89c3ae8bbcd8f1fe05df0c38a4465664
PKG_MAINTAINER:=Othmar Truniger <github@truniger.ch>
SECTION:=net
CATEGORY:=Network
TITLE:=EIB KNX daemon
- DEPENDS:=+libusb-1.0 +libstdcpp +libev
+ DEPENDS:=+libusb-1.0 +libstdcpp +libev +libfmt
endef
define Package/knxd/description
append_parm args Name "Name" "OpenWrt"
append_bool args no_monitor "no-monitor" 0
append_bool args Routing "Routing" 0
- append_parm args trace "trace" # "7"
append_bool args tpuarts_ack_all_group "tpuarts-ack-all-group" 0
append_bool args tpuarts_ack_all_individual "tpuarts-ack-all-individual" 0
append_bool args tpuarts_disch_reset "tpuarts-disch-reset" 0
append_bool args Discovery "Discovery" 1
append_parm args Server "Server" "224.0.23.12"
append_parm args listen_local "listen-local" "/var/run/knxd"
+ append_parm args trace "trace" # "7"
config_get url args url
if [ "$url" == "usb:" ] ; then
url="usb:""$(findknxusb | tail -n1 | sed -e 's/device: \([0-9]:[0-9]:[0-9]\):[0-9].*/\1/')"
include $(TOPDIR)/rules.mk
PKG_NAME:=krb5
-PKG_VERSION:=1.14.2
-PKG_RELEASE:=2
+PKG_VERSION:=1.16
+PKG_RELEASE:=1
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=NOTICE
-PKG_SOURCE:=krb5-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://web.mit.edu/kerberos/dist/krb5/1.14/
-PKG_HASH:=6bcad7e6778d1965e4ce4af21d2efdc15b274c5ce5c69031c58e4c954cda8b27
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://web.mit.edu/kerberos/dist/krb5/1.16/
+PKG_HASH:=faeb125f83b0fb4cdb2f99f088140631bb47d975982de0956d18c85842969e08
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_CHECK_FORMAT_SECURITY:=0
+PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
--without-system-verto \
--without-tcl \
--without-libedit \
- --localstatedir=/etc
+ --localstatedir=/etc \
+ --with-size-optimizations \
+ --disable-rpath \
+ --without-krb5-config
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
- $(CP) $(PKG_INSTALL_DIR)/usr/include \
- $(1)/usr
+ $(CP) $(PKG_INSTALL_DIR)/usr/include $(1)/usr
$(INSTALL_DIR) $(1)/usr
- $(CP) $(PKG_INSTALL_DIR)/usr/lib \
- $(1)/usr
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib $(1)/usr
+ # needed for samba4, to detect system-krb5
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/krb5-config $(1)/usr/bin
endef
define Package/krb5-libs/install
PKG_NAME:=lftp
PKG_VERSION:=4.8.2
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://lftp.tech/ftp/ \
https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/distfiles/
--without-libiconv-prefix \
--without-libintl-prefix \
--without-gnutls \
- --without-libidn \
+ --without-libidn2 \
--without-libresolv \
--with-openssl="$(STAGING_DIR)/usr" \
--with-readline="$(STAGING_DIR)/usr" \
$(eval $(call BuildPlugin,userdir,User directory,,30))
$(eval $(call BuildPlugin,usertrack,User tracking,,30))
$(eval $(call BuildPlugin,webdav,WebDAV,+PACKAGE_lighttpd-mod-webdav:libsqlite3 +PACKAGE_lighttpd-mod-webdav:libuuid +PACKAGE_lighttpd-mod-webdav:libxml2,30))
-
+$(eval $(call BuildPlugin,wstunnel,Websocket tunneling,,30))
include $(TOPDIR)/rules.mk
PKG_NAME:=linuxptp
-PKG_VERSION:=1.8
-PKG_RELEASE:=4
+PKG_VERSION:=1.9.2
+PKG_RELEASE:=1
PKG_MAINTAINER:=Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)/v$(PKG_VERSION)
-PKG_HASH:=fa8e00f6ec73cefa7bb313dce7f60dfe5eb9e2bde3353594e9ac18edc93e5165
+PKG_HASH:=7f662e65c66c37ff211dc525476626875c2b74162ded05c8a25d036fb963b8d0
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
+++ /dev/null
---- a/raw.c
-+++ b/raw.c
-@@ -20,7 +20,6 @@
- #include <fcntl.h>
- #include <linux/filter.h>
- #include <linux/if_ether.h>
--#include <net/ethernet.h>
- #include <net/if.h>
- #include <netinet/in.h>
- #include <netpacket/packet.h>
---- a/util.h
-+++ b/util.h
-@@ -20,6 +20,8 @@
- #ifndef HAVE_UTIL_H
- #define HAVE_UTIL_H
-
-+#include <time.h>
-+
- #include "ddt.h"
- #include "ether.h"
-
+++ /dev/null
-From 60db5d0b0fd8be9afede7e8a14e708f5429f2023 Mon Sep 17 00:00:00 2001
-From: Florian Fainelli <f.fainelli@gmail.com>
-Date: Sun, 7 May 2017 11:16:06 -0700
-Subject: [PATCH] udp: Avoid including netdb.h
-
-netdb.h pulls in a large chain of include files:
-rpc/netdb.h
-rpc/types.h
-
-rpc/types.h re-defines TRUE/FALSE and does it in this way:
-
- #ifndef FALSE
- # define FALSE (0)
- #endif
-
- #ifndef TRUE
- # define TRUE (1)
- #endif
-
-And this later causes build problems that appear in this way:
-
-mipsel-linux-gnu-gcc -Wall -DVER=1.8 -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME
--DHAVE_POSIX_SPAWN -DHAVE_ONESTEP_SYNC -Os -pipe -mno-branch-likely
--mips32r2 -mtune=24kc -fno-caller-saves -Wno-unused-result
--D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro
--I/home/florian/dev/openwrt/trunk/staging_dir/target-mipsel-unknown-linux-gnu_glibc/usr/include
--I/home/florian/dev/openwrt/trunk/staging_dir/target-mipsel-unknown-linux-gnu_glibc/include
--I/home/florian/dev/toolchains/stbgcc-4.8-1.5/usr/include
--I/home/florian/dev/toolchains/stbgcc-4.8-1.5/include
--DHAVE_CLOCK_ADJTIME -DHAVE_POSIX_SPAWN -DHAVE_ONESTEP_SYNC -c -o
-udp.o udp.c
-In file included from
-/home/florian/dev/openwrt/trunk/staging_dir/target-mipsel-unknown-linux-gnu_glibc/usr/include/rpc/netdb.h:45:0,
- from
-/home/florian/dev/toolchains/stbgcc-4.8-1.5/mipsel-linux-gnu/sys-root/usr/include/netdb.h:32,
- from udp.c:23:
-pdt.h:25:7: error: expected identifier before '(' token
- enum {FALSE, TRUE};
- ^
-<builtin>: recipe for target 'udp.o' failed
-
-Upon inspection, it does not appear that netdb.h is providing any useful
-definition or declaration, so let's just remove its inclusion.
-
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
----
- udp.c | 1 -
- udp6.c | 1 -
- 2 files changed, 2 deletions(-)
-
-diff --git a/udp.c b/udp.c
-index 6dabc31836fe..530a2ee3748d 100644
---- a/udp.c
-+++ b/udp.c
-@@ -20,7 +20,6 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <net/if.h>
--#include <netdb.h>
- #include <netinet/in.h>
- #include <stdio.h>
- #include <stdlib.h>
-diff --git a/udp6.c b/udp6.c
-index c229cac0c41c..89e27bf9e863 100644
---- a/udp6.c
-+++ b/udp6.c
-@@ -20,7 +20,6 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <net/if.h>
--#include <netdb.h>
- #include <netinet/in.h>
- #include <stdio.h>
- #include <stdlib.h>
---
-2.11.0
-
--- /dev/null
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=miniupnpd
+PKG_VERSION:=2.0.20180422
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://miniupnp.free.fr/files
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=fe73dd48cbd2eeb30b1ae4f2b6ff46922f214019a50b9a8dd447849b42c9e90d
+
+PKG_MAINTAINER:=Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+PKG_LICENSE:=BSD-3-Clause
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/version.mk
+
+define Package/miniupnpd
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+iptables +libip4tc +IPV6:libip6tc +IPV6:ip6tables +libuuid
+ TITLE:=Lightweight UPnP IGD, NAT-PMP & PCP daemon
+ SUBMENU:=Firewall
+ URL:=http://miniupnp.free.fr/
+endef
+
+define Package/miniupnpd/conffiles
+/etc/config/upnpd
+endef
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+ echo "$(VERSION_NUMBER)" | tr '() ' '_' >$(PKG_BUILD_DIR)/os.openwrt
+endef
+
+MAKE_FLAGS += \
+ TARGET_OPENWRT=1 TEST=0 LIBS="" \
+ CC="$(TARGET_CC) -DIPTABLES_143 -lip4tc -luuid \
+ $(if $(CONFIG_IPV6),-lip6tc)" \
+ CONFIG_OPTIONS="--portinuse --leasefile --igd2 \
+ $(if $(CONFIG_IPV6),--ipv6)" \
+ -f Makefile.linux miniupnpd
+
+define Package/miniupnpd/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+ $(INSTALL_DIR) $(1)/etc/uci-defaults
+ $(INSTALL_DIR) $(1)/usr/share/miniupnpd
+
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/sbin/miniupnpd
+ $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
+ $(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
+ $(INSTALL_DATA) ./files/miniupnpd.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
+ $(INSTALL_BIN) ./files/miniupnpd.defaults $(1)/etc/uci-defaults/99-miniupnpd
+ $(INSTALL_DATA) ./files/firewall.include $(1)/usr/share/miniupnpd/firewall.include
+endef
+
+$(eval $(call BuildPackage,miniupnpd))
--- /dev/null
+#!/bin/sh
+# miniupnpd integration for firewall3
+
+IPTABLES=/usr/sbin/iptables
+IP6TABLES=/usr/sbin/ip6tables
+
+$IPTABLES -t filter -N MINIUPNPD 2>/dev/null
+$IPTABLES -t nat -N MINIUPNPD 2>/dev/null
+$IPTABLES -t nat -N MINIUPNPD-POSTROUTING 2>/dev/null
+
+[ -x $IP6TABLES ] && $IP6TABLES -t filter -N MINIUPNPD 2>/dev/null
+
+. /lib/functions/network.sh
+
+# helper to insert in chain as penultimate
+iptables_prepend_rule() {
+ local iptables="$1"
+ local table="$2"
+ local chain="$3"
+ local target="$4"
+
+ $iptables -t "$table" -I "$chain" $($iptables -t "$table" --line-numbers -nL "$chain" | \
+ sed -ne '$s/[^0-9].*//p') -j "$target"
+}
+
+ADDED=0
+
+add_extzone_rules() {
+ local ext_zone="$1"
+
+ [ -z "$ext_zone" ] && return
+
+ # IPv4 - due to NAT, need to add both to nat and filter table
+ # need to insert as penultimate rule for forward & postrouting since final rule might be a fw3 REJECT
+ iptables_prepend_rule "$IPTABLES" filter "zone_${ext_zone}_forward" MINIUPNPD
+ $IPTABLES -t nat -A "zone_${ext_zone}_prerouting" -j MINIUPNPD
+ iptables_prepend_rule "$IPTABLES" nat "zone_${ext_zone}_postrouting" MINIUPNPD-POSTROUTING
+
+ # IPv6 if available - filter only
+ [ -x $IP6TABLES ] && {
+ iptables_prepend_rule "$IP6TABLES" filter "zone_${ext_zone}_forward" MINIUPNPD
+ }
+ ADDED=$(($ADDED + 1))
+}
+
+# By default, user configuration is king.
+
+for ext_iface in $(uci -q get upnpd.config.external_iface); do
+ add_extzone_rules $(fw3 -q network "$ext_iface")
+done
+
+add_extzone_rules $(uci -q get upnpd.config.external_zone)
+
+[ "$ADDED" -ne 0 ] && exit 0
+
+# If really nothing is available, resort to network_find_wan{,6} and
+# assume external interfaces all have same firewall zone.
+
+# (This heuristic may fail horribly, in case of e.g. multihoming, so
+# please set external_zone in that case!)
+
+network_find_wan wan_iface
+network_find_wan6 wan6_iface
+
+for ext_iface in $wan_iface $wan6_iface; do
+ # fw3 -q network fails on sub-interfaces => map to device first
+ network_get_device ext_device $ext_iface
+ add_extzone_rules $(fw3 -q device "$ext_device")
+done
--- /dev/null
+#!/bin/sh
+
+uci -q batch <<-EOT
+ delete firewall.miniupnpd
+ set firewall.miniupnpd=include
+ set firewall.miniupnpd.type=script
+ set firewall.miniupnpd.path=/usr/share/miniupnpd/firewall.include
+ set firewall.miniupnpd.family=any
+ set firewall.miniupnpd.reload=1
+ commit firewall
+EOT
+
+exit 0
--- /dev/null
+#!/bin/sh
+
+/etc/init.d/miniupnpd enabled || exit 0
+
+. /lib/functions/service.sh
+
+# If miniupnpd is not running:
+# - check on _any_ event (even updates may contribute to network_find_wan*)
+
+# If miniupnpd _is_ running:
+# - check only on ifup (otherwise lease updates etc would cause
+# miniupnpd state loss)
+
+[ "$ACTION" != "ifup" ] && service_check /usr/sbin/miniupnpd && exit 0
+
+tmpconf="/var/etc/miniupnpd.conf"
+extiface=$(uci get upnpd.config.external_iface)
+extzone=$(uci get upnpd.config.external_zone)
+
+. /lib/functions/network.sh
+
+if [ -z "$extiface" ] ; then
+ # manual external zone (if dynamically find interfaces
+ # belonging to it) overrides network_find_wan*
+ if [ -n "$extzone" ] ; then
+ ifname=$(fw3 -q zone $extzone | head -1)
+ fi
+ [ -n "$extiface" ] || network_find_wan extiface
+ [ -n "$extiface" ] || network_find_wan6 extiface
+fi
+
+[ -n "$ifname" ] || network_get_device ifname "$extiface"
+grep -q "ext_ifname=$ifname" "$tmpconf" || /etc/init.d/miniupnpd restart
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2014 OpenWrt.org
+
+START=94
+STOP=15
+
+SERVICE_USE_PID=1
+
+upnpd_get_port_range() {
+ local var="$1"; shift
+ local val
+
+ config_get val "$@"
+
+ case "$val" in
+ [0-9]*[:-][0-9]*)
+ export -n -- "${var}_start=${val%%[:-]*}"
+ export -n -- "${var}_end=${val##*[:-]}"
+ ;;
+ [0-9]*)
+ export -n -- "${var}_start=$val"
+ export -n -- "${var}_end="
+ ;;
+ esac
+}
+
+conf_rule_add() {
+ local cfg="$1"
+ local tmpconf="$2"
+ local action external_port_start external_port_end int_addr
+ local internal_port_start internal_port_end comment
+
+ config_get action "$cfg" action "deny" # allow or deny
+ upnpd_get_port_range "ext" "$cfg" ext_ports "0-65535" # external ports: x, x-y, x:y
+ config_get int_addr "$cfg" int_addr "0.0.0.0/0" # ip or network and subnet mask (internal)
+ upnpd_get_port_range "int" "$cfg" int_ports "0-65535" # internal ports: x, x-y, x:y or range
+ config_get comment "$cfg" comment "ACL" # comment
+
+ # Make a single IP IP/32 so that miniupnpd.conf can use it.
+ [ "${int_addr%/*}" = "$int_addr" ] && int_addr="$int_addr/32"
+
+ echo "$action $ext_start${ext_end:+-}$ext_end $int_addr $int_start${int_end:+-}$int_end #$comment" >>$tmpconf
+}
+
+upnpd_write_bool() {
+ local opt="$1"
+ local def="${2:-0}"
+ local alt="${3:-$opt}"
+ local val
+
+ config_get_bool val config "$opt" "$def"
+ if [ "$val" -eq 0 ]; then
+ echo "$alt=no" >> $tmpconf
+ else
+ echo "$alt=yes" >> $tmpconf
+ fi
+}
+
+boot() {
+ return
+}
+
+start() {
+ config_load "upnpd"
+ local extiface intiface upload download logging secure enabled natpmp
+ local extip port usesysuptime conffile serial_number model_number
+ local uuid notify_interval presentation_url enable_upnp
+ local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval
+ local ipv6_listening_ip enabled
+
+ config_get_bool enabled config enabled 1
+
+ [ "$enabled" -eq 0 ] && return 1
+
+ config_get extiface config external_iface
+ config_get extzone config external_zone
+ config_get intiface config internal_iface
+ config_get extip config external_ip
+ config_get port config port 5000
+ config_get upload config upload
+ config_get download config download
+ config_get_bool logging config log_output 0
+ config_get conffile config config_file
+ config_get serial_number config serial_number
+ config_get model_number config model_number
+ config_get uuid config uuid
+ config_get notify_interval config notify_interval
+ config_get presentation_url config presentation_url
+ config_get upnp_lease_file config upnp_lease_file
+ config_get clean_ruleset_threshold config clean_ruleset_threshold
+ config_get clean_ruleset_interval config clean_ruleset_interval
+ config_get ipv6_listening_ip config ipv6_listening_ip
+
+ local args ifname
+
+ . /lib/functions/network.sh
+
+ # manual external interface overrides everything
+ if [ -z "$extiface" ] ; then
+ # manual external zone (if dynamically find interfaces
+ # belonging to it) overrides network_find_wan*
+ if [ -n "$extzone" ] ; then
+ ifname=$(fw3 -q zone $extzone | head -1)
+ fi
+ [ -n "$extiface" ] || network_find_wan extiface
+ [ -n "$extiface" ] || network_find_wan6 extiface
+ fi
+
+ [ -n "$ifname" ] || network_get_device ifname $extiface
+
+ if [ -n "$conffile" ]; then
+ args="-f $conffile"
+ else
+ local tmpconf="/var/etc/miniupnpd.conf"
+ args="-f $tmpconf"
+ mkdir -p /var/etc
+
+ echo "ext_ifname=$ifname" >$tmpconf
+
+ [ -n "$extip" ] && \
+ echo "ext_ip=$extip" >>$tmpconf
+
+ local iface
+ for iface in ${intiface:-lan}; do
+ local device
+ network_get_device device "$iface" && {
+ echo "listening_ip=$device" >>$tmpconf
+ }
+ done
+
+ [ "$port" != "auto" ] && \
+ echo "port=$port" >>$tmpconf
+
+ config_load "upnpd"
+ upnpd_write_bool enable_natpmp 1
+ upnpd_write_bool enable_upnp 1
+ upnpd_write_bool secure_mode 1
+ upnpd_write_bool pcp_allow_thirdparty 0
+ upnpd_write_bool system_uptime 1
+ upnpd_write_bool igdv1 0 force_igd_desc_v1
+
+ [ -n "$upnp_lease_file" ] && \
+ echo "lease_file=$upnp_lease_file" >>$tmpconf
+
+ [ -n "$upload" -a -n "$download" ] && {
+ echo "bitrate_down=$(($download * 1024 * 8))" >>$tmpconf
+ echo "bitrate_up=$(($upload * 1024 * 8))" >>$tmpconf
+ }
+
+ [ -n "${presentation_url}" ] && \
+ echo "presentation_url=${presentation_url}" >>$tmpconf
+
+ [ -n "${notify_interval}" ] && \
+ echo "notify_interval=${notify_interval}" >>$tmpconf
+
+ [ -n "${clean_ruleset_threshold}" ] && \
+ echo "clean_ruleset_threshold=${clean_ruleset_threshold}" >>$tmpconf
+
+ [ -n "${clean_ruleset_interval}" ] && \
+ echo "clean_ruleset_interval=${clean_ruleset_interval}" >>$tmpconf
+
+ [ -n "${ipv6_listening_ip}" ] && \
+ echo "ipv6_listening_ip=${ipv6_listening_ip}" >>$tmpconf
+
+ [ -z "$uuid" ] && {
+ uuid="$(cat /proc/sys/kernel/random/uuid)"
+ uci set upnpd.config.uuid=$uuid
+ uci commit upnpd
+ }
+
+ [ "$uuid" = "nocli" ] || \
+ echo "uuid=$uuid" >>$tmpconf
+
+ [ -n "${serial_number}" ] && \
+ echo "serial=${serial_number}" >>$tmpconf
+
+ [ -n "${model_number}" ] && \
+ echo "model_number=${model_number}" >>$tmpconf
+
+ config_foreach conf_rule_add perm_rule "$tmpconf"
+ fi
+
+
+ if [ -n "$ifname" ]; then
+ # start firewall
+ iptables -L MINIUPNPD >/dev/null 2>&1 || fw3 reload
+
+ if [ "$logging" = "1" ]; then
+ SERVICE_DAEMONIZE=1 \
+ service_start /usr/sbin/miniupnpd $args -d
+ else
+ SERVICE_DAEMONIZE= \
+ service_start /usr/sbin/miniupnpd $args
+ fi
+ else
+ logger -t "upnp daemon" "external interface not found, not starting"
+ fi
+}
+
+stop() {
+ service_stop /usr/sbin/miniupnpd
+
+ iptables -t nat -F MINIUPNPD 2>/dev/null
+ iptables -t nat -F MINIUPNPD-POSTROUTING 2>/dev/null
+ iptables -t filter -F MINIUPNPD 2>/dev/null
+
+ [ -x /usr/sbin/ip6tables ] && {
+ ip6tables -t filter -F MINIUPNPD 2>/dev/null
+ }
+}
--- /dev/null
+config upnpd config
+ option enabled 0
+ option enable_natpmp 1
+ option enable_upnp 1
+ option secure_mode 1
+ option log_output 0
+ option download 1024
+ option upload 512
+#by default, looked up dynamically from ubus
+# option external_iface wan
+ option internal_iface lan
+ option port 5000
+ option upnp_lease_file /var/upnp.leases
+ option igdv1 0
+
+config perm_rule
+ option action allow
+ option ext_ports 1024-65535
+ option int_addr 0.0.0.0/0 # Does not override secure_mode
+ option int_ports 1024-65535
+ option comment "Allow high ports"
+
+config perm_rule
+ option action deny
+ option ext_ports 0-65535
+ option int_addr 0.0.0.0/0
+ option int_ports 0-65535
+ option comment "Default deny"
--- /dev/null
+--- a/genconfig.sh
++++ b/genconfig.sh
+@@ -379,12 +379,19 @@ case $FW in
+ esac
+
+ # UUID API
+-if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
+- echo "#define BSD_UUID" >> ${CONFIGFILE}
+-fi
+-if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
+- echo "#define LIB_UUID" >> ${CONFIGFILE}
+-fi
++case $OS_NAME in
++ OpenWRT)
++ echo "#define LIB_UUID" >> ${CONFIGFILE}
++ ;;
++ *)
++ if grep uuid_create /usr/include/uuid.h > /dev/null 2>&1 ; then
++ echo "#define BSD_UUID" >> ${CONFIGFILE}
++ fi
++ if grep uuid_generate /usr/include/uuid/uuid.h > /dev/null 2>&1 ; then
++ echo "#define LIB_UUID" >> ${CONFIGFILE}
++ fi
++ ;;
++esac
+
+ # set V6SOCKETS_ARE_V6ONLY to 0 if it was not set above
+ if [ -z "$V6SOCKETS_ARE_V6ONLY" ] ; then
+--- a/Makefile.linux
++++ b/Makefile.linux
+@@ -73,7 +73,10 @@ CPPFLAGS += -DIPTABLES_143
+ endif
+
+ CFLAGS += $(shell $(PKG_CONFIG) --cflags libiptc)
++#OpenWrt packager passes correct libraries
++ifeq ($(TARGET_OPENWRT),)
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libiptc)
++endif
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L libiptc)
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-other libiptc)
+ else
+@@ -153,6 +156,8 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libnetfilter_conntrack)
+ endif # ($(TEST),1)
+
++# OpenWrt packager disables https server for IGD v2 and hardcodes libuuid support
++ifeq ($(TARGET_OPENWRT),)
+ LDLIBS += $(shell $(PKG_CONFIG) --static --libs-only-l libssl)
+
+ TEST := $(shell $(PKG_CONFIG) --exists uuid && echo 1)
+@@ -161,6 +166,7 @@ LDLIBS += $(shell $(PKG_CONFIG) --static
+ else
+ $(info please install uuid-dev package / libuuid)
+ endif # ($(TEST),1)
++endif # ($(TARGET_OPENWRT,)
+
+ TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o
+
include $(TOPDIR)/rules.mk
PKG_NAME:=mosquitto
-PKG_VERSION:=1.4.14
+PKG_VERSION:=1.4.15
PKG_RELEASE:=3
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE.txt
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://mosquitto.org/files/source/
-PKG_HASH:=156b1fa731d12baad4b8b22f7b6a8af50ba881fc711b81e9919ec103cf2942d1
+PKG_HASH:=7d3b3e245a3b4ec94b05678c8199c806359737949f4cfe0bf936184f6ca89a83
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/mosquitto-ssl/description
$(call Package/mosquitto/default/description)
- This package is built with SSL support
+This package is built with SSL support. TLS-PSK will be included (in both
+the client and broker) if OpenSSL is built with TLS-PSK support.
endef
define Package/mosquitto-nossl/description
MAKE_FLAGS += WITH_TLS=no WITH_WEBSOCKETS=no
else
MAKE_FLAGS += WITH_WEBSOCKETS=$(if $(CONFIG_MOSQUITTO_LWS),"yes","no")
+ MAKE_FLAGS += WITH_TLS_PSK=$(if $(CONFIG_OPENSSL_WITH_PSK),"yes","no")
endif
$(eval $(call BuildPackage,mosquitto-ssl))
-From ebfccff8735ca0f8b6c9e8d06f2d3efe916affaf Mon Sep 17 00:00:00 2001
-From: Alexander Couzens <lynxis@fe80.eu>
-Date: Sun, 10 Dec 2017 01:23:29 +0100
-Subject: [PATCH] fix reproducible builds by removing build timestamp
-
-Build timestamps prevents reproducible builds. [0]
-
-[0] https://reproducible-builds.org/docs/timestamps/
-
-Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
----
- src/conf.c | 2 +-
- src/mosquitto.c | 4 +---
- 2 files changed, 2 insertions(+), 4 deletions(-)
-
+diff --git a/config.mk b/config.mk
+index bfaa208..2a3e2bf 100644
+--- a/config.mk
++++ b/config.mk
+@@ -87,7 +87,6 @@ WITH_SOCKS:=yes
+ # Also bump lib/mosquitto.h, CMakeLists.txt,
+ # installer/mosquitto.nsi, installer/mosquitto-cygwin.nsi
+ VERSION=1.4.15
+-TIMESTAMP:=$(shell date "+%F %T%z")
+
+ # Client library SO version. Bump if incompatible API/ABI changes are made.
+ SOVERSION=1
+@@ -115,7 +114,7 @@ LIB_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I. -I.. -I../lib
+ LIB_CXXFLAGS:=$(LIB_CFLAGS) ${CPPFLAGS}
+ LIB_LDFLAGS:=${LDFLAGS}
+
+-BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DTIMESTAMP="\"${TIMESTAMP}\"" -DWITH_BROKER
++BROKER_CFLAGS:=${LIB_CFLAGS} ${CPPFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER
+ CLIENT_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I../lib -DVERSION="\"${VERSION}\""
+
+ ifneq ($(or $(findstring $(UNAME),FreeBSD), $(findstring $(UNAME),OpenBSD)),)
diff --git a/src/conf.c b/src/conf.c
-index a3e233de..e8162031 100644
+index 25d80a6..9ab0599 100644
--- a/src/conf.c
+++ b/src/conf.c
-@@ -309,7 +309,7 @@ void mqtt3_config_cleanup(struct mqtt3_config *config)
+@@ -338,7 +338,7 @@ void mqtt3_config_cleanup(struct mqtt3_config *config)
static void print_usage(void)
{
printf("Usage: mosquitto [-c config_file] [-d] [-h] [-p port]\n\n");
printf(" -c : specify the broker config file.\n");
diff --git a/src/mosquitto.c b/src/mosquitto.c
-index b28150ce..dcf3a72a 100644
+index 22b6372..b581f45 100644
--- a/src/mosquitto.c
+++ b/src/mosquitto.c
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
}
- _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s (build date %s) starting", VERSION, TIMESTAMP);
+ _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s starting", VERSION);
- if(config.config_file){
- _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "Config loaded from %s.", config.config_file);
+ if(int_db.config_file){
+ _mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "Config loaded from %s.", int_db.config_file);
}else{
@@ -308,8 +308,6 @@ int main(int argc, char *argv[])
/* Set static $SYS messages */
include $(TOPDIR)/rules.mk
PKG_NAME:=mwan3
-PKG_VERSION:=2.6.9
+PKG_VERSION:=2.6.14
PKG_RELEASE:=1
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
PKG_LICENSE:=GPLv2
SECTION:=net
CATEGORY:=Network
SUBMENU:=Routing and Redirection
- DEPENDS:=+ip +ipset +iptables +iptables-mod-conntrack-extra +iptables-mod-ipopt
+ DEPENDS:= \
+ +ip \
+ +ipset \
+ +iptables \
+ +iptables-mod-conntrack-extra \
+ +iptables-mod-ipopt \
+ +jshn
TITLE:=Multiwan hotplug script with connection tracking support
MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
PKGARCH:=all
+config globals 'globals'
+ option mmx_mask '0x3F00'
+ option local_source 'lan'
+
config interface 'wan'
option enabled '1'
list track_ip '8.8.4.4'
list track_ip '8.8.8.8'
list track_ip '208.67.222.222'
list track_ip '208.67.220.220'
+ option family 'ipv4'
option reliability '2'
option count '1'
option timeout '2'
option down '3'
option up '8'
-config interface 'wan2'
+config interface 'wan6'
+ option enabled '0'
+ list track_ip '2001:4860:4860::8844'
+ list track_ip '2001:4860:4860::8888'
+ list track_ip '2620:0:ccd::2'
+ list track_ip '2620:0:ccc::2'
+ option family 'ipv6'
+ option reliability '2'
+ option count '1'
+ option timeout '2'
+ option interval '5'
+ option down '3'
+ option up '8'
+
+config interface 'wanb'
option enabled '0'
list track_ip '8.8.8.8'
list track_ip '208.67.220.220'
+ option family 'ipv4'
+ option reliability '1'
+ option count '1'
+ option timeout '2'
+ option interval '5'
+ option down '3'
+ option up '8'
+
+config interface 'wanb6'
+ option enabled '0'
+ list track_ip '2001:4860:4860::8888'
+ list track_ip '2620:0:ccc::2'
+ option family 'ipv6'
option reliability '1'
option count '1'
option timeout '2'
option metric '2'
option weight '3'
-config member 'wan2_m1_w2'
- option interface 'wan2'
+config member 'wanb_m1_w2'
+ option interface 'wanb'
+ option metric '1'
+ option weight '2'
+
+config member 'wanb_m2_w2'
+ option interface 'wanb'
+ option metric '2'
+ option weight '2'
+
+config member 'wan6_m1_w3'
+ option interface 'wan6'
+ option metric '1'
+ option weight '3'
+
+config member 'wan6_m2_w3'
+ option interface 'wan6'
+ option metric '2'
+ option weight '3'
+
+config member 'wanb6_m1_w2'
+ option interface 'wanb6'
option metric '1'
option weight '2'
-config member 'wan2_m2_w2'
- option interface 'wan2'
+config member 'wanb6_m2_w2'
+ option interface 'wanb6'
option metric '2'
option weight '2'
config policy 'wan_only'
list use_member 'wan_m1_w3'
+ list use_member 'wan6_m1_w3'
-config policy 'wan2_only'
- list use_member 'wan2_m1_w2'
+config policy 'wanb_only'
+ list use_member 'wanb_m1_w2'
+ list use_member 'wanb6_m1_w2'
config policy 'balanced'
list use_member 'wan_m1_w3'
- list use_member 'wan2_m1_w2'
+ list use_member 'wanb_m1_w2'
+ list use_member 'wan6_m1_w3'
+ list use_member 'wanb6_m1_w2'
-config policy 'wan_wan2'
+config policy 'wan_wanb'
list use_member 'wan_m1_w3'
- list use_member 'wan2_m2_w2'
+ list use_member 'wanb_m2_w2'
+ list use_member 'wan6_m1_w3'
+ list use_member 'wanb6_m2_w2'
-config policy 'wan2_wan'
+config policy 'wanb_wan'
list use_member 'wan_m2_w3'
- list use_member 'wan2_m1_w2'
+ list use_member 'wanb_m1_w2'
+ list use_member 'wan6_m2_w3'
+ list use_member 'wanb6_m1_w2'
config rule 'https'
option sticky '1'
fi
config_load mwan3
+config_get_bool enabled globals 'enabled' '0'
+[ ${enabled} -gt 0 ] || exit 0
+
config_get local_source globals local_source 'none'
[ "${local_source}" = "none" ] && {
exit 0
[ -n "$DEVICE" ] || exit 3
fi
-mwan3_lock
-mwan3_set_connected_iptables
-mwan3_unlock
-
config_load mwan3
+config_get_bool enabled globals 'enabled' '0'
+[ ${enabled} -gt 0 ] || exit 0
+
config_get enabled $INTERFACE enabled 0
config_get initial_state $INTERFACE initial_state "online"
[ "$enabled" == "1" ] || exit 0
+mwan3_lock
+mwan3_init
+mwan3_set_connected_iptables
+mwan3_unlock
+
if [ "$ACTION" == "ifup" ]; then
config_get family $INTERFACE family ipv4
if [ "$family" = "ipv4" ]; then
. /lib/functions.sh
config_load mwan3
+ config_get_bool enabled globals 'enabled' '0'
+ [ ${enabled} -gt 0 ] || exit 0
+
config_get enabled "$INTERFACE" enabled 0
[ "${enabled}" = "1" ] || exit 0
env -i ACTION="$ACTION" INTERFACE="$INTERFACE" DEVICE="$DEVICE" \
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=19
+
+reload() {
+ local enabled
+
+ config_load mwan3
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+ mwan3 restart
+}
+
+boot() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "1"
+}
+
+start() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "1"
+ mwan3 start
+}
+
+stop() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "0"
+ mwan3 stop
+}
#
# There are three main environment variables that are passed to this script.
#
-# $ACTION Either "ifup" or "ifdown"
+# $ACTION
+# <ifup> Is called by netifd and mwan3track
+# <ifdown> Is called by netifd and mwan3track
+# <connected> Is only called by mwan3track if tracking was successful
+# <disconnected> Is only called by mwan3track if tracking has failed
# $INTERFACE Name of the interface which went up or down (e.g. "wan" or "wwan")
# $DEVICE Physical device name which interface went up or down (e.g. "eth0" or "wwan0")
MWAN3_STATUS_DIR="/var/run/mwan3"
MWAN3TRACK_STATUS_DIR="/var/run/mwan3track"
+MWAN3_INTERFACE_MAX=""
DEFAULT_LOWEST_METRIC=256
+MMX_MASK=""
+MMX_DEFAULT=""
+MMX_BLACKHOLE=""
+MM_BLACKHOLE=""
+
+MMX_UNREACHABLE=""
+MM_UNREACHABLE=""
-[ -d $MWAN3_STATUS_DIR ] || mkdir -p $MWAN3_STATUS_DIR/iface_state
-# mwan3's MARKing mask (at least 3 bits should be set)
-if [ -e "${MWAN3_STATUS_DIR}/mmx_mask" ]; then
- MMX_MASK=$(cat "${MWAN3_STATUS_DIR}/mmx_mask")
-else
- config_load mwan3
- config_get MMX_MASK globals mmx_mask '0xff00'
- echo "$MMX_MASK" > "${MWAN3_STATUS_DIR}/mmx_mask"
- $LOG notice "Using firewall mask ${MMX_MASK}"
-fi
# counts how many bits are set to 1
# n&(n-1) clears the lowest bit set to 1
printf "0x%x" $result
}
-# mark mask constants
-MM_BIT_CNT=$(mwan3_count_one_bits MMX_MASK)
-MM_DEFAULT=$(((1<<MM_BIT_CNT)-1))
-MM_BLACKHOLE=$(($MM_DEFAULT-2))
-MM_UNREACHABLE=$(($MM_DEFAULT-1))
+mwan3_init()
+{
+ local bitcnt
+ local mmdefault
+
+ [ -d $MWAN3_STATUS_DIR ] || mkdir -p $MWAN3_STATUS_DIR/iface_state
-# MMX_DEFAULT should equal MMX_MASK
-MMX_DEFAULT=$(mwan3_id2mask MM_DEFAULT MMX_MASK)
-MMX_BLACKHOLE=$(mwan3_id2mask MM_BLACKHOLE MMX_MASK)
-MMX_UNREACHABLE=$(mwan3_id2mask MM_UNREACHABLE MMX_MASK)
+ # mwan3's MARKing mask (at least 3 bits should be set)
+ if [ -e "${MWAN3_STATUS_DIR}/mmx_mask" ]; then
+ MMX_MASK=$(cat "${MWAN3_STATUS_DIR}/mmx_mask")
+ MWAN3_INTERFACE_MAX=$(uci_get_state mwan3 globals iface_max)
+ else
+ config_load mwan3
+ config_get MMX_MASK globals mmx_mask '0x3F00'
+ echo "$MMX_MASK" > "${MWAN3_STATUS_DIR}/mmx_mask"
+ $LOG notice "Using firewall mask ${MMX_MASK}"
+
+ bitcnt=$(mwan3_count_one_bits MMX_MASK)
+ mmdefault=$(((1<<bitcnt)-1))
+ MWAN3_INTERFACE_MAX=$(($mmdefault-3))
+ uci_toggle_state mwan3 globals iface_max "$MWAN3_INTERFACE_MAX"
+ $LOG notice "Max interface count is ${MWAN3_INTERFACE_MAX}"
+ fi
+
+ # mark mask constants
+ bitcnt=$(mwan3_count_one_bits MMX_MASK)
+ mmdefault=$(((1<<bitcnt)-1))
+ MM_BLACKHOLE=$(($mmdefault-2))
+ MM_UNREACHABLE=$(($mmdefault-1))
+
+ # MMX_DEFAULT should equal MMX_MASK
+ MMX_DEFAULT=$(mwan3_id2mask mmdefault MMX_MASK)
+ MMX_BLACKHOLE=$(mwan3_id2mask MM_BLACKHOLE MMX_MASK)
+ MMX_UNREACHABLE=$(mwan3_id2mask MM_UNREACHABLE MMX_MASK)
+}
mwan3_lock() {
lock /var/run/mwan3.lock
mwan3_track()
{
- local track_ip track_ips
+ local track_ip track_ips pid
mwan3_list_track_ips()
{
}
config_list_foreach $1 track_ip mwan3_list_track_ips
- kill $(pgrep -f "mwan3track $1 $2") &> /dev/null
+ for pid in $(pgrep -f "mwan3track $1 $2"); do
+ kill -TERM "$pid" > /dev/null 2>&1
+ sleep 1
+ kill -KILL "$pid" > /dev/null 2>&1
+ done
if [ -n "$track_ips" ]; then
[ -x /usr/sbin/mwan3track ] && /usr/sbin/mwan3track "$1" "$2" "$3" "$4" $track_ips &
fi
fi
}
-case "$1" in
- list)
- json_init
- json_add_object "status"
- json_add_string "section" "x"
- json_add_string "interface" "x"
- json_close_object
- json_dump
- ;;
- call)
- case "$2" in
- status)
- local section iface
- read input;
- json_load "$input"
- json_get_var section section
- json_get_var iface interface
-
- config_load mwan3
+main () {
+
+ case "$1" in
+ list)
json_init
- case "$section" in
- interfaces)
- json_add_object interfaces
- config_foreach get_mwan3_status interface "${iface}"
- json_close_object
- ;;
- connected)
- json_add_object connected
- json_add_array ipv4
- report_connected_v4
- json_close_array
- json_add_array ipv6
- report_connected_v6
- json_close_array
- json_close_object
- ;;
- *)
- # interfaces
- json_add_object interfaces
- config_foreach get_mwan3_status interface
- json_close_object
- # connected
- json_add_object connected
- json_add_array ipv4
- report_connected_v4
- json_close_array
- json_add_array ipv6
- report_connected_v6
- json_close_array
- json_close_object
- ;;
- esac
+ json_add_object "status"
+ json_add_string "section" "x"
+ json_add_string "interface" "x"
+ json_close_object
json_dump
;;
- esac
- ;;
-esac
+ call)
+ case "$2" in
+ status)
+ local section iface
+ read input;
+ json_load "$input"
+ json_get_var section section
+ json_get_var iface interface
+
+ config_load mwan3
+ json_init
+ case "$section" in
+ interfaces)
+ json_add_object interfaces
+ config_foreach get_mwan3_status interface "${iface}"
+ json_close_object
+ ;;
+ connected)
+ json_add_object connected
+ json_add_array ipv4
+ report_connected_v4
+ json_close_array
+ json_add_array ipv6
+ report_connected_v6
+ json_close_array
+ json_close_object
+ ;;
+ *)
+ # interfaces
+ json_add_object interfaces
+ config_foreach get_mwan3_status interface
+ json_close_object
+ # connected
+ json_add_object connected
+ json_add_array ipv4
+ report_connected_v4
+ json_close_array
+ json_add_array ipv6
+ report_connected_v6
+ json_close_array
+ json_close_object
+ ;;
+ esac
+ json_dump
+ ;;
+ esac
+ ;;
+ esac
+}
+
+main "$@"
echo "Too many arguments. Usage: mwan3 ifup <interface>" && exit 0
fi
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+
config_get enabled "$1" enabled 0
device=$(uci -p /var/state get network.$1.ifname) &> /dev/null
start()
{
+ local enabled
+
config_load mwan3
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+
config_foreach ifup interface
}
stop()
{
- local ipset route rule table IP IPT
+ local ipset route rule table IP IPT pid
- killall mwan3track &> /dev/null
+ for pid in $(pgrep -f "mwan3track"); do
+ kill -TERM "$pid" > /dev/null 2>&1
+ sleep 1
+ kill -KILL "$pid" > /dev/null 2>&1
+ done
config_load mwan3
config_foreach mwan3_track_clean interface
for IP in "$IP4" "$IP6"; do
- for route in $($IP route list table all | sed 's/.*table \([^ ]*\) .*/\1/' | awk '{print $1}' | awk '{for(i=1;i<=NF;i++) if($i+0>0) if($i+0<255) {print;break}}'); do
+ for route in $(seq 1 $MWAN3_INTERFACE_MAX); do
$IP route flush table $route &> /dev/null
done
case "$1" in
ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart)
+ mwan3_init
$*
;;
*)
STATUS=$3
SRC_IP=$4
mkdir -p /var/run/mwan3track/$1
- trap clean_up SIGINT SIGTERM
- trap if_down SIGUSR1
+ trap clean_up TERM
+ trap if_down USR1
config_load mwan3
config_get track_method $1 track_method ping
score=0
else
echo "online" > /var/run/mwan3track/$1/STATUS
+ env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
fi
while true; do
if [ $? -eq 0 ]; then
let host_up_count++
echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip}
+ if [ $score -le $up ]; then
+ $LOG info "Check ($track_method) success for target \"$track_ip\" on interface $1 ($2)"
+ fi
else
let lost++
echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip}
+ if [ $score -gt $up ]; then
+ $LOG info "Check ($track_method) failed for target \"$track_ip\" on interface $1 ($2)"
+ fi
fi
else
echo "skipped" > /var/run/mwan3track/$1/TRACK_${track_ip}
echo "offline" > /var/run/mwan3track/$1/STATUS
$LOG notice "Interface $1 ($2) is offline"
env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface
+ env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
score=0
fi
else
$(INSTALL_DIR) $(2)/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
$(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
+ $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
$(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
$(INSTALL_DIR) $(1)/usr/include
include $(TOPDIR)/rules.mk
PKG_NAME:=nmap
-PKG_VERSION:=7.60
+PKG_VERSION:=7.70
PKG_RELEASE:=1
PKG_MAINTAINER:=Nuno Goncalves <nunojpg@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://nmap.org/dist/
-PKG_HASH:=a8796ecc4fa6c38aad6139d9515dc8113023a82e9d787e5a5fb5fa1b05516f21
+PKG_HASH:=847b068955f792f4cc247593aca6dc3dc4aae12976169873247488de147a6e18
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
include $(TOPDIR)/rules.mk
PKG_NAME:=ntp
-PKG_VERSION:=4.2.8p10
-PKG_RELEASE:=4
+PKG_VERSION:=4.2.8p11
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
-PKG_HASH:=ddd2366e64219b9efa0f7438e06800d0db394ac5c88e13c17b70d0dcdf99b99f
+PKG_HASH:=f14a39f753688252d683ff907035ffff106ba8d3db21309b742e09b5c3cd278e
PKG_LICENSE:=Unique
PKG_LICENSE_FILES:=COPYRIGHT html/copyright.html
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/obfsproxy
SECTION:=net
include $(TOPDIR)/rules.mk
PKG_NAME:=ocserv
-PKG_VERSION:=0.11.10
+PKG_VERSION:=0.12.0
PKG_RELEASE:=1
PKG_USE_MIPS16:=0
PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/ocserv/
-PKG_HASH:=52c821dcd234a8f0d61f440ce3c80d0b23051d7fbd74c6d47dc2b884ae25966a
+PKG_HASH:=fdbb7241013341975640bb9851b14ed16c786029466e81b79cdfbce21f7dc89f
PKG_LICENSE:=GPLv2+
PKG_LICENSE_FILES:=COPYING
-PKG_FIXUP:=autoreconf
+#PKG_FIXUP:=autoreconf
PKG_CONFIG_DEPENDS:= \
CONFIG_OCSERV_PAM \
CONFIGURE_ARGS+= \
--with-pager="" \
- --enable-local-libopts \
--with-libreadline-prefix="$(STAGING_DIR)/" \
--without-libnl \
- --without-lz4 \
--without-gssapi \
--with-libcrypt-prefix="$(STAGING_DIR)/" \
--with-libev-prefix="$(STAGING_DIR)/" \
PKG_NAME:=ola
PKG_VERSION:=0.10.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/OpenLightingProject/ola.git
TITLE:=Open Lighting Architecture Daemon
URL:=https://www.openlighting.org/
MAINTAINER:=Christian Beier <dontmind@freeshell.org>
- DEPENDS:=+protobuf +libusb-1.0 +libuuid +libstdcpp +libpthread +librt +zlib +libncurses +liblo +sudo
+ DEPENDS:=+protobuf +libusb-1.0 +libuuid +libstdcpp +libpthread +librt +zlib +libncurses +liblo
endef
define Package/ola/description
start_service() {
procd_open_instance
- procd_set_param command sudo -u nobody /usr/bin/olad --syslog --log-level 2 --config-dir /etc/ola
+ procd_set_param user nobody
+ procd_set_param command /usr/bin/olad --syslog --log-level 2 --config-dir /etc/ola
procd_set_param respawn
procd_close_instance
}
--with-vpnc-script=/lib/netifd/vpnc-script \
--without-libpcsclite \
--without-stoken \
+ --without-libpskc \
+ --without-gssapi \
--without-lz4
ifeq ($(CONFIG_OPENCONNECT_OPENSSL),y)
include $(TOPDIR)/rules.mk
PKG_NAME:=openssh
-PKG_VERSION:=7.6p1
+PKG_VERSION:=7.7p1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
https://ftp.spline.de/pub/OpenBSD/OpenSSH/portable/ \
https://anorien.csc.warwick.ac.uk/pub/OpenBSD/OpenSSH/portable/
-PKG_HASH:=a323caeeddfe145baaa0db16e98d784b1fbc7dd436a6bf1f479dfd5cd1d21723
+PKG_HASH:=d73be7e684e99efcd024be15a30bffcbe41b012b2f7b3c9084aed621775e6b8f
PKG_LICENSE:=BSD ISC
PKG_LICENSE_FILES:=LICENCE
--- a/ssh_config
+++ b/ssh_config
-@@ -48,3 +48,6 @@
+@@ -44,3 +44,6 @@
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
+#IPQoS AF21 AF11
--- a/sshd_config
+++ b/sshd_config
-@@ -107,6 +107,9 @@ AuthorizedKeysFile .ssh/authorized_keys
+@@ -106,6 +106,9 @@ AuthorizedKeysFile .ssh/authorized_keys
# no default banner path
#Banner none
-#
+#
# Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
# Copyright (C) 2014-2017 OpenWrt.org
#
PKG_NAME:=openvswitch
+PKG_VERSION:=2.8.2
PKG_RELEASE:=1
-PKG_VERSION:=2.8.1
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=COPYING
PKG_USE_MIPS16:=0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://openvswitch.org/releases/
-PKG_HASH:=8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
+PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
+PKG_HASH:=87b4a7e7134a44ce1f808d3415a2244b4518c2b0b2a42fa2f8231e592f13103d
PKG_BUILD_DEPENDS:=python/host python-six/host
-PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_openvswitch-python
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
-SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4||LINUX_4_9
+PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-host.mk
+include ../../lang/python/python-package.mk
define Package/openvswitch/Default
SECTION:=net
SUBMENU:=Open vSwitch
CATEGORY:=Network
URL:=http://openvswitch.org/
- MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
endef
define Package/openvswitch/Default/description
define Package/openvswitch-base
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Userspace Package (base)
- DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
+ DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch
endef
define Package/openvswitch-base/description
define Package/openvswitch-python
$(call Package/openvswitch/Default)
TITLE:=Open vSwitch Python Support
- DEPENDS:=+openvswitch +PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
+ DEPENDS:=+PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
endef
define Package/openvswitch-python/description
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
- TITLE:=Open vSwitch Kernel Package
- KCONFIG:= \
- CONFIG_BRIDGE \
- CONFIG_OPENVSWITCH \
- CONFIG_OPENVSWITCH_GRE=n \
- CONFIG_OPENVSWITCH_VXLAN=n \
- CONFIG_OPENVSWITCH_GENEVE=n
+ TITLE:=Open vSwitch kernel datapath
+ KCONFIG:=CONFIG_OPENVSWITCH
DEPENDS:= \
- @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-mpls \
- +kmod-vxlan +kmod-nf-nat +kmod-nf-nat6 \
- @($(SUPPORTED_KERNELS))
+ +kmod-lib-crc32c +kmod-mpls \
+ +kmod-nf-nat +IPV6:kmod-nf-nat6
FILES:= $(LINUX_DIR)/net/openvswitch/openvswitch.ko
- AUTOLOAD:=$(call AutoLoad,21,openvswitch)
+ AUTOLOAD:=$(call AutoProbe,openvswitch)
+endef
+
+define KernelPackage/openvswitch-gre
+ SECTION:=kernel
+ CATEGORY:=Kernel modules
+ SUBMENU:=Network Support
+ TITLE:=Open vSwitch GRE tunneling support
+ KCONFIG:= CONFIG_OPENVSWITCH_GRE
+ DEPENDS:= +kmod-openvswitch +kmod-gre
+ FILES:= $(LINUX_DIR)/net/openvswitch/vport-gre.ko
+ AUTOLOAD:=$(call AutoProbe,vport-gre)
+endef
+
+define KernelPackage/openvswitch-vxlan
+ SECTION:=kernel
+ CATEGORY:=Kernel modules
+ SUBMENU:=Network Support
+ TITLE:=Open vSwitch VXLAN tunneling support
+ KCONFIG:= CONFIG_OPENVSWITCH_VXLAN
+ DEPENDS:= +kmod-openvswitch +kmod-vxlan
+ FILES:= $(LINUX_DIR)/net/openvswitch/vport-vxlan.ko
+ AUTOLOAD:=$(call AutoProbe,vport-vxlan)
endef
-define KernelPackage/openvswitch/description
- This package contains the Open vSwitch kernel moodule and bridge compat
- module. Furthermore, it supports OpenFlow.
+define KernelPackage/openvswitch-geneve
+ SECTION:=kernel
+ CATEGORY:=Kernel modules
+ SUBMENU:=Network Support
+ TITLE:=Open vSwitch Geneve tunneling support
+ KCONFIG:= CONFIG_OPENVSWITCH_GENEVE
+ DEPENDS:= +kmod-openvswitch +kmod-geneve
+ FILES:= $(LINUX_DIR)/net/openvswitch/vport-geneve.ko
+ AUTOLOAD:=$(call AutoProbe,vport-geneve)
endef
-CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
CONFIGURE_ARGS += --enable-ndebug
-CONFIGURE_ARGS += --disable-ssl
CONFIGURE_ARGS += --enable-shared
TARGET_CFLAGS += -flto -std=gnu99
ovs_cv_flake8=no \
ovs_cv_python3=no \
ovs_cv_sphinx=no \
+ ovs_cv_python=$(PYTHON) \
+ ovs_cv_python_host=$(HOST_PYTHON_BIN) \
KARCH=$(LINUX_KARCH)
-MAKE_FLAGS += \
- ARCH="$(LINUX_KARCH)" \
- PYTHONPATH="$(HOST_PYTHONPATH)" \
- PYTHON="$(HOST_PYTHON_BIN)"
+MAKE_VARS += PYTHONPATH="$(HOST_PYTHONPATH)"
+MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
define OvsBinUtility
define Package/openvswitch-$(2)
$(eval $(call BuildPackage,openvswitch-vtep))
$(eval $(call BuildPackage,openvswitch-python))
$(eval $(call BuildPackage,openvswitch))
-$(eval $(call KernelPackage,openvswitch))
+$(eval $(call KernelPackage,openvswitch))
+$(eval $(call KernelPackage,openvswitch-gre))
+$(eval $(call KernelPackage,openvswitch-vxlan))
+$(eval $(call KernelPackage,openvswitch-geneve))
--- /dev/null
+diff --git a/configure.ac b/configure.ac
+index e6a23a6..8a7c6d6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -118,7 +118,6 @@ OVS_CHECK_XENSERVER_VERSION
+ OVS_CHECK_GROFF
+ OVS_CHECK_GNU_MAKE
+ OVS_CHECK_TLS
+-OVS_CHECK_ATOMIC_LIBS
+ OVS_CHECK_GCC4_ATOMICS
+ OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(1)
+ OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(2)
+diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
+index 712cb5a..e840f10 100644
+--- a/lib/netdev-linux.c
++++ b/lib/netdev-linux.c
+@@ -40,7 +40,9 @@
+ #include <netpacket/packet.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
++#if defined(__UCLIBC__) || defined(__GLIBC__)
+ #include <net/if_packet.h>
++#endif
+ #include <net/route.h>
+ #include <netinet/in.h>
+ #include <poll.h>
+diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
+index 9ead907..0a131d7 100644
+--- a/lib/ovs-atomic.h
++++ b/lib/ovs-atomic.h
+@@ -318,7 +318,7 @@
+ #include "util.h"
+
+ #define IN_OVS_ATOMIC_H
+- #if __CHECKER__
++ #if 1
+ /* sparse doesn't understand some GCC extensions we use. */
+ #include "ovs-atomic-pthreads.h"
+ #elif __has_extension(c_atomic)
+++ /dev/null
-From 12edcd800d924f69630768eeece842373dee5bb0 Mon Sep 17 00:00:00 2001
-From: Helmut Schaa <helmut.schaa@googlemail.com>
-Date: Wed, 8 Jan 2014 13:48:33 +0100
-Subject: [PATCH 1/2] netdev-linux: Use unsigned int for ifi_flags
-
-ifi_flags is unsigned, the local equivalents should do the same.
-
-Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
----
- lib/netdev-linux.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index 9bdbbdf..9eaac33 100644
---- a/lib/netdev-linux.c
-+++ b/lib/netdev-linux.c
-@@ -2709,7 +2709,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
- enum netdev_flags on, enum netdev_flags *old_flagsp)
- OVS_REQUIRES(netdev->mutex)
- {
-- int old_flags, new_flags;
-+ unsigned int old_flags, new_flags;
- int error = 0;
-
- old_flags = netdev->ifi_flags;
---
-1.8.1.4
-
+++ /dev/null
-From b9284f535e93c337ab21f330753e60e1038f9a27 Mon Sep 17 00:00:00 2001
-From: Helmut Schaa <helmut.schaa@googlemail.com>
-Date: Wed, 8 Jan 2014 13:48:49 +0100
-Subject: [PATCH 2/2] netdev-linux: Let interface flag survive internal port
- setup
-
-Due to a race condition when bringing up an internal port on Linux
-some interface flags (e.g. IFF_MULTICAST) are falsely reset. This
-happens because netlink events may be processed after the according
-netdev has been brought up (which sets interface flags).
-
-Fix this by reading the interface flags just before updating them
-if they have not been updated by from the kernel yet.
-
-Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
----
- lib/netdev-linux.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index 9eaac33..423e72e 100644
---- a/lib/netdev-linux.c
-+++ b/lib/netdev-linux.c
-@@ -2712,7 +2712,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
- unsigned int old_flags, new_flags;
- int error = 0;
-
-- old_flags = netdev->ifi_flags;
-+ if (!(netdev->cache_valid & VALID_DRVINFO)) {
-+ /* Most likely the debvice flags are not in sync yet, fetch them now */
-+ get_flags(&netdev->up, &old_flags);
-+ } else {
-+ old_flags = netdev->ifi_flags;
-+ }
-+
- *old_flagsp = iff_to_nd_flags(old_flags);
- new_flags = (old_flags & ~nd_to_iff_flags(off)) | nd_to_iff_flags(on);
- if (new_flags != old_flags) {
---
-1.8.1.4
-
+++ /dev/null
-diff --git a/Makefile.am b/Makefile.am
-index a4dd7b8..099a3c1 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -53,7 +53,7 @@ endif
- # foo/__init__.py into an (older) version with plain foo.py, since
- # foo/__init__.pyc will cause Python to ignore foo.py.
- run_python = \
-- PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
-+ PYTHONPATH=$(top_srcdir)/python$(psep)$(PYTHONPATH) \
- PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
-
- ALL_LOCAL =
-diff --git a/Makefile.in b/Makefile.in
-index 8df66e2..98b54bf 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -1654,7 +1654,7 @@ AM_CFLAGS = -Wstrict-prototypes $(WARNING_FLAGS) $(OVS_CFLAGS) \
- # foo/__init__.py into an (older) version with plain foo.py, since
- # foo/__init__.pyc will cause Python to ignore foo.py.
- run_python = \
-- PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
-+ PYTHONPATH=$(top_srcdir)/python$(psep)$(PYTHONPATH) \
- PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
-
-
+++ /dev/null
-diff --git a/configure.ac b/configure.ac
-index e6a23a6..8a7c6d6 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -118,7 +118,6 @@ OVS_CHECK_XENSERVER_VERSION
- OVS_CHECK_GROFF
- OVS_CHECK_GNU_MAKE
- OVS_CHECK_TLS
--OVS_CHECK_ATOMIC_LIBS
- OVS_CHECK_GCC4_ATOMICS
- OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(1)
- OVS_CHECK_ATOMIC_ALWAYS_LOCK_FREE(2)
-diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
-index 712cb5a..e840f10 100644
---- a/lib/netdev-linux.c
-+++ b/lib/netdev-linux.c
-@@ -40,7 +40,9 @@
- #include <netpacket/packet.h>
- #include <net/if.h>
- #include <net/if_arp.h>
-+#if defined(__UCLIBC__) || defined(__GLIBC__)
- #include <net/if_packet.h>
-+#endif
- #include <net/route.h>
- #include <netinet/in.h>
- #include <poll.h>
-diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
-index 9ead907..0a131d7 100644
---- a/lib/ovs-atomic.h
-+++ b/lib/ovs-atomic.h
-@@ -318,7 +318,7 @@
- #include "util.h"
-
- #define IN_OVS_ATOMIC_H
-- #if __CHECKER__
-+ #if 1
- /* sparse doesn't understand some GCC extensions we use. */
- #include "ovs-atomic-pthreads.h"
- #elif __has_extension(c_atomic)
+++ /dev/null
-From 7cf69704374e363fdda227803be3849233ba96f3 Mon Sep 17 00:00:00 2001
-From: Dario Ernst <Dario.Ernst@riverbed.com>
-Date: Fri, 25 Nov 2016 15:33:48 +0100
-Subject: [PATCH 4/4] disable-module-build
-
----
- datapath/linux/Makefile.main.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/datapath/linux/Makefile.main.in b/datapath/linux/Makefile.main.in
-index 7d18253..e5555a7 100644
---- a/datapath/linux/Makefile.main.in
-+++ b/datapath/linux/Makefile.main.in
-@@ -68,7 +68,7 @@ ifeq (,$(wildcard $(CONFIG_FILE)))
- endif
-
- default:
-- $(MAKE) -C $(KSRC) M=$(builddir) modules
-+ @echo skipping module build
-
- modules_install:
- $(MAKE) -C $(KSRC) M=$(builddir) modules_install
---
-2.9.3
-
+++ /dev/null
-diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
-index dc1d02c..61ecf2f 100755
---- a/utilities/ovs-ctl.in
-+++ b/utilities/ovs-ctl.in
-@@ -108,7 +108,7 @@ set_system_ids () {
- esac
- set "$@" external-ids:system-id="\"$SYSTEM_ID\""
-
-- set "$@" external-ids:hostname="\"$(hostname -f)\""
-+ set "$@" external-ids:hostname="\"$(cat /proc/sys/kernel/hostname)\""
-
- set "$@" external-ids:rundir="\"$rundir\""
-
-diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
-index 8665698..7931bc6 100644
---- a/utilities/ovs-lib.in
-+++ b/utilities/ovs-lib.in
-@@ -157,7 +157,11 @@ install_dir () {
- [ "${OVS_USER##*:}" != "" ] && INSTALL_GROUP="${OVS_USER##*:}"
-
- if test ! -d "$DIR"; then
-- install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
-+ mkdir -p "$DIR"
-+ [ -n "$INSTALL_MODE" ] && chmod "$INSTALL_MODE" "$DIR"
-+ local OWN="$INSTALL_USER"
-+ [ -n "$OWN" ] && [ -n "$INSTALL_GROUP" ] && OWN="${OWN}:${INSTALL_GROUP}"
-+ [ -n "$OWN" ] && chown "$OWN" "$DIR"
- restorecon "$DIR" >/dev/null 2>&1
- fi
- }
--- /dev/null
+From c27232c954cdbe0207252ad88fddad4fd6ac0fbc Mon Sep 17 00:00:00 2001
+From: Helmut Schaa <helmut.schaa@googlemail.com>
+Date: Wed, 8 Jan 2014 13:48:33 +0100
+Subject: [PATCH 100/104] netdev-linux: Use unsigned int for ifi_flags
+
+ifi_flags is unsigned, the local equivalents should do the same.
+
+Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
+---
+ lib/netdev-linux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
+index c0471be15..0750e5f2c 100644
+--- a/lib/netdev-linux.c
++++ b/lib/netdev-linux.c
+@@ -2788,7 +2788,7 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
+ enum netdev_flags on, enum netdev_flags *old_flagsp)
+ OVS_REQUIRES(netdev->mutex)
+ {
+- int old_flags, new_flags;
++ unsigned int old_flags, new_flags;
+ int error = 0;
+
+ old_flags = netdev->ifi_flags;
+--
+2.16.2
+
--- /dev/null
+From a6df8dd455c8be7c0c2ba79f35cf5390e892b39e Mon Sep 17 00:00:00 2001
+From: Helmut Schaa <helmut.schaa@googlemail.com>
+Date: Wed, 8 Jan 2014 13:48:49 +0100
+Subject: [PATCH 101/104] netdev-linux: Let interface flag survive internal
+ port setup
+
+Due to a race condition when bringing up an internal port on Linux
+some interface flags (e.g. IFF_MULTICAST) are falsely reset. This
+happens because netlink events may be processed after the according
+netdev has been brought up (which sets interface flags).
+
+Fix this by reading the interface flags just before updating them
+if they have not been updated by from the kernel yet.
+
+Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
+---
+ lib/netdev-linux.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
+index 0750e5f2c..59e7b9c96 100644
+--- a/lib/netdev-linux.c
++++ b/lib/netdev-linux.c
+@@ -2791,7 +2791,13 @@ update_flags(struct netdev_linux *netdev, enum netdev_flags off,
+ unsigned int old_flags, new_flags;
+ int error = 0;
+
+- old_flags = netdev->ifi_flags;
++ if (!(netdev->cache_valid & VALID_DRVINFO)) {
++ /* Most likely the debvice flags are not in sync yet, fetch them now */
++ get_flags(&netdev->up, &old_flags);
++ } else {
++ old_flags = netdev->ifi_flags;
++ }
++
+ *old_flagsp = iff_to_nd_flags(old_flags);
+ new_flags = (old_flags & ~nd_to_iff_flags(off)) | nd_to_iff_flags(on);
+ if (new_flags != old_flags) {
+--
+2.16.2
+
--- /dev/null
+From b3cc748d502f7f87aeb103b3f69573b0e640e2ba Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Wed, 28 Feb 2018 13:42:44 +0800
+Subject: [PATCH 102/104] python: separate host/target python for cross-compile
+
+At the moment, python-six is a requirement for openvswitch python
+library on target machine.
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ Makefile.am | 2 +-
+ m4/openvswitch.m4 | 12 ++++--------
+ 2 files changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 31d633179..4b9e8d491 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -59,7 +59,7 @@ endif
+ # foo/__init__.pyc will cause Python to ignore foo.py.
+ run_python = \
+ PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
+- PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
++ PYTHONDONTWRITEBYTECODE=yes $(PYTHON_HOST)
+
+ ALL_LOCAL =
+ BUILT_SOURCES =
+diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
+index 00ffad35f..52f207bda 100644
+--- a/m4/openvswitch.m4
++++ b/m4/openvswitch.m4
+@@ -347,20 +347,16 @@ else:
+ if test $ovs_cv_python = no; then
+ AC_MSG_ERROR([cannot find python 2.7 or higher.])
+ fi
+- AM_MISSING_PROG([PYTHON], [python])
++ AC_SUBST([PYTHON])
+ PYTHON=$ovs_cv_python
++ AM_MISSING_PROG([PYTHON_HOST], [python])
++ PYTHON_HOST=$ovs_cv_python_host
+
+ # HAVE_PYTHON is always true. (Python has not always been a build
+ # requirement, so this variable is now obsolete.)
+ AC_SUBST([HAVE_PYTHON])
+ HAVE_PYTHON=yes
+- AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])
+-
+- AC_MSG_CHECKING([whether $PYTHON has six library])
+- if ! $PYTHON -c 'import six ; six.moves.range' >&AS_MESSAGE_LOG_FD 2>&1; then
+- AC_MSG_ERROR([Missing Python six library or version too old.])
+- fi
+- AC_MSG_RESULT([yes])])
++ AM_CONDITIONAL([HAVE_PYTHON], [test "$HAVE_PYTHON" = yes])])
+
+ dnl Checks for Python 3.x, x >= 4.
+ AC_DEFUN([OVS_CHECK_PYTHON3],
+--
+2.16.2
+
--- /dev/null
+From 05a6fa94778f9d6c54ca676de80708d03d6c365a Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Wed, 14 Mar 2018 16:40:01 +0800
+Subject: [PATCH 103/104] ovs-ctl: fix setting hostname
+
+The command "hostname" is not available in OpenWrt by default.
+
+The other thing to note is that currently kernel.hostname is not a fully
+qualitied name
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ utilities/ovs-ctl.in | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
+index 4ddc450fb..52018e6d3 100755
+--- a/utilities/ovs-ctl.in
++++ b/utilities/ovs-ctl.in
+@@ -68,9 +68,7 @@ ovs_vsctl () {
+ }
+
+ set_hostname () {
+- # 'hostname -f' needs network connectivity to work. So we should
+- # call this only after ovs-vswitchd is running.
+- ovs_vsctl set Open_vSwitch . external-ids:hostname="$(hostname -f)"
++ ovs_vsctl set Open_vSwitch . external-ids:hostname="$(sysctl -n kernel.hostname)"
+ }
+
+ set_system_ids () {
+--
+2.16.2
+
--- /dev/null
+From d8dd661e1c100a2d2ba0361cf6c91dcdedfeeb70 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Wed, 14 Mar 2018 16:44:13 +0800
+Subject: [PATCH 104/104] ovs-lib: fix install_dir()
+
+The command "install" is not available in OpenWrt by default
+
+Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
+---
+ utilities/ovs-lib.in | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
+index 1bccea0c5..457297f3f 100644
+--- a/utilities/ovs-lib.in
++++ b/utilities/ovs-lib.in
+@@ -157,7 +157,10 @@ install_dir () {
+ [ "${OVS_USER##*:}" != "" ] && INSTALL_GROUP="${OVS_USER##*:}"
+
+ if test ! -d "$DIR"; then
+- install -d -m "$INSTALL_MODE" -o "$INSTALL_USER" -g "$INSTALL_GROUP" "$DIR"
++ mkdir -p "$DIR"
++ chmod "$INSTALL_MODE"
++ chown "$INSTALL_USER" "$DIR"
++ chgrp "$INSTALL_GROUP" "$DIR"
+ restorecon "$DIR" >/dev/null 2>&1
+ fi
+ }
+--
+2.16.2
+
--- /dev/null
+#
+# Copyright (C) 2012-2018 Karl Palsson <karlp@tweak.net.au>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pagekitec
+PKG_REV:=0.91.171102
+PKG_VERSION:=$(PKG_REV)C
+PKG_RELEASE:=1
+PKG_LICENSE:=Apache-2.0
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://github.com/pagekite/libpagekite.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_REV)
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+CONFIGURE_ARGS += --without-java
+
+define Package/pagekitec/default
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=Make localhost servers publicly visible.
+ URL:=https://pagekite.net/wiki/Floss/LibPageKite/
+ MAINTAINER:= Karl Palsson <karlp@tweak.net.au>
+ DEPENDS:=+libopenssl +libpthread +libev
+endef
+
+define Package/libpagekite
+ $(call Package/pagekitec/default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE+= (library)
+endef
+
+define Package/pagekitec
+ $(call Package/pagekitec/default)
+ DEPENDS:=+libpagekite
+endef
+
+define Package/pagekitec/default/description
+PageKite is a system for running publicly visible servers (generally
+web servers) on machines without a direct connection to the Internet,
+such as mobile devices or computers behind restrictive firewalls.
+PageKite works around NAT, firewalls and IP-address limitations by
+using a combination of tunnels and reverse proxies.
+
+This package provides an implementation of the PageKite Protocol in C,
+optimized for high-performance or embedded applications.
+
+endef
+
+define Package/libpagekite/description
+ $(call Package/pagekitec/default/description)
+
+This package contains the core library
+endef
+
+define Package/pagekitec/description
+ $(call Package/pagekitec/default/description)
+
+This package contains a basic backend useful for exposing http/ssh servers.
+
+Basic UCI support for configuring this backend is also included.
+endef
+
+define Package/pagekitec/conffiles
+/etc/config/pagekitec
+endef
+
+define Build/Configure
+ (cd $(PKG_BUILD_DIR); ./autogen.sh );
+ $(call Build/Configure/Default)
+endef
+
+#this installs files into ./staging_dir/. so that you can cross compile from the host
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/{include,lib/pkgconfig}
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/libpagekite/pagekite.h $(1)/usr/include
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpagekite.{a,so*} $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libpagekite/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libpagekite.so* $(1)/usr/lib
+endef
+
+define Package/pagekitec/install
+ $(CP) ./files/* $(1)/
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pagekitec $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,pagekitec))
+$(eval $(call BuildPackage,libpagekite))
--- /dev/null
+config pagekitec pagekitec
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Oct 2012, karlp@remake.is
+START=90
+APP=pagekitec
+USE_PROCD=1
+
+add_instance() {
+ local cfg="$1"
+ local kitename kitesecret simple_http simple_ssh static
+ config_get kitename "$cfg" kitename
+ config_get kitesecret "$cfg" kitesecret
+ [ -z "$kitename" -o -z "$kitesecret" ] && {
+ echo "Both kitename and kitesecret must be specified"
+ return 1
+ }
+ config_get_bool simple_http "$cfg" simple_http 0
+ config_get_bool simple_ssh "$cfg" simple_ssh 0
+ config_get_bool static "$cfg" static 0
+
+ procd_open_instance
+ procd_set_param command $APP
+ procd_append_param command -s
+ [ $static -eq 1 ] && procd_append_param command -S
+ [ $simple_http -eq 1 ] && procd_append_param command 80 http $kitename 80 $kitesecret
+ [ $simple_ssh -eq 1 ] && procd_append_param command 22 raw $kitename 443 $kitesecret
+ procd_close_instance
+}
+
+start_service() {
+ config_load pagekitec && config_foreach add_instance pagekitec
+}
+
+service_triggers()
+{
+ procd_add_reload_trigger "pagekitec"
+}
include $(TOPDIR)/rules.mk
PKG_NAME:=pingcheck
-PKG_VERSION:=0.1
+PKG_VERSION:=2017-10-02
PKG_RELEASE:=1
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_MIRROR_HASH:=511a6bedd65169ffd1aadb38dd470d53d445cffcc3a322ec2dd0dee6009162a6
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=https://github.com/br101/pingcheck.git
+PKG_SOURCE_URL:=https://github.com/br101/pingcheck
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=0f099998782f550e2abebdc65bcc3e969b798769
+PKG_SOURCE_VERSION:=12e65e2f3fd2a17db785d28756df43ccade29b1b
PKG_MAINTAINER:=Bruno Randolf <br1@einfach.org>
PKG_LICENSE:=GPL-2.0+
DEPENDS:=+libubus +libuci
MAINTAINER:=Bruno Randolf <br1@einfach.org>
TITLE:=Check Internet and interface connectivity
+ URL:=https://github.com/br101/pingcheck
endef
define Package/pingcheck/description
-Checks by using "ping" (ICMP echo) wether a configured host (normally on the
-internet) can be reached via a specific interface. Then makes this information
-available via ubus and triggers "online" and "offline" scripts.
+Checks by using "ping" (ICMP echo) or by opening connections to TCP port 80
+wether a configured host (normally on the internet) can be reached via a
+specific interface. Then makes this information available via ubus and triggers
+"online" and "offline" scripts.
endef
define Package/pingcheck/conffiles
define Package/pingcheck/install
$(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/pingcheck $(1)/usr/sbin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/pingcheck $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./pingcheck.init $(1)/etc/init.d/pingcheck
$(INSTALL_DIR) $(1)/etc/config
-# Copyright (C) 2017 Yousong Zhou
+# Copyright (C) 2017-2018 Yousong Zhou
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=pixiewps
-PKG_VERSION:=1.4.1
-PKG_RELEASE:=1
+PKG_VERSION:=1.4.2
+PKG_RELEASE:=2
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/wiire-a/pixiewps/releases/download/v$(PKG_VERSION)
-PKG_HASH:=8b61b9d94e26c07ab08a01eacd200576375c08139f9d781b5fdbb587ddd33528
+PKG_HASH:=c4dc0569e476ebdbd85992da2d1ff799db97ed0040da9dc44e13d08a97a9de1e
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE.md
include $(INCLUDE_DIR)/package.mk
-MAKE_PATH:=src
define Package/pixiewps
SECTION:=net
meant for educational purposes only.
endef
+# override flags by pixiewps' own Makefile
+MAKE_FLAGS += \
+ CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
+ CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
+
define Package/pixiewps/install
$(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pixiewps $(1)/usr/bin/
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/pixiewps $(1)/usr/bin/
endef
$(eval $(call BuildPackage,pixiewps))
PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../../lang/python/python-package.mk
+include ../../lang/python/python3-package.mk
# no default dependencies
PKG_DEFAULT_DEPENDS:=
include $(TOPDIR)/rules.mk
PKG_NAME:=reaver
-PKG_VERSION:=1.6.3
-PKG_RELEASE:=2
+PKG_VERSION:=1.6.4
+PKG_RELEASE:=1
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/t6x/reaver-wps-fork-t6x/releases/download/v$(PKG_VERSION)
-PKG_HASH:=191f785f53030e4803260ada1a29ca4b42c848d56f6f3982e320d03b6117aaf2
+PKG_HASH:=bf63b3d5a5596b0bd292a995f778dc99b0b89af88237cc2cfd7c4abbce942bb2
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=docs/LICENSE
PKG_NAME:=rp-pppoe
PKG_VERSION:=3.12
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_MAINTAINER:=Daniel Dickinson <lede@cshore.thecshore.com>
PKG_LICENSE:=LGPL-2.0+
define Package/rp-pppoe-common
$(call Package/rp-pppoe/Default)
TITLE+= common
- DEPENDS:=+ppp
+ DEPENDS:=ppp
endef
define Package/rp-pppoe-common/description
define Package/rp-pppoe-server
$(call Package/rp-pppoe/Default)
- DEPENDS:=+rp-pppoe-common
+ DEPENDS:=+rp-pppoe-common +ppp-mod-pppoe
TITLE+= server
endef
TARGET_CFLAGS += -I$(PKG_BUILD_DIR)/src/libevent -isystem $(PKG_BUILD_DIR)/missing-headers
CONFIGURE_PATH := ./src
CONFIGURE_ARGS += ac_cv_path_PPPD=/usr/sbin/pppd --enable-plugin=$(STAGING_DIR)/usr/include/
-MAKE_FLAGS := DESTDIR="$(PKG_INSTALL_DIR)" install
+MAKE_FLAGS := DESTDIR="$(PKG_INSTALL_DIR)" PLUGIN_PATH=rp-pppoe.so install
MAKE_PATH := ./src
define Build/Prepare
$(INSTALL_DIR) $(1)/etc/ppp/plugins
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/pppoe-server $(1)/usr/sbin/
- $(CP) $(PKG_INSTALL_DIR)/etc/ppp/plugins/rp-pppoe.so $(1)/etc/ppp/plugins/
$(INSTALL_DATA) ./files/pppoe-server.default $(1)/etc/uci-defaults/
endef
# Copyright (C) 2006-2011 OpenWrt.org
START=50
+STOP=50
USE_PROCD=1
pppoe_triggers() {
local cfg="$1"
- local interface server_interfaces client_interfaces both_interfaces
+ local enabled interface server_interfaces client_interfaces both_interfaces
+ config_get_bool enabled "$cfg" enabled 1
+ [ "$enabled" -gt 0 ] || return 0
config_get server_interfaces "$cfg" server_interface
config_get client_interfaces "$cfg" client_interface
config_get both_interfaces "$cfg" both_interfaces
- for interface in $server_interfaces; do
- append interfaces "$interface" "|"
- done
- for interface in $client_interfaces; do
- append interfaces "$interface" "|"
- done
- for interface in $both_interfaces; do
- append interfaces "$interface" "|"
+ for interface in $server_interfaces $client_interfaces $both_interfaces; do
+ procd_add_reload_interface_trigger $interface
done
}
pppoe_relay_instance() {
local cfg="$1"
- local interface server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS
+ local enabled interface device server_interfaces client_interfaces both_interfaces maxsessions timeout OPTIONS
+ config_get_bool enabled "$cfg" enabled 1
+ [ "$enabled" -gt 0 ] || return 0
config_get server_interfaces "$cfg" server_interface
config_get client_interfaces "$cfg" client_interface
config_get both_interfaces "$cfg" both_interfaces
if [ "$use_non_uci_config" -gt 0 ]; then
. /etc/default/pppoe-relay
else
- [ -z "${server_interfaces}${client_interfaces}${both_interfaces}" ] && return 1
+ local NEED_INTFS=SC
+ . /lib/functions/network.sh
for interface in $server_interfaces; do
- append OPTIONS "-S $interface"
+ if network_get_physdev device $interface; then
+ append OPTIONS "-S $device"
+ NEED_INTFS=${NEED_INTFS/S/}
+ fi
done
for interface in $client_interfaces; do
- append OPTIONS "-C $interface"
+ if network_get_physdev device $interface; then
+ append OPTIONS "-C $device"
+ NEED_INTFS=${NEED_INTFS/C/}
+ fi
done
for interface in $both_interfaces; do
- append OPTIONS "-B $interface"
+ if network_get_physdev device $interface; then
+ append OPTIONS "-B $device"
+ NEED_INTFS=${NEED_INTFS/?/}
+ fi
done
+ [ -z "${NEED_INTFS}" ] || return 1 # need at least 2 interfaces, one for server(s) and one for client(s)
[ -n "$maxsessions" ] && append OPTIONS "-n $maxsessions"
[ -n "$timeout" ] && append OPTIONS "-i $timeout"
fi
procd_open_instance
- procd_set_param command /usr/sbin/pppoe-relay -F
- procd_append_param command $OPTIONS
+ procd_set_param command /usr/sbin/pppoe-relay -F $OPTIONS
+ procd_set_param respawn
procd_close_instance
}
start_service() {
- local use_non_uci_config
+ local use_non_uci_config
- config_load pppoe
- config_foreach pppoe_relay_instance pppoe_relay
+ config_load pppoe
+ config_foreach pppoe_relay_instance pppoe_relay
}
-reload_triggers() {
- local interfaces
-
- config_load pppoe
- config_foreach pppoe_triggers pppoe_relay
+service_triggers() {
+ procd_add_reload_trigger "pppoe"
- procd_add_reload_trigger "pppoe"
- procd_add_interface_trigger "$interfaces"
+ config_load pppoe
+ config_foreach pppoe_triggers pppoe_relay
}
# Copyright (C) 2006-2011 OpenWrt.org
START=50
+STOP=50
USE_PROCD=1
pppoe_triggers() {
- local cfg="$1"
- local interface
- config_get interface "$cfg" interface
+ local cfg="$1"
+ local enabled interface
+ config_get_bool enabled "$cfg" enabled 1
+ [ "$enabled" -gt 0 ] || return 0
+ config_get interface "$cfg" interface
+ procd_add_reload_interface_trigger $interface
}
pppoe_instance() {
- local cfg="$1"
- local interface ac_name service_names service_name maxsessionsperpeer localip firstremoteip maxsessions optionsfiles randomsession unit offset timeout mss sync OPTIONS
- config_get interface "$cfg" interface
- config_get ac_name "$cfg" ac_name
- config_get service_names "$cfg" service_name
- config_get maxsessionsperpeer "$cfg" maxsessionsperpeer
- config_get localip "$cfg" localip
- config_get firstremoteip "$cfg" firstremoteip
- config_get maxsessions "$cfg" maxsessions
- config_get optionsfile "$cfg" optionsfile
- config_get_bool randomsession "$cfg" randomsession 1
- config_get_bool unit "$cfg" unit 0
- config_get offset "$cfg" offset
- config_get timeout "$cfg" timeout
- config_get mss "$cfg" mss
- config_get_bool sync "$cfg" sync 0
- config_get use_non_uci_config "$cfg" use_non_uci_config 0
+ local cfg="$1"
+ local enabled interface device ac_name service_names service_name maxsessionsperpeer localip firstremoteip maxsessions optionsfiles randomsession unit offset timeout mss sync OPTIONS
+ config_get_bool enabled "$cfg" enabled 1
+ [ "$enabled" -gt 0 ] || return 0
+ config_get interface "$cfg" interface
+ config_get ac_name "$cfg" ac_name
+ config_get service_names "$cfg" service_name
+ config_get maxsessionsperpeer "$cfg" maxsessionsperpeer
+ config_get localip "$cfg" localip
+ config_get firstremoteip "$cfg" firstremoteip
+ config_get maxsessions "$cfg" maxsessions
+ config_get optionsfile "$cfg" optionsfile
+ config_get_bool randomsession "$cfg" randomsession 1
+ config_get_bool unit "$cfg" unit 0
+ config_get offset "$cfg" offset
+ config_get timeout "$cfg" timeout
+ config_get mss "$cfg" mss
+ config_get_bool sync "$cfg" sync 0
+ config_get_bool use_non_uci_config "$cfg" use_non_uci_config 0
- if [ "$use_non_uci_config" -gt 0 ]; then
- . /etc/default/pppoe-server
- else
- [ -z "$interface" ] && return 1
- [ -n "$ac_name" ] && append OPTIONS "-C $ac_name"
- for service_name in $service_names; do
- append OPTIONS "-S $service_name"
- done
- append OPTIONS "-I $interface"
- [ -n "$maxsessionsperpeer" ] && append OPTIONS "-x $maxsessionsperpeer"
- [ -n "$localip" ] && append OPTIONS "-L $localip"
- [ -n "$firstremoteip" ] && append OPTIONS "-R $firstremoteip"
- [ -n "maxsessions" ] && append OPTIONS "-N $maxsessions"
- [ -n "optionsfile" ] && append OPTIONS "-O $optionsfile"
- [ "$randomsession" = "1" ] && append OPTIONS "-r"
- [ "$unit" = "1" ] && append OPTIONS "-u"
- [ -n "$offset" ] && append OPTIONS "-o $offset"
- [ -n "$timeout" ] && append OPTIONS "-T $timeout"
- [ -n "$mss" ] && append OPTIONS "-m $mss"
- [ "$sync" = "1" ] && append OPTIONS "-s"
- fi
+ if [ "$use_non_uci_config" -gt 0 ]; then
+ . /etc/default/pppoe-server
+ else
+ . /lib/functions/network.sh
+ network_get_physdev device $interface || return 1
+ [ -n "$ac_name" ] && append OPTIONS "-C $ac_name"
+ for service_name in $service_names; do
+ append OPTIONS "-S $service_name"
+ done
+ append OPTIONS "-I $device"
+ [ -n "$maxsessionsperpeer" ] && append OPTIONS "-x $maxsessionsperpeer"
+ [ -n "$localip" ] && append OPTIONS "-L $localip"
+ [ -n "$firstremoteip" ] && append OPTIONS "-R $firstremoteip"
+ [ -n "maxsessions" ] && append OPTIONS "-N $maxsessions"
+ [ -n "optionsfile" ] && append OPTIONS "-O $optionsfile"
+ [ "$randomsession" = "1" ] && append OPTIONS "-r"
+ [ "$unit" = "1" ] && append OPTIONS "-u"
+ [ -n "$offset" ] && append OPTIONS "-o $offset"
+ [ -n "$timeout" ] && append OPTIONS "-T $timeout"
+ [ -n "$mss" ] && append OPTIONS "-m $mss"
+ [ "$sync" = "1" ] && append OPTIONS "-s"
+ fi
- procd_open_instance
- procd_set_param command /usr/sbin/pppoe-server -F
- procd_append_param command $OPTIONS
- procd_set_param file /etc/ppp/options
- procd_append_param file /etc/ppp/pppoe-server-options
- procd_close_instance
+ procd_open_instance
+ procd_set_param command /usr/sbin/pppoe-server -F -k $OPTIONS
+ procd_set_param respawn
+ procd_set_param file /etc/ppp/options
+ procd_append_param file /etc/ppp/pppoe-server-options
+ procd_close_instance
}
start_service() {
- config_load pppoe
- config_foreach pppoe_instance pppoe_server
+ config_load pppoe
+ config_foreach pppoe_instance pppoe_server
}
service_triggers() {
- local interface
- config_load pppoe
- config_foreach pppoe_triggers pppoe_server
+ procd_add_reload_trigger "pppoe"
- procd_add_reload_trigger "pppoe"
- procd_add_interface_trigger "$interface"
+ config_load pppoe
+ config_foreach pppoe_triggers pppoe_server
}
--- a/src/configure
+++ b/src/configure
-@@ -3661,7 +3661,7 @@ done
+@@ -3691,7 +3691,7 @@ done
for ac_header in linux/if.h
do :
- ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include<sys/socket.h>
+ ac_fn_c_check_header_compile "$LINENO" "linux/if.h" "ac_cv_header_linux_if_h" "#include <sys/socket.h>
"
- if test "x$ac_cv_header_linux_if_h" = x""yes; then :
+ if test "x$ac_cv_header_linux_if_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
-@@ -3675,10 +3675,11 @@ done
+@@ -3705,10 +3705,11 @@ done
for ac_header in linux/if_pppox.h
do :
ac_fn_c_check_header_compile "$LINENO" "linux/if_pppox.h" "ac_cv_header_linux_if_pppox_h" "
+#include <linux/in6.h>
"
- if test "x$ac_cv_header_linux_if_pppox_h" = x""yes; then :
-@@ -4611,7 +4612,7 @@ esac
+ if test "x$ac_cv_header_linux_if_pppox_h" = xyes; then :
+@@ -4644,7 +4645,7 @@ esac
$as_echo_n "checking packing order of bit fields... " >&6; }
if test "${rpppoe_cv_pack_bitfields+set}" != set ; then
if test "$cross_compiling" = yes; then :
- @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS) -Llibevent -levent
+ @CC@ -o $@ @RDYNAMIC@ $^ $(LDFLAGS) $(PPPOE_SERVER_LIBS)
- pppoe: pppoe.o if.o debug.o common.o ppp.o discovery.o
- @CC@ -o $@ $^ $(LDFLAGS)
+ # Experimental code from Savoir Faire Linux. I do not consider it
+ # production-ready, so not part of the official distribution.
-Index: rp-pppoe-3.11/src/configure
-===================================================================
---- rp-pppoe-3.11.orig/src/configure 2016-05-21 23:42:58.142423086 -0400
-+++ rp-pppoe-3.11/src/configure 2016-05-21 23:42:58.178423086 -0400
-@@ -3646,7 +3646,7 @@
+--- a/src/configure
++++ b/src/configure
+@@ -3676,7 +3676,7 @@ fi
done
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-Index: rp-pppoe-3.11/src/if.c
-===================================================================
---- rp-pppoe-3.11.orig/src/if.c 2012-08-17 14:31:25.000000000 -0400
-+++ rp-pppoe-3.11/src/if.c 2016-05-21 23:45:13.546423086 -0400
-@@ -30,10 +30,6 @@
+--- a/src/if.c
++++ b/src/if.c
+@@ -30,10 +30,6 @@ static char const RCSID[] =
#include <linux/if_packet.h>
#endif
#ifdef HAVE_ASM_TYPES_H
#include <asm/types.h>
#endif
-Index: rp-pppoe-3.11/src/plugin.c
-===================================================================
---- rp-pppoe-3.11.orig/src/plugin.c 2012-08-17 14:31:25.000000000 -0400
-+++ rp-pppoe-3.11/src/plugin.c 2016-05-21 23:43:55.314423086 -0400
-@@ -49,7 +49,6 @@
+--- a/src/plugin.c
++++ b/src/plugin.c
+@@ -49,7 +49,6 @@ static char const RCSID[] =
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
--- /dev/null
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -139,7 +139,8 @@ plugin/plugin.o: plugin.c
+ @CC@ -DPLUGIN=1 '-DRP_VERSION="$(VERSION)"' $(CFLAGS) -I$(PPPD_INCDIR) -c -o $@ -fPIC $<
+
+ plugin/libplugin.a: plugin/discovery.o plugin/if.o plugin/common.o plugin/debug.o
+- ar -rc $@ $^
++ $(AR) -rc $@ $^
++ @RANLIB@ $@
+
+ plugin/discovery.o: discovery.c
+ @CC@ -DPLUGIN=1 $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o $@ -fPIC $<
include $(TOPDIR)/rules.mk
PKG_NAME:=rsync
-PKG_VERSION:=3.1.2
-PKG_RELEASE:=4
+PKG_VERSION:=3.1.3
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://download.samba.org/pub/rsync/src
-PKG_HASH:=ecfa62a7fa3c4c18b9eccd8c16eaddee4bd308a76ea50b5c02a5840f09c0a1c2
+PKG_HASH:=55cc554efec5fdaad70de921cd5a5eeb6c29a95524c715f3bbf849235b0800c0
PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=COPYING
+++ /dev/null
-commit af5bb175ec78d97d34e0c140cfbb1039c52c7159
-Author: Maxim Storchak <m.storchak@gmail.com>
-Date: Thu Dec 7 22:48:00 2017 +0200
-
- rm
-
-diff --git a/configure.sh b/configure.sh
-deleted file mode 100755
-index d6e9c8d..0000000
---- a/configure.sh
-+++ /dev/null
-@@ -1,10350 +0,0 @@
--#! /bin/sh
--# Guess values for system-dependent variables and create Makefiles.
--# Generated by GNU Autoconf 2.69 for rsync 3.1.2.
--#
--# Report bugs to <http://rsync.samba.org/bugzilla.html>.
--#
--#
--# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
--#
--#
--# This configure script is free software; the Free Software Foundation
--# gives unlimited permission to copy, distribute and modify it.
--## -------------------- ##
--## M4sh Initialization. ##
--## -------------------- ##
--
--# Be more Bourne compatible
--DUALCASE=1; export DUALCASE # for MKS sh
--if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-- emulate sh
-- NULLCMD=:
-- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-- # is contrary to our usage. Disable this feature.
-- alias -g '${1+"$@"}'='"$@"'
-- setopt NO_GLOB_SUBST
--else
-- case `(set -o) 2>/dev/null` in #(
-- *posix*) :
-- set -o posix ;; #(
-- *) :
-- ;;
--esac
--fi
--
--
--as_nl='
--'
--export as_nl
--# Printing a long string crashes Solaris 7 /usr/bin/printf.
--as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
--as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
--as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
--# Prefer a ksh shell builtin over an external printf program on Solaris,
--# but without wasting forks for bash or zsh.
--if test -z "$BASH_VERSION$ZSH_VERSION" \
-- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-- as_echo='print -r --'
-- as_echo_n='print -rn --'
--elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-- as_echo='printf %s\n'
-- as_echo_n='printf %s'
--else
-- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-- as_echo_n='/usr/ucb/echo -n'
-- else
-- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-- as_echo_n_body='eval
-- arg=$1;
-- case $arg in #(
-- *"$as_nl"*)
-- expr "X$arg" : "X\\(.*\\)$as_nl";
-- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-- esac;
-- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-- '
-- export as_echo_n_body
-- as_echo_n='sh -c $as_echo_n_body as_echo'
-- fi
-- export as_echo_body
-- as_echo='sh -c $as_echo_body as_echo'
--fi
--
--# The user is always right.
--if test "${PATH_SEPARATOR+set}" != set; then
-- PATH_SEPARATOR=:
-- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-- PATH_SEPARATOR=';'
-- }
--fi
--
--
--# IFS
--# We need space, tab and new line, in precisely that order. Quoting is
--# there to prevent editors from complaining about space-tab.
--# (If _AS_PATH_WALK were called with IFS unset, it would disable word
--# splitting by setting IFS to empty value.)
--IFS=" "" $as_nl"
--
--# Find who we are. Look in the path if we contain no directory separator.
--as_myself=
--case $0 in #((
-- *[\\/]* ) as_myself=$0 ;;
-- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-- done
--IFS=$as_save_IFS
--
-- ;;
--esac
--# We did not find ourselves, most probably we were run as `sh COMMAND'
--# in which case we are not to be found in the path.
--if test "x$as_myself" = x; then
-- as_myself=$0
--fi
--if test ! -f "$as_myself"; then
-- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-- exit 1
--fi
--
--# Unset variables that we do not need and which cause bugs (e.g. in
--# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
--# suppresses any "Segmentation fault" message there. '((' could
--# trigger a bug in pdksh 5.2.14.
--for as_var in BASH_ENV ENV MAIL MAILPATH
--do eval test x\${$as_var+set} = xset \
-- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
--done
--PS1='$ '
--PS2='> '
--PS4='+ '
--
--# NLS nuisances.
--LC_ALL=C
--export LC_ALL
--LANGUAGE=C
--export LANGUAGE
--
--# CDPATH.
--(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
--
--# Use a proper internal environment variable to ensure we don't fall
-- # into an infinite loop, continuously re-executing ourselves.
-- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
-- _as_can_reexec=no; export _as_can_reexec;
-- # We cannot yet assume a decent shell, so we have to provide a
--# neutralization value for shells without unset; and this also
--# works around shells that cannot unset nonexistent variables.
--# Preserve -v and -x to the replacement shell.
--BASH_ENV=/dev/null
--ENV=/dev/null
--(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
--case $- in # ((((
-- *v*x* | *x*v* ) as_opts=-vx ;;
-- *v* ) as_opts=-v ;;
-- *x* ) as_opts=-x ;;
-- * ) as_opts= ;;
--esac
--exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
--# Admittedly, this is quite paranoid, since all the known shells bail
--# out after a failed `exec'.
--$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
--as_fn_exit 255
-- fi
-- # We don't want this to propagate to other subprocesses.
-- { _as_can_reexec=; unset _as_can_reexec;}
--if test "x$CONFIG_SHELL" = x; then
-- as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
-- emulate sh
-- NULLCMD=:
-- # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
-- # is contrary to our usage. Disable this feature.
-- alias -g '\${1+\"\$@\"}'='\"\$@\"'
-- setopt NO_GLOB_SUBST
--else
-- case \`(set -o) 2>/dev/null\` in #(
-- *posix*) :
-- set -o posix ;; #(
-- *) :
-- ;;
--esac
--fi
--"
-- as_required="as_fn_return () { (exit \$1); }
--as_fn_success () { as_fn_return 0; }
--as_fn_failure () { as_fn_return 1; }
--as_fn_ret_success () { return 0; }
--as_fn_ret_failure () { return 1; }
--
--exitcode=0
--as_fn_success || { exitcode=1; echo as_fn_success failed.; }
--as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
--as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
--as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
--if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
--
--else
-- exitcode=1; echo positional parameters were not saved.
--fi
--test x\$exitcode = x0 || exit 1
--test -x / || exit 1"
-- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
-- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
-- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
--test \$(( 1 + 1 )) = 2 || exit 1"
-- if (eval "$as_required") 2>/dev/null; then :
-- as_have_required=yes
--else
-- as_have_required=no
--fi
-- if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
--
--else
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--as_found=false
--for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- as_found=:
-- case $as_dir in #(
-- /*)
-- for as_base in sh bash ksh sh5; do
-- # Try only shells that exist, to save several forks.
-- as_shell=$as_dir/$as_base
-- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
-- CONFIG_SHELL=$as_shell as_have_required=yes
-- if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
-- break 2
--fi
--fi
-- done;;
-- esac
-- as_found=false
--done
--$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
-- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
-- CONFIG_SHELL=$SHELL as_have_required=yes
--fi; }
--IFS=$as_save_IFS
--
--
-- if test "x$CONFIG_SHELL" != x; then :
-- export CONFIG_SHELL
-- # We cannot yet assume a decent shell, so we have to provide a
--# neutralization value for shells without unset; and this also
--# works around shells that cannot unset nonexistent variables.
--# Preserve -v and -x to the replacement shell.
--BASH_ENV=/dev/null
--ENV=/dev/null
--(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
--case $- in # ((((
-- *v*x* | *x*v* ) as_opts=-vx ;;
-- *v* ) as_opts=-v ;;
-- *x* ) as_opts=-x ;;
-- * ) as_opts= ;;
--esac
--exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
--# Admittedly, this is quite paranoid, since all the known shells bail
--# out after a failed `exec'.
--$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
--exit 255
--fi
--
-- if test x$as_have_required = xno; then :
-- $as_echo "$0: This script requires a shell more modern than all"
-- $as_echo "$0: the shells that I found on your system."
-- if test x${ZSH_VERSION+set} = xset ; then
-- $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
-- $as_echo "$0: be upgraded to zsh 4.3.4 or later."
-- else
-- $as_echo "$0: Please tell bug-autoconf@gnu.org and
--$0: http://rsync.samba.org/bugzilla.html about your system,
--$0: including any error possibly output before this
--$0: message. Then install a modern shell, or manually run
--$0: the script under such a shell if you do have one."
-- fi
-- exit 1
--fi
--fi
--fi
--SHELL=${CONFIG_SHELL-/bin/sh}
--export SHELL
--# Unset more variables known to interfere with behavior of common tools.
--CLICOLOR_FORCE= GREP_OPTIONS=
--unset CLICOLOR_FORCE GREP_OPTIONS
--
--## --------------------- ##
--## M4sh Shell Functions. ##
--## --------------------- ##
--# as_fn_unset VAR
--# ---------------
--# Portably unset VAR.
--as_fn_unset ()
--{
-- { eval $1=; unset $1;}
--}
--as_unset=as_fn_unset
--
--# as_fn_set_status STATUS
--# -----------------------
--# Set $? to STATUS, without forking.
--as_fn_set_status ()
--{
-- return $1
--} # as_fn_set_status
--
--# as_fn_exit STATUS
--# -----------------
--# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
--as_fn_exit ()
--{
-- set +e
-- as_fn_set_status $1
-- exit $1
--} # as_fn_exit
--
--# as_fn_mkdir_p
--# -------------
--# Create "$as_dir" as a directory, including parents if necessary.
--as_fn_mkdir_p ()
--{
--
-- case $as_dir in #(
-- -*) as_dir=./$as_dir;;
-- esac
-- test -d "$as_dir" || eval $as_mkdir_p || {
-- as_dirs=
-- while :; do
-- case $as_dir in #(
-- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-- *) as_qdir=$as_dir;;
-- esac
-- as_dirs="'$as_qdir' $as_dirs"
-- as_dir=`$as_dirname -- "$as_dir" ||
--$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-- X"$as_dir" : 'X\(//\)[^/]' \| \
-- X"$as_dir" : 'X\(//\)$' \| \
-- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X"$as_dir" |
-- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)[^/].*/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
-- test -d "$as_dir" && break
-- done
-- test -z "$as_dirs" || eval "mkdir $as_dirs"
-- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
--
--
--} # as_fn_mkdir_p
--
--# as_fn_executable_p FILE
--# -----------------------
--# Test if FILE is an executable regular file.
--as_fn_executable_p ()
--{
-- test -f "$1" && test -x "$1"
--} # as_fn_executable_p
--# as_fn_append VAR VALUE
--# ----------------------
--# Append the text in VALUE to the end of the definition contained in VAR. Take
--# advantage of any shell optimizations that allow amortized linear growth over
--# repeated appends, instead of the typical quadratic growth present in naive
--# implementations.
--if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-- eval 'as_fn_append ()
-- {
-- eval $1+=\$2
-- }'
--else
-- as_fn_append ()
-- {
-- eval $1=\$$1\$2
-- }
--fi # as_fn_append
--
--# as_fn_arith ARG...
--# ------------------
--# Perform arithmetic evaluation on the ARGs, and store the result in the
--# global $as_val. Take advantage of shells that can avoid forks. The arguments
--# must be portable across $(()) and expr.
--if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-- eval 'as_fn_arith ()
-- {
-- as_val=$(( $* ))
-- }'
--else
-- as_fn_arith ()
-- {
-- as_val=`expr "$@" || test $? -eq 1`
-- }
--fi # as_fn_arith
--
--
--# as_fn_error STATUS ERROR [LINENO LOG_FD]
--# ----------------------------------------
--# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
--# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
--# script with STATUS, using 1 if that was 0.
--as_fn_error ()
--{
-- as_status=$1; test $as_status -eq 0 && as_status=1
-- if test "$4"; then
-- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
-- fi
-- $as_echo "$as_me: error: $2" >&2
-- as_fn_exit $as_status
--} # as_fn_error
--
--if expr a : '\(a\)' >/dev/null 2>&1 &&
-- test "X`expr 00001 : '.*\(...\)'`" = X001; then
-- as_expr=expr
--else
-- as_expr=false
--fi
--
--if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-- as_basename=basename
--else
-- as_basename=false
--fi
--
--if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-- as_dirname=dirname
--else
-- as_dirname=false
--fi
--
--as_me=`$as_basename -- "$0" ||
--$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-- X"$0" : 'X\(//\)$' \| \
-- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X/"$0" |
-- sed '/^.*\/\([^/][^/]*\)\/*$/{
-- s//\1/
-- q
-- }
-- /^X\/\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\/\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
--
--# Avoid depending upon Character Ranges.
--as_cr_letters='abcdefghijklmnopqrstuvwxyz'
--as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
--as_cr_Letters=$as_cr_letters$as_cr_LETTERS
--as_cr_digits='0123456789'
--as_cr_alnum=$as_cr_Letters$as_cr_digits
--
--
-- as_lineno_1=$LINENO as_lineno_1a=$LINENO
-- as_lineno_2=$LINENO as_lineno_2a=$LINENO
-- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
-- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
-- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
-- sed -n '
-- p
-- /[$]LINENO/=
-- ' <$as_myself |
-- sed '
-- s/[$]LINENO.*/&-/
-- t lineno
-- b
-- :lineno
-- N
-- :loop
-- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-- t loop
-- s/-\n.*//
-- ' >$as_me.lineno &&
-- chmod +x "$as_me.lineno" ||
-- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
--
-- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
-- # already done that, so ensure we don't try to do so again and fall
-- # in an infinite loop. This has already happened in practice.
-- _as_can_reexec=no; export _as_can_reexec
-- # Don't try to exec as it changes $[0], causing all sort of problems
-- # (the dirname of $[0] is not the place where we might find the
-- # original and so on. Autoconf is especially sensitive to this).
-- . "./$as_me.lineno"
-- # Exit status is that of the last command.
-- exit
--}
--
--ECHO_C= ECHO_N= ECHO_T=
--case `echo -n x` in #(((((
---n*)
-- case `echo 'xy\c'` in
-- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
-- xy) ECHO_C='\c';;
-- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
-- ECHO_T=' ';;
-- esac;;
--*)
-- ECHO_N='-n';;
--esac
--
--rm -f conf$$ conf$$.exe conf$$.file
--if test -d conf$$.dir; then
-- rm -f conf$$.dir/conf$$.file
--else
-- rm -f conf$$.dir
-- mkdir conf$$.dir 2>/dev/null
--fi
--if (echo >conf$$.file) 2>/dev/null; then
-- if ln -s conf$$.file conf$$ 2>/dev/null; then
-- as_ln_s='ln -s'
-- # ... but there are two gotchas:
-- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-- # In both cases, we have to default to `cp -pR'.
-- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-- as_ln_s='cp -pR'
-- elif ln conf$$.file conf$$ 2>/dev/null; then
-- as_ln_s=ln
-- else
-- as_ln_s='cp -pR'
-- fi
--else
-- as_ln_s='cp -pR'
--fi
--rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
--rmdir conf$$.dir 2>/dev/null
--
--if mkdir -p . 2>/dev/null; then
-- as_mkdir_p='mkdir -p "$as_dir"'
--else
-- test -d ./-p && rmdir ./-p
-- as_mkdir_p=false
--fi
--
--as_test_x='test -x'
--as_executable_p=as_fn_executable_p
--
--# Sed expression to map a string onto a valid CPP name.
--as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
--
--# Sed expression to map a string onto a valid variable name.
--as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
--
--
--test -n "$DJDIR" || exec 7<&0 </dev/null
--exec 6>&1
--
--# Name of the host.
--# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
--# so uname gets run too.
--ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
--
--#
--# Initializations.
--#
--ac_default_prefix=/usr/local
--ac_clean_files=
--ac_config_libobj_dir=.
--LIBOBJS=
--cross_compiling=no
--subdirs=
--MFLAGS=
--MAKEFLAGS=
--
--# Identity of this package.
--PACKAGE_NAME='rsync'
--PACKAGE_TARNAME='rsync'
--PACKAGE_VERSION='3.1.2'
--PACKAGE_STRING='rsync 3.1.2'
--PACKAGE_BUGREPORT='http://rsync.samba.org/bugzilla.html'
--PACKAGE_URL=''
--
--ac_unique_file="byteorder.h"
--ac_config_libobj_dir=lib
--# Factoring default headers for most tests.
--ac_includes_default="\
--#include <stdio.h>
--#ifdef HAVE_SYS_TYPES_H
--# include <sys/types.h>
--#endif
--#ifdef HAVE_SYS_STAT_H
--# include <sys/stat.h>
--#endif
--#ifdef STDC_HEADERS
--# include <stdlib.h>
--# include <stddef.h>
--#else
--# ifdef HAVE_STDLIB_H
--# include <stdlib.h>
--# endif
--#endif
--#ifdef HAVE_STRING_H
--# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
--# include <memory.h>
--# endif
--# include <string.h>
--#endif
--#ifdef HAVE_STRINGS_H
--# include <strings.h>
--#endif
--#ifdef HAVE_INTTYPES_H
--# include <inttypes.h>
--#endif
--#ifdef HAVE_STDINT_H
--# include <stdint.h>
--#endif
--#ifdef HAVE_UNISTD_H
--# include <unistd.h>
--#endif"
--
--ac_header_list=
--ac_subst_vars='LTLIBOBJS
--STUNNEL4
--STUNNEL
--MAKE_MAN
--BUILD_ZLIB
--BUILD_POPT
--CC_SHOBJ_FLAG
--OBJ_RESTORE
--OBJ_SAVE
--ALLOCA
--LIBOBJS
--FAKEROOT_PATH
--SHELL_PATH
--HAVE_YODL2MAN
--HAVE_REMSH
--PERL
--MKDIR_P
--INSTALL_DATA
--INSTALL_SCRIPT
--INSTALL_PROGRAM
--EGREP
--GREP
--CPP
--OBJEXT
--EXEEXT
--ac_ct_CC
--CPPFLAGS
--LDFLAGS
--CFLAGS
--CC
--host_os
--host_vendor
--host_cpu
--host
--build_os
--build_vendor
--build_cpu
--build
--RSYNC_VERSION
--target_alias
--host_alias
--build_alias
--LIBS
--ECHO_T
--ECHO_N
--ECHO_C
--DEFS
--mandir
--localedir
--libdir
--psdir
--pdfdir
--dvidir
--htmldir
--infodir
--docdir
--oldincludedir
--includedir
--localstatedir
--sharedstatedir
--sysconfdir
--datadir
--datarootdir
--libexecdir
--sbindir
--bindir
--program_transform_name
--prefix
--exec_prefix
--PACKAGE_URL
--PACKAGE_BUGREPORT
--PACKAGE_STRING
--PACKAGE_VERSION
--PACKAGE_TARNAME
--PACKAGE_NAME
--PATH_SEPARATOR
--SHELL'
--ac_subst_files=''
--ac_user_opts='
--enable_option_checking
--enable_debug
--enable_profile
--enable_maintainer_mode
--with_included_popt
--with_included_zlib
--with_protected_args
--with_rsync_path
--with_rsyncd_conf
--with_rsh
--with_nobody_group
--enable_largefile
--enable_ipv6
--enable_locale
--enable_iconv_open
--enable_iconv
--enable_acl_support
--enable_xattr_support
--'
-- ac_precious_vars='build_alias
--host_alias
--target_alias
--CC
--CFLAGS
--LDFLAGS
--LIBS
--CPPFLAGS
--CPP'
--
--
--# Initialize some variables set by options.
--ac_init_help=
--ac_init_version=false
--ac_unrecognized_opts=
--ac_unrecognized_sep=
--# The variables have the same names as the options, with
--# dashes changed to underlines.
--cache_file=/dev/null
--exec_prefix=NONE
--no_create=
--no_recursion=
--prefix=NONE
--program_prefix=NONE
--program_suffix=NONE
--program_transform_name=s,x,x,
--silent=
--site=
--srcdir=
--verbose=
--x_includes=NONE
--x_libraries=NONE
--
--# Installation directory options.
--# These are left unexpanded so users can "make install exec_prefix=/foo"
--# and all the variables that are supposed to be based on exec_prefix
--# by default will actually change.
--# Use braces instead of parens because sh, perl, etc. also accept them.
--# (The list follows the same order as the GNU Coding Standards.)
--bindir='${exec_prefix}/bin'
--sbindir='${exec_prefix}/sbin'
--libexecdir='${exec_prefix}/libexec'
--datarootdir='${prefix}/share'
--datadir='${datarootdir}'
--sysconfdir='${prefix}/etc'
--sharedstatedir='${prefix}/com'
--localstatedir='${prefix}/var'
--includedir='${prefix}/include'
--oldincludedir='/usr/include'
--docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
--infodir='${datarootdir}/info'
--htmldir='${docdir}'
--dvidir='${docdir}'
--pdfdir='${docdir}'
--psdir='${docdir}'
--libdir='${exec_prefix}/lib'
--localedir='${datarootdir}/locale'
--mandir='${datarootdir}/man'
--
--ac_prev=
--ac_dashdash=
--for ac_option
--do
-- # If the previous option needs an argument, assign it.
-- if test -n "$ac_prev"; then
-- eval $ac_prev=\$ac_option
-- ac_prev=
-- continue
-- fi
--
-- case $ac_option in
-- *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-- *=) ac_optarg= ;;
-- *) ac_optarg=yes ;;
-- esac
--
-- # Accept the important Cygnus configure options, so we can diagnose typos.
--
-- case $ac_dashdash$ac_option in
-- --)
-- ac_dashdash=yes ;;
--
-- -bindir | --bindir | --bindi | --bind | --bin | --bi)
-- ac_prev=bindir ;;
-- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-- bindir=$ac_optarg ;;
--
-- -build | --build | --buil | --bui | --bu)
-- ac_prev=build_alias ;;
-- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-- build_alias=$ac_optarg ;;
--
-- -cache-file | --cache-file | --cache-fil | --cache-fi \
-- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-- ac_prev=cache_file ;;
-- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-- cache_file=$ac_optarg ;;
--
-- --config-cache | -C)
-- cache_file=config.cache ;;
--
-- -datadir | --datadir | --datadi | --datad)
-- ac_prev=datadir ;;
-- -datadir=* | --datadir=* | --datadi=* | --datad=*)
-- datadir=$ac_optarg ;;
--
-- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-- | --dataroo | --dataro | --datar)
-- ac_prev=datarootdir ;;
-- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-- datarootdir=$ac_optarg ;;
--
-- -disable-* | --disable-*)
-- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-- # Reject names that are not valid shell variable names.
-- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-- as_fn_error $? "invalid feature name: $ac_useropt"
-- ac_useropt_orig=$ac_useropt
-- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-- case $ac_user_opts in
-- *"
--"enable_$ac_useropt"
--"*) ;;
-- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
-- ac_unrecognized_sep=', ';;
-- esac
-- eval enable_$ac_useropt=no ;;
--
-- -docdir | --docdir | --docdi | --doc | --do)
-- ac_prev=docdir ;;
-- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-- docdir=$ac_optarg ;;
--
-- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-- ac_prev=dvidir ;;
-- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-- dvidir=$ac_optarg ;;
--
-- -enable-* | --enable-*)
-- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-- # Reject names that are not valid shell variable names.
-- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-- as_fn_error $? "invalid feature name: $ac_useropt"
-- ac_useropt_orig=$ac_useropt
-- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-- case $ac_user_opts in
-- *"
--"enable_$ac_useropt"
--"*) ;;
-- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
-- ac_unrecognized_sep=', ';;
-- esac
-- eval enable_$ac_useropt=\$ac_optarg ;;
--
-- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-- | --exec | --exe | --ex)
-- ac_prev=exec_prefix ;;
-- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-- | --exec=* | --exe=* | --ex=*)
-- exec_prefix=$ac_optarg ;;
--
-- -gas | --gas | --ga | --g)
-- # Obsolete; use --with-gas.
-- with_gas=yes ;;
--
-- -help | --help | --hel | --he | -h)
-- ac_init_help=long ;;
-- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-- ac_init_help=recursive ;;
-- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-- ac_init_help=short ;;
--
-- -host | --host | --hos | --ho)
-- ac_prev=host_alias ;;
-- -host=* | --host=* | --hos=* | --ho=*)
-- host_alias=$ac_optarg ;;
--
-- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-- ac_prev=htmldir ;;
-- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-- | --ht=*)
-- htmldir=$ac_optarg ;;
--
-- -includedir | --includedir | --includedi | --included | --include \
-- | --includ | --inclu | --incl | --inc)
-- ac_prev=includedir ;;
-- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-- | --includ=* | --inclu=* | --incl=* | --inc=*)
-- includedir=$ac_optarg ;;
--
-- -infodir | --infodir | --infodi | --infod | --info | --inf)
-- ac_prev=infodir ;;
-- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-- infodir=$ac_optarg ;;
--
-- -libdir | --libdir | --libdi | --libd)
-- ac_prev=libdir ;;
-- -libdir=* | --libdir=* | --libdi=* | --libd=*)
-- libdir=$ac_optarg ;;
--
-- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-- | --libexe | --libex | --libe)
-- ac_prev=libexecdir ;;
-- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-- | --libexe=* | --libex=* | --libe=*)
-- libexecdir=$ac_optarg ;;
--
-- -localedir | --localedir | --localedi | --localed | --locale)
-- ac_prev=localedir ;;
-- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-- localedir=$ac_optarg ;;
--
-- -localstatedir | --localstatedir | --localstatedi | --localstated \
-- | --localstate | --localstat | --localsta | --localst | --locals)
-- ac_prev=localstatedir ;;
-- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-- localstatedir=$ac_optarg ;;
--
-- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-- ac_prev=mandir ;;
-- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-- mandir=$ac_optarg ;;
--
-- -nfp | --nfp | --nf)
-- # Obsolete; use --without-fp.
-- with_fp=no ;;
--
-- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-- | --no-cr | --no-c | -n)
-- no_create=yes ;;
--
-- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-- no_recursion=yes ;;
--
-- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-- | --oldin | --oldi | --old | --ol | --o)
-- ac_prev=oldincludedir ;;
-- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-- oldincludedir=$ac_optarg ;;
--
-- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-- ac_prev=prefix ;;
-- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-- prefix=$ac_optarg ;;
--
-- -program-prefix | --program-prefix | --program-prefi | --program-pref \
-- | --program-pre | --program-pr | --program-p)
-- ac_prev=program_prefix ;;
-- -program-prefix=* | --program-prefix=* | --program-prefi=* \
-- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-- program_prefix=$ac_optarg ;;
--
-- -program-suffix | --program-suffix | --program-suffi | --program-suff \
-- | --program-suf | --program-su | --program-s)
-- ac_prev=program_suffix ;;
-- -program-suffix=* | --program-suffix=* | --program-suffi=* \
-- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-- program_suffix=$ac_optarg ;;
--
-- -program-transform-name | --program-transform-name \
-- | --program-transform-nam | --program-transform-na \
-- | --program-transform-n | --program-transform- \
-- | --program-transform | --program-transfor \
-- | --program-transfo | --program-transf \
-- | --program-trans | --program-tran \
-- | --progr-tra | --program-tr | --program-t)
-- ac_prev=program_transform_name ;;
-- -program-transform-name=* | --program-transform-name=* \
-- | --program-transform-nam=* | --program-transform-na=* \
-- | --program-transform-n=* | --program-transform-=* \
-- | --program-transform=* | --program-transfor=* \
-- | --program-transfo=* | --program-transf=* \
-- | --program-trans=* | --program-tran=* \
-- | --progr-tra=* | --program-tr=* | --program-t=*)
-- program_transform_name=$ac_optarg ;;
--
-- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-- ac_prev=pdfdir ;;
-- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-- pdfdir=$ac_optarg ;;
--
-- -psdir | --psdir | --psdi | --psd | --ps)
-- ac_prev=psdir ;;
-- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-- psdir=$ac_optarg ;;
--
-- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-- | -silent | --silent | --silen | --sile | --sil)
-- silent=yes ;;
--
-- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-- ac_prev=sbindir ;;
-- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-- | --sbi=* | --sb=*)
-- sbindir=$ac_optarg ;;
--
-- -sharedstatedir | --sharedstatedir | --sharedstatedi \
-- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-- | --sharedst | --shareds | --shared | --share | --shar \
-- | --sha | --sh)
-- ac_prev=sharedstatedir ;;
-- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-- | --sha=* | --sh=*)
-- sharedstatedir=$ac_optarg ;;
--
-- -site | --site | --sit)
-- ac_prev=site ;;
-- -site=* | --site=* | --sit=*)
-- site=$ac_optarg ;;
--
-- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-- ac_prev=srcdir ;;
-- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-- srcdir=$ac_optarg ;;
--
-- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-- | --syscon | --sysco | --sysc | --sys | --sy)
-- ac_prev=sysconfdir ;;
-- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-- sysconfdir=$ac_optarg ;;
--
-- -target | --target | --targe | --targ | --tar | --ta | --t)
-- ac_prev=target_alias ;;
-- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-- target_alias=$ac_optarg ;;
--
-- -v | -verbose | --verbose | --verbos | --verbo | --verb)
-- verbose=yes ;;
--
-- -version | --version | --versio | --versi | --vers | -V)
-- ac_init_version=: ;;
--
-- -with-* | --with-*)
-- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-- # Reject names that are not valid shell variable names.
-- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-- as_fn_error $? "invalid package name: $ac_useropt"
-- ac_useropt_orig=$ac_useropt
-- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-- case $ac_user_opts in
-- *"
--"with_$ac_useropt"
--"*) ;;
-- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
-- ac_unrecognized_sep=', ';;
-- esac
-- eval with_$ac_useropt=\$ac_optarg ;;
--
-- -without-* | --without-*)
-- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-- # Reject names that are not valid shell variable names.
-- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-- as_fn_error $? "invalid package name: $ac_useropt"
-- ac_useropt_orig=$ac_useropt
-- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-- case $ac_user_opts in
-- *"
--"with_$ac_useropt"
--"*) ;;
-- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
-- ac_unrecognized_sep=', ';;
-- esac
-- eval with_$ac_useropt=no ;;
--
-- --x)
-- # Obsolete; use --with-x.
-- with_x=yes ;;
--
-- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-- | --x-incl | --x-inc | --x-in | --x-i)
-- ac_prev=x_includes ;;
-- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-- x_includes=$ac_optarg ;;
--
-- -x-libraries | --x-libraries | --x-librarie | --x-librari \
-- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-- ac_prev=x_libraries ;;
-- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-- x_libraries=$ac_optarg ;;
--
-- -*) as_fn_error $? "unrecognized option: \`$ac_option'
--Try \`$0 --help' for more information"
-- ;;
--
-- *=*)
-- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-- # Reject names that are not valid shell variable names.
-- case $ac_envvar in #(
-- '' | [0-9]* | *[!_$as_cr_alnum]* )
-- as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
-- esac
-- eval $ac_envvar=\$ac_optarg
-- export $ac_envvar ;;
--
-- *)
-- # FIXME: should be removed in autoconf 3.0.
-- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-- : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
-- ;;
--
-- esac
--done
--
--if test -n "$ac_prev"; then
-- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-- as_fn_error $? "missing argument to $ac_option"
--fi
--
--if test -n "$ac_unrecognized_opts"; then
-- case $enable_option_checking in
-- no) ;;
-- fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
-- esac
--fi
--
--# Check all directory arguments for consistency.
--for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
-- datadir sysconfdir sharedstatedir localstatedir includedir \
-- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-- libdir localedir mandir
--do
-- eval ac_val=\$$ac_var
-- # Remove trailing slashes.
-- case $ac_val in
-- */ )
-- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
-- eval $ac_var=\$ac_val;;
-- esac
-- # Be sure to have absolute directory names.
-- case $ac_val in
-- [\\/$]* | ?:[\\/]* ) continue;;
-- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-- esac
-- as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
--done
--
--# There might be people who depend on the old broken behavior: `$host'
--# used to hold the argument of --host etc.
--# FIXME: To remove some day.
--build=$build_alias
--host=$host_alias
--target=$target_alias
--
--# FIXME: To remove some day.
--if test "x$host_alias" != x; then
-- if test "x$build_alias" = x; then
-- cross_compiling=maybe
-- elif test "x$build_alias" != "x$host_alias"; then
-- cross_compiling=yes
-- fi
--fi
--
--ac_tool_prefix=
--test -n "$host_alias" && ac_tool_prefix=$host_alias-
--
--test "$silent" = yes && exec 6>/dev/null
--
--
--ac_pwd=`pwd` && test -n "$ac_pwd" &&
--ac_ls_di=`ls -di .` &&
--ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-- as_fn_error $? "working directory cannot be determined"
--test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-- as_fn_error $? "pwd does not report name of working directory"
--
--
--# Find the source files, if location was not specified.
--if test -z "$srcdir"; then
-- ac_srcdir_defaulted=yes
-- # Try the directory containing this script, then the parent directory.
-- ac_confdir=`$as_dirname -- "$as_myself" ||
--$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-- X"$as_myself" : 'X\(//\)[^/]' \| \
-- X"$as_myself" : 'X\(//\)$' \| \
-- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X"$as_myself" |
-- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)[^/].*/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
-- srcdir=$ac_confdir
-- if test ! -r "$srcdir/$ac_unique_file"; then
-- srcdir=..
-- fi
--else
-- ac_srcdir_defaulted=no
--fi
--if test ! -r "$srcdir/$ac_unique_file"; then
-- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-- as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
--fi
--ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
--ac_abs_confdir=`(
-- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
-- pwd)`
--# When building in place, set srcdir=.
--if test "$ac_abs_confdir" = "$ac_pwd"; then
-- srcdir=.
--fi
--# Remove unnecessary trailing slashes from srcdir.
--# Double slashes in file names in object file debugging info
--# mess up M-x gdb in Emacs.
--case $srcdir in
--*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
--esac
--for ac_var in $ac_precious_vars; do
-- eval ac_env_${ac_var}_set=\${${ac_var}+set}
-- eval ac_env_${ac_var}_value=\$${ac_var}
-- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-- eval ac_cv_env_${ac_var}_value=\$${ac_var}
--done
--
--#
--# Report the --help message.
--#
--if test "$ac_init_help" = "long"; then
-- # Omit some internal or obsolete options to make the list less imposing.
-- # This message is too long to be a string in the A/UX 3.1 sh.
-- cat <<_ACEOF
--\`configure' configures rsync 3.1.2 to adapt to many kinds of systems.
--
--Usage: $0 [OPTION]... [VAR=VALUE]...
--
--To assign environment variables (e.g., CC, CFLAGS...), specify them as
--VAR=VALUE. See below for descriptions of some of the useful variables.
--
--Defaults for the options are specified in brackets.
--
--Configuration:
-- -h, --help display this help and exit
-- --help=short display options specific to this package
-- --help=recursive display the short help of all the included packages
-- -V, --version display version information and exit
-- -q, --quiet, --silent do not print \`checking ...' messages
-- --cache-file=FILE cache test results in FILE [disabled]
-- -C, --config-cache alias for \`--cache-file=config.cache'
-- -n, --no-create do not create output files
-- --srcdir=DIR find the sources in DIR [configure dir or \`..']
--
--Installation directories:
-- --prefix=PREFIX install architecture-independent files in PREFIX
-- [$ac_default_prefix]
-- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
-- [PREFIX]
--
--By default, \`make install' will install all the files in
--\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
--an installation prefix other than \`$ac_default_prefix' using \`--prefix',
--for instance \`--prefix=\$HOME'.
--
--For better control, use the options below.
--
--Fine tuning of the installation directories:
-- --bindir=DIR user executables [EPREFIX/bin]
-- --sbindir=DIR system admin executables [EPREFIX/sbin]
-- --libexecdir=DIR program executables [EPREFIX/libexec]
-- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
-- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
-- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
-- --libdir=DIR object code libraries [EPREFIX/lib]
-- --includedir=DIR C header files [PREFIX/include]
-- --oldincludedir=DIR C header files for non-gcc [/usr/include]
-- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
-- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
-- --infodir=DIR info documentation [DATAROOTDIR/info]
-- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
-- --mandir=DIR man documentation [DATAROOTDIR/man]
-- --docdir=DIR documentation root [DATAROOTDIR/doc/rsync]
-- --htmldir=DIR html documentation [DOCDIR]
-- --dvidir=DIR dvi documentation [DOCDIR]
-- --pdfdir=DIR pdf documentation [DOCDIR]
-- --psdir=DIR ps documentation [DOCDIR]
--_ACEOF
--
-- cat <<\_ACEOF
--
--System types:
-- --build=BUILD configure for building on BUILD [guessed]
-- --host=HOST cross-compile to build programs to run on HOST [BUILD]
--_ACEOF
--fi
--
--if test -n "$ac_init_help"; then
-- case $ac_init_help in
-- short | recursive ) echo "Configuration of rsync 3.1.2:";;
-- esac
-- cat <<\_ACEOF
--
--Optional Features:
-- --disable-option-checking ignore unrecognized --enable/--with options
-- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
-- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
-- --disable-debug disable debugging symbols and features
-- --enable-profile turn on CPU profiling
-- --enable-maintainer-mode
-- turn on extra debug features
-- --disable-largefile omit support for large files
-- --disable-ipv6 do not even try to use IPv6
-- --disable-locale disable locale features
-- --disable-iconv-open disable all use of iconv_open() function
-- --disable-iconv disable rsync's --iconv option
-- --disable-acl-support disable ACL support
-- --disable-xattr-support disable extended attributes
--
--Optional Packages:
-- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
-- --with-included-popt use bundled popt library, not from system
-- --with-included-zlib use bundled zlib library, not from system
-- --with-protected-args make --protected-args option the default
-- --with-rsync-path=PATH set default --rsync-path to PATH (default: rsync)
-- --with-rsyncd-conf=PATH set configuration file for rsync server to PATH
-- (default: /etc/rsyncd.conf)
-- --with-rsh=CMD set remote shell command to CMD (default: ssh)
-- --with-nobody-group=GROUP
-- set the default unprivileged group (default nobody
-- or nogroup)
--
--Some influential environment variables:
-- CC C compiler command
-- CFLAGS C compiler flags
-- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
-- nonstandard directory <lib dir>
-- LIBS libraries to pass to the linker, e.g. -l<library>
-- CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
-- you have headers in a nonstandard directory <include dir>
-- CPP C preprocessor
--
--Use these variables to override the choices made by `configure' or to help
--it to find libraries and programs with nonstandard names/locations.
--
--Report bugs to <http://rsync.samba.org/bugzilla.html>.
--_ACEOF
--ac_status=$?
--fi
--
--if test "$ac_init_help" = "recursive"; then
-- # If there are subdirs, report their specific --help.
-- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-- test -d "$ac_dir" ||
-- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
-- continue
-- ac_builddir=.
--
--case "$ac_dir" in
--.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
--*)
-- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-- # A ".." for each directory in $ac_dir_suffix.
-- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-- case $ac_top_builddir_sub in
-- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-- esac ;;
--esac
--ac_abs_top_builddir=$ac_pwd
--ac_abs_builddir=$ac_pwd$ac_dir_suffix
--# for backward compatibility:
--ac_top_builddir=$ac_top_build_prefix
--
--case $srcdir in
-- .) # We are building in place.
-- ac_srcdir=.
-- ac_top_srcdir=$ac_top_builddir_sub
-- ac_abs_top_srcdir=$ac_pwd ;;
-- [\\/]* | ?:[\\/]* ) # Absolute name.
-- ac_srcdir=$srcdir$ac_dir_suffix;
-- ac_top_srcdir=$srcdir
-- ac_abs_top_srcdir=$srcdir ;;
-- *) # Relative name.
-- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-- ac_top_srcdir=$ac_top_build_prefix$srcdir
-- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
--esac
--ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
--
-- cd "$ac_dir" || { ac_status=$?; continue; }
-- # Check for guested configure.
-- if test -f "$ac_srcdir/configure.gnu"; then
-- echo &&
-- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-- elif test -f "$ac_srcdir/configure"; then
-- echo &&
-- $SHELL "$ac_srcdir/configure" --help=recursive
-- else
-- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-- fi || ac_status=$?
-- cd "$ac_pwd" || { ac_status=$?; break; }
-- done
--fi
--
--test -n "$ac_init_help" && exit $ac_status
--if $ac_init_version; then
-- cat <<\_ACEOF
--rsync configure 3.1.2
--generated by GNU Autoconf 2.69
--
--Copyright (C) 2012 Free Software Foundation, Inc.
--This configure script is free software; the Free Software Foundation
--gives unlimited permission to copy, distribute and modify it.
--_ACEOF
-- exit
--fi
--
--## ------------------------ ##
--## Autoconf initialization. ##
--## ------------------------ ##
--
--# ac_fn_c_try_compile LINENO
--# --------------------------
--# Try to compile conftest.$ac_ext, and return whether this succeeded.
--ac_fn_c_try_compile ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- rm -f conftest.$ac_objext
-- if { { ac_try="$ac_compile"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_compile") 2>conftest.err
-- ac_status=$?
-- if test -s conftest.err; then
-- grep -v '^ *+' conftest.err >conftest.er1
-- cat conftest.er1 >&5
-- mv -f conftest.er1 conftest.err
-- fi
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; } && {
-- test -z "$ac_c_werror_flag" ||
-- test ! -s conftest.err
-- } && test -s conftest.$ac_objext; then :
-- ac_retval=0
--else
-- $as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
-- ac_retval=1
--fi
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-- as_fn_set_status $ac_retval
--
--} # ac_fn_c_try_compile
--
--# ac_fn_c_try_cpp LINENO
--# ----------------------
--# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
--ac_fn_c_try_cpp ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- if { { ac_try="$ac_cpp conftest.$ac_ext"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-- ac_status=$?
-- if test -s conftest.err; then
-- grep -v '^ *+' conftest.err >conftest.er1
-- cat conftest.er1 >&5
-- mv -f conftest.er1 conftest.err
-- fi
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; } > conftest.i && {
-- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-- test ! -s conftest.err
-- }; then :
-- ac_retval=0
--else
-- $as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
-- ac_retval=1
--fi
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-- as_fn_set_status $ac_retval
--
--} # ac_fn_c_try_cpp
--
--# ac_fn_c_try_run LINENO
--# ----------------------
--# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
--# that executables *can* be run.
--ac_fn_c_try_run ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- if { { ac_try="$ac_link"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_link") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-- { { case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_try") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }; }; then :
-- ac_retval=0
--else
-- $as_echo "$as_me: program exited with status $ac_status" >&5
-- $as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
-- ac_retval=$ac_status
--fi
-- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-- as_fn_set_status $ac_retval
--
--} # ac_fn_c_try_run
--
--# ac_fn_c_try_link LINENO
--# -----------------------
--# Try to link conftest.$ac_ext, and return whether this succeeded.
--ac_fn_c_try_link ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- rm -f conftest.$ac_objext conftest$ac_exeext
-- if { { ac_try="$ac_link"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_link") 2>conftest.err
-- ac_status=$?
-- if test -s conftest.err; then
-- grep -v '^ *+' conftest.err >conftest.er1
-- cat conftest.er1 >&5
-- mv -f conftest.er1 conftest.err
-- fi
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; } && {
-- test -z "$ac_c_werror_flag" ||
-- test ! -s conftest.err
-- } && test -s conftest$ac_exeext && {
-- test "$cross_compiling" = yes ||
-- test -x conftest$ac_exeext
-- }; then :
-- ac_retval=0
--else
-- $as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
-- ac_retval=1
--fi
-- # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-- # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-- # interfere with the next link command; also delete a directory that is
-- # left behind by Apple's compiler. We do this before executing the actions.
-- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-- as_fn_set_status $ac_retval
--
--} # ac_fn_c_try_link
--
--# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
--# -------------------------------------------------------
--# Tests whether HEADER exists and can be compiled using the include files in
--# INCLUDES, setting the cache variable VAR accordingly.
--ac_fn_c_check_header_compile ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
--$as_echo_n "checking for $2... " >&6; }
--if eval \${$3+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--#include <$2>
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "$3=yes"
--else
-- eval "$3=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--eval ac_res=\$$3
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
--
--} # ac_fn_c_check_header_compile
--
--# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
--# -------------------------------------------------------
--# Tests whether HEADER exists, giving a warning if it cannot be compiled using
--# the include files in INCLUDES and setting the cache variable VAR
--# accordingly.
--ac_fn_c_check_header_mongrel ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- if eval \${$3+:} false; then :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
--$as_echo_n "checking for $2... " >&6; }
--if eval \${$3+:} false; then :
-- $as_echo_n "(cached) " >&6
--fi
--eval ac_res=\$$3
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
--else
-- # Is the header compilable?
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
--$as_echo_n "checking $2 usability... " >&6; }
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--#include <$2>
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_header_compiler=yes
--else
-- ac_header_compiler=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
--$as_echo "$ac_header_compiler" >&6; }
--
--# Is the header present?
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
--$as_echo_n "checking $2 presence... " >&6; }
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <$2>
--_ACEOF
--if ac_fn_c_try_cpp "$LINENO"; then :
-- ac_header_preproc=yes
--else
-- ac_header_preproc=no
--fi
--rm -f conftest.err conftest.i conftest.$ac_ext
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
--$as_echo "$ac_header_preproc" >&6; }
--
--# So? What about this header?
--case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
-- yes:no: )
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
--$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
--$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-- ;;
-- no:yes:* )
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
--$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
--$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
--$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
--$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
--$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
--( $as_echo "## --------------------------------------------------- ##
--## Report this to http://rsync.samba.org/bugzilla.html ##
--## --------------------------------------------------- ##"
-- ) | sed "s/^/$as_me: WARNING: /" >&2
-- ;;
--esac
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
--$as_echo_n "checking for $2... " >&6; }
--if eval \${$3+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- eval "$3=\$ac_header_compiler"
--fi
--eval ac_res=\$$3
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
--fi
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
--
--} # ac_fn_c_check_header_mongrel
--
--# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
--# --------------------------------------------
--# Tries to find the compile-time value of EXPR in a program that includes
--# INCLUDES, setting VAR accordingly. Returns whether the value could be
--# computed
--ac_fn_c_compute_int ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- if test "$cross_compiling" = yes; then
-- # Depending upon the size, compute the lo and hi bounds.
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--static int test_array [1 - 2 * !(($2) >= 0)];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_lo=0 ac_mid=0
-- while :; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--static int test_array [1 - 2 * !(($2) <= $ac_mid)];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_hi=$ac_mid; break
--else
-- as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-- if test $ac_lo -le $ac_mid; then
-- ac_lo= ac_hi=
-- break
-- fi
-- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- done
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--static int test_array [1 - 2 * !(($2) < 0)];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_hi=-1 ac_mid=-1
-- while :; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--static int test_array [1 - 2 * !(($2) >= $ac_mid)];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_lo=$ac_mid; break
--else
-- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-- if test $ac_mid -le $ac_hi; then
-- ac_lo= ac_hi=
-- break
-- fi
-- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- done
--else
-- ac_lo= ac_hi=
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--# Binary search between lo and hi bounds.
--while test "x$ac_lo" != "x$ac_hi"; do
-- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--static int test_array [1 - 2 * !(($2) <= $ac_mid)];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_hi=$ac_mid
--else
-- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--done
--case $ac_lo in #((
--?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
--'') ac_retval=1 ;;
--esac
-- else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--static long int longval () { return $2; }
--static unsigned long int ulongval () { return $2; }
--#include <stdio.h>
--#include <stdlib.h>
--int
--main ()
--{
--
-- FILE *f = fopen ("conftest.val", "w");
-- if (! f)
-- return 1;
-- if (($2) < 0)
-- {
-- long int i = longval ();
-- if (i != ($2))
-- return 1;
-- fprintf (f, "%ld", i);
-- }
-- else
-- {
-- unsigned long int i = ulongval ();
-- if (i != ($2))
-- return 1;
-- fprintf (f, "%lu", i);
-- }
-- /* Do not output a trailing newline, as this causes \r\n confusion
-- on some platforms. */
-- return ferror (f) || fclose (f) != 0;
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- echo >>conftest.val; read $3 <conftest.val; ac_retval=0
--else
-- ac_retval=1
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--rm -f conftest.val
--
-- fi
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-- as_fn_set_status $ac_retval
--
--} # ac_fn_c_compute_int
--
--# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
--# -------------------------------------------
--# Tests whether TYPE exists after having included INCLUDES, setting cache
--# variable VAR accordingly.
--ac_fn_c_check_type ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
--$as_echo_n "checking for $2... " >&6; }
--if eval \${$3+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- eval "$3=no"
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--if (sizeof ($2))
-- return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$4
--int
--main ()
--{
--if (sizeof (($2)))
-- return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
--
--else
-- eval "$3=yes"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--eval ac_res=\$$3
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
--
--} # ac_fn_c_check_type
--
--# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
--# ----------------------------------------------------
--# Tries to find if the field MEMBER exists in type AGGR, after including
--# INCLUDES, setting cache variable VAR accordingly.
--ac_fn_c_check_member ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
--$as_echo_n "checking for $2.$3... " >&6; }
--if eval \${$4+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$5
--int
--main ()
--{
--static $2 ac_aggr;
--if (ac_aggr.$3)
--return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "$4=yes"
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$5
--int
--main ()
--{
--static $2 ac_aggr;
--if (sizeof ac_aggr.$3)
--return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "$4=yes"
--else
-- eval "$4=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--eval ac_res=\$$4
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
--
--} # ac_fn_c_check_member
--
--# ac_fn_c_check_func LINENO FUNC VAR
--# ----------------------------------
--# Tests whether FUNC exists, setting the cache variable VAR accordingly
--ac_fn_c_check_func ()
--{
-- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
--$as_echo_n "checking for $2... " >&6; }
--if eval \${$3+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-- For example, HP-UX 11i <limits.h> declares gettimeofday. */
--#define $2 innocuous_$2
--
--/* System header to define __stub macros and hopefully few prototypes,
-- which can conflict with char $2 (); below.
-- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-- <limits.h> exists even on freestanding compilers. */
--
--#ifdef __STDC__
--# include <limits.h>
--#else
--# include <assert.h>
--#endif
--
--#undef $2
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char $2 ();
--/* The GNU C library defines this for functions which it implements
-- to always fail with ENOSYS. Some functions are actually named
-- something starting with __ and the normal name is an alias. */
--#if defined __stub_$2 || defined __stub___$2
--choke me
--#endif
--
--int
--main ()
--{
--return $2 ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- eval "$3=yes"
--else
-- eval "$3=no"
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--eval ac_res=\$$3
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
-- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
--
--} # ac_fn_c_check_func
--cat >config.log <<_ACEOF
--This file contains any messages produced by compilers while
--running configure, to aid debugging if configure makes a mistake.
--
--It was created by rsync $as_me 3.1.2, which was
--generated by GNU Autoconf 2.69. Invocation command line was
--
-- $ $0 $@
--
--_ACEOF
--exec 5>>config.log
--{
--cat <<_ASUNAME
--## --------- ##
--## Platform. ##
--## --------- ##
--
--hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
--uname -m = `(uname -m) 2>/dev/null || echo unknown`
--uname -r = `(uname -r) 2>/dev/null || echo unknown`
--uname -s = `(uname -s) 2>/dev/null || echo unknown`
--uname -v = `(uname -v) 2>/dev/null || echo unknown`
--
--/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
--/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
--
--/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
--/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
--/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
--/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
--/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
--/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
--/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
--
--_ASUNAME
--
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- $as_echo "PATH: $as_dir"
-- done
--IFS=$as_save_IFS
--
--} >&5
--
--cat >&5 <<_ACEOF
--
--
--## ----------- ##
--## Core tests. ##
--## ----------- ##
--
--_ACEOF
--
--
--# Keep a trace of the command line.
--# Strip out --no-create and --no-recursion so they do not pile up.
--# Strip out --silent because we don't want to record it for future runs.
--# Also quote any args containing shell meta-characters.
--# Make two passes to allow for proper duplicate-argument suppression.
--ac_configure_args=
--ac_configure_args0=
--ac_configure_args1=
--ac_must_keep_next=false
--for ac_pass in 1 2
--do
-- for ac_arg
-- do
-- case $ac_arg in
-- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-- | -silent | --silent | --silen | --sile | --sil)
-- continue ;;
-- *\'*)
-- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-- esac
-- case $ac_pass in
-- 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
-- 2)
-- as_fn_append ac_configure_args1 " '$ac_arg'"
-- if test $ac_must_keep_next = true; then
-- ac_must_keep_next=false # Got value, back to normal.
-- else
-- case $ac_arg in
-- *=* | --config-cache | -C | -disable-* | --disable-* \
-- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-- | -with-* | --with-* | -without-* | --without-* | --x)
-- case "$ac_configure_args0 " in
-- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-- esac
-- ;;
-- -* ) ac_must_keep_next=true ;;
-- esac
-- fi
-- as_fn_append ac_configure_args " '$ac_arg'"
-- ;;
-- esac
-- done
--done
--{ ac_configure_args0=; unset ac_configure_args0;}
--{ ac_configure_args1=; unset ac_configure_args1;}
--
--# When interrupted or exit'd, cleanup temporary files, and complete
--# config.log. We remove comments because anyway the quotes in there
--# would cause problems or look ugly.
--# WARNING: Use '\'' to represent an apostrophe within the trap.
--# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
--trap 'exit_status=$?
-- # Save into config.log some information that might help in debugging.
-- {
-- echo
--
-- $as_echo "## ---------------- ##
--## Cache variables. ##
--## ---------------- ##"
-- echo
-- # The following way of writing the cache mishandles newlines in values,
--(
-- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-- eval ac_val=\$$ac_var
-- case $ac_val in #(
-- *${as_nl}*)
-- case $ac_var in #(
-- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
--$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-- esac
-- case $ac_var in #(
-- _ | IFS | as_nl) ;; #(
-- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-- *) { eval $ac_var=; unset $ac_var;} ;;
-- esac ;;
-- esac
-- done
-- (set) 2>&1 |
-- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-- *${as_nl}ac_space=\ *)
-- sed -n \
-- "s/'\''/'\''\\\\'\'''\''/g;
-- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-- ;; #(
-- *)
-- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-- ;;
-- esac |
-- sort
--)
-- echo
--
-- $as_echo "## ----------------- ##
--## Output variables. ##
--## ----------------- ##"
-- echo
-- for ac_var in $ac_subst_vars
-- do
-- eval ac_val=\$$ac_var
-- case $ac_val in
-- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-- esac
-- $as_echo "$ac_var='\''$ac_val'\''"
-- done | sort
-- echo
--
-- if test -n "$ac_subst_files"; then
-- $as_echo "## ------------------- ##
--## File substitutions. ##
--## ------------------- ##"
-- echo
-- for ac_var in $ac_subst_files
-- do
-- eval ac_val=\$$ac_var
-- case $ac_val in
-- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-- esac
-- $as_echo "$ac_var='\''$ac_val'\''"
-- done | sort
-- echo
-- fi
--
-- if test -s confdefs.h; then
-- $as_echo "## ----------- ##
--## confdefs.h. ##
--## ----------- ##"
-- echo
-- cat confdefs.h
-- echo
-- fi
-- test "$ac_signal" != 0 &&
-- $as_echo "$as_me: caught signal $ac_signal"
-- $as_echo "$as_me: exit $exit_status"
-- } >&5
-- rm -f core *.core core.conftest.* &&
-- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-- exit $exit_status
--' 0
--for ac_signal in 1 2 13 15; do
-- trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
--done
--ac_signal=0
--
--# confdefs.h avoids OS command line length limits that DEFS can exceed.
--rm -f -r conftest* confdefs.h
--
--$as_echo "/* confdefs.h */" > confdefs.h
--
--# Predefined preprocessor variables.
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_NAME "$PACKAGE_NAME"
--_ACEOF
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
--_ACEOF
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_VERSION "$PACKAGE_VERSION"
--_ACEOF
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_STRING "$PACKAGE_STRING"
--_ACEOF
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
--_ACEOF
--
--cat >>confdefs.h <<_ACEOF
--#define PACKAGE_URL "$PACKAGE_URL"
--_ACEOF
--
--
--# Let the site file select an alternate cache file if it wants to.
--# Prefer an explicitly selected file to automatically selected ones.
--ac_site_file1=NONE
--ac_site_file2=NONE
--if test -n "$CONFIG_SITE"; then
-- # We do not want a PATH search for config.site.
-- case $CONFIG_SITE in #((
-- -*) ac_site_file1=./$CONFIG_SITE;;
-- */*) ac_site_file1=$CONFIG_SITE;;
-- *) ac_site_file1=./$CONFIG_SITE;;
-- esac
--elif test "x$prefix" != xNONE; then
-- ac_site_file1=$prefix/share/config.site
-- ac_site_file2=$prefix/etc/config.site
--else
-- ac_site_file1=$ac_default_prefix/share/config.site
-- ac_site_file2=$ac_default_prefix/etc/config.site
--fi
--for ac_site_file in "$ac_site_file1" "$ac_site_file2"
--do
-- test "x$ac_site_file" = xNONE && continue
-- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
--$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-- sed 's/^/| /' "$ac_site_file" >&5
-- . "$ac_site_file" \
-- || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "failed to load site script $ac_site_file
--See \`config.log' for more details" "$LINENO" 5; }
-- fi
--done
--
--if test -r "$cache_file"; then
-- # Some versions of bash will fail to source /dev/null (special files
-- # actually), so we avoid doing that. DJGPP emulates it as a regular file.
-- if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
--$as_echo "$as_me: loading cache $cache_file" >&6;}
-- case $cache_file in
-- [\\/]* | ?:[\\/]* ) . "$cache_file";;
-- *) . "./$cache_file";;
-- esac
-- fi
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
--$as_echo "$as_me: creating cache $cache_file" >&6;}
-- >$cache_file
--fi
--
--as_fn_append ac_header_list " utime.h"
--# Check that the precious variables saved in the cache have kept the same
--# value.
--ac_cache_corrupted=false
--for ac_var in $ac_precious_vars; do
-- eval ac_old_set=\$ac_cv_env_${ac_var}_set
-- eval ac_new_set=\$ac_env_${ac_var}_set
-- eval ac_old_val=\$ac_cv_env_${ac_var}_value
-- eval ac_new_val=\$ac_env_${ac_var}_value
-- case $ac_old_set,$ac_new_set in
-- set,)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
--$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-- ac_cache_corrupted=: ;;
-- ,set)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
--$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-- ac_cache_corrupted=: ;;
-- ,);;
-- *)
-- if test "x$ac_old_val" != "x$ac_new_val"; then
-- # differences in whitespace do not lead to failure.
-- ac_old_val_w=`echo x $ac_old_val`
-- ac_new_val_w=`echo x $ac_new_val`
-- if test "$ac_old_val_w" != "$ac_new_val_w"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
--$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-- ac_cache_corrupted=:
-- else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
--$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-- eval $ac_var=\$ac_old_val
-- fi
-- { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
--$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
--$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
-- fi;;
-- esac
-- # Pass precious variables to config.status.
-- if test "$ac_new_set" = set; then
-- case $ac_new_val in
-- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-- *) ac_arg=$ac_var=$ac_new_val ;;
-- esac
-- case " $ac_configure_args " in
-- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
-- *) as_fn_append ac_configure_args " '$ac_arg'" ;;
-- esac
-- fi
--done
--if $ac_cache_corrupted; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-- { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
--$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-- as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
--fi
--## -------------------- ##
--## Main body of script. ##
--## -------------------- ##
--
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
--
--
--
--
--
--ac_config_headers="$ac_config_headers config.h"
--
--
--
--RSYNC_VERSION=$PACKAGE_VERSION
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring rsync $PACKAGE_VERSION" >&5
--$as_echo "$as_me: Configuring rsync $PACKAGE_VERSION" >&6;}
--
--
--cat >>confdefs.h <<_ACEOF
--#define RSYNC_VERSION "$PACKAGE_VERSION"
--_ACEOF
--
--
--LDFLAGS=${LDFLAGS-""}
--
--ac_aux_dir=
--for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-- if test -f "$ac_dir/install-sh"; then
-- ac_aux_dir=$ac_dir
-- ac_install_sh="$ac_aux_dir/install-sh -c"
-- break
-- elif test -f "$ac_dir/install.sh"; then
-- ac_aux_dir=$ac_dir
-- ac_install_sh="$ac_aux_dir/install.sh -c"
-- break
-- elif test -f "$ac_dir/shtool"; then
-- ac_aux_dir=$ac_dir
-- ac_install_sh="$ac_aux_dir/shtool install -c"
-- break
-- fi
--done
--if test -z "$ac_aux_dir"; then
-- as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
--fi
--
--# These three variables are undocumented and unsupported,
--# and are intended to be withdrawn in a future Autoconf release.
--# They can cause serious problems if a builder's source tree is in a directory
--# whose full name contains unusual characters.
--ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
--ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
--ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
--
--
--# Make sure we can run config.sub.
--$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
--$as_echo_n "checking build system type... " >&6; }
--if ${ac_cv_build+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_build_alias=$build_alias
--test "x$ac_build_alias" = x &&
-- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
--test "x$ac_build_alias" = x &&
-- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
--ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
--$as_echo "$ac_cv_build" >&6; }
--case $ac_cv_build in
--*-*-*) ;;
--*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
--esac
--build=$ac_cv_build
--ac_save_IFS=$IFS; IFS='-'
--set x $ac_cv_build
--shift
--build_cpu=$1
--build_vendor=$2
--shift; shift
--# Remember, the first character of IFS is used to create $*,
--# except with old shells:
--build_os=$*
--IFS=$ac_save_IFS
--case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
--$as_echo_n "checking host system type... " >&6; }
--if ${ac_cv_host+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test "x$host_alias" = x; then
-- ac_cv_host=$ac_cv_build
--else
-- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
--$as_echo "$ac_cv_host" >&6; }
--case $ac_cv_host in
--*-*-*) ;;
--*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
--esac
--host=$ac_cv_host
--ac_save_IFS=$IFS; IFS='-'
--set x $ac_cv_host
--shift
--host_cpu=$1
--host_vendor=$2
--shift; shift
--# Remember, the first character of IFS is used to create $*,
--# except with old shells:
--host_os=$*
--IFS=$ac_save_IFS
--case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
--
--
--
--
--
--# We must decide this before testing the compiler.
--
--# Please allow this to default to yes, so that your users have more
--# chance of getting a useful stack trace if problems occur.
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include debugging symbols" >&5
--$as_echo_n "checking whether to include debugging symbols... " >&6; }
--# Check whether --enable-debug was given.
--if test "${enable_debug+set}" = set; then :
-- enableval=$enable_debug;
--fi
--
--
--if test x"$enable_debug" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
-- ac_cv_prog_cc_g=no
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
-- # leave ac_cv_prog_cc_g alone; AC_PROG_CC will try to include -g if it can
--fi
--
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
--if test -n "$ac_tool_prefix"; then
-- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
--set dummy ${ac_tool_prefix}gcc; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_CC="${ac_tool_prefix}gcc"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--fi
--fi
--CC=$ac_cv_prog_CC
--if test -n "$CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
--$as_echo "$CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--fi
--if test -z "$ac_cv_prog_CC"; then
-- ac_ct_CC=$CC
-- # Extract the first word of "gcc", so it can be a program name with args.
--set dummy gcc; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_ac_ct_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$ac_ct_CC"; then
-- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_ac_ct_CC="gcc"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--fi
--fi
--ac_ct_CC=$ac_cv_prog_ac_ct_CC
--if test -n "$ac_ct_CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
--$as_echo "$ac_ct_CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
-- if test "x$ac_ct_CC" = x; then
-- CC=""
-- else
-- case $cross_compiling:$ac_tool_warned in
--yes:)
--{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
--$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
--ac_tool_warned=yes ;;
--esac
-- CC=$ac_ct_CC
-- fi
--else
-- CC="$ac_cv_prog_CC"
--fi
--
--if test -z "$CC"; then
-- if test -n "$ac_tool_prefix"; then
-- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
--set dummy ${ac_tool_prefix}cc; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_CC="${ac_tool_prefix}cc"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--fi
--fi
--CC=$ac_cv_prog_CC
--if test -n "$CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
--$as_echo "$CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
-- fi
--fi
--if test -z "$CC"; then
-- # Extract the first word of "cc", so it can be a program name with args.
--set dummy cc; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
-- ac_prog_rejected=no
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-- ac_prog_rejected=yes
-- continue
-- fi
-- ac_cv_prog_CC="cc"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--if test $ac_prog_rejected = yes; then
-- # We found a bogon in the path, so make sure we never use it.
-- set dummy $ac_cv_prog_CC
-- shift
-- if test $# != 0; then
-- # We chose a different compiler from the bogus one.
-- # However, it has the same basename, so the bogon will be chosen
-- # first if we set CC to just the basename; use the full file name.
-- shift
-- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-- fi
--fi
--fi
--fi
--CC=$ac_cv_prog_CC
--if test -n "$CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
--$as_echo "$CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--fi
--if test -z "$CC"; then
-- if test -n "$ac_tool_prefix"; then
-- for ac_prog in cl.exe
-- do
-- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
--set dummy $ac_tool_prefix$ac_prog; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--fi
--fi
--CC=$ac_cv_prog_CC
--if test -n "$CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
--$as_echo "$CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
-- test -n "$CC" && break
-- done
--fi
--if test -z "$CC"; then
-- ac_ct_CC=$CC
-- for ac_prog in cl.exe
--do
-- # Extract the first word of "$ac_prog", so it can be a program name with args.
--set dummy $ac_prog; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_ac_ct_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$ac_ct_CC"; then
-- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_ac_ct_CC="$ac_prog"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
--fi
--fi
--ac_ct_CC=$ac_cv_prog_ac_ct_CC
--if test -n "$ac_ct_CC"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
--$as_echo "$ac_ct_CC" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
-- test -n "$ac_ct_CC" && break
--done
--
-- if test "x$ac_ct_CC" = x; then
-- CC=""
-- else
-- case $cross_compiling:$ac_tool_warned in
--yes:)
--{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
--$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
--ac_tool_warned=yes ;;
--esac
-- CC=$ac_ct_CC
-- fi
--fi
--
--fi
--
--
--test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "no acceptable C compiler found in \$PATH
--See \`config.log' for more details" "$LINENO" 5; }
--
--# Provide some information about the compiler.
--$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
--set X $ac_compile
--ac_compiler=$2
--for ac_option in --version -v -V -qversion; do
-- { { ac_try="$ac_compiler $ac_option >&5"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-- ac_status=$?
-- if test -s conftest.err; then
-- sed '10a\
--... rest of stderr output deleted ...
-- 10q' conftest.err >conftest.er1
-- cat conftest.er1 >&5
-- fi
-- rm -f conftest.er1 conftest.err
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }
--done
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--ac_clean_files_save=$ac_clean_files
--ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
--# Try to create an executable without -o first, disregard a.out.
--# It will help us diagnose broken compilers, and finding out an intuition
--# of exeext.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
--$as_echo_n "checking whether the C compiler works... " >&6; }
--ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
--
--# The possible output files:
--ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
--
--ac_rmfiles=
--for ac_file in $ac_files
--do
-- case $ac_file in
-- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-- esac
--done
--rm -f $ac_rmfiles
--
--if { { ac_try="$ac_link_default"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_link_default") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }; then :
-- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
--# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
--# in a Makefile. We should not override ac_cv_exeext if it was cached,
--# so that the user can short-circuit this test for compilers unknown to
--# Autoconf.
--for ac_file in $ac_files ''
--do
-- test -f "$ac_file" || continue
-- case $ac_file in
-- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-- ;;
-- [ab].out )
-- # We found the default executable, but exeext='' is most
-- # certainly right.
-- break;;
-- *.* )
-- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-- then :; else
-- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-- fi
-- # We set ac_cv_exeext here because the later test for it is not
-- # safe: cross compilers may not add the suffix if given an `-o'
-- # argument, so we may need to know it at that point already.
-- # Even if this section looks crufty: it has the advantage of
-- # actually working.
-- break;;
-- * )
-- break;;
-- esac
--done
--test "$ac_cv_exeext" = no && ac_cv_exeext=
--
--else
-- ac_file=''
--fi
--if test -z "$ac_file"; then :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--$as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
--{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "C compiler cannot create executables
--See \`config.log' for more details" "$LINENO" 5; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
--$as_echo_n "checking for C compiler default output file name... " >&6; }
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
--$as_echo "$ac_file" >&6; }
--ac_exeext=$ac_cv_exeext
--
--rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
--ac_clean_files=$ac_clean_files_save
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
--$as_echo_n "checking for suffix of executables... " >&6; }
--if { { ac_try="$ac_link"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_link") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }; then :
-- # If both `conftest.exe' and `conftest' are `present' (well, observable)
--# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
--# work properly (i.e., refer to `conftest.exe'), while it won't with
--# `rm'.
--for ac_file in conftest.exe conftest conftest.*; do
-- test -f "$ac_file" || continue
-- case $ac_file in
-- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-- break;;
-- * ) break;;
-- esac
--done
--else
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "cannot compute suffix of executables: cannot compile and link
--See \`config.log' for more details" "$LINENO" 5; }
--fi
--rm -f conftest conftest$ac_cv_exeext
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
--$as_echo "$ac_cv_exeext" >&6; }
--
--rm -f conftest.$ac_ext
--EXEEXT=$ac_cv_exeext
--ac_exeext=$EXEEXT
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdio.h>
--int
--main ()
--{
--FILE *f = fopen ("conftest.out", "w");
-- return ferror (f) || fclose (f) != 0;
--
-- ;
-- return 0;
--}
--_ACEOF
--ac_clean_files="$ac_clean_files conftest.out"
--# Check that the compiler produces executables we can run. If not, either
--# the compiler is broken, or we cross compile.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
--$as_echo_n "checking whether we are cross compiling... " >&6; }
--if test "$cross_compiling" != yes; then
-- { { ac_try="$ac_link"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_link") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }
-- if { ac_try='./conftest$ac_cv_exeext'
-- { { case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_try") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }; }; then
-- cross_compiling=no
-- else
-- if test "$cross_compiling" = maybe; then
-- cross_compiling=yes
-- else
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "cannot run C compiled programs.
--If you meant to cross compile, use \`--host'.
--See \`config.log' for more details" "$LINENO" 5; }
-- fi
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
--$as_echo "$cross_compiling" >&6; }
--
--rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
--ac_clean_files=$ac_clean_files_save
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
--$as_echo_n "checking for suffix of object files... " >&6; }
--if ${ac_cv_objext+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--rm -f conftest.o conftest.obj
--if { { ac_try="$ac_compile"
--case "(($ac_try" in
-- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-- *) ac_try_echo=$ac_try;;
--esac
--eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
--$as_echo "$ac_try_echo"; } >&5
-- (eval "$ac_compile") 2>&5
-- ac_status=$?
-- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-- test $ac_status = 0; }; then :
-- for ac_file in conftest.o conftest.obj conftest.*; do
-- test -f "$ac_file" || continue;
-- case $ac_file in
-- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-- break;;
-- esac
--done
--else
-- $as_echo "$as_me: failed program was:" >&5
--sed 's/^/| /' conftest.$ac_ext >&5
--
--{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "cannot compute suffix of object files: cannot compile
--See \`config.log' for more details" "$LINENO" 5; }
--fi
--rm -f conftest.$ac_cv_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
--$as_echo "$ac_cv_objext" >&6; }
--OBJEXT=$ac_cv_objext
--ac_objext=$OBJEXT
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
--$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
--if ${ac_cv_c_compiler_gnu+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--#ifndef __GNUC__
-- choke me
--#endif
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_compiler_gnu=yes
--else
-- ac_compiler_gnu=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--ac_cv_c_compiler_gnu=$ac_compiler_gnu
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
--$as_echo "$ac_cv_c_compiler_gnu" >&6; }
--if test $ac_compiler_gnu = yes; then
-- GCC=yes
--else
-- GCC=
--fi
--ac_test_CFLAGS=${CFLAGS+set}
--ac_save_CFLAGS=$CFLAGS
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
--$as_echo_n "checking whether $CC accepts -g... " >&6; }
--if ${ac_cv_prog_cc_g+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_save_c_werror_flag=$ac_c_werror_flag
-- ac_c_werror_flag=yes
-- ac_cv_prog_cc_g=no
-- CFLAGS="-g"
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_prog_cc_g=yes
--else
-- CFLAGS=""
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
--
--else
-- ac_c_werror_flag=$ac_save_c_werror_flag
-- CFLAGS="-g"
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_prog_cc_g=yes
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- ac_c_werror_flag=$ac_save_c_werror_flag
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
--$as_echo "$ac_cv_prog_cc_g" >&6; }
--if test "$ac_test_CFLAGS" = set; then
-- CFLAGS=$ac_save_CFLAGS
--elif test $ac_cv_prog_cc_g = yes; then
-- if test "$GCC" = yes; then
-- CFLAGS="-g -O2"
-- else
-- CFLAGS="-g"
-- fi
--else
-- if test "$GCC" = yes; then
-- CFLAGS="-O2"
-- else
-- CFLAGS=
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
--$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
--if ${ac_cv_prog_cc_c89+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_prog_cc_c89=no
--ac_save_CC=$CC
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdarg.h>
--#include <stdio.h>
--struct stat;
--/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
--struct buf { int x; };
--FILE * (*rcsopen) (struct buf *, struct stat *, int);
--static char *e (p, i)
-- char **p;
-- int i;
--{
-- return p[i];
--}
--static char *f (char * (*g) (char **, int), char **p, ...)
--{
-- char *s;
-- va_list v;
-- va_start (v,p);
-- s = g (p, va_arg (v,int));
-- va_end (v);
-- return s;
--}
--
--/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
-- function prototypes and stuff, but not '\xHH' hex character constants.
-- These don't provoke an error unfortunately, instead are silently treated
-- as 'x'. The following induces an error, until -std is added to get
-- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
-- array size at least. It's necessary to write '\x00'==0 to get something
-- that's true only with -std. */
--int osf4_cc_array ['\x00' == 0 ? 1 : -1];
--
--/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-- inside strings and character constants. */
--#define FOO(x) 'x'
--int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
--
--int test (int i, double x);
--struct s1 {int (*f) (int a);};
--struct s2 {int (*f) (double a);};
--int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
--int argc;
--char **argv;
--int
--main ()
--{
--return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
-- ;
-- return 0;
--}
--_ACEOF
--for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
--do
-- CC="$ac_save_CC $ac_arg"
-- if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_prog_cc_c89=$ac_arg
--fi
--rm -f core conftest.err conftest.$ac_objext
-- test "x$ac_cv_prog_cc_c89" != "xno" && break
--done
--rm -f conftest.$ac_ext
--CC=$ac_save_CC
--
--fi
--# AC_CACHE_VAL
--case "x$ac_cv_prog_cc_c89" in
-- x)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
--$as_echo "none needed" >&6; } ;;
-- xno)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
--$as_echo "unsupported" >&6; } ;;
-- *)
-- CC="$CC $ac_cv_prog_cc_c89"
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
--$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
--esac
--if test "x$ac_cv_prog_cc_c89" != xno; then :
--
--fi
--
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
--
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
--$as_echo_n "checking how to run the C preprocessor... " >&6; }
--# On Suns, sometimes $CPP names a directory.
--if test -n "$CPP" && test -d "$CPP"; then
-- CPP=
--fi
--if test -z "$CPP"; then
-- if ${ac_cv_prog_CPP+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- # Double quotes because CPP needs to be expanded
-- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-- do
-- ac_preproc_ok=false
--for ac_c_preproc_warn_flag in '' yes
--do
-- # Use a header file that comes with gcc, so configuring glibc
-- # with a fresh cross-compiler works.
-- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-- # <limits.h> exists even on freestanding compilers.
-- # On the NeXT, cc -E runs the code through the compiler's parser,
-- # not just through cpp. "Syntax error" is here to catch this case.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#ifdef __STDC__
--# include <limits.h>
--#else
--# include <assert.h>
--#endif
-- Syntax error
--_ACEOF
--if ac_fn_c_try_cpp "$LINENO"; then :
--
--else
-- # Broken: fails on valid input.
--continue
--fi
--rm -f conftest.err conftest.i conftest.$ac_ext
--
-- # OK, works on sane cases. Now check whether nonexistent headers
-- # can be detected and how.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <ac_nonexistent.h>
--_ACEOF
--if ac_fn_c_try_cpp "$LINENO"; then :
-- # Broken: success on invalid input.
--continue
--else
-- # Passes both tests.
--ac_preproc_ok=:
--break
--fi
--rm -f conftest.err conftest.i conftest.$ac_ext
--
--done
--# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
--rm -f conftest.i conftest.err conftest.$ac_ext
--if $ac_preproc_ok; then :
-- break
--fi
--
-- done
-- ac_cv_prog_CPP=$CPP
--
--fi
-- CPP=$ac_cv_prog_CPP
--else
-- ac_cv_prog_CPP=$CPP
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
--$as_echo "$CPP" >&6; }
--ac_preproc_ok=false
--for ac_c_preproc_warn_flag in '' yes
--do
-- # Use a header file that comes with gcc, so configuring glibc
-- # with a fresh cross-compiler works.
-- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-- # <limits.h> exists even on freestanding compilers.
-- # On the NeXT, cc -E runs the code through the compiler's parser,
-- # not just through cpp. "Syntax error" is here to catch this case.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#ifdef __STDC__
--# include <limits.h>
--#else
--# include <assert.h>
--#endif
-- Syntax error
--_ACEOF
--if ac_fn_c_try_cpp "$LINENO"; then :
--
--else
-- # Broken: fails on valid input.
--continue
--fi
--rm -f conftest.err conftest.i conftest.$ac_ext
--
-- # OK, works on sane cases. Now check whether nonexistent headers
-- # can be detected and how.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <ac_nonexistent.h>
--_ACEOF
--if ac_fn_c_try_cpp "$LINENO"; then :
-- # Broken: success on invalid input.
--continue
--else
-- # Passes both tests.
--ac_preproc_ok=:
--break
--fi
--rm -f conftest.err conftest.i conftest.$ac_ext
--
--done
--# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
--rm -f conftest.i conftest.err conftest.$ac_ext
--if $ac_preproc_ok; then :
--
--else
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
--See \`config.log' for more details" "$LINENO" 5; }
--fi
--
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
--$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
--if ${ac_cv_path_GREP+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -z "$GREP"; then
-- ac_path_GREP_found=false
-- # Loop through the user's path and test for each of PROGNAME-LIST
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_prog in grep ggrep; do
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-- as_fn_executable_p "$ac_path_GREP" || continue
--# Check for GNU ac_path_GREP and select it if it is found.
-- # Check for GNU $ac_path_GREP
--case `"$ac_path_GREP" --version 2>&1` in
--*GNU*)
-- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
--*)
-- ac_count=0
-- $as_echo_n 0123456789 >"conftest.in"
-- while :
-- do
-- cat "conftest.in" "conftest.in" >"conftest.tmp"
-- mv "conftest.tmp" "conftest.in"
-- cp "conftest.in" "conftest.nl"
-- $as_echo 'GREP' >> "conftest.nl"
-- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-- as_fn_arith $ac_count + 1 && ac_count=$as_val
-- if test $ac_count -gt ${ac_path_GREP_max-0}; then
-- # Best one so far, save it but keep looking for a better one
-- ac_cv_path_GREP="$ac_path_GREP"
-- ac_path_GREP_max=$ac_count
-- fi
-- # 10*(2^10) chars as input seems more than enough
-- test $ac_count -gt 10 && break
-- done
-- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
--esac
--
-- $ac_path_GREP_found && break 3
-- done
-- done
-- done
--IFS=$as_save_IFS
-- if test -z "$ac_cv_path_GREP"; then
-- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-- fi
--else
-- ac_cv_path_GREP=$GREP
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
--$as_echo "$ac_cv_path_GREP" >&6; }
-- GREP="$ac_cv_path_GREP"
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
--$as_echo_n "checking for egrep... " >&6; }
--if ${ac_cv_path_EGREP+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-- then ac_cv_path_EGREP="$GREP -E"
-- else
-- if test -z "$EGREP"; then
-- ac_path_EGREP_found=false
-- # Loop through the user's path and test for each of PROGNAME-LIST
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_prog in egrep; do
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-- as_fn_executable_p "$ac_path_EGREP" || continue
--# Check for GNU ac_path_EGREP and select it if it is found.
-- # Check for GNU $ac_path_EGREP
--case `"$ac_path_EGREP" --version 2>&1` in
--*GNU*)
-- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
--*)
-- ac_count=0
-- $as_echo_n 0123456789 >"conftest.in"
-- while :
-- do
-- cat "conftest.in" "conftest.in" >"conftest.tmp"
-- mv "conftest.tmp" "conftest.in"
-- cp "conftest.in" "conftest.nl"
-- $as_echo 'EGREP' >> "conftest.nl"
-- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-- as_fn_arith $ac_count + 1 && ac_count=$as_val
-- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-- # Best one so far, save it but keep looking for a better one
-- ac_cv_path_EGREP="$ac_path_EGREP"
-- ac_path_EGREP_max=$ac_count
-- fi
-- # 10*(2^10) chars as input seems more than enough
-- test $ac_count -gt 10 && break
-- done
-- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
--esac
--
-- $ac_path_EGREP_found && break 3
-- done
-- done
-- done
--IFS=$as_save_IFS
-- if test -z "$ac_cv_path_EGREP"; then
-- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
-- fi
--else
-- ac_cv_path_EGREP=$EGREP
--fi
--
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
--$as_echo "$ac_cv_path_EGREP" >&6; }
-- EGREP="$ac_cv_path_EGREP"
--
--
--# Find a good install program. We prefer a C program (faster),
--# so one script is as good as another. But avoid the broken or
--# incompatible versions:
--# SysV /etc/install, /usr/sbin/install
--# SunOS /usr/etc/install
--# IRIX /sbin/install
--# AIX /bin/install
--# AmigaOS /C/install, which installs bootblocks on floppy discs
--# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
--# AFS /usr/afsws/bin/install, which mishandles nonexistent args
--# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
--# OS/2's system install, which has a completely different semantic
--# ./install, which can be erroneously created by make from ./install.sh.
--# Reject install programs that cannot install multiple files.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
--$as_echo_n "checking for a BSD-compatible install... " >&6; }
--if test -z "$INSTALL"; then
--if ${ac_cv_path_install+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- # Account for people who put trailing slashes in PATH elements.
--case $as_dir/ in #((
-- ./ | .// | /[cC]/* | \
-- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-- ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
-- /usr/ucb/* ) ;;
-- *)
-- # OSF1 and SCO ODT 3.0 have their own names for install.
-- # Don't use installbsd from OSF since it installs stuff as root
-- # by default.
-- for ac_prog in ginstall scoinst install; do
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
-- if test $ac_prog = install &&
-- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-- # AIX install. It has an incompatible calling convention.
-- :
-- elif test $ac_prog = install &&
-- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-- # program-specific install script used by HP pwplus--don't use.
-- :
-- else
-- rm -rf conftest.one conftest.two conftest.dir
-- echo one > conftest.one
-- echo two > conftest.two
-- mkdir conftest.dir
-- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-- test -s conftest.one && test -s conftest.two &&
-- test -s conftest.dir/conftest.one &&
-- test -s conftest.dir/conftest.two
-- then
-- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-- break 3
-- fi
-- fi
-- fi
-- done
-- done
-- ;;
--esac
--
-- done
--IFS=$as_save_IFS
--
--rm -rf conftest.one conftest.two conftest.dir
--
--fi
-- if test "${ac_cv_path_install+set}" = set; then
-- INSTALL=$ac_cv_path_install
-- else
-- # As a last resort, use the slow shell script. Don't cache a
-- # value for INSTALL within a source directory, because that will
-- # break other packages using the cache if that directory is
-- # removed, or if the value is a relative name.
-- INSTALL=$ac_install_sh
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
--$as_echo "$INSTALL" >&6; }
--
--# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
--# It thinks the first close brace ends the variable substitution.
--test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
--
--test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
--
--test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
--$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
--if test -z "$MKDIR_P"; then
-- if ${ac_cv_path_mkdir+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_prog in mkdir gmkdir; do
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
-- case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-- 'mkdir (GNU coreutils) '* | \
-- 'mkdir (coreutils) '* | \
-- 'mkdir (fileutils) '4.1*)
-- ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-- break 3;;
-- esac
-- done
-- done
-- done
--IFS=$as_save_IFS
--
--fi
--
-- test -d ./--version && rmdir ./--version
-- if test "${ac_cv_path_mkdir+set}" = set; then
-- MKDIR_P="$ac_cv_path_mkdir -p"
-- else
-- # As a last resort, use the slow shell script. Don't cache a
-- # value for MKDIR_P within a source directory, because that will
-- # break other packages using the cache if that directory is
-- # removed, or if the value is a relative name.
-- MKDIR_P="$ac_install_sh -d"
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
--$as_echo "$MKDIR_P" >&6; }
--
-- case $ac_cv_prog_cc_stdc in #(
-- no) :
-- ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
-- *) :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
--$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
--if ${ac_cv_prog_cc_c99+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_prog_cc_c99=no
--ac_save_CC=$CC
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdarg.h>
--#include <stdbool.h>
--#include <stdlib.h>
--#include <wchar.h>
--#include <stdio.h>
--
--// Check varargs macros. These examples are taken from C99 6.10.3.5.
--#define debug(...) fprintf (stderr, __VA_ARGS__)
--#define showlist(...) puts (#__VA_ARGS__)
--#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
--static void
--test_varargs_macros (void)
--{
-- int x = 1234;
-- int y = 5678;
-- debug ("Flag");
-- debug ("X = %d\n", x);
-- showlist (The first, second, and third items.);
-- report (x>y, "x is %d but y is %d", x, y);
--}
--
--// Check long long types.
--#define BIG64 18446744073709551615ull
--#define BIG32 4294967295ul
--#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
--#if !BIG_OK
-- your preprocessor is broken;
--#endif
--#if BIG_OK
--#else
-- your preprocessor is broken;
--#endif
--static long long int bignum = -9223372036854775807LL;
--static unsigned long long int ubignum = BIG64;
--
--struct incomplete_array
--{
-- int datasize;
-- double data[];
--};
--
--struct named_init {
-- int number;
-- const wchar_t *name;
-- double average;
--};
--
--typedef const char *ccp;
--
--static inline int
--test_restrict (ccp restrict text)
--{
-- // See if C++-style comments work.
-- // Iterate through items via the restricted pointer.
-- // Also check for declarations in for loops.
-- for (unsigned int i = 0; *(text+i) != '\0'; ++i)
-- continue;
-- return 0;
--}
--
--// Check varargs and va_copy.
--static void
--test_varargs (const char *format, ...)
--{
-- va_list args;
-- va_start (args, format);
-- va_list args_copy;
-- va_copy (args_copy, args);
--
-- const char *str;
-- int number;
-- float fnumber;
--
-- while (*format)
-- {
-- switch (*format++)
-- {
-- case 's': // string
-- str = va_arg (args_copy, const char *);
-- break;
-- case 'd': // int
-- number = va_arg (args_copy, int);
-- break;
-- case 'f': // float
-- fnumber = va_arg (args_copy, double);
-- break;
-- default:
-- break;
-- }
-- }
-- va_end (args_copy);
-- va_end (args);
--}
--
--int
--main ()
--{
--
-- // Check bool.
-- _Bool success = false;
--
-- // Check restrict.
-- if (test_restrict ("String literal") == 0)
-- success = true;
-- char *restrict newvar = "Another string";
--
-- // Check varargs.
-- test_varargs ("s, d' f .", "string", 65, 34.234);
-- test_varargs_macros ();
--
-- // Check flexible array members.
-- struct incomplete_array *ia =
-- malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
-- ia->datasize = 10;
-- for (int i = 0; i < ia->datasize; ++i)
-- ia->data[i] = i * 1.234;
--
-- // Check named initializers.
-- struct named_init ni = {
-- .number = 34,
-- .name = L"Test wide string",
-- .average = 543.34343,
-- };
--
-- ni.number = 58;
--
-- int dynamic_array[ni.number];
-- dynamic_array[ni.number - 1] = 543;
--
-- // work around unused variable warnings
-- return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
-- || dynamic_array[ni.number - 1] != 543);
--
-- ;
-- return 0;
--}
--_ACEOF
--for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
--do
-- CC="$ac_save_CC $ac_arg"
-- if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_prog_cc_c99=$ac_arg
--fi
--rm -f core conftest.err conftest.$ac_objext
-- test "x$ac_cv_prog_cc_c99" != "xno" && break
--done
--rm -f conftest.$ac_ext
--CC=$ac_save_CC
--
--fi
--# AC_CACHE_VAL
--case "x$ac_cv_prog_cc_c99" in
-- x)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
--$as_echo "none needed" >&6; } ;;
-- xno)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
--$as_echo "unsupported" >&6; } ;;
-- *)
-- CC="$CC $ac_cv_prog_cc_c99"
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
--$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
--esac
--if test "x$ac_cv_prog_cc_c99" != xno; then :
-- ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
--$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
--if ${ac_cv_prog_cc_c89+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_prog_cc_c89=no
--ac_save_CC=$CC
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdarg.h>
--#include <stdio.h>
--struct stat;
--/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
--struct buf { int x; };
--FILE * (*rcsopen) (struct buf *, struct stat *, int);
--static char *e (p, i)
-- char **p;
-- int i;
--{
-- return p[i];
--}
--static char *f (char * (*g) (char **, int), char **p, ...)
--{
-- char *s;
-- va_list v;
-- va_start (v,p);
-- s = g (p, va_arg (v,int));
-- va_end (v);
-- return s;
--}
--
--/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
-- function prototypes and stuff, but not '\xHH' hex character constants.
-- These don't provoke an error unfortunately, instead are silently treated
-- as 'x'. The following induces an error, until -std is added to get
-- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
-- array size at least. It's necessary to write '\x00'==0 to get something
-- that's true only with -std. */
--int osf4_cc_array ['\x00' == 0 ? 1 : -1];
--
--/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-- inside strings and character constants. */
--#define FOO(x) 'x'
--int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
--
--int test (int i, double x);
--struct s1 {int (*f) (int a);};
--struct s2 {int (*f) (double a);};
--int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
--int argc;
--char **argv;
--int
--main ()
--{
--return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
-- ;
-- return 0;
--}
--_ACEOF
--for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
--do
-- CC="$ac_save_CC $ac_arg"
-- if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_prog_cc_c89=$ac_arg
--fi
--rm -f core conftest.err conftest.$ac_objext
-- test "x$ac_cv_prog_cc_c89" != "xno" && break
--done
--rm -f conftest.$ac_ext
--CC=$ac_save_CC
--
--fi
--# AC_CACHE_VAL
--case "x$ac_cv_prog_cc_c89" in
-- x)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
--$as_echo "none needed" >&6; } ;;
-- xno)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
--$as_echo "unsupported" >&6; } ;;
-- *)
-- CC="$CC $ac_cv_prog_cc_c89"
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
--$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
--esac
--if test "x$ac_cv_prog_cc_c89" != xno; then :
-- ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
--else
-- ac_cv_prog_cc_stdc=no
--fi
--
--fi
-- ;;
--esac
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
--$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
-- if ${ac_cv_prog_cc_stdc+:} false; then :
-- $as_echo_n "(cached) " >&6
--fi
--
-- case $ac_cv_prog_cc_stdc in #(
-- no) :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
--$as_echo "unsupported" >&6; } ;; #(
-- '') :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
--$as_echo "none needed" >&6; } ;; #(
-- *) :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
--$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
--esac
--
--
--# Extract the first word of "perl", so it can be a program name with args.
--set dummy perl; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_path_PERL+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- case $PERL in
-- [\\/]* | ?:[\\/]*)
-- ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
-- ;;
-- *)
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- ;;
--esac
--fi
--PERL=$ac_cv_path_PERL
--if test -n "$PERL"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
--$as_echo "$PERL" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--
--
--$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
--
--
--if test x"$ac_cv_prog_cc_stdc" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: rsync requires an ANSI C compiler and you do not seem to have one" >&5
--$as_echo "$as_me: WARNING: rsync requires an ANSI C compiler and you do not seem to have one" >&2;}
--fi
--
--# Check whether --enable-profile was given.
--if test "${enable_profile+set}" = set; then :
-- enableval=$enable_profile;
--fi
--
--if test x"$enable_profile" = x"yes"; then
-- CFLAGS="$CFLAGS -pg"
--fi
--
--
--# Specifically, this turns on panic_action handling.
--# Check whether --enable-maintainer-mode was given.
--if test "${enable_maintainer_mode+set}" = set; then :
-- enableval=$enable_maintainer_mode;
--fi
--
--if test x"$enable_maintainer_mode" = x"yes"; then
-- CFLAGS="$CFLAGS -DMAINTAINER_MODE"
--fi
--
--
--# This is needed for our included version of popt. Kind of silly, but
--# I don't want our version too far out of sync.
--CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
--
--# If GCC, turn on warnings.
--if test x"$GCC" = x"yes"; then
-- CFLAGS="$CFLAGS -Wall -W"
--fi
--
--
--# Check whether --with-included-popt was given.
--if test "${with_included_popt+set}" = set; then :
-- withval=$with_included_popt;
--fi
--
--
--
--# Check whether --with-included-zlib was given.
--if test "${with_included_zlib+set}" = set; then :
-- withval=$with_included_zlib;
--fi
--
--
--
--# Check whether --with-protected-args was given.
--if test "${with_protected_args+set}" = set; then :
-- withval=$with_protected_args;
--fi
--
--if test x"$with_protected_args" = x"yes"; then
--
--cat >>confdefs.h <<_ACEOF
--#define RSYNC_USE_PROTECTED_ARGS 1
--_ACEOF
--
--fi
--
--
--# Check whether --with-rsync-path was given.
--if test "${with_rsync_path+set}" = set; then :
-- withval=$with_rsync_path; RSYNC_PATH="$with_rsync_path"
--else
-- RSYNC_PATH="rsync"
--fi
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define RSYNC_PATH "$RSYNC_PATH"
--_ACEOF
--
--
--
--# Check whether --with-rsyncd-conf was given.
--if test "${with_rsyncd_conf+set}" = set; then :
-- withval=$with_rsyncd_conf; if test ! -z "$with_rsyncd_conf" ; then
-- case $with_rsyncd_conf in
-- yes|no)
-- RSYNCD_SYSCONF="/etc/rsyncd.conf"
-- ;;
-- /*)
-- RSYNCD_SYSCONF="$with_rsyncd_conf"
-- ;;
-- *)
-- as_fn_error $? "You must specify an absolute path to --with-rsyncd-conf=PATH" "$LINENO" 5
-- ;;
-- esac
-- else
-- RSYNCD_SYSCONF="/etc/rsyncd.conf"
-- fi
--else
-- RSYNCD_SYSCONF="/etc/rsyncd.conf"
--fi
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define RSYNCD_SYSCONF "$RSYNCD_SYSCONF"
--_ACEOF
--
--
--
--# Check whether --with-rsh was given.
--if test "${with_rsh+set}" = set; then :
-- withval=$with_rsh;
--fi
--
--
--# Extract the first word of "remsh", so it can be a program name with args.
--set dummy remsh; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_HAVE_REMSH+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$HAVE_REMSH"; then
-- ac_cv_prog_HAVE_REMSH="$HAVE_REMSH" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_HAVE_REMSH="1"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_prog_HAVE_REMSH" && ac_cv_prog_HAVE_REMSH="0"
--fi
--fi
--HAVE_REMSH=$ac_cv_prog_HAVE_REMSH
--if test -n "$HAVE_REMSH"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_REMSH" >&5
--$as_echo "$HAVE_REMSH" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--if test x$HAVE_REMSH = x1; then
--
--$as_echo "#define HAVE_REMSH 1" >>confdefs.h
--
--fi
--
--if test x"$with_rsh" != x; then
-- RSYNC_RSH="$with_rsh"
--else
-- RSYNC_RSH="ssh"
--fi
--
--cat >>confdefs.h <<_ACEOF
--#define RSYNC_RSH "$RSYNC_RSH"
--_ACEOF
--
--
--# Extract the first word of "yodl2man", so it can be a program name with args.
--set dummy yodl2man; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_prog_HAVE_YODL2MAN+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test -n "$HAVE_YODL2MAN"; then
-- ac_cv_prog_HAVE_YODL2MAN="$HAVE_YODL2MAN" # Let the user override the test.
--else
--as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_prog_HAVE_YODL2MAN="1"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_prog_HAVE_YODL2MAN" && ac_cv_prog_HAVE_YODL2MAN="0"
--fi
--fi
--HAVE_YODL2MAN=$ac_cv_prog_HAVE_YODL2MAN
--if test -n "$HAVE_YODL2MAN"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_YODL2MAN" >&5
--$as_echo "$HAVE_YODL2MAN" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--if test x$HAVE_YODL2MAN = x1; then
-- MAKE_MAN=man
--else
-- MAKE_MAN=man-copy
--fi
--
--# Some programs on solaris are only found in /usr/xpg4/bin (or work better than others versions).
--# Extract the first word of "sh", so it can be a program name with args.
--set dummy sh; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_path_SHELL_PATH+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- case $SHELL_PATH in
-- [\\/]* | ?:[\\/]*)
-- ac_cv_path_SHELL_PATH="$SHELL_PATH" # Let the user override the test with a path.
-- ;;
-- *)
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in /usr/xpg4/bin$PATH_SEPARATOR$PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_path_SHELL_PATH="$as_dir/$ac_word$ac_exec_ext"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_path_SHELL_PATH" && ac_cv_path_SHELL_PATH="/bin/sh"
-- ;;
--esac
--fi
--SHELL_PATH=$ac_cv_path_SHELL_PATH
--if test -n "$SHELL_PATH"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHELL_PATH" >&5
--$as_echo "$SHELL_PATH" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--# Extract the first word of "fakeroot", so it can be a program name with args.
--set dummy fakeroot; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_path_FAKEROOT_PATH+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- case $FAKEROOT_PATH in
-- [\\/]* | ?:[\\/]*)
-- ac_cv_path_FAKEROOT_PATH="$FAKEROOT_PATH" # Let the user override the test with a path.
-- ;;
-- *)
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in /usr/xpg4/bin$PATH_SEPARATOR$PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_path_FAKEROOT_PATH="$as_dir/$ac_word$ac_exec_ext"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_path_FAKEROOT_PATH" && ac_cv_path_FAKEROOT_PATH="/usr/bin/fakeroot"
-- ;;
--esac
--fi
--FAKEROOT_PATH=$ac_cv_path_FAKEROOT_PATH
--if test -n "$FAKEROOT_PATH"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FAKEROOT_PATH" >&5
--$as_echo "$FAKEROOT_PATH" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--
--
--# Check whether --with-nobody-group was given.
--if test "${with_nobody_group+set}" = set; then :
-- withval=$with_nobody_group; NOBODY_GROUP="$with_nobody_group"
--fi
--
--
--if test x"$with_nobody_group" = x; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking the group for user \"nobody\"" >&5
--$as_echo_n "checking the group for user \"nobody\"... " >&6; }
-- if grep '^nobody:' /etc/group >/dev/null 2>&1; then
-- NOBODY_GROUP=nobody
-- elif grep '^nogroup:' /etc/group >/dev/null 2>&1; then
-- NOBODY_GROUP=nogroup
-- else
-- NOBODY_GROUP=nobody # test for others?
-- fi
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NOBODY_GROUP" >&5
--$as_echo "$NOBODY_GROUP" >&6; }
--fi
--
--
--cat >>confdefs.h <<_ACEOF
--#define NOBODY_USER "nobody"
--_ACEOF
--
--
--cat >>confdefs.h <<_ACEOF
--#define NOBODY_GROUP "$NOBODY_GROUP"
--_ACEOF
--
--
--# arrgh. libc in some old debian version screwed up the largefile
--# stuff, getting byte range locking wrong
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken largefile support" >&5
--$as_echo_n "checking for broken largefile support... " >&6; }
--if ${rsync_cv_HAVE_BROKEN_LARGEFILE+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_HAVE_BROKEN_LARGEFILE=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#define _FILE_OFFSET_BITS 64
--#include <stdio.h>
--#include <fcntl.h>
--#include <sys/types.h>
--#include <sys/wait.h>
--
--int main(void)
--{
-- struct flock lock;
-- int status;
-- char tpl[32] = "/tmp/locktest.XXXXXX";
-- int fd = mkstemp(tpl);
-- if (fd < 0) {
-- strcpy(tpl, "conftest.dat");
-- fd = open(tpl, O_CREAT|O_RDWR, 0600);
-- }
--
-- lock.l_type = F_WRLCK;
-- lock.l_whence = SEEK_SET;
-- lock.l_start = 0;
-- lock.l_len = 1;
-- lock.l_pid = 0;
-- fcntl(fd,F_SETLK,&lock);
-- if (fork() == 0) {
-- lock.l_start = 1;
-- _exit(fcntl(fd,F_SETLK,&lock) == 0);
-- }
-- wait(&status);
-- unlink(tpl);
-- exit(WEXITSTATUS(status));
--}
--
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_HAVE_BROKEN_LARGEFILE=yes
--else
-- rsync_cv_HAVE_BROKEN_LARGEFILE=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_BROKEN_LARGEFILE" >&5
--$as_echo "$rsync_cv_HAVE_BROKEN_LARGEFILE" >&6; }
--if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
-- # Check whether --enable-largefile was given.
--if test "${enable_largefile+set}" = set; then :
-- enableval=$enable_largefile;
--fi
--
--if test "$enable_largefile" != no; then
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
--$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
--if ${ac_cv_sys_largefile_CC+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_sys_largefile_CC=no
-- if test "$GCC" != yes; then
-- ac_save_CC=$CC
-- while :; do
-- # IRIX 6.2 and later do not support large files by default,
-- # so use the C compiler's -n32 option if that helps.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- /* Check that off_t can represent 2**63 - 1 correctly.
-- We can't simply define LARGE_OFF_T to be 9223372036854775807,
-- since some C++ compilers masquerading as C compilers
-- incorrectly reject 9223372036854775807. */
--#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-- && LARGE_OFF_T % 2147483647 == 1)
-- ? 1 : -1];
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
-- if ac_fn_c_try_compile "$LINENO"; then :
-- break
--fi
--rm -f core conftest.err conftest.$ac_objext
-- CC="$CC -n32"
-- if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_sys_largefile_CC=' -n32'; break
--fi
--rm -f core conftest.err conftest.$ac_objext
-- break
-- done
-- CC=$ac_save_CC
-- rm -f conftest.$ac_ext
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
--$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-- if test "$ac_cv_sys_largefile_CC" != no; then
-- CC=$CC$ac_cv_sys_largefile_CC
-- fi
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
--$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
--if ${ac_cv_sys_file_offset_bits+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- while :; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- /* Check that off_t can represent 2**63 - 1 correctly.
-- We can't simply define LARGE_OFF_T to be 9223372036854775807,
-- since some C++ compilers masquerading as C compilers
-- incorrectly reject 9223372036854775807. */
--#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-- && LARGE_OFF_T % 2147483647 == 1)
-- ? 1 : -1];
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_sys_file_offset_bits=no; break
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#define _FILE_OFFSET_BITS 64
--#include <sys/types.h>
-- /* Check that off_t can represent 2**63 - 1 correctly.
-- We can't simply define LARGE_OFF_T to be 9223372036854775807,
-- since some C++ compilers masquerading as C compilers
-- incorrectly reject 9223372036854775807. */
--#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-- && LARGE_OFF_T % 2147483647 == 1)
-- ? 1 : -1];
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_sys_file_offset_bits=64; break
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- ac_cv_sys_file_offset_bits=unknown
-- break
--done
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
--$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
--case $ac_cv_sys_file_offset_bits in #(
-- no | unknown) ;;
-- *)
--cat >>confdefs.h <<_ACEOF
--#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
--_ACEOF
--;;
--esac
--rm -rf conftest*
-- if test $ac_cv_sys_file_offset_bits = unknown; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
--$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
--if ${ac_cv_sys_large_files+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- while :; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- /* Check that off_t can represent 2**63 - 1 correctly.
-- We can't simply define LARGE_OFF_T to be 9223372036854775807,
-- since some C++ compilers masquerading as C compilers
-- incorrectly reject 9223372036854775807. */
--#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-- && LARGE_OFF_T % 2147483647 == 1)
-- ? 1 : -1];
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_sys_large_files=no; break
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#define _LARGE_FILES 1
--#include <sys/types.h>
-- /* Check that off_t can represent 2**63 - 1 correctly.
-- We can't simply define LARGE_OFF_T to be 9223372036854775807,
-- since some C++ compilers masquerading as C compilers
-- incorrectly reject 9223372036854775807. */
--#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
-- int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-- && LARGE_OFF_T % 2147483647 == 1)
-- ? 1 : -1];
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_sys_large_files=1; break
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- ac_cv_sys_large_files=unknown
-- break
--done
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
--$as_echo "$ac_cv_sys_large_files" >&6; }
--case $ac_cv_sys_large_files in #(
-- no | unknown) ;;
-- *)
--cat >>confdefs.h <<_ACEOF
--#define _LARGE_FILES $ac_cv_sys_large_files
--_ACEOF
--;;
--esac
--rm -rf conftest*
-- fi
--
--
--fi
--
--fi
--
--ipv6type=unknown
--ipv6lib=none
--ipv6trylibc=yes
--
--# Check whether --enable-ipv6 was given.
--if test "${enable_ipv6+set}" = set; then :
-- enableval=$enable_ipv6;
--fi
--
--if test x"$enable_ipv6" != x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking ipv6 stack type" >&5
--$as_echo_n "checking ipv6 stack type... " >&6; }
-- for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
-- case $i in
-- inria)
-- # http://www.kame.net/
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <netinet/in.h>
--#ifdef IPV6_INRIA_VERSION
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--
--fi
--rm -f conftest*
--
-- ;;
-- kame)
-- # http://www.kame.net/
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <netinet/in.h>
--#ifdef __KAME__
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- linux-glibc)
-- # http://www.v6.linux.or.jp/
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <features.h>
--#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- linux-inet6)
-- # http://www.v6.linux.or.jp/
-- if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
-- ipv6type=$i
-- ipv6lib=inet6
-- ipv6libdir=/usr/inet6/lib
-- ipv6trylibc=yes;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
-- CFLAGS="-I/usr/inet6/include $CFLAGS"
-- fi
-- ;;
-- solaris)
-- # http://www.sun.com
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <netinet/ip6.h>
--#ifdef __sun
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- toshiba)
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/param.h>
--#ifdef _TOSHIBA_INET6
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
-- ipv6lib=inet6;
-- ipv6libdir=/usr/local/v6/lib;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- v6d)
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include </usr/local/v6/include/sys/v6config.h>
--#ifdef __V6D__
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
-- ipv6lib=v6;
-- ipv6libdir=/usr/local/v6/lib;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- zeta)
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/param.h>
--#ifdef _ZETA_MINAMI_INET6
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
-- ipv6lib=inet6;
-- ipv6libdir=/usr/local/v6/lib;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- cygwin)
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <netinet/in.h>
--#ifdef _CYGWIN_IN6_H
--yes
--#endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- ipv6type=$i;
--
--$as_echo "#define INET6 1" >>confdefs.h
--
--fi
--rm -f conftest*
--
-- ;;
-- esac
-- if test "$ipv6type" != "unknown"; then
-- break
-- fi
-- done
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6type" >&5
--$as_echo "$ipv6type" >&6; }
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getaddrinfo" >&5
--$as_echo_n "checking for library containing getaddrinfo... " >&6; }
--if ${ac_cv_search_getaddrinfo+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char getaddrinfo ();
--int
--main ()
--{
--return getaddrinfo ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' inet6; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_getaddrinfo=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_getaddrinfo+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_getaddrinfo+:} false; then :
--
--else
-- ac_cv_search_getaddrinfo=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getaddrinfo" >&5
--$as_echo "$ac_cv_search_getaddrinfo" >&6; }
--ac_res=$ac_cv_search_getaddrinfo
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--fi
--
--# Check whether --enable-locale was given.
--if test "${enable_locale+set}" = set; then :
-- enableval=$enable_locale;
--fi
--
--
--if test x"$enable_locale" != x"no"; then
-- $as_echo "#define CONFIG_LOCALE 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to call shutdown on all sockets" >&5
--$as_echo_n "checking whether to call shutdown on all sockets... " >&6; }
--case $host_os in
-- *cygwin* ) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
--
--$as_echo "#define SHUTDOWN_ALL_SOCKETS 1" >>confdefs.h
--
-- ;;
-- * ) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; };;
--esac
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
--$as_echo_n "checking for ANSI C header files... " >&6; }
--if ${ac_cv_header_stdc+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdlib.h>
--#include <stdarg.h>
--#include <string.h>
--#include <float.h>
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_header_stdc=yes
--else
-- ac_cv_header_stdc=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--
--if test $ac_cv_header_stdc = yes; then
-- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <string.h>
--
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "memchr" >/dev/null 2>&1; then :
--
--else
-- ac_cv_header_stdc=no
--fi
--rm -f conftest*
--
--fi
--
--if test $ac_cv_header_stdc = yes; then
-- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdlib.h>
--
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "free" >/dev/null 2>&1; then :
--
--else
-- ac_cv_header_stdc=no
--fi
--rm -f conftest*
--
--fi
--
--if test $ac_cv_header_stdc = yes; then
-- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-- if test "$cross_compiling" = yes; then :
-- :
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <ctype.h>
--#include <stdlib.h>
--#if ((' ' & 0x0FF) == 0x020)
--# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
--# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
--#else
--# define ISLOWER(c) \
-- (('a' <= (c) && (c) <= 'i') \
-- || ('j' <= (c) && (c) <= 'r') \
-- || ('s' <= (c) && (c) <= 'z'))
--# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
--#endif
--
--#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
--int
--main ()
--{
-- int i;
-- for (i = 0; i < 256; i++)
-- if (XOR (islower (i), ISLOWER (i))
-- || toupper (i) != TOUPPER (i))
-- return 2;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
--
--else
-- ac_cv_header_stdc=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
--$as_echo "$ac_cv_header_stdc" >&6; }
--if test $ac_cv_header_stdc = yes; then
--
--$as_echo "#define STDC_HEADERS 1" >>confdefs.h
--
--fi
--
--# On IRIX 5.3, sys/types and inttypes.h are conflicting.
--for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-- inttypes.h stdint.h unistd.h
--do :
-- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
--ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
--"
--if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--
--done
--
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
--$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
--if ${ac_cv_c_bigendian+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_c_bigendian=unknown
-- # See if we're dealing with a universal compiler.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#ifndef __APPLE_CC__
-- not a universal capable compiler
-- #endif
-- typedef int dummy;
--
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
--
-- # Check for potential -arch flags. It is not universal unless
-- # there are at least two -arch flags with different values.
-- ac_arch=
-- ac_prev=
-- for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
-- if test -n "$ac_prev"; then
-- case $ac_word in
-- i?86 | x86_64 | ppc | ppc64)
-- if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
-- ac_arch=$ac_word
-- else
-- ac_cv_c_bigendian=universal
-- break
-- fi
-- ;;
-- esac
-- ac_prev=
-- elif test "x$ac_word" = "x-arch"; then
-- ac_prev=arch
-- fi
-- done
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- if test $ac_cv_c_bigendian = unknown; then
-- # See if sys/param.h defines the BYTE_ORDER macro.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- #include <sys/param.h>
--
--int
--main ()
--{
--#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
-- && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
-- && LITTLE_ENDIAN)
-- bogus endian macros
-- #endif
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- # It does; now see whether it defined to BIG_ENDIAN or not.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- #include <sys/param.h>
--
--int
--main ()
--{
--#if BYTE_ORDER != BIG_ENDIAN
-- not big endian
-- #endif
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_c_bigendian=yes
--else
-- ac_cv_c_bigendian=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- fi
-- if test $ac_cv_c_bigendian = unknown; then
-- # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <limits.h>
--
--int
--main ()
--{
--#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
-- bogus endian macros
-- #endif
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- # It does; now see whether it defined to _BIG_ENDIAN or not.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <limits.h>
--
--int
--main ()
--{
--#ifndef _BIG_ENDIAN
-- not big endian
-- #endif
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_c_bigendian=yes
--else
-- ac_cv_c_bigendian=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- fi
-- if test $ac_cv_c_bigendian = unknown; then
-- # Compile a test program.
-- if test "$cross_compiling" = yes; then :
-- # Try to guess by grepping values from an object file.
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--short int ascii_mm[] =
-- { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-- short int ascii_ii[] =
-- { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-- int use_ascii (int i) {
-- return ascii_mm[i] + ascii_ii[i];
-- }
-- short int ebcdic_ii[] =
-- { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-- short int ebcdic_mm[] =
-- { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-- int use_ebcdic (int i) {
-- return ebcdic_mm[i] + ebcdic_ii[i];
-- }
-- extern int foo;
--
--int
--main ()
--{
--return use_ascii (foo) == use_ebcdic (foo);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
-- ac_cv_c_bigendian=yes
-- fi
-- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-- if test "$ac_cv_c_bigendian" = unknown; then
-- ac_cv_c_bigendian=no
-- else
-- # finding both strings is unlikely to happen, but who knows?
-- ac_cv_c_bigendian=unknown
-- fi
-- fi
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$ac_includes_default
--int
--main ()
--{
--
-- /* Are we little or big endian? From Harbison&Steele. */
-- union
-- {
-- long int l;
-- char c[sizeof (long int)];
-- } u;
-- u.l = 1;
-- return u.c[sizeof (long int) - 1] == 1;
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- ac_cv_c_bigendian=no
--else
-- ac_cv_c_bigendian=yes
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
-- fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
--$as_echo "$ac_cv_c_bigendian" >&6; }
-- case $ac_cv_c_bigendian in #(
-- yes)
-- $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
--;; #(
-- no)
-- ;; #(
-- universal)
--
--$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
--
-- ;; #(
-- *)
-- as_fn_error $? "unknown endianness
-- presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
-- esac
--
--ac_header_dirent=no
--for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-- as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
--$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
--if eval \${$as_ac_Header+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <$ac_hdr>
--
--int
--main ()
--{
--if ((DIR *) 0)
--return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "$as_ac_Header=yes"
--else
-- eval "$as_ac_Header=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--eval ac_res=\$$as_ac_Header
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--$as_echo "$ac_res" >&6; }
--if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
--_ACEOF
--
--ac_header_dirent=$ac_hdr; break
--fi
--
--done
--# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
--if test $ac_header_dirent = dirent.h; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
--$as_echo_n "checking for library containing opendir... " >&6; }
--if ${ac_cv_search_opendir+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char opendir ();
--int
--main ()
--{
--return opendir ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' dir; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_opendir=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_opendir+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_opendir+:} false; then :
--
--else
-- ac_cv_search_opendir=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
--$as_echo "$ac_cv_search_opendir" >&6; }
--ac_res=$ac_cv_search_opendir
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
--$as_echo_n "checking for library containing opendir... " >&6; }
--if ${ac_cv_search_opendir+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char opendir ();
--int
--main ()
--{
--return opendir ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' x; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_opendir=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_opendir+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_opendir+:} false; then :
--
--else
-- ac_cv_search_opendir=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
--$as_echo "$ac_cv_search_opendir" >&6; }
--ac_res=$ac_cv_search_opendir
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
--$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
--if ${ac_cv_header_time+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <sys/time.h>
--#include <time.h>
--
--int
--main ()
--{
--if ((struct tm *) 0)
--return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_header_time=yes
--else
-- ac_cv_header_time=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
--$as_echo "$ac_cv_header_time" >&6; }
--if test $ac_cv_header_time = yes; then
--
--$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
--$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
--if ${ac_cv_header_sys_wait_h+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <sys/wait.h>
--#ifndef WEXITSTATUS
--# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
--#endif
--#ifndef WIFEXITED
--# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
--#endif
--
--int
--main ()
--{
-- int s;
-- wait (&s);
-- s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_header_sys_wait_h=yes
--else
-- ac_cv_header_sys_wait_h=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
--$as_echo "$ac_cv_header_sys_wait_h" >&6; }
--if test $ac_cv_header_sys_wait_h = yes; then
--
--$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
--
--fi
--
--for ac_header in sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
-- unistd.h utime.h grp.h compat.h sys/param.h ctype.h sys/wait.h \
-- sys/ioctl.h sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h \
-- sys/un.h sys/attr.h mcheck.h arpa/inet.h arpa/nameser.h locale.h \
-- netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
-- sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
-- popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netinet/ip.h \
-- zlib.h
--do :
-- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
--ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
--if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--
--done
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5
--$as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
--if ${ac_cv_header_sys_types_h_makedev+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--int
--main ()
--{
--return makedev(0, 0);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_header_sys_types_h_makedev=yes
--else
-- ac_cv_header_sys_types_h_makedev=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5
--$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; }
--
--if test $ac_cv_header_sys_types_h_makedev = no; then
--ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default"
--if test "x$ac_cv_header_sys_mkdev_h" = xyes; then :
--
--$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h
--
--fi
--
--
--
-- if test $ac_cv_header_sys_mkdev_h = no; then
-- ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default"
--if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then :
--
--$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h
--
--fi
--
--
-- fi
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if makedev takes 3 args" >&5
--$as_echo_n "checking if makedev takes 3 args... " >&6; }
--if ${rsync_cv_MAKEDEV_TAKES_3_ARGS+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_MAKEDEV_TAKES_3_ARGS=no
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/types.h>
--#ifdef MAJOR_IN_MKDEV
--#include <sys/mkdev.h>
--# if !defined makedev && (defined mkdev || defined _WIN32 || defined __WIN32__)
--# define makedev mkdev
--# endif
--#elif defined MAJOR_IN_SYSMACROS
--#include <sys/sysmacros.h>
--#endif
--
--int main(void)
--{
-- dev_t dev = makedev(0, 5, 7);
-- if (major(dev) != 5 || minor(dev) != 7)
-- exit(1);
-- return 0;
--}
--
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_MAKEDEV_TAKES_3_ARGS=yes
--else
-- rsync_cv_MAKEDEV_TAKES_3_ARGS=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_MAKEDEV_TAKES_3_ARGS" >&5
--$as_echo "$rsync_cv_MAKEDEV_TAKES_3_ARGS" >&6; }
--if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then
--
--$as_echo "#define MAKEDEV_TAKES_3_ARGS 1" >>confdefs.h
--
--fi
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
--$as_echo_n "checking size of int... " >&6; }
--if ${ac_cv_sizeof_int+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_int" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (int)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_int=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
--$as_echo "$ac_cv_sizeof_int" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_INT $ac_cv_sizeof_int
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
--$as_echo_n "checking size of long... " >&6; }
--if ${ac_cv_sizeof_long+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_long" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (long)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_long=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
--$as_echo "$ac_cv_sizeof_long" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_LONG $ac_cv_sizeof_long
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
--$as_echo_n "checking size of long long... " >&6; }
--if ${ac_cv_sizeof_long_long+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_long_long" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (long long)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_long_long=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
--$as_echo "$ac_cv_sizeof_long_long" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
--$as_echo_n "checking size of short... " >&6; }
--if ${ac_cv_sizeof_short+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_short" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (short)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_short=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
--$as_echo "$ac_cv_sizeof_short" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_SHORT $ac_cv_sizeof_short
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int16_t" >&5
--$as_echo_n "checking size of int16_t... " >&6; }
--if ${ac_cv_sizeof_int16_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int16_t))" "ac_cv_sizeof_int16_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_int16_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (int16_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_int16_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int16_t" >&5
--$as_echo "$ac_cv_sizeof_int16_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_INT16_T $ac_cv_sizeof_int16_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint16_t" >&5
--$as_echo_n "checking size of uint16_t... " >&6; }
--if ${ac_cv_sizeof_uint16_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint16_t))" "ac_cv_sizeof_uint16_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_uint16_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (uint16_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_uint16_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_uint16_t" >&5
--$as_echo "$ac_cv_sizeof_uint16_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_UINT16_T $ac_cv_sizeof_uint16_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int32_t" >&5
--$as_echo_n "checking size of int32_t... " >&6; }
--if ${ac_cv_sizeof_int32_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int32_t))" "ac_cv_sizeof_int32_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_int32_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (int32_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_int32_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int32_t" >&5
--$as_echo "$ac_cv_sizeof_int32_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_INT32_T $ac_cv_sizeof_int32_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uint32_t" >&5
--$as_echo_n "checking size of uint32_t... " >&6; }
--if ${ac_cv_sizeof_uint32_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uint32_t))" "ac_cv_sizeof_uint32_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_uint32_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (uint32_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_uint32_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_uint32_t" >&5
--$as_echo "$ac_cv_sizeof_uint32_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_UINT32_T $ac_cv_sizeof_uint32_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int64_t" >&5
--$as_echo_n "checking size of int64_t... " >&6; }
--if ${ac_cv_sizeof_int64_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int64_t))" "ac_cv_sizeof_int64_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_int64_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (int64_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_int64_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int64_t" >&5
--$as_echo "$ac_cv_sizeof_int64_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_INT64_T $ac_cv_sizeof_int64_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5
--$as_echo_n "checking size of off_t... " >&6; }
--if ${ac_cv_sizeof_off_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_off_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (off_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_off_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5
--$as_echo "$ac_cv_sizeof_off_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off64_t" >&5
--$as_echo_n "checking size of off64_t... " >&6; }
--if ${ac_cv_sizeof_off64_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off64_t))" "ac_cv_sizeof_off64_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_off64_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (off64_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_off64_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off64_t" >&5
--$as_echo "$ac_cv_sizeof_off64_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_OFF64_T $ac_cv_sizeof_off64_t
--_ACEOF
--
--
--# The cast to long int works around a bug in the HP C Compiler
--# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
--# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
--# This bug is HP SR number 8606223364.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
--$as_echo_n "checking size of time_t... " >&6; }
--if ${ac_cv_sizeof_time_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "$ac_includes_default"; then :
--
--else
-- if test "$ac_cv_type_time_t" = yes; then
-- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
--$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
--as_fn_error 77 "cannot compute sizeof (time_t)
--See \`config.log' for more details" "$LINENO" 5; }
-- else
-- ac_cv_sizeof_time_t=0
-- fi
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
--$as_echo "$ac_cv_sizeof_time_t" >&6; }
--
--
--
--cat >>confdefs.h <<_ACEOF
--#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
--_ACEOF
--
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
--$as_echo_n "checking for inline... " >&6; }
--if ${ac_cv_c_inline+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_cv_c_inline=no
--for ac_kw in inline __inline__ __inline; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#ifndef __cplusplus
--typedef int foo_t;
--static $ac_kw foo_t static_foo () {return 0; }
--$ac_kw foo_t foo () {return 0; }
--#endif
--
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_c_inline=$ac_kw
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- test "$ac_cv_c_inline" != no && break
--done
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
--$as_echo "$ac_cv_c_inline" >&6; }
--
--case $ac_cv_c_inline in
-- inline | yes) ;;
-- *)
-- case $ac_cv_c_inline in
-- no) ac_val=;;
-- *) ac_val=$ac_cv_c_inline;;
-- esac
-- cat >>confdefs.h <<_ACEOF
--#ifndef __cplusplus
--#define inline $ac_val
--#endif
--_ACEOF
-- ;;
--esac
--
--
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5
--$as_echo_n "checking for long double with more range or precision than double... " >&6; }
--if ${ac_cv_type_long_double_wider+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <float.h>
-- long double const a[] =
-- {
-- 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON,
-- LDBL_MIN, LDBL_MAX, LDBL_EPSILON
-- };
-- long double
-- f (long double x)
-- {
-- return ((x + (unsigned long int) 10) * (-1 / x) + a[0]
-- + (x ? f (x) : 'c'));
-- }
--
--int
--main ()
--{
--static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
-- + (DBL_MANT_DIG < LDBL_MANT_DIG)
-- - (LDBL_MAX_EXP < DBL_MAX_EXP)
-- - (LDBL_MANT_DIG < DBL_MANT_DIG)))
-- && (int) LDBL_EPSILON == 0
-- )];
--test_array [0] = 0;
--return test_array [0];
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_type_long_double_wider=yes
--else
-- ac_cv_type_long_double_wider=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5
--$as_echo "$ac_cv_type_long_double_wider" >&6; }
-- if test $ac_cv_type_long_double_wider = yes; then
--
--$as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h
--
-- fi
--
--ac_cv_c_long_double=$ac_cv_type_long_double_wider
--if test $ac_cv_c_long_double = yes; then
--
--$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
--$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
--if ${ac_cv_type_uid_t+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "uid_t" >/dev/null 2>&1; then :
-- ac_cv_type_uid_t=yes
--else
-- ac_cv_type_uid_t=no
--fi
--rm -f conftest*
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
--$as_echo "$ac_cv_type_uid_t" >&6; }
--if test $ac_cv_type_uid_t = no; then
--
--$as_echo "#define uid_t int" >>confdefs.h
--
--
--$as_echo "#define gid_t int" >>confdefs.h
--
--fi
--
--ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
--if test "x$ac_cv_type_mode_t" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_MODE_T 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
--if test "x$ac_cv_type_off_t" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_OFF_T 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
--if test "x$ac_cv_type_size_t" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_SIZE_T 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
--if test "x$ac_cv_type_pid_t" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_PID_T 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_type "$LINENO" "id_t" "ac_cv_type_id_t" "$ac_includes_default"
--if test "x$ac_cv_type_id_t" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_ID_T 1
--_ACEOF
--
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
--$as_echo_n "checking type of array argument to getgroups... " >&6; }
--if ${ac_cv_type_getgroups+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test "$cross_compiling" = yes; then :
-- ac_cv_type_getgroups=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--/* Thanks to Mike Rendell for this test. */
--$ac_includes_default
--#define NGID 256
--#undef MAX
--#define MAX(x, y) ((x) > (y) ? (x) : (y))
--
--int
--main ()
--{
-- gid_t gidset[NGID];
-- int i, n;
-- union { gid_t gval; long int lval; } val;
--
-- val.lval = -1;
-- for (i = 0; i < NGID; i++)
-- gidset[i] = val.gval;
-- n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
-- gidset);
-- /* Exit non-zero if getgroups seems to require an array of ints. This
-- happens when gid_t is short int but getgroups modifies an array
-- of ints. */
-- return n > 0 && gidset[n] != val.gval;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- ac_cv_type_getgroups=gid_t
--else
-- ac_cv_type_getgroups=int
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--if test $ac_cv_type_getgroups = cross; then
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <unistd.h>
--
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then :
-- ac_cv_type_getgroups=gid_t
--else
-- ac_cv_type_getgroups=int
--fi
--rm -f conftest*
--
--fi
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5
--$as_echo "$ac_cv_type_getgroups" >&6; }
--
--cat >>confdefs.h <<_ACEOF
--#define GETGROUPS_T $ac_cv_type_getgroups
--_ACEOF
--
--
--ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "
--#ifdef HAVE_SYS_TYPES_H
--#include <sys/types.h>
--#endif
--#ifdef HAVE_SYS_STAT_H
--#include <sys/stat.h>
--#endif
--#ifdef HAVE_UNISTD_H
--#include <unistd.h>
--#endif
--"
--if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_STAT_ST_RDEV 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtimensec" "ac_cv_member_struct_stat_st_mtimensec" "
--#ifdef HAVE_SYS_TYPES_H
--#include <sys/types.h>
--#endif
--#ifdef HAVE_SYS_STAT_H
--#include <sys/stat.h>
--#endif
--#ifdef HAVE_UNISTD_H
--#include <unistd.h>
--#endif
--"
--if test "x$ac_cv_member_struct_stat_st_mtimensec" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
--_ACEOF
--
--
--fi
--ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.tv_nsec" "ac_cv_member_struct_stat_st_mtim_tv_nsec" "
--#ifdef HAVE_SYS_TYPES_H
--#include <sys/types.h>
--#endif
--#ifdef HAVE_SYS_STAT_H
--#include <sys/stat.h>
--#endif
--#ifdef HAVE_UNISTD_H
--#include <unistd.h>
--#endif
--"
--if test "x$ac_cv_member_struct_stat_st_mtim_tv_nsec" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
--_ACEOF
--
--
--fi
--
--
--
-- ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h>
--#include <sys/socket.h>
--"
--if test "x$ac_cv_type_socklen_t" = xyes; then :
--
--else
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5
--$as_echo_n "checking for socklen_t equivalent... " >&6; }
-- if ${rsync_cv_socklen_t_equiv+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- # Systems have either "struct sockaddr *" or
-- # "void *" as the second argument to getpeername
-- rsync_cv_socklen_t_equiv=
-- for arg2 in "struct sockaddr" void; do
-- for t in int size_t unsigned long "unsigned long"; do
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/types.h>
--#include <sys/socket.h>
--
-- int getpeername (int, $arg2 *, $t *);
--
--int
--main ()
--{
--
-- $t len;
-- getpeername(0,0,&len);
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
--
-- rsync_cv_socklen_t_equiv="$t"
-- break
--
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- done
-- done
--
-- if test "x$rsync_cv_socklen_t_equiv" = x; then
-- as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5
-- fi
--
--fi
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_socklen_t_equiv" >&5
--$as_echo "$rsync_cv_socklen_t_equiv" >&6; }
--
--cat >>confdefs.h <<_ACEOF
--#define socklen_t $rsync_cv_socklen_t_equiv
--_ACEOF
--
--fi
--
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for errno in errno.h" >&5
--$as_echo_n "checking for errno in errno.h... " >&6; }
--if ${rsync_cv_errno+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <errno.h>
--int
--main ()
--{
--int i = errno
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- rsync_cv_errno=yes
--else
-- rsync_cv_have_errno_decl=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_errno" >&5
--$as_echo "$rsync_cv_errno" >&6; }
--if test x"$rsync_cv_errno" = x"yes"; then
--
--$as_echo "#define HAVE_ERRNO_DECL 1" >>confdefs.h
--
--fi
--
--# The following test taken from the cvs sources
--# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
--# These need checks to be before checks for any other functions that
--# might be in the same libraries.
--# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
--# libsocket.so which has a bad implementation of gethostbyname (it
--# only looks in /etc/hosts), so we only look for -lsocket if we need
--# it.
--for ac_func in connect
--do :
-- ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect"
--if test "x$ac_cv_func_connect" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_CONNECT 1
--_ACEOF
--
--fi
--done
--
--if test x"$ac_cv_func_connect" = x"no"; then
-- case "$LIBS" in
-- *-lnsl*) ;;
-- *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf in -lnsl_s" >&5
--$as_echo_n "checking for printf in -lnsl_s... " >&6; }
--if ${ac_cv_lib_nsl_s_printf+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lnsl_s $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char printf ();
--int
--main ()
--{
--return printf ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_nsl_s_printf=yes
--else
-- ac_cv_lib_nsl_s_printf=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_s_printf" >&5
--$as_echo "$ac_cv_lib_nsl_s_printf" >&6; }
--if test "x$ac_cv_lib_nsl_s_printf" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBNSL_S 1
--_ACEOF
--
-- LIBS="-lnsl_s $LIBS"
--
--fi
-- ;;
-- esac
-- case "$LIBS" in
-- *-lnsl*) ;;
-- *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf in -lnsl" >&5
--$as_echo_n "checking for printf in -lnsl... " >&6; }
--if ${ac_cv_lib_nsl_printf+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lnsl $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char printf ();
--int
--main ()
--{
--return printf ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_nsl_printf=yes
--else
-- ac_cv_lib_nsl_printf=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_printf" >&5
--$as_echo "$ac_cv_lib_nsl_printf" >&6; }
--if test "x$ac_cv_lib_nsl_printf" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBNSL 1
--_ACEOF
--
-- LIBS="-lnsl $LIBS"
--
--fi
-- ;;
-- esac
-- case "$LIBS" in
-- *-lsocket*) ;;
-- *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5
--$as_echo_n "checking for connect in -lsocket... " >&6; }
--if ${ac_cv_lib_socket_connect+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lsocket $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char connect ();
--int
--main ()
--{
--return connect ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_socket_connect=yes
--else
-- ac_cv_lib_socket_connect=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5
--$as_echo "$ac_cv_lib_socket_connect" >&6; }
--if test "x$ac_cv_lib_socket_connect" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBSOCKET 1
--_ACEOF
--
-- LIBS="-lsocket $LIBS"
--
--fi
-- ;;
-- esac
-- case "$LIBS" in
-- *-linet*) ;;
-- *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -linet" >&5
--$as_echo_n "checking for connect in -linet... " >&6; }
--if ${ac_cv_lib_inet_connect+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-linet $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char connect ();
--int
--main ()
--{
--return connect ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_inet_connect=yes
--else
-- ac_cv_lib_inet_connect=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_connect" >&5
--$as_echo "$ac_cv_lib_inet_connect" >&6; }
--if test "x$ac_cv_lib_inet_connect" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBINET 1
--_ACEOF
--
-- LIBS="-linet $LIBS"
--
--fi
-- ;;
-- esac
-- if test x"$ac_cv_lib_socket_connect" = x"yes" ||
-- test x"$ac_cv_lib_inet_connect" = x"yes"; then
-- # ac_cv_func_connect=yes
-- # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
--
--$as_echo "#define HAVE_CONNECT 1" >>confdefs.h
--
-- fi
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_ntop" >&5
--$as_echo_n "checking for library containing inet_ntop... " >&6; }
--if ${ac_cv_search_inet_ntop+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char inet_ntop ();
--int
--main ()
--{
--return inet_ntop ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' resolv; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_inet_ntop=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_inet_ntop+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_inet_ntop+:} false; then :
--
--else
-- ac_cv_search_inet_ntop=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_ntop" >&5
--$as_echo "$ac_cv_search_inet_ntop" >&6; }
--ac_res=$ac_cv_search_inet_ntop
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--
--# For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll
--# accept either iconv_open or libiconv_open, since some include files map
--# the former to the latter.
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing iconv_open" >&5
--$as_echo_n "checking for library containing iconv_open... " >&6; }
--if ${ac_cv_search_iconv_open+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char iconv_open ();
--int
--main ()
--{
--return iconv_open ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' iconv; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_iconv_open=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_iconv_open+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_iconv_open+:} false; then :
--
--else
-- ac_cv_search_iconv_open=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_iconv_open" >&5
--$as_echo "$ac_cv_search_iconv_open" >&6; }
--ac_res=$ac_cv_search_iconv_open
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libiconv_open" >&5
--$as_echo_n "checking for library containing libiconv_open... " >&6; }
--if ${ac_cv_search_libiconv_open+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_func_search_save_LIBS=$LIBS
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char libiconv_open ();
--int
--main ()
--{
--return libiconv_open ();
-- ;
-- return 0;
--}
--_ACEOF
--for ac_lib in '' iconv; do
-- if test -z "$ac_lib"; then
-- ac_res="none required"
-- else
-- ac_res=-l$ac_lib
-- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
-- fi
-- if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_search_libiconv_open=$ac_res
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext
-- if ${ac_cv_search_libiconv_open+:} false; then :
-- break
--fi
--done
--if ${ac_cv_search_libiconv_open+:} false; then :
--
--else
-- ac_cv_search_libiconv_open=no
--fi
--rm conftest.$ac_ext
--LIBS=$ac_func_search_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_libiconv_open" >&5
--$as_echo "$ac_cv_search_libiconv_open" >&6; }
--ac_res=$ac_cv_search_libiconv_open
--if test "$ac_res" != no; then :
-- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
--
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5
--$as_echo_n "checking for iconv declaration... " >&6; }
--if ${am_cv_proto_iconv+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <stdlib.h>
--#include <iconv.h>
--extern
--#ifdef __cplusplus
--"C"
--#endif
--#if defined(__STDC__) || defined(__cplusplus)
--size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
--#else
--size_t iconv();
--#endif
--
--int
--main ()
--{
--
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- am_cv_proto_iconv_arg1=""
--else
-- am_cv_proto_iconv_arg1="const"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
--fi
--
-- am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:-
-- }$am_cv_proto_iconv" >&5
--$as_echo "${ac_t:-
-- }$am_cv_proto_iconv" >&6; }
--
--cat >>confdefs.h <<_ACEOF
--#define ICONV_CONST $am_cv_proto_iconv_arg1
--_ACEOF
--
--
--
--ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop"
--if test "x$ac_cv_func_inet_ntop" = xyes; then :
-- $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h
--
--else
-- case " $LIBOBJS " in
-- *" inet_ntop.$ac_objext "* ) ;;
-- *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext"
-- ;;
--esac
--
--fi
--
--ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton"
--if test "x$ac_cv_func_inet_pton" = xyes; then :
-- $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h
--
--else
-- case " $LIBOBJS " in
-- *" inet_pton.$ac_objext "* ) ;;
-- *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext"
-- ;;
--esac
--
--fi
--
--
--
--
--
--cv=`echo "struct addrinfo" | sed 'y%./+- %__p__%'`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5
--$as_echo_n "checking for struct addrinfo... " >&6; }
--if eval \${ac_cv_type_$cv+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--$ac_includes_default
--#include <netdb.h>
--int
--main ()
--{
--struct addrinfo foo;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "ac_cv_type_$cv=yes"
--else
-- eval "ac_cv_type_$cv=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--ac_foo=`eval echo \\$ac_cv_type_$cv`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_foo" >&5
--$as_echo "$ac_foo" >&6; }
--if test "$ac_foo" = yes; then
-- ac_tr_hdr=HAVE_`echo struct addrinfo | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
--if false; then
-- ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" "$ac_includes_default"
--if test "x$ac_cv_type_struct_addrinfo" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_ADDRINFO 1
--_ACEOF
--
--
--fi
--
--fi
--
--cat >>confdefs.h <<_ACEOF
--#define $ac_tr_hdr 1
--_ACEOF
--
--fi
--
--
--
--cv=`echo "struct sockaddr_storage" | sed 'y%./+- %__p__%'`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sockaddr_storage" >&5
--$as_echo_n "checking for struct sockaddr_storage... " >&6; }
--if eval \${ac_cv_type_$cv+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--$ac_includes_default
--#include <sys/types.h>
--#include <sys/socket.h>
--int
--main ()
--{
--struct sockaddr_storage foo;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "ac_cv_type_$cv=yes"
--else
-- eval "ac_cv_type_$cv=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--ac_foo=`eval echo \\$ac_cv_type_$cv`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_foo" >&5
--$as_echo "$ac_foo" >&6; }
--if test "$ac_foo" = yes; then
-- ac_tr_hdr=HAVE_`echo struct sockaddr_storage | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
--if false; then
-- ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "$ac_includes_default"
--if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_SOCKADDR_STORAGE 1
--_ACEOF
--
--
--fi
--
--fi
--
--cat >>confdefs.h <<_ACEOF
--#define $ac_tr_hdr 1
--_ACEOF
--
--fi
--
--
--# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
--# builtin getaddrinfo if one of the defines don't exist
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether defines needed by getaddrinfo exist" >&5
--$as_echo_n "checking whether defines needed by getaddrinfo exist... " >&6; }
--if ${rsync_cv_HAVE_GETADDR_DEFINES+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
-- #include <sys/types.h>
-- #include <sys/socket.h>
-- #include <netdb.h>
-- #ifdef AI_PASSIVE
-- yes
-- #endif
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "yes" >/dev/null 2>&1; then :
-- rsync_cv_HAVE_GETADDR_DEFINES=yes
--else
-- rsync_cv_HAVE_GETADDR_DEFINES=no
--fi
--rm -f conftest*
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_GETADDR_DEFINES" >&5
--$as_echo "$rsync_cv_HAVE_GETADDR_DEFINES" >&6; }
--if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then :
--
-- # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
-- # something else so we must include <netdb.h> to get the
-- # redefinition.
-- for ac_func in getaddrinfo
--do :
-- ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
--if test "x$ac_cv_func_getaddrinfo" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_GETADDRINFO 1
--_ACEOF
--
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo by including <netdb.h>" >&5
--$as_echo_n "checking for getaddrinfo by including <netdb.h>... " >&6; }
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
-- #include <sys/socket.h>
-- #include <netdb.h>
--int
--main ()
--{
--getaddrinfo(NULL, NULL, NULL, NULL);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
--
--$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h
--
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
-- case " $LIBOBJS " in
-- *" getaddrinfo.$ac_objext "* ) ;;
-- *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext"
-- ;;
--esac
--
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--done
--
--
--else
-- case " $LIBOBJS " in
-- *" getaddrinfo.$ac_objext "* ) ;;
-- *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext"
-- ;;
--esac
--
--fi
--
--ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "
--#include <sys/types.h>
--#include <sys/socket.h>
--
--"
--if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then :
--
--$as_echo "#define HAVE_SOCKADDR_LEN 1" >>confdefs.h
--
--fi
--
--
--ac_fn_c_check_member "$LINENO" "struct sockaddr_in" "sin_len" "ac_cv_member_struct_sockaddr_in_sin_len" "
--#include <sys/types.h>
--#include <sys/socket.h>
--#include <netinet/in.h>
--
--"
--if test "x$ac_cv_member_struct_sockaddr_in_sin_len" = xyes; then :
--
--$as_echo "#define HAVE_SOCKADDR_IN_LEN 1" >>confdefs.h
--
--fi
--
--
--ac_fn_c_check_member "$LINENO" "struct sockaddr_un" "sun_len" "ac_cv_member_struct_sockaddr_un_sun_len" "
--#include <sys/types.h>
--#include <sys/socket.h>
--#include <netinet/in.h>
--
--"
--if test "x$ac_cv_member_struct_sockaddr_un_sun_len" = xyes; then :
--
--$as_echo "#define HAVE_SOCKADDR_UN_LEN 1" >>confdefs.h
--
--fi
--
--
--ac_fn_c_check_member "$LINENO" "struct sockaddr_in6" "sin6_scope_id" "ac_cv_member_struct_sockaddr_in6_sin6_scope_id" "
--#include <sys/types.h>
--#include <sys/socket.h>
--#include <netinet/in.h>
--
--"
--if test "x$ac_cv_member_struct_sockaddr_in6_sin6_scope_id" = xyes; then :
--
--$as_echo "#define HAVE_SOCKADDR_IN6_SCOPE_ID 1" >>confdefs.h
--
--fi
--
--
--
--
--cv=`echo "struct stat64" | sed 'y%./+- %__p__%'`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5
--$as_echo_n "checking for struct stat64... " >&6; }
--if eval \${ac_cv_type_$cv+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--$ac_includes_default
--#include <stdio.h>
--#if HAVE_SYS_TYPES_H
--# include <sys/types.h>
--#endif
--#if HAVE_SYS_STAT_H
--# include <sys/stat.h>
--#endif
--#if STDC_HEADERS
--# include <stdlib.h>
--# include <stddef.h>
--#else
--# if HAVE_STDLIB_H
--# include <stdlib.h>
--# endif
--#endif
--
--int
--main ()
--{
--struct stat64 foo;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- eval "ac_cv_type_$cv=yes"
--else
-- eval "ac_cv_type_$cv=no"
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--ac_foo=`eval echo \\$ac_cv_type_$cv`
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_foo" >&5
--$as_echo "$ac_foo" >&6; }
--if test "$ac_foo" = yes; then
-- ac_tr_hdr=HAVE_`echo struct stat64 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
--if false; then
-- ac_fn_c_check_type "$LINENO" "struct stat64" "ac_cv_type_struct_stat64" "$ac_includes_default"
--if test "x$ac_cv_type_struct_stat64" = xyes; then :
--
--cat >>confdefs.h <<_ACEOF
--#define HAVE_STRUCT_STAT64 1
--_ACEOF
--
--
--fi
--
--fi
--
--cat >>confdefs.h <<_ACEOF
--#define $ac_tr_hdr 1
--_ACEOF
--
--fi
--
--
--# if we can't find strcasecmp, look in -lresolv (for Unixware at least)
--#
--for ac_func in strcasecmp
--do :
-- ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp"
--if test "x$ac_cv_func_strcasecmp" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_STRCASECMP 1
--_ACEOF
--
--fi
--done
--
--if test x"$ac_cv_func_strcasecmp" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp in -lresolv" >&5
--$as_echo_n "checking for strcasecmp in -lresolv... " >&6; }
--if ${ac_cv_lib_resolv_strcasecmp+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lresolv $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char strcasecmp ();
--int
--main ()
--{
--return strcasecmp ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_resolv_strcasecmp=yes
--else
-- ac_cv_lib_resolv_strcasecmp=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_strcasecmp" >&5
--$as_echo "$ac_cv_lib_resolv_strcasecmp" >&6; }
--if test "x$ac_cv_lib_resolv_strcasecmp" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBRESOLV 1
--_ACEOF
--
-- LIBS="-lresolv $LIBS"
--
--fi
--
--fi
--
--for ac_func in aclsort
--do :
-- ac_fn_c_check_func "$LINENO" "aclsort" "ac_cv_func_aclsort"
--if test "x$ac_cv_func_aclsort" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_ACLSORT 1
--_ACEOF
--
--fi
--done
--
--if test x"$ac_cv_func_aclsort" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aclsort in -lsec" >&5
--$as_echo_n "checking for aclsort in -lsec... " >&6; }
--if ${ac_cv_lib_sec_aclsort+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lsec $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char aclsort ();
--int
--main ()
--{
--return aclsort ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_sec_aclsort=yes
--else
-- ac_cv_lib_sec_aclsort=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_aclsort" >&5
--$as_echo "$ac_cv_lib_sec_aclsort" >&6; }
--if test "x$ac_cv_lib_sec_aclsort" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBSEC 1
--_ACEOF
--
-- LIBS="-lsec $LIBS"
--
--fi
--
--fi
--
--
--
--
--
-- for ac_header in $ac_header_list
--do :
-- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
--ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
--"
--if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--
--done
--
--
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
--$as_echo_n "checking whether utime accepts a null argument... " >&6; }
--if ${ac_cv_func_utime_null+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- rm -f conftest.data; >conftest.data
--# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong.
--if test "$cross_compiling" = yes; then :
-- ac_cv_func_utime_null='guessing yes'
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$ac_includes_default
-- #ifdef HAVE_UTIME_H
-- # include <utime.h>
-- #endif
--int
--main ()
--{
--struct stat s, t;
-- return ! (stat ("conftest.data", &s) == 0
-- && utime ("conftest.data", 0) == 0
-- && stat ("conftest.data", &t) == 0
-- && t.st_mtime >= s.st_mtime
-- && t.st_mtime - s.st_mtime < 120);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- ac_cv_func_utime_null=yes
--else
-- ac_cv_func_utime_null=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_utime_null" >&5
--$as_echo "$ac_cv_func_utime_null" >&6; }
--if test "x$ac_cv_func_utime_null" != xno; then
-- ac_cv_func_utime_null=yes
--
--$as_echo "#define HAVE_UTIME_NULL 1" >>confdefs.h
--
--fi
--rm -f conftest.data
--
--ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
--if test "x$ac_cv_type_size_t" = xyes; then :
--
--else
--
--cat >>confdefs.h <<_ACEOF
--#define size_t unsigned int
--_ACEOF
--
--fi
--
--# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
--# for constant arguments. Useless!
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
--$as_echo_n "checking for working alloca.h... " >&6; }
--if ${ac_cv_working_alloca_h+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <alloca.h>
--int
--main ()
--{
--char *p = (char *) alloca (2 * sizeof (int));
-- if (p) return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_working_alloca_h=yes
--else
-- ac_cv_working_alloca_h=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
--$as_echo "$ac_cv_working_alloca_h" >&6; }
--if test $ac_cv_working_alloca_h = yes; then
--
--$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
--$as_echo_n "checking for alloca... " >&6; }
--if ${ac_cv_func_alloca_works+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#ifdef __GNUC__
--# define alloca __builtin_alloca
--#else
--# ifdef _MSC_VER
--# include <malloc.h>
--# define alloca _alloca
--# else
--# ifdef HAVE_ALLOCA_H
--# include <alloca.h>
--# else
--# ifdef _AIX
-- #pragma alloca
--# else
--# ifndef alloca /* predefined by HP cc +Olibcalls */
--void *alloca (size_t);
--# endif
--# endif
--# endif
--# endif
--#endif
--
--int
--main ()
--{
--char *p = (char *) alloca (1);
-- if (p) return 0;
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_func_alloca_works=yes
--else
-- ac_cv_func_alloca_works=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
--$as_echo "$ac_cv_func_alloca_works" >&6; }
--
--if test $ac_cv_func_alloca_works = yes; then
--
--$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
--
--else
-- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
--# that cause trouble. Some versions do not even contain alloca or
--# contain a buggy version. If you still want to use their alloca,
--# use ar to extract alloca.o from them instead of compiling alloca.c.
--
--ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
--
--$as_echo "#define C_ALLOCA 1" >>confdefs.h
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
--$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
--if ${ac_cv_os_cray+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#if defined CRAY && ! defined CRAY2
--webecray
--#else
--wenotbecray
--#endif
--
--_ACEOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- $EGREP "webecray" >/dev/null 2>&1; then :
-- ac_cv_os_cray=yes
--else
-- ac_cv_os_cray=no
--fi
--rm -f conftest*
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
--$as_echo "$ac_cv_os_cray" >&6; }
--if test $ac_cv_os_cray = yes; then
-- for ac_func in _getb67 GETB67 getb67; do
-- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
--ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
--if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
--
--cat >>confdefs.h <<_ACEOF
--#define CRAY_STACKSEG_END $ac_func
--_ACEOF
--
-- break
--fi
--
-- done
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
--$as_echo_n "checking stack direction for C alloca... " >&6; }
--if ${ac_cv_c_stack_direction+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- if test "$cross_compiling" = yes; then :
-- ac_cv_c_stack_direction=0
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$ac_includes_default
--int
--find_stack_direction (int *addr, int depth)
--{
-- int dir, dummy = 0;
-- if (! addr)
-- addr = &dummy;
-- *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
-- dir = depth ? find_stack_direction (addr, depth - 1) : 0;
-- return dir + dummy;
--}
--
--int
--main (int argc, char **argv)
--{
-- return find_stack_direction (0, argc + !argv + 20) < 0;
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- ac_cv_c_stack_direction=1
--else
-- ac_cv_c_stack_direction=-1
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
--$as_echo "$ac_cv_c_stack_direction" >&6; }
--cat >>confdefs.h <<_ACEOF
--#define STACK_DIRECTION $ac_cv_c_stack_direction
--_ACEOF
--
--
--fi
--
--for ac_func in waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
-- fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
-- memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \
-- strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
-- setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
-- seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
-- extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
-- initgroups utimensat posix_fallocate attropen setvbuf usleep
--do :
-- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
--ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
--if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--done
--
--
--if test x"$ac_cv_func_iconv_open" != x"yes"; then
-- ac_fn_c_check_func "$LINENO" "libiconv_open" "ac_cv_func_libiconv_open"
--if test "x$ac_cv_func_libiconv_open" = xyes; then :
-- ac_cv_func_iconv_open=yes; $as_echo "#define HAVE_ICONV_OPEN 1" >>confdefs.h
--
--fi
--
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for useable fallocate" >&5
--$as_echo_n "checking for useable fallocate... " >&6; }
--if ${rsync_cv_have_fallocate+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <fcntl.h>
--#include <sys/types.h>
--int
--main ()
--{
--fallocate(0, 0, 0, 0);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- rsync_cv_have_fallocate=yes
--else
-- rsync_cv_have_fallocate=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_have_fallocate" >&5
--$as_echo "$rsync_cv_have_fallocate" >&6; }
--if test x"$rsync_cv_have_fallocate" = x"yes"; then
--
--$as_echo "#define HAVE_FALLOCATE 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYS_fallocate" >&5
--$as_echo_n "checking for SYS_fallocate... " >&6; }
--if ${rsync_cv_have_sys_fallocate+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/syscall.h>
--#include <sys/types.h>
--int
--main ()
--{
--syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- rsync_cv_have_sys_fallocate=yes
--else
-- rsync_cv_have_sys_fallocate=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_have_sys_fallocate" >&5
--$as_echo "$rsync_cv_have_sys_fallocate" >&6; }
--if test x"$rsync_cv_have_sys_fallocate" = x"yes"; then
--
--$as_echo "#define HAVE_SYS_FALLOCATE 1" >>confdefs.h
--
--fi
--
--if test x"$ac_cv_func_posix_fallocate" = x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether posix_fallocate is efficient" >&5
--$as_echo_n "checking whether posix_fallocate is efficient... " >&6; }
-- case $host_os in
-- *cygwin*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
--$as_echo "yes" >&6; }
--
--$as_echo "#define HAVE_EFFICIENT_POSIX_FALLOCATE 1" >>confdefs.h
--
-- ;;
-- *)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
-- ;;
-- esac
--fi
--
--
--for ac_func in getpgrp tcgetpgrp
--do :
-- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
--ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
--if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--done
--
--if test $ac_cv_func_getpgrp = yes; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5
--$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; }
--if ${ac_cv_func_getpgrp_void+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- # Use it with a single arg.
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--$ac_includes_default
--int
--main ()
--{
--getpgrp (0);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- ac_cv_func_getpgrp_void=no
--else
-- ac_cv_func_getpgrp_void=yes
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5
--$as_echo "$ac_cv_func_getpgrp_void" >&6; }
--if test $ac_cv_func_getpgrp_void = yes; then
--
--$as_echo "#define GETPGRP_VOID 1" >>confdefs.h
--
--fi
--
--fi
--
--# Check whether --enable-iconv-open was given.
--if test "${enable_iconv_open+set}" = set; then :
-- enableval=$enable_iconv_open;
--else
-- enable_iconv_open=$ac_cv_func_iconv_open
--fi
--
--
--if test x"$enable_iconv_open" != x"no"; then
--
--$as_echo "#define USE_ICONV_OPEN 1" >>confdefs.h
--
--fi
--
--# Check whether --enable-iconv was given.
--if test "${enable_iconv+set}" = set; then :
-- enableval=$enable_iconv;
--else
-- enable_iconv=$enable_iconv_open
--fi
--
--
--if test x"$enable_iconv" != x"no"; then
-- if test x"$enable_iconv" = x"yes"; then
-- $as_echo "#define ICONV_OPTION NULL" >>confdefs.h
--
-- else
-- cat >>confdefs.h <<_ACEOF
--#define ICONV_OPTION "$enable_iconv"
--_ACEOF
--
-- fi
--
--$as_echo "#define UTF8_CHARSET \"UTF-8\"" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown() modifies symlinks" >&5
--$as_echo_n "checking whether chown() modifies symlinks... " >&6; }
--if ${rsync_cv_chown_modifies_symlink+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- if test "$cross_compiling" = yes; then :
-- rsync_cv_chown_modifies_symlink=no
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#if HAVE_UNISTD_H
--# include <unistd.h>
--#endif
--#include <stdlib.h>
--#include <errno.h>
-- main() {
-- char const *dangling_symlink = "conftest.dangle";
-- unlink(dangling_symlink);
-- if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
-- if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
-- exit(0);
-- }
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_chown_modifies_symlink=yes
--else
-- rsync_cv_chown_modifies_symlink=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_chown_modifies_symlink" >&5
--$as_echo "$rsync_cv_chown_modifies_symlink" >&6; }
--if test $rsync_cv_chown_modifies_symlink = yes; then
--
--$as_echo "#define CHOWN_MODIFIES_SYMLINK 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether link() can hard-link symlinks" >&5
--$as_echo_n "checking whether link() can hard-link symlinks... " >&6; }
--if ${rsync_cv_can_hardlink_symlink+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- if test "$cross_compiling" = yes; then :
-- rsync_cv_can_hardlink_symlink=no
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#if HAVE_UNISTD_H
--# include <unistd.h>
--#endif
--#include <stdlib.h>
--#include <errno.h>
--#define FILENAME "conftest.dangle"
-- main() {
-- unlink(FILENAME);
-- if (symlink("conftest.no-such", FILENAME) < 0) abort();
-- unlink(FILENAME "2");
-- if (link(FILENAME, FILENAME "2") < 0) exit(1);
-- exit(0);
-- }
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_can_hardlink_symlink=yes
--else
-- rsync_cv_can_hardlink_symlink=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_can_hardlink_symlink" >&5
--$as_echo "$rsync_cv_can_hardlink_symlink" >&6; }
--if test $rsync_cv_can_hardlink_symlink = yes; then
--
--$as_echo "#define CAN_HARDLINK_SYMLINK 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether link() can hard-link special files" >&5
--$as_echo_n "checking whether link() can hard-link special files... " >&6; }
--if ${rsync_cv_can_hardlink_special+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- if test "$cross_compiling" = yes; then :
-- rsync_cv_can_hardlink_special=no
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#if HAVE_UNISTD_H
--# include <unistd.h>
--#endif
--#include <stdlib.h>
--#include <errno.h>
--#define FILENAME "conftest.fifi"
-- main() {
-- unlink(FILENAME);
-- if (mkfifo(FILENAME, 0777) < 0) abort();
-- unlink(FILENAME "2");
-- if (link(FILENAME, FILENAME "2") < 0) exit(1);
-- exit(0);
-- }
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_can_hardlink_special=yes
--else
-- rsync_cv_can_hardlink_special=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_can_hardlink_special" >&5
--$as_echo "$rsync_cv_can_hardlink_special" >&6; }
--if test $rsync_cv_can_hardlink_special = yes; then
--
--$as_echo "#define CAN_HARDLINK_SPECIAL 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working socketpair" >&5
--$as_echo_n "checking for working socketpair... " >&6; }
--if ${rsync_cv_HAVE_SOCKETPAIR+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_HAVE_SOCKETPAIR=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/types.h>
--#include <sys/socket.h>
--
--main() {
-- int fd[2];
-- exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_HAVE_SOCKETPAIR=yes
--else
-- rsync_cv_HAVE_SOCKETPAIR=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_SOCKETPAIR" >&5
--$as_echo "$rsync_cv_HAVE_SOCKETPAIR" >&6; }
--if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
--
--$as_echo "#define HAVE_SOCKETPAIR 1" >>confdefs.h
--
--fi
--
--ac_fn_c_check_func "$LINENO" "getpass" "ac_cv_func_getpass"
--if test "x$ac_cv_func_getpass" = xyes; then :
-- $as_echo "#define HAVE_GETPASS 1" >>confdefs.h
--
--else
-- case " $LIBOBJS " in
-- *" getpass.$ac_objext "* ) ;;
-- *) LIBOBJS="$LIBOBJS getpass.$ac_objext"
-- ;;
--esac
--
--fi
--
--
--
--if test x"$with_included_popt" != x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poptGetContext in -lpopt" >&5
--$as_echo_n "checking for poptGetContext in -lpopt... " >&6; }
--if ${ac_cv_lib_popt_poptGetContext+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lpopt $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char poptGetContext ();
--int
--main ()
--{
--return poptGetContext ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_popt_poptGetContext=yes
--else
-- ac_cv_lib_popt_poptGetContext=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_popt_poptGetContext" >&5
--$as_echo "$ac_cv_lib_popt_poptGetContext" >&6; }
--if test "x$ac_cv_lib_popt_poptGetContext" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBPOPT 1
--_ACEOF
--
-- LIBS="-lpopt $LIBS"
--
--else
-- with_included_popt=yes
--fi
--
--fi
--if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
-- # If the system has /usr/include/popt/popt.h, we enable the
-- # included popt because an attempt to "#include <popt/popt.h>"
-- # would use our included header file anyway (due to -I.), and
-- # might conflict with the system popt.
-- with_included_popt=yes
--elif test x"$ac_cv_header_popt_h" != x"yes"; then
-- with_included_popt=yes
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use included libpopt" >&5
--$as_echo_n "checking whether to use included libpopt... " >&6; }
--if test x"$with_included_popt" = x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $srcdir/popt" >&5
--$as_echo "$srcdir/popt" >&6; }
-- BUILD_POPT='$(popt_OBJS)'
-- CFLAGS="-I$srcdir/popt $CFLAGS"
-- if test x"$ALLOCA" != x
-- then
-- # this can be removed when/if we add an included alloca.c;
-- # see autoconf documentation on AC_FUNC_ALLOCA
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: included libpopt will use malloc, not alloca (which wastes a small amount of memory)" >&5
--$as_echo "$as_me: WARNING: included libpopt will use malloc, not alloca (which wastes a small amount of memory)" >&2;}
-- fi
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--# We default to using our zlib unless --with-included-zlib=no is given.
--if test x"$with_included_zlib" != x"no"; then
-- with_included_zlib=yes
--elif test x"$ac_cv_header_zlib_h" != x"yes"; then
-- with_included_zlib=yes
--fi
--if test x"$with_included_zlib" != x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflateParams in -lz" >&5
--$as_echo_n "checking for deflateParams in -lz... " >&6; }
--if ${ac_cv_lib_z_deflateParams+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lz $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char deflateParams ();
--int
--main ()
--{
--return deflateParams ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_z_deflateParams=yes
--else
-- ac_cv_lib_z_deflateParams=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflateParams" >&5
--$as_echo "$ac_cv_lib_z_deflateParams" >&6; }
--if test "x$ac_cv_lib_z_deflateParams" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBZ 1
--_ACEOF
--
-- LIBS="-lz $LIBS"
--
--else
-- with_included_zlib=yes
--fi
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use included zlib" >&5
--$as_echo_n "checking whether to use included zlib... " >&6; }
--if test x"$with_included_zlib" = x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $srcdir/zlib" >&5
--$as_echo "$srcdir/zlib" >&6; }
-- BUILD_ZLIB='$(zlib_OBJS)'
-- CFLAGS="-I$srcdir/zlib $CFLAGS"
--else
--
--$as_echo "#define EXTERNAL_ZLIB 1" >>confdefs.h
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned char" >&5
--$as_echo_n "checking for unsigned char... " >&6; }
--if ${rsync_cv_SIGNED_CHAR_OK+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--int
--main ()
--{
--signed char *s = ""
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- rsync_cv_SIGNED_CHAR_OK=yes
--else
-- rsync_cv_SIGNED_CHAR_OK=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_SIGNED_CHAR_OK" >&5
--$as_echo "$rsync_cv_SIGNED_CHAR_OK" >&6; }
--if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
--
--$as_echo "#define SIGNED_CHAR_OK 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken readdir" >&5
--$as_echo_n "checking for broken readdir... " >&6; }
--if ${rsync_cv_HAVE_BROKEN_READDIR+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_HAVE_BROKEN_READDIR=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <dirent.h>
--main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
--if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
--di->d_name[0] == 0) exit(0); exit(1);}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_HAVE_BROKEN_READDIR=yes
--else
-- rsync_cv_HAVE_BROKEN_READDIR=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_BROKEN_READDIR" >&5
--$as_echo "$rsync_cv_HAVE_BROKEN_READDIR" >&6; }
--if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
--
--$as_echo "#define HAVE_BROKEN_READDIR 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimbuf" >&5
--$as_echo_n "checking for utimbuf... " >&6; }
--if ${rsync_cv_HAVE_STRUCT_UTIMBUF+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <utime.h>
--int
--main ()
--{
--struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- rsync_cv_HAVE_STRUCT_UTIMBUF=yes
--else
-- rsync_cv_HAVE_STRUCT_UTIMBUF=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_STRUCT_UTIMBUF" >&5
--$as_echo "$rsync_cv_HAVE_STRUCT_UTIMBUF" >&6; }
--if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
--
--$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gettimeofday takes tz argument" >&5
--$as_echo_n "checking if gettimeofday takes tz argument... " >&6; }
--if ${rsync_cv_HAVE_GETTIMEOFDAY_TZ+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/time.h>
--#include <unistd.h>
--int
--main ()
--{
--struct timeval tv; exit(gettimeofday(&tv, NULL));
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_compile "$LINENO"; then :
-- rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes
--else
-- rsync_cv_HAVE_GETTIMEOFDAY_TZ=no
--fi
--rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_GETTIMEOFDAY_TZ" >&5
--$as_echo "$rsync_cv_HAVE_GETTIMEOFDAY_TZ" >&6; }
--if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
--
--$as_echo "#define HAVE_GETTIMEOFDAY_TZ 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5
--$as_echo_n "checking for C99 vsnprintf... " >&6; }
--if ${rsync_cv_HAVE_C99_VSNPRINTF+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_HAVE_C99_VSNPRINTF=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <sys/types.h>
--#include <stdarg.h>
--void foo(const char *format, ...) {
-- va_list ap;
-- int len;
-- char buf[5];
--
-- va_start(ap, format);
-- len = vsnprintf(0, 0, format, ap);
-- va_end(ap);
-- if (len != 5) exit(1);
--
-- if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
--
-- exit(0);
--}
--main() { foo("hello"); }
--
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_HAVE_C99_VSNPRINTF=yes
--else
-- rsync_cv_HAVE_C99_VSNPRINTF=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_C99_VSNPRINTF" >&5
--$as_echo "$rsync_cv_HAVE_C99_VSNPRINTF" >&6; }
--if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
--
--$as_echo "#define HAVE_C99_VSNPRINTF 1" >>confdefs.h
--
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for secure mkstemp" >&5
--$as_echo_n "checking for secure mkstemp... " >&6; }
--if ${rsync_cv_HAVE_SECURE_MKSTEMP+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_HAVE_SECURE_MKSTEMP=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdlib.h>
--#include <sys/types.h>
--#include <sys/stat.h>
--#include <unistd.h>
--main() {
-- struct stat st;
-- char tpl[20]="/tmp/test.XXXXXX";
-- int fd = mkstemp(tpl);
-- if (fd == -1) exit(1);
-- unlink(tpl);
-- if (fstat(fd, &st) != 0) exit(1);
-- if ((st.st_mode & 0777) != 0600) exit(1);
-- exit(0);
--}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_HAVE_SECURE_MKSTEMP=yes
--else
-- rsync_cv_HAVE_SECURE_MKSTEMP=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_HAVE_SECURE_MKSTEMP" >&5
--$as_echo "$rsync_cv_HAVE_SECURE_MKSTEMP" >&6; }
--if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
-- case $host_os in
-- hpux*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Skipping broken HP-UX mkstemp() -- using mktemp() instead" >&5
--$as_echo "$as_me: WARNING: Skipping broken HP-UX mkstemp() -- using mktemp() instead" >&2;}
-- ;;
-- *)
--
--$as_echo "#define HAVE_SECURE_MKSTEMP 1" >>confdefs.h
--
-- ;;
-- esac
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if mknod creates FIFOs" >&5
--$as_echo_n "checking if mknod creates FIFOs... " >&6; }
--if ${rsync_cv_MKNOD_CREATES_FIFOS+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_MKNOD_CREATES_FIFOS=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <stdio.h>
--#include <sys/stat.h>
--#include <errno.h>
--main() { int rc, ec; char *fn = "fifo-test";
--unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
--if (rc) {printf("(%d %d) ",rc,ec); return ec;}
--return 0;}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_MKNOD_CREATES_FIFOS=yes
--else
-- rsync_cv_MKNOD_CREATES_FIFOS=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_MKNOD_CREATES_FIFOS" >&5
--$as_echo "$rsync_cv_MKNOD_CREATES_FIFOS" >&6; }
--if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
--
--$as_echo "#define MKNOD_CREATES_FIFOS 1" >>confdefs.h
--
--fi
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if mknod creates sockets" >&5
--$as_echo_n "checking if mknod creates sockets... " >&6; }
--if ${rsync_cv_MKNOD_CREATES_SOCKETS+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--if test "$cross_compiling" = yes; then :
-- rsync_cv_MKNOD_CREATES_SOCKETS=cross
--else
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--#include <stdio.h>
--#include <sys/stat.h>
--#include <errno.h>
--main() { int rc, ec; char *fn = "sock-test";
--unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
--if (rc) {printf("(%d %d) ",rc,ec); return ec;}
--return 0;}
--_ACEOF
--if ac_fn_c_try_run "$LINENO"; then :
-- rsync_cv_MKNOD_CREATES_SOCKETS=yes
--else
-- rsync_cv_MKNOD_CREATES_SOCKETS=no
--fi
--rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-- conftest.$ac_objext conftest.beam conftest.$ac_ext
--fi
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_MKNOD_CREATES_SOCKETS" >&5
--$as_echo "$rsync_cv_MKNOD_CREATES_SOCKETS" >&6; }
--if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
--
--$as_echo "#define MKNOD_CREATES_SOCKETS 1" >>confdefs.h
--
--fi
--
--#
--# The following test was mostly taken from the tcl/tk plus patches
--#
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -c -o works" >&5
--$as_echo_n "checking whether -c -o works... " >&6; }
--if ${rsync_cv_DASHC_WORKS_WITH_DASHO+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
--rm -rf conftest*
--cat > conftest.$ac_ext <<EOF
--int main() { return 0; }
--EOF
--${CC-cc} -c -o conftest..o conftest.$ac_ext
--if test -f conftest..o; then
-- rsync_cv_DASHC_WORKS_WITH_DASHO=yes
--else
-- rsync_cv_DASHC_WORKS_WITH_DASHO=no
--fi
--rm -rf conftest*
--
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_cv_DASHC_WORKS_WITH_DASHO" >&5
--$as_echo "$rsync_cv_DASHC_WORKS_WITH_DASHO" >&6; }
--if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
-- OBJ_SAVE="#"
-- OBJ_RESTORE="#"
-- CC_SHOBJ_FLAG='-o $@'
--else
-- OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
-- OBJ_RESTORE=' @b=`basename $@ .o`;if test "$$b.o" != "$@"; then mv $$b.o $@; if test -f $$b.o.sav; then mv $$b.o.sav $$b.o; fi; fi'
-- CC_SHOBJ_FLAG=""
--fi
--
--
--
--
--
--
--
--
--# Extract the first word of "stunnel", so it can be a program name with args.
--set dummy stunnel; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_path_STUNNEL+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- case $STUNNEL in
-- [\\/]* | ?:[\\/]*)
-- ac_cv_path_STUNNEL="$STUNNEL" # Let the user override the test with a path.
-- ;;
-- *)
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_path_STUNNEL="$as_dir/$ac_word$ac_exec_ext"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_path_STUNNEL" && ac_cv_path_STUNNEL="stunnel"
-- ;;
--esac
--fi
--STUNNEL=$ac_cv_path_STUNNEL
--if test -n "$STUNNEL"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STUNNEL" >&5
--$as_echo "$STUNNEL" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--# Extract the first word of "stunnel4", so it can be a program name with args.
--set dummy stunnel4; ac_word=$2
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
--$as_echo_n "checking for $ac_word... " >&6; }
--if ${ac_cv_path_STUNNEL4+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- case $STUNNEL4 in
-- [\\/]* | ?:[\\/]*)
-- ac_cv_path_STUNNEL4="$STUNNEL4" # Let the user override the test with a path.
-- ;;
-- *)
-- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- for ac_exec_ext in '' $ac_executable_extensions; do
-- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-- ac_cv_path_STUNNEL4="$as_dir/$ac_word$ac_exec_ext"
-- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-- break 2
-- fi
--done
-- done
--IFS=$as_save_IFS
--
-- test -z "$ac_cv_path_STUNNEL4" && ac_cv_path_STUNNEL4="$STUNNEL"
-- ;;
--esac
--fi
--STUNNEL4=$ac_cv_path_STUNNEL4
--if test -n "$STUNNEL4"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STUNNEL4" >&5
--$as_echo "$STUNNEL4" >&6; }
--else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--fi
--
--
--
--for ac_func in _acl __acl _facl __facl
--do :
-- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
--ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
--if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-- cat >>confdefs.h <<_ACEOF
--#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
--_ACEOF
--
--fi
--done
--
--#################################################
--# check for ACL support
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support ACLs" >&5
--$as_echo_n "checking whether to support ACLs... " >&6; }
--# Check whether --enable-acl-support was given.
--if test "${enable_acl_support+set}" = set; then :
-- enableval=$enable_acl_support;
--fi
--
--
--if test x"$enable_acl_support" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--else
-- case "$host_os" in
-- *sysv5*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using UnixWare ACLs" >&5
--$as_echo "Using UnixWare ACLs" >&6; }
--
--$as_echo "#define HAVE_UNIXWARE_ACLS 1" >>confdefs.h
--
--
--$as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- solaris*|*cygwin*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using solaris ACLs" >&5
--$as_echo "Using solaris ACLs" >&6; }
--
--$as_echo "#define HAVE_SOLARIS_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- *hpux*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using HPUX ACLs" >&5
--$as_echo "Using HPUX ACLs" >&6; }
--
--$as_echo "#define HAVE_HPUX_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- *irix*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using IRIX ACLs" >&5
--$as_echo "Using IRIX ACLs" >&6; }
--
--$as_echo "#define HAVE_IRIX_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- *aix*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using AIX ACLs" >&5
--$as_echo "Using AIX ACLs" >&6; }
--
--$as_echo "#define HAVE_AIX_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- *osf*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using Tru64 ACLs" >&5
--$as_echo "Using Tru64 ACLs" >&6; }
--
--$as_echo "#define HAVE_TRU64_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- LIBS="$LIBS -lpacl"
-- ;;
-- darwin*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using OS X ACLs" >&5
--$as_echo "Using OS X ACLs" >&6; }
--
--$as_echo "#define HAVE_OSX_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- ;;
-- *)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: running tests:" >&5
--$as_echo "running tests:" >&6; }
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_file in -lacl" >&5
--$as_echo_n "checking for acl_get_file in -lacl... " >&6; }
--if ${ac_cv_lib_acl_acl_get_file+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lacl $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char acl_get_file ();
--int
--main ()
--{
--return acl_get_file ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_acl_acl_get_file=yes
--else
-- ac_cv_lib_acl_acl_get_file=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_acl_acl_get_file" >&5
--$as_echo "$ac_cv_lib_acl_acl_get_file" >&6; }
--if test "x$ac_cv_lib_acl_acl_get_file" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBACL 1
--_ACEOF
--
-- LIBS="-lacl $LIBS"
--
--fi
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ACL support" >&5
--$as_echo_n "checking for ACL support... " >&6; }
--if ${samba_cv_HAVE_POSIX_ACLS+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <sys/acl.h>
--int
--main ()
--{
-- acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- samba_cv_HAVE_POSIX_ACLS=yes
--else
-- samba_cv_HAVE_POSIX_ACLS=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $samba_cv_HAVE_POSIX_ACLS" >&5
--$as_echo "$samba_cv_HAVE_POSIX_ACLS" >&6; }
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking ACL test results" >&5
--$as_echo_n "checking ACL test results... " >&6; }
-- if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using posix ACLs" >&5
--$as_echo "Using posix ACLs" >&6; }
--
--$as_echo "#define HAVE_POSIX_ACLS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_ACLS 1" >>confdefs.h
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get_perm_np" >&5
--$as_echo_n "checking for acl_get_perm_np... " >&6; }
--if ${samba_cv_HAVE_ACL_GET_PERM_NP+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
--
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <sys/types.h>
--#include <sys/acl.h>
--int
--main ()
--{
-- acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- samba_cv_HAVE_ACL_GET_PERM_NP=yes
--else
-- samba_cv_HAVE_ACL_GET_PERM_NP=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $samba_cv_HAVE_ACL_GET_PERM_NP" >&5
--$as_echo "$samba_cv_HAVE_ACL_GET_PERM_NP" >&6; }
-- if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
--
--$as_echo "#define HAVE_ACL_GET_PERM_NP 1" >>confdefs.h
--
-- fi
-- else
-- if test x"$enable_acl_support" = x"yes"; then
-- as_fn_error $? "Failed to find ACL support" "$LINENO" 5
-- else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: No ACL support found" >&5
--$as_echo "No ACL support found" >&6; }
-- fi
-- fi
-- ;;
-- esac
--fi
--
--#################################################
--# check for extended attribute support
--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support extended attributes" >&5
--$as_echo_n "checking whether to support extended attributes... " >&6; }
--# Check whether --enable-xattr-support was given.
--if test "${enable_xattr_support+set}" = set; then :
-- enableval=$enable_xattr_support;
--else
-- case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_attropen" in
-- *yes*) enable_xattr_support=maybe ;;
-- *) enable_xattr_support=no ;;
-- esac
--fi
--
--
--if test x"$enable_xattr_support" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--$as_echo "no" >&6; }
--else
-- case "$host_os" in
-- *linux*|*netbsd*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using Linux xattrs" >&5
--$as_echo "Using Linux xattrs" >&6; }
--
--$as_echo "#define HAVE_LINUX_XATTRS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h
--
--
--$as_echo "#define NO_SYMLINK_USER_XATTRS 1" >>confdefs.h
--
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getxattr in -lattr" >&5
--$as_echo_n "checking for getxattr in -lattr... " >&6; }
--if ${ac_cv_lib_attr_getxattr+:} false; then :
-- $as_echo_n "(cached) " >&6
--else
-- ac_check_lib_save_LIBS=$LIBS
--LIBS="-lattr $LIBS"
--cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--
--/* Override any GCC internal prototype to avoid an error.
-- Use char because int might match the return type of a GCC
-- builtin and then its argument prototype would still apply. */
--#ifdef __cplusplus
--extern "C"
--#endif
--char getxattr ();
--int
--main ()
--{
--return getxattr ();
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- ac_cv_lib_attr_getxattr=yes
--else
-- ac_cv_lib_attr_getxattr=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
--LIBS=$ac_check_lib_save_LIBS
--fi
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_attr_getxattr" >&5
--$as_echo "$ac_cv_lib_attr_getxattr" >&6; }
--if test "x$ac_cv_lib_attr_getxattr" = xyes; then :
-- cat >>confdefs.h <<_ACEOF
--#define HAVE_LIBATTR 1
--_ACEOF
--
-- LIBS="-lattr $LIBS"
--
--fi
--
-- ;;
-- darwin*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using OS X xattrs" >&5
--$as_echo "Using OS X xattrs" >&6; }
--
--$as_echo "#define HAVE_OSX_XATTRS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h
--
--
--$as_echo "#define NO_DEVICE_XATTRS 1" >>confdefs.h
--
--
--$as_echo "#define NO_SPECIAL_XATTRS 1" >>confdefs.h
--
-- ;;
-- freebsd*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using FreeBSD extattrs" >&5
--$as_echo "Using FreeBSD extattrs" >&6; }
--
--$as_echo "#define HAVE_FREEBSD_XATTRS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h
--
-- ;;
-- solaris*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using Solaris xattrs" >&5
--$as_echo "Using Solaris xattrs" >&6; }
--
--$as_echo "#define HAVE_SOLARIS_XATTRS 1" >>confdefs.h
--
-- $as_echo "#define SUPPORT_XATTRS 1" >>confdefs.h
--
--
--$as_echo "#define NO_SYMLINK_XATTRS 1" >>confdefs.h
--
-- ;;
-- *)
-- if test x"$enable_xattr_support" = x"yes"; then
-- as_fn_error $? "Failed to find extended attribute support" "$LINENO" 5
-- else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: No extended attribute support found" >&5
--$as_echo "No extended attribute support found" >&6; }
-- fi
-- ;;
-- esac
--fi
--
--if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5
--$as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; }
-- OLD_CFLAGS="$CFLAGS"
-- CFLAGS="$CFLAGS -Wno-unused-parameter"
-- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
--/* end confdefs.h. */
--#include <stdio.h>
--int
--main ()
--{
--printf("hello\n");
-- ;
-- return 0;
--}
--_ACEOF
--if ac_fn_c_try_link "$LINENO"; then :
-- rsync_warn_flag=yes
--else
-- rsync_warn_flag=no
--fi
--rm -f core conftest.err conftest.$ac_objext \
-- conftest$ac_exeext conftest.$ac_ext
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rsync_warn_flag" >&5
--$as_echo "$rsync_warn_flag" >&6; }
-- if test x"$rsync_warn_flag" = x"no"; then
-- CFLAGS="$OLD_CFLAGS"
-- fi
--fi
--
--case "$CC" in
--' checker'*|checker*)
--
--$as_echo "#define FORCE_FD_ZERO_MEMSET 1" >>confdefs.h
--
-- ;;
--esac
--
--ac_config_files="$ac_config_files Makefile lib/dummy zlib/dummy popt/dummy shconfig"
--
--cat >confcache <<\_ACEOF
--# This file is a shell script that caches the results of configure
--# tests run on this system so they can be shared between configure
--# scripts and configure runs, see configure's option --config-cache.
--# It is not useful on other systems. If it contains results you don't
--# want to keep, you may remove or edit it.
--#
--# config.status only pays attention to the cache file if you give it
--# the --recheck option to rerun configure.
--#
--# `ac_cv_env_foo' variables (set or unset) will be overridden when
--# loading this file, other *unset* `ac_cv_foo' will be assigned the
--# following values.
--
--_ACEOF
--
--# The following way of writing the cache mishandles newlines in values,
--# but we know of no workaround that is simple, portable, and efficient.
--# So, we kill variables containing newlines.
--# Ultrix sh set writes to stderr and can't be redirected directly,
--# and sets the high bit in the cache file unless we assign to the vars.
--(
-- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-- eval ac_val=\$$ac_var
-- case $ac_val in #(
-- *${as_nl}*)
-- case $ac_var in #(
-- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
--$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-- esac
-- case $ac_var in #(
-- _ | IFS | as_nl) ;; #(
-- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-- *) { eval $ac_var=; unset $ac_var;} ;;
-- esac ;;
-- esac
-- done
--
-- (set) 2>&1 |
-- case $as_nl`(ac_space=' '; set) 2>&1` in #(
-- *${as_nl}ac_space=\ *)
-- # `set' does not quote correctly, so add quotes: double-quote
-- # substitution turns \\\\ into \\, and sed turns \\ into \.
-- sed -n \
-- "s/'/'\\\\''/g;
-- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-- ;; #(
-- *)
-- # `set' quotes correctly as required by POSIX, so do not add quotes.
-- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-- ;;
-- esac |
-- sort
--) |
-- sed '
-- /^ac_cv_env_/b end
-- t clear
-- :clear
-- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-- t end
-- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-- :end' >>confcache
--if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-- if test -w "$cache_file"; then
-- if test "x$cache_file" != "x/dev/null"; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
--$as_echo "$as_me: updating cache $cache_file" >&6;}
-- if test ! -f "$cache_file" || test -h "$cache_file"; then
-- cat confcache >"$cache_file"
-- else
-- case $cache_file in #(
-- */* | ?:*)
-- mv -f confcache "$cache_file"$$ &&
-- mv -f "$cache_file"$$ "$cache_file" ;; #(
-- *)
-- mv -f confcache "$cache_file" ;;
-- esac
-- fi
-- fi
-- else
-- { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
--$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
-- fi
--fi
--rm -f confcache
--
--test "x$prefix" = xNONE && prefix=$ac_default_prefix
--# Let make expand exec_prefix.
--test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
--
--DEFS=-DHAVE_CONFIG_H
--
--ac_libobjs=
--ac_ltlibobjs=
--U=
--for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-- # 1. Remove the extension, and $U if already installed.
-- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
-- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
-- # will be set to the directory where LIBOBJS objects are built.
-- as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-- as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
--done
--LIBOBJS=$ac_libobjs
--
--LTLIBOBJS=$ac_ltlibobjs
--
--
--
--
--: "${CONFIG_STATUS=./config.status}"
--ac_write_fail=0
--ac_clean_files_save=$ac_clean_files
--ac_clean_files="$ac_clean_files $CONFIG_STATUS"
--{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
--$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
--as_write_fail=0
--cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
--#! $SHELL
--# Generated by $as_me.
--# Run this file to recreate the current configuration.
--# Compiler output produced by configure, useful for debugging
--# configure, is in config.log if it exists.
--
--debug=false
--ac_cs_recheck=false
--ac_cs_silent=false
--
--SHELL=\${CONFIG_SHELL-$SHELL}
--export SHELL
--_ASEOF
--cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
--## -------------------- ##
--## M4sh Initialization. ##
--## -------------------- ##
--
--# Be more Bourne compatible
--DUALCASE=1; export DUALCASE # for MKS sh
--if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-- emulate sh
-- NULLCMD=:
-- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-- # is contrary to our usage. Disable this feature.
-- alias -g '${1+"$@"}'='"$@"'
-- setopt NO_GLOB_SUBST
--else
-- case `(set -o) 2>/dev/null` in #(
-- *posix*) :
-- set -o posix ;; #(
-- *) :
-- ;;
--esac
--fi
--
--
--as_nl='
--'
--export as_nl
--# Printing a long string crashes Solaris 7 /usr/bin/printf.
--as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
--as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
--as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
--# Prefer a ksh shell builtin over an external printf program on Solaris,
--# but without wasting forks for bash or zsh.
--if test -z "$BASH_VERSION$ZSH_VERSION" \
-- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-- as_echo='print -r --'
-- as_echo_n='print -rn --'
--elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-- as_echo='printf %s\n'
-- as_echo_n='printf %s'
--else
-- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-- as_echo_n='/usr/ucb/echo -n'
-- else
-- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-- as_echo_n_body='eval
-- arg=$1;
-- case $arg in #(
-- *"$as_nl"*)
-- expr "X$arg" : "X\\(.*\\)$as_nl";
-- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-- esac;
-- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-- '
-- export as_echo_n_body
-- as_echo_n='sh -c $as_echo_n_body as_echo'
-- fi
-- export as_echo_body
-- as_echo='sh -c $as_echo_body as_echo'
--fi
--
--# The user is always right.
--if test "${PATH_SEPARATOR+set}" != set; then
-- PATH_SEPARATOR=:
-- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-- PATH_SEPARATOR=';'
-- }
--fi
--
--
--# IFS
--# We need space, tab and new line, in precisely that order. Quoting is
--# there to prevent editors from complaining about space-tab.
--# (If _AS_PATH_WALK were called with IFS unset, it would disable word
--# splitting by setting IFS to empty value.)
--IFS=" "" $as_nl"
--
--# Find who we are. Look in the path if we contain no directory separator.
--as_myself=
--case $0 in #((
-- *[\\/]* ) as_myself=$0 ;;
-- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
--for as_dir in $PATH
--do
-- IFS=$as_save_IFS
-- test -z "$as_dir" && as_dir=.
-- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-- done
--IFS=$as_save_IFS
--
-- ;;
--esac
--# We did not find ourselves, most probably we were run as `sh COMMAND'
--# in which case we are not to be found in the path.
--if test "x$as_myself" = x; then
-- as_myself=$0
--fi
--if test ! -f "$as_myself"; then
-- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-- exit 1
--fi
--
--# Unset variables that we do not need and which cause bugs (e.g. in
--# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
--# suppresses any "Segmentation fault" message there. '((' could
--# trigger a bug in pdksh 5.2.14.
--for as_var in BASH_ENV ENV MAIL MAILPATH
--do eval test x\${$as_var+set} = xset \
-- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
--done
--PS1='$ '
--PS2='> '
--PS4='+ '
--
--# NLS nuisances.
--LC_ALL=C
--export LC_ALL
--LANGUAGE=C
--export LANGUAGE
--
--# CDPATH.
--(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
--
--
--# as_fn_error STATUS ERROR [LINENO LOG_FD]
--# ----------------------------------------
--# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
--# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
--# script with STATUS, using 1 if that was 0.
--as_fn_error ()
--{
-- as_status=$1; test $as_status -eq 0 && as_status=1
-- if test "$4"; then
-- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
-- fi
-- $as_echo "$as_me: error: $2" >&2
-- as_fn_exit $as_status
--} # as_fn_error
--
--
--# as_fn_set_status STATUS
--# -----------------------
--# Set $? to STATUS, without forking.
--as_fn_set_status ()
--{
-- return $1
--} # as_fn_set_status
--
--# as_fn_exit STATUS
--# -----------------
--# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
--as_fn_exit ()
--{
-- set +e
-- as_fn_set_status $1
-- exit $1
--} # as_fn_exit
--
--# as_fn_unset VAR
--# ---------------
--# Portably unset VAR.
--as_fn_unset ()
--{
-- { eval $1=; unset $1;}
--}
--as_unset=as_fn_unset
--# as_fn_append VAR VALUE
--# ----------------------
--# Append the text in VALUE to the end of the definition contained in VAR. Take
--# advantage of any shell optimizations that allow amortized linear growth over
--# repeated appends, instead of the typical quadratic growth present in naive
--# implementations.
--if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-- eval 'as_fn_append ()
-- {
-- eval $1+=\$2
-- }'
--else
-- as_fn_append ()
-- {
-- eval $1=\$$1\$2
-- }
--fi # as_fn_append
--
--# as_fn_arith ARG...
--# ------------------
--# Perform arithmetic evaluation on the ARGs, and store the result in the
--# global $as_val. Take advantage of shells that can avoid forks. The arguments
--# must be portable across $(()) and expr.
--if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-- eval 'as_fn_arith ()
-- {
-- as_val=$(( $* ))
-- }'
--else
-- as_fn_arith ()
-- {
-- as_val=`expr "$@" || test $? -eq 1`
-- }
--fi # as_fn_arith
--
--
--if expr a : '\(a\)' >/dev/null 2>&1 &&
-- test "X`expr 00001 : '.*\(...\)'`" = X001; then
-- as_expr=expr
--else
-- as_expr=false
--fi
--
--if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-- as_basename=basename
--else
-- as_basename=false
--fi
--
--if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-- as_dirname=dirname
--else
-- as_dirname=false
--fi
--
--as_me=`$as_basename -- "$0" ||
--$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-- X"$0" : 'X\(//\)$' \| \
-- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X/"$0" |
-- sed '/^.*\/\([^/][^/]*\)\/*$/{
-- s//\1/
-- q
-- }
-- /^X\/\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\/\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
--
--# Avoid depending upon Character Ranges.
--as_cr_letters='abcdefghijklmnopqrstuvwxyz'
--as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
--as_cr_Letters=$as_cr_letters$as_cr_LETTERS
--as_cr_digits='0123456789'
--as_cr_alnum=$as_cr_Letters$as_cr_digits
--
--ECHO_C= ECHO_N= ECHO_T=
--case `echo -n x` in #(((((
---n*)
-- case `echo 'xy\c'` in
-- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
-- xy) ECHO_C='\c';;
-- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
-- ECHO_T=' ';;
-- esac;;
--*)
-- ECHO_N='-n';;
--esac
--
--rm -f conf$$ conf$$.exe conf$$.file
--if test -d conf$$.dir; then
-- rm -f conf$$.dir/conf$$.file
--else
-- rm -f conf$$.dir
-- mkdir conf$$.dir 2>/dev/null
--fi
--if (echo >conf$$.file) 2>/dev/null; then
-- if ln -s conf$$.file conf$$ 2>/dev/null; then
-- as_ln_s='ln -s'
-- # ... but there are two gotchas:
-- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-- # In both cases, we have to default to `cp -pR'.
-- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-- as_ln_s='cp -pR'
-- elif ln conf$$.file conf$$ 2>/dev/null; then
-- as_ln_s=ln
-- else
-- as_ln_s='cp -pR'
-- fi
--else
-- as_ln_s='cp -pR'
--fi
--rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
--rmdir conf$$.dir 2>/dev/null
--
--
--# as_fn_mkdir_p
--# -------------
--# Create "$as_dir" as a directory, including parents if necessary.
--as_fn_mkdir_p ()
--{
--
-- case $as_dir in #(
-- -*) as_dir=./$as_dir;;
-- esac
-- test -d "$as_dir" || eval $as_mkdir_p || {
-- as_dirs=
-- while :; do
-- case $as_dir in #(
-- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-- *) as_qdir=$as_dir;;
-- esac
-- as_dirs="'$as_qdir' $as_dirs"
-- as_dir=`$as_dirname -- "$as_dir" ||
--$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-- X"$as_dir" : 'X\(//\)[^/]' \| \
-- X"$as_dir" : 'X\(//\)$' \| \
-- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X"$as_dir" |
-- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)[^/].*/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
-- test -d "$as_dir" && break
-- done
-- test -z "$as_dirs" || eval "mkdir $as_dirs"
-- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
--
--
--} # as_fn_mkdir_p
--if mkdir -p . 2>/dev/null; then
-- as_mkdir_p='mkdir -p "$as_dir"'
--else
-- test -d ./-p && rmdir ./-p
-- as_mkdir_p=false
--fi
--
--
--# as_fn_executable_p FILE
--# -----------------------
--# Test if FILE is an executable regular file.
--as_fn_executable_p ()
--{
-- test -f "$1" && test -x "$1"
--} # as_fn_executable_p
--as_test_x='test -x'
--as_executable_p=as_fn_executable_p
--
--# Sed expression to map a string onto a valid CPP name.
--as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
--
--# Sed expression to map a string onto a valid variable name.
--as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
--
--
--exec 6>&1
--## ----------------------------------- ##
--## Main body of $CONFIG_STATUS script. ##
--## ----------------------------------- ##
--_ASEOF
--test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--# Save the log message, to keep $0 and so on meaningful, and to
--# report actual input values of CONFIG_FILES etc. instead of their
--# values after options handling.
--ac_log="
--This file was extended by rsync $as_me 3.1.2, which was
--generated by GNU Autoconf 2.69. Invocation command line was
--
-- CONFIG_FILES = $CONFIG_FILES
-- CONFIG_HEADERS = $CONFIG_HEADERS
-- CONFIG_LINKS = $CONFIG_LINKS
-- CONFIG_COMMANDS = $CONFIG_COMMANDS
-- $ $0 $@
--
--on `(hostname || uname -n) 2>/dev/null | sed 1q`
--"
--
--_ACEOF
--
--case $ac_config_files in *"
--"*) set x $ac_config_files; shift; ac_config_files=$*;;
--esac
--
--case $ac_config_headers in *"
--"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
--esac
--
--
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--# Files that config.status was made for.
--config_files="$ac_config_files"
--config_headers="$ac_config_headers"
--
--_ACEOF
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--ac_cs_usage="\
--\`$as_me' instantiates files and other configuration actions
--from templates according to the current configuration. Unless the files
--and actions are specified as TAGs, all are instantiated by default.
--
--Usage: $0 [OPTION]... [TAG]...
--
-- -h, --help print this help, then exit
-- -V, --version print version number and configuration settings, then exit
-- --config print configuration, then exit
-- -q, --quiet, --silent
-- do not print progress messages
-- -d, --debug don't remove temporary files
-- --recheck update $as_me by reconfiguring in the same conditions
-- --file=FILE[:TEMPLATE]
-- instantiate the configuration file FILE
-- --header=FILE[:TEMPLATE]
-- instantiate the configuration header FILE
--
--Configuration files:
--$config_files
--
--Configuration headers:
--$config_headers
--
--Report bugs to <http://rsync.samba.org/bugzilla.html>."
--
--_ACEOF
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
--ac_cs_version="\\
--rsync config.status 3.1.2
--configured by $0, generated by GNU Autoconf 2.69,
-- with options \\"\$ac_cs_config\\"
--
--Copyright (C) 2012 Free Software Foundation, Inc.
--This config.status script is free software; the Free Software Foundation
--gives unlimited permission to copy, distribute and modify it."
--
--ac_pwd='$ac_pwd'
--srcdir='$srcdir'
--INSTALL='$INSTALL'
--MKDIR_P='$MKDIR_P'
--test -n "\$AWK" || AWK=awk
--_ACEOF
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--# The default lists apply if the user does not specify any file.
--ac_need_defaults=:
--while test $# != 0
--do
-- case $1 in
-- --*=?*)
-- ac_option=`expr "X$1" : 'X\([^=]*\)='`
-- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-- ac_shift=:
-- ;;
-- --*=)
-- ac_option=`expr "X$1" : 'X\([^=]*\)='`
-- ac_optarg=
-- ac_shift=:
-- ;;
-- *)
-- ac_option=$1
-- ac_optarg=$2
-- ac_shift=shift
-- ;;
-- esac
--
-- case $ac_option in
-- # Handling of the options.
-- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-- ac_cs_recheck=: ;;
-- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-- $as_echo "$ac_cs_version"; exit ;;
-- --config | --confi | --conf | --con | --co | --c )
-- $as_echo "$ac_cs_config"; exit ;;
-- --debug | --debu | --deb | --de | --d | -d )
-- debug=: ;;
-- --file | --fil | --fi | --f )
-- $ac_shift
-- case $ac_optarg in
-- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-- '') as_fn_error $? "missing file argument" ;;
-- esac
-- as_fn_append CONFIG_FILES " '$ac_optarg'"
-- ac_need_defaults=false;;
-- --header | --heade | --head | --hea )
-- $ac_shift
-- case $ac_optarg in
-- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-- esac
-- as_fn_append CONFIG_HEADERS " '$ac_optarg'"
-- ac_need_defaults=false;;
-- --he | --h)
-- # Conflict between --help and --header
-- as_fn_error $? "ambiguous option: \`$1'
--Try \`$0 --help' for more information.";;
-- --help | --hel | -h )
-- $as_echo "$ac_cs_usage"; exit ;;
-- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-- | -silent | --silent | --silen | --sile | --sil | --si | --s)
-- ac_cs_silent=: ;;
--
-- # This is an error.
-- -*) as_fn_error $? "unrecognized option: \`$1'
--Try \`$0 --help' for more information." ;;
--
-- *) as_fn_append ac_config_targets " $1"
-- ac_need_defaults=false ;;
--
-- esac
-- shift
--done
--
--ac_configure_extra_args=
--
--if $ac_cs_silent; then
-- exec 6>/dev/null
-- ac_configure_extra_args="$ac_configure_extra_args --silent"
--fi
--
--_ACEOF
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--if \$ac_cs_recheck; then
-- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-- shift
-- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
-- CONFIG_SHELL='$SHELL'
-- export CONFIG_SHELL
-- exec "\$@"
--fi
--
--_ACEOF
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--exec 5>>config.log
--{
-- echo
-- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
--## Running $as_me. ##
--_ASBOX
-- $as_echo "$ac_log"
--} >&5
--
--_ACEOF
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--_ACEOF
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--
--# Handling of arguments.
--for ac_config_target in $ac_config_targets
--do
-- case $ac_config_target in
-- "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-- "lib/dummy") CONFIG_FILES="$CONFIG_FILES lib/dummy" ;;
-- "zlib/dummy") CONFIG_FILES="$CONFIG_FILES zlib/dummy" ;;
-- "popt/dummy") CONFIG_FILES="$CONFIG_FILES popt/dummy" ;;
-- "shconfig") CONFIG_FILES="$CONFIG_FILES shconfig" ;;
--
-- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
-- esac
--done
--
--
--# If the user did not use the arguments to specify the items to instantiate,
--# then the envvar interface is used. Set only those that are not.
--# We use the long form for the default assignment because of an extremely
--# bizarre bug on SunOS 4.1.3.
--if $ac_need_defaults; then
-- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
--fi
--
--# Have a temporary directory for convenience. Make it in the build tree
--# simply because there is no reason against having it here, and in addition,
--# creating and moving files from /tmp can sometimes cause problems.
--# Hook for its removal unless debugging.
--# Note that there is a small window in which the directory will not be cleaned:
--# after its creation but before its name has been assigned to `$tmp'.
--$debug ||
--{
-- tmp= ac_tmp=
-- trap 'exit_status=$?
-- : "${ac_tmp:=$tmp}"
-- { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
--' 0
-- trap 'as_fn_exit 1' 1 2 13 15
--}
--# Create a (secure) tmp directory for tmp files.
--
--{
-- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-- test -d "$tmp"
--} ||
--{
-- tmp=./conf$$-$RANDOM
-- (umask 077 && mkdir "$tmp")
--} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
--ac_tmp=$tmp
--
--# Set up the scripts for CONFIG_FILES section.
--# No need to generate them if there are no CONFIG_FILES.
--# This happens for instance with `./config.status config.h'.
--if test -n "$CONFIG_FILES"; then
--
--
--ac_cr=`echo X | tr X '\015'`
--# On cygwin, bash can eat \r inside `` if the user requested igncr.
--# But we know of no other shell where ac_cr would be empty at this
--# point, so we can use a bashism as a fallback.
--if test "x$ac_cr" = x; then
-- eval ac_cr=\$\'\\r\'
--fi
--ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
--if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-- ac_cs_awk_cr='\\r'
--else
-- ac_cs_awk_cr=$ac_cr
--fi
--
--echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
--_ACEOF
--
--
--{
-- echo "cat >conf$$subs.awk <<_ACEOF" &&
-- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
-- echo "_ACEOF"
--} >conf$$subs.sh ||
-- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
--ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
--ac_delim='%!_!# '
--for ac_last_try in false false false false false :; do
-- . ./conf$$subs.sh ||
-- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
--
-- ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
-- if test $ac_delim_n = $ac_delim_num; then
-- break
-- elif $ac_last_try; then
-- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-- else
-- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-- fi
--done
--rm -f conf$$subs.sh
--
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
--_ACEOF
--sed -n '
--h
--s/^/S["/; s/!.*/"]=/
--p
--g
--s/^[^!]*!//
--:repl
--t repl
--s/'"$ac_delim"'$//
--t delim
--:nl
--h
--s/\(.\{148\}\)..*/\1/
--t more1
--s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
--p
--n
--b repl
--:more1
--s/["\\]/\\&/g; s/^/"/; s/$/"\\/
--p
--g
--s/.\{148\}//
--t nl
--:delim
--h
--s/\(.\{148\}\)..*/\1/
--t more2
--s/["\\]/\\&/g; s/^/"/; s/$/"/
--p
--b
--:more2
--s/["\\]/\\&/g; s/^/"/; s/$/"\\/
--p
--g
--s/.\{148\}//
--t delim
--' <conf$$subs.awk | sed '
--/^[^""]/{
-- N
-- s/\n//
--}
--' >>$CONFIG_STATUS || ac_write_fail=1
--rm -f conf$$subs.awk
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--_ACAWK
--cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
-- for (key in S) S_is_set[key] = 1
-- FS = "\a"
--
--}
--{
-- line = $ 0
-- nfields = split(line, field, "@")
-- substed = 0
-- len = length(field[1])
-- for (i = 2; i < nfields; i++) {
-- key = field[i]
-- keylen = length(key)
-- if (S_is_set[key]) {
-- value = S[key]
-- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
-- len += length(value) + length(field[++i])
-- substed = 1
-- } else
-- len += 1 + keylen
-- }
--
-- print line
--}
--
--_ACAWK
--_ACEOF
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
-- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
--else
-- cat
--fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
-- || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
--_ACEOF
--
--# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
--# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
--# trailing colons and then remove the whole line if VPATH becomes empty
--# (actually we leave an empty line to preserve line numbers).
--if test "x$srcdir" = x.; then
-- ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
--h
--s///
--s/^/:/
--s/[ ]*$/:/
--s/:\$(srcdir):/:/g
--s/:\${srcdir}:/:/g
--s/:@srcdir@:/:/g
--s/^:*//
--s/:*$//
--x
--s/\(=[ ]*\).*/\1/
--G
--s/\n//
--s/^[^=]*=[ ]*$//
--}'
--fi
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--fi # test -n "$CONFIG_FILES"
--
--# Set up the scripts for CONFIG_HEADERS section.
--# No need to generate them if there are no CONFIG_HEADERS.
--# This happens for instance with `./config.status Makefile'.
--if test -n "$CONFIG_HEADERS"; then
--cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
--BEGIN {
--_ACEOF
--
--# Transform confdefs.h into an awk script `defines.awk', embedded as
--# here-document in config.status, that substitutes the proper values into
--# config.h.in to produce config.h.
--
--# Create a delimiter string that does not exist in confdefs.h, to ease
--# handling of long lines.
--ac_delim='%!_!# '
--for ac_last_try in false false :; do
-- ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
-- if test -z "$ac_tt"; then
-- break
-- elif $ac_last_try; then
-- as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
-- else
-- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-- fi
--done
--
--# For the awk script, D is an array of macro values keyed by name,
--# likewise P contains macro parameters if any. Preserve backslash
--# newline sequences.
--
--ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
--sed -n '
--s/.\{148\}/&'"$ac_delim"'/g
--t rset
--:rset
--s/^[ ]*#[ ]*define[ ][ ]*/ /
--t def
--d
--:def
--s/\\$//
--t bsnl
--s/["\\]/\\&/g
--s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
--D["\1"]=" \3"/p
--s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
--d
--:bsnl
--s/["\\]/\\&/g
--s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
--D["\1"]=" \3\\\\\\n"\\/p
--t cont
--s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
--t cont
--d
--:cont
--n
--s/.\{148\}/&'"$ac_delim"'/g
--t clear
--:clear
--s/\\$//
--t bsnlc
--s/["\\]/\\&/g; s/^/"/; s/$/"/p
--d
--:bsnlc
--s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
--b cont
--' <confdefs.h | sed '
--s/'"$ac_delim"'/"\\\
--"/g' >>$CONFIG_STATUS || ac_write_fail=1
--
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-- for (key in D) D_is_set[key] = 1
-- FS = "\a"
--}
--/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
-- line = \$ 0
-- split(line, arg, " ")
-- if (arg[1] == "#") {
-- defundef = arg[2]
-- mac1 = arg[3]
-- } else {
-- defundef = substr(arg[1], 2)
-- mac1 = arg[2]
-- }
-- split(mac1, mac2, "(") #)
-- macro = mac2[1]
-- prefix = substr(line, 1, index(line, defundef) - 1)
-- if (D_is_set[macro]) {
-- # Preserve the white space surrounding the "#".
-- print prefix "define", macro P[macro] D[macro]
-- next
-- } else {
-- # Replace #undef with comments. This is necessary, for example,
-- # in the case of _POSIX_SOURCE, which is predefined and required
-- # on some systems where configure will not decide to define it.
-- if (defundef == "undef") {
-- print "/*", prefix defundef, macro, "*/"
-- next
-- }
-- }
--}
--{ print }
--_ACAWK
--_ACEOF
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-- as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
--fi # test -n "$CONFIG_HEADERS"
--
--
--eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
--shift
--for ac_tag
--do
-- case $ac_tag in
-- :[FHLC]) ac_mode=$ac_tag; continue;;
-- esac
-- case $ac_mode$ac_tag in
-- :[FHL]*:*);;
-- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
-- :[FH]-) ac_tag=-:-;;
-- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-- esac
-- ac_save_IFS=$IFS
-- IFS=:
-- set x $ac_tag
-- IFS=$ac_save_IFS
-- shift
-- ac_file=$1
-- shift
--
-- case $ac_mode in
-- :L) ac_source=$1;;
-- :[FH])
-- ac_file_inputs=
-- for ac_f
-- do
-- case $ac_f in
-- -) ac_f="$ac_tmp/stdin";;
-- *) # Look for the file first in the build tree, then in the source tree
-- # (if the path is not absolute). The absolute path cannot be DOS-style,
-- # because $ac_f cannot contain `:'.
-- test -f "$ac_f" ||
-- case $ac_f in
-- [\\/$]*) false;;
-- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-- esac ||
-- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
-- esac
-- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-- as_fn_append ac_file_inputs " '$ac_f'"
-- done
--
-- # Let's still pretend it is `configure' which instantiates (i.e., don't
-- # use $as_me), people would be surprised to read:
-- # /* config.h. Generated by config.status. */
-- configure_input='Generated from '`
-- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
-- `' by configure.'
-- if test x"$ac_file" != x-; then
-- configure_input="$ac_file. $configure_input"
-- { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
--$as_echo "$as_me: creating $ac_file" >&6;}
-- fi
-- # Neutralize special characters interpreted by sed in replacement strings.
-- case $configure_input in #(
-- *\&* | *\|* | *\\* )
-- ac_sed_conf_input=`$as_echo "$configure_input" |
-- sed 's/[\\\\&|]/\\\\&/g'`;; #(
-- *) ac_sed_conf_input=$configure_input;;
-- esac
--
-- case $ac_tag in
-- *:-:* | *:-) cat >"$ac_tmp/stdin" \
-- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
-- esac
-- ;;
-- esac
--
-- ac_dir=`$as_dirname -- "$ac_file" ||
--$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-- X"$ac_file" : 'X\(//\)[^/]' \| \
-- X"$ac_file" : 'X\(//\)$' \| \
-- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
--$as_echo X"$ac_file" |
-- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)[^/].*/{
-- s//\1/
-- q
-- }
-- /^X\(\/\/\)$/{
-- s//\1/
-- q
-- }
-- /^X\(\/\).*/{
-- s//\1/
-- q
-- }
-- s/.*/./; q'`
-- as_dir="$ac_dir"; as_fn_mkdir_p
-- ac_builddir=.
--
--case "$ac_dir" in
--.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
--*)
-- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-- # A ".." for each directory in $ac_dir_suffix.
-- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-- case $ac_top_builddir_sub in
-- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-- esac ;;
--esac
--ac_abs_top_builddir=$ac_pwd
--ac_abs_builddir=$ac_pwd$ac_dir_suffix
--# for backward compatibility:
--ac_top_builddir=$ac_top_build_prefix
--
--case $srcdir in
-- .) # We are building in place.
-- ac_srcdir=.
-- ac_top_srcdir=$ac_top_builddir_sub
-- ac_abs_top_srcdir=$ac_pwd ;;
-- [\\/]* | ?:[\\/]* ) # Absolute name.
-- ac_srcdir=$srcdir$ac_dir_suffix;
-- ac_top_srcdir=$srcdir
-- ac_abs_top_srcdir=$srcdir ;;
-- *) # Relative name.
-- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-- ac_top_srcdir=$ac_top_build_prefix$srcdir
-- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
--esac
--ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
--
--
-- case $ac_mode in
-- :F)
-- #
-- # CONFIG_FILE
-- #
--
-- case $INSTALL in
-- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
-- esac
-- ac_MKDIR_P=$MKDIR_P
-- case $MKDIR_P in
-- [\\/$]* | ?:[\\/]* ) ;;
-- */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
-- esac
--_ACEOF
--
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--# If the template does not know about datarootdir, expand it.
--# FIXME: This hack should be removed a few years after 2.60.
--ac_datarootdir_hack=; ac_datarootdir_seen=
--ac_sed_dataroot='
--/datarootdir/ {
-- p
-- q
--}
--/@datadir@/p
--/@docdir@/p
--/@infodir@/p
--/@localedir@/p
--/@mandir@/p'
--case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
--*datarootdir*) ac_datarootdir_seen=yes;;
--*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
--$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
--_ACEOF
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-- ac_datarootdir_hack='
-- s&@datadir@&$datadir&g
-- s&@docdir@&$docdir&g
-- s&@infodir@&$infodir&g
-- s&@localedir@&$localedir&g
-- s&@mandir@&$mandir&g
-- s&\\\${datarootdir}&$datarootdir&g' ;;
--esac
--_ACEOF
--
--# Neutralize VPATH when `$srcdir' = `.'.
--# Shell code in configure.ac might set extrasub.
--# FIXME: do we really want to maintain this feature?
--cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
--ac_sed_extra="$ac_vpsub
--$extrasub
--_ACEOF
--cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
--:t
--/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
--s|@configure_input@|$ac_sed_conf_input|;t t
--s&@top_builddir@&$ac_top_builddir_sub&;t t
--s&@top_build_prefix@&$ac_top_build_prefix&;t t
--s&@srcdir@&$ac_srcdir&;t t
--s&@abs_srcdir@&$ac_abs_srcdir&;t t
--s&@top_srcdir@&$ac_top_srcdir&;t t
--s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
--s&@builddir@&$ac_builddir&;t t
--s&@abs_builddir@&$ac_abs_builddir&;t t
--s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
--s&@INSTALL@&$ac_INSTALL&;t t
--s&@MKDIR_P@&$ac_MKDIR_P&;t t
--$ac_datarootdir_hack
--"
--eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-- >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
--
--test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-- { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
-- "$ac_tmp/out"`; test -z "$ac_out"; } &&
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
--which seems to be undefined. Please make sure it is defined" >&5
--$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
--which seems to be undefined. Please make sure it is defined" >&2;}
--
-- rm -f "$ac_tmp/stdin"
-- case $ac_file in
-- -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-- *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
-- esac \
-- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-- ;;
-- :H)
-- #
-- # CONFIG_HEADER
-- #
-- if test x"$ac_file" != x-; then
-- {
-- $as_echo "/* $configure_input */" \
-- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
-- } >"$ac_tmp/config.h" \
-- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-- if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
--$as_echo "$as_me: $ac_file is unchanged" >&6;}
-- else
-- rm -f "$ac_file"
-- mv "$ac_tmp/config.h" "$ac_file" \
-- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-- fi
-- else
-- $as_echo "/* $configure_input */" \
-- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
-- || as_fn_error $? "could not create -" "$LINENO" 5
-- fi
-- ;;
--
--
-- esac
--
--done # for ac_tag
--
--
--as_fn_exit 0
--_ACEOF
--ac_clean_files=$ac_clean_files_save
--
--test $ac_write_fail = 0 ||
-- as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
--
--
--# configure is writing to config.log, and then calls config.status.
--# config.status does its own redirection, appending to config.log.
--# Unfortunately, on DOS this fails, as config.log is still kept open
--# by configure, so config.status won't be able to write to it; its
--# output is simply discarded. So we exec the FD to /dev/null,
--# effectively closing config.log, so it can be properly (re)opened and
--# appended to by config.status. When coming back to configure, we
--# need to make the FD available again.
--if test "$no_create" != yes; then
-- ac_cs_success=:
-- ac_config_status_args=
-- test "$silent" = yes &&
-- ac_config_status_args="$ac_config_status_args --quiet"
-- exec 5>/dev/null
-- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-- exec 5>>config.log
-- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-- # would make configure fail if this is the last instruction.
-- $ac_cs_success || as_fn_exit 1
--fi
--if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
--$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
--fi
--
--
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
--$as_echo "" >&6; }
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: rsync ${RSYNC_VERSION} configuration successful" >&5
--$as_echo " rsync ${RSYNC_VERSION} configuration successful" >&6; }
--{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
--$as_echo "" >&6; }
--if test x$HAVE_YODL2MAN != x1; then
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Note that yodl2man was not found, so pre-existing manpage files will be" >&5
--$as_echo " Note that yodl2man was not found, so pre-existing manpage files will be" >&6; }
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: used w/o change (if available) -- no .yo file changes will be used." >&5
--$as_echo " used w/o change (if available) -- no .yo file changes will be used." >&6; }
-- { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
--$as_echo "" >&6; }
--fi
+++ /dev/null
-commit 4fc78878e01451d6465e2072f3f0653182f885c1
-Author: Wayne Davison <wayned@samba.org>
-Date: Sun May 1 16:29:34 2016 -0700
-
- Tweak indentation only.
-
-diff --git a/checksum.c b/checksum.c
-index 6ebb56b..bac775d 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -188,32 +188,31 @@ void sum_update(const char *p, int32 len)
- {
- if (protocol_version >= 30) {
- md5_update(&md, (uchar *)p, len);
-- return;
-- }
-+ } else {
-+ if (len + sumresidue < CSUM_CHUNK) {
-+ memcpy(md.buffer + sumresidue, p, len);
-+ sumresidue += len;
-+ return;
-+ }
-
-- if (len + sumresidue < CSUM_CHUNK) {
-- memcpy(md.buffer + sumresidue, p, len);
-- sumresidue += len;
-- return;
-- }
-+ if (sumresidue) {
-+ int32 i = CSUM_CHUNK - sumresidue;
-+ memcpy(md.buffer + sumresidue, p, i);
-+ mdfour_update(&md, (uchar *)md.buffer, CSUM_CHUNK);
-+ len -= i;
-+ p += i;
-+ }
-
-- if (sumresidue) {
-- int32 i = CSUM_CHUNK - sumresidue;
-- memcpy(md.buffer + sumresidue, p, i);
-- mdfour_update(&md, (uchar *)md.buffer, CSUM_CHUNK);
-- len -= i;
-- p += i;
-- }
-+ while (len >= CSUM_CHUNK) {
-+ mdfour_update(&md, (uchar *)p, CSUM_CHUNK);
-+ len -= CSUM_CHUNK;
-+ p += CSUM_CHUNK;
-+ }
-
-- while (len >= CSUM_CHUNK) {
-- mdfour_update(&md, (uchar *)p, CSUM_CHUNK);
-- len -= CSUM_CHUNK;
-- p += CSUM_CHUNK;
-+ sumresidue = len;
-+ if (sumresidue)
-+ memcpy(md.buffer, p, sumresidue);
- }
--
-- sumresidue = len;
-- if (sumresidue)
-- memcpy(md.buffer, p, sumresidue);
- }
-
- int sum_end(char *sum)
-@@ -221,12 +220,12 @@ int sum_end(char *sum)
- if (protocol_version >= 30) {
- md5_result(&md, (uchar *)sum);
- return MD5_DIGEST_LEN;
-- }
--
-- if (sumresidue || protocol_version >= 27)
-- mdfour_update(&md, (uchar *)md.buffer, sumresidue);
-+ } else {
-+ if (sumresidue || protocol_version >= 27)
-+ mdfour_update(&md, (uchar *)md.buffer, sumresidue);
-
-- mdfour_result(&md, (uchar *)sum);
-+ mdfour_result(&md, (uchar *)sum);
-
-- return MD4_DIGEST_LEN;
-+ return MD4_DIGEST_LEN;
-+ }
- }
+++ /dev/null
-commit a5a7d3a297b836387b0ac677383bdddaf2ac3598
-Author: Wayne Davison <wayned@samba.org>
-Date: Sun May 1 16:32:45 2016 -0700
-
- Add --checksum-choice option to choose the checksum algorithms.
-
-diff --git a/authenticate.c b/authenticate.c
-index 5f125de..d60ee20 100644
---- a/authenticate.c
-+++ b/authenticate.c
-@@ -71,7 +71,7 @@ static void gen_challenge(const char *addr, char *challenge)
- SIVAL(input, 20, tv.tv_usec);
- SIVAL(input, 24, getpid());
-
-- sum_init(0);
-+ sum_init(-1, 0);
- sum_update(input, sizeof input);
- len = sum_end(digest);
-
-@@ -85,7 +85,7 @@ static void generate_hash(const char *in, const char *challenge, char *out)
- char buf[MAX_DIGEST_LEN];
- int len;
-
-- sum_init(0);
-+ sum_init(-1, 0);
- sum_update(in, strlen(in));
- sum_update(challenge, strlen(challenge));
- len = sum_end(buf);
-diff --git a/checksum.c b/checksum.c
-index bac775d..8b38833 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -24,6 +24,76 @@
- extern int checksum_seed;
- extern int protocol_version;
- extern int proper_seed_order;
-+extern char *checksum_choice;
-+
-+#define CSUM_NONE 0
-+#define CSUM_ARCHAIC 1
-+#define CSUM_MD4_BUSTED 2
-+#define CSUM_MD4_OLD 3
-+#define CSUM_MD4 4
-+#define CSUM_MD5 5
-+
-+int xfersum_type = 0; /* used for the file transfer checksums */
-+int checksum_type = 0; /* used for the pre-transfer (--checksum) checksums */
-+
-+/* Returns 1 if --whole-file must be enabled. */
-+int parse_checksum_choice(void)
-+{
-+ char *cp = checksum_choice ? strchr(checksum_choice, ',') : NULL;
-+ if (cp) {
-+ xfersum_type = parse_csum_name(checksum_choice, cp - checksum_choice);
-+ checksum_type = parse_csum_name(cp+1, -1);
-+ } else
-+ xfersum_type = checksum_type = parse_csum_name(checksum_choice, -1);
-+ return xfersum_type == CSUM_NONE;
-+}
-+
-+int parse_csum_name(const char *name, int len)
-+{
-+ if (len < 0 && name)
-+ len = strlen(name);
-+
-+ if (!name || (len == 4 && strncasecmp(name, "auto", 4) == 0)) {
-+ if (protocol_version >= 30)
-+ return CSUM_MD5;
-+ if (protocol_version >= 27)
-+ return CSUM_MD4_OLD;
-+ if (protocol_version >= 21)
-+ return CSUM_MD4_BUSTED;
-+ return CSUM_ARCHAIC;
-+ }
-+ if (len == 3 && strncasecmp(name, "md4", 3) == 0)
-+ return CSUM_MD4;
-+ if (len == 3 && strncasecmp(name, "md5", 3) == 0)
-+ return CSUM_MD5;
-+ if (len == 4 && strncasecmp(name, "none", 4) == 0)
-+ return CSUM_NONE;
-+
-+ rprintf(FERROR, "unknown checksum name: %s\n", name);
-+ exit_cleanup(RERR_UNSUPPORTED);
-+}
-+
-+int csum_len_for_type(int cst)
-+{
-+ switch (cst) {
-+ case CSUM_NONE:
-+ return 1;
-+ case CSUM_ARCHAIC:
-+ return 2;
-+ case CSUM_MD4:
-+ case CSUM_MD4_OLD:
-+ case CSUM_MD4_BUSTED:
-+ return MD4_DIGEST_LEN;
-+ case CSUM_MD5:
-+ return MD5_DIGEST_LEN;
-+ }
-+ return 0;
-+}
-+
-+int canonical_checksum(int csum_type)
-+{
-+ return csum_type >= CSUM_MD4 ? 1 : 0;
-+}
-
- /*
- a simple 32 bit checksum that can be upadted from either end
-@@ -47,12 +117,12 @@ uint32 get_checksum1(char *buf1, int32 len)
- return (s1 & 0xffff) + (s2 << 16);
- }
-
--
- void get_checksum2(char *buf, int32 len, char *sum)
- {
- md_context m;
-
-- if (protocol_version >= 30) {
-+ switch (xfersum_type) {
-+ case CSUM_MD5: {
- uchar seedbuf[4];
- md5_begin(&m);
- if (proper_seed_order) {
-@@ -69,7 +139,11 @@ void get_checksum2(char *buf, int32 len, char *sum)
- }
- }
- md5_result(&m, (uchar *)sum);
-- } else {
-+ break;
-+ }
-+ case CSUM_MD4:
-+ case CSUM_MD4_OLD:
-+ case CSUM_MD4_BUSTED: {
- int32 i;
- static char *buf1;
- static int32 len1;
-@@ -100,10 +174,12 @@ void get_checksum2(char *buf, int32 len, char *sum)
- * are multiples of 64. This is fixed by calling mdfour_update()
- * even when there are no more bytes.
- */
-- if (len - i > 0 || protocol_version >= 27)
-+ if (len - i > 0 || xfersum_type != CSUM_MD4_BUSTED)
- mdfour_update(&m, (uchar *)(buf1+i), len-i);
-
- mdfour_result(&m, (uchar *)sum);
-+ break;
-+ }
- }
- }
-
-@@ -123,7 +199,8 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
-
- buf = map_file(fd, len, MAX_MAP_SIZE, CSUM_CHUNK);
-
-- if (protocol_version >= 30) {
-+ switch (checksum_type) {
-+ case CSUM_MD5:
- md5_begin(&m);
-
- for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
-@@ -136,7 +213,10 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
- md5_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
-
- md5_result(&m, (uchar *)sum);
-- } else {
-+ break;
-+ case CSUM_MD4:
-+ case CSUM_MD4_OLD:
-+ case CSUM_MD4_BUSTED:
- mdfour_begin(&m);
-
- for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
-@@ -149,10 +229,14 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
- * are multiples of 64. This is fixed by calling mdfour_update()
- * even when there are no more bytes. */
- remainder = (int32)(len - i);
-- if (remainder > 0 || protocol_version >= 27)
-+ if (remainder > 0 || checksum_type != CSUM_MD4_BUSTED)
- mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
-
- mdfour_result(&m, (uchar *)sum);
-+ break;
-+ default:
-+ rprintf(FERROR, "invalid checksum-choice for the --checksum option (%d)\n", checksum_type);
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
-
- close(fd);
-@@ -161,18 +245,33 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
-
- static int32 sumresidue;
- static md_context md;
-+static int cursum_type;
-
--void sum_init(int seed)
-+void sum_init(int csum_type, int seed)
- {
- char s[4];
-
-- if (protocol_version >= 30)
-+ if (csum_type < 0)
-+ csum_type = parse_csum_name(NULL, 0);
-+ cursum_type = csum_type;
-+
-+ switch (csum_type) {
-+ case CSUM_MD5:
- md5_begin(&md);
-- else {
-+ break;
-+ case CSUM_MD4:
-+ mdfour_begin(&md);
-+ sumresidue = 0;
-+ break;
-+ case CSUM_MD4_OLD:
-+ case CSUM_MD4_BUSTED:
- mdfour_begin(&md);
- sumresidue = 0;
- SIVAL(s, 0, seed);
- sum_update(s, 4);
-+ break;
-+ case CSUM_NONE:
-+ break;
- }
- }
-
-@@ -186,13 +285,17 @@ void sum_init(int seed)
- **/
- void sum_update(const char *p, int32 len)
- {
-- if (protocol_version >= 30) {
-+ switch (cursum_type) {
-+ case CSUM_MD5:
- md5_update(&md, (uchar *)p, len);
-- } else {
-+ break;
-+ case CSUM_MD4:
-+ case CSUM_MD4_OLD:
-+ case CSUM_MD4_BUSTED:
- if (len + sumresidue < CSUM_CHUNK) {
- memcpy(md.buffer + sumresidue, p, len);
- sumresidue += len;
-- return;
-+ break;
- }
-
- if (sumresidue) {
-@@ -212,20 +315,32 @@ void sum_update(const char *p, int32 len)
- sumresidue = len;
- if (sumresidue)
- memcpy(md.buffer, p, sumresidue);
-+ break;
-+ case CSUM_NONE:
-+ break;
- }
- }
-
- int sum_end(char *sum)
- {
-- if (protocol_version >= 30) {
-+ switch (cursum_type) {
-+ case CSUM_MD5:
- md5_result(&md, (uchar *)sum);
-- return MD5_DIGEST_LEN;
-- } else {
-- if (sumresidue || protocol_version >= 27)
-+ break;
-+ case CSUM_MD4:
-+ case CSUM_MD4_OLD:
-+ mdfour_update(&md, (uchar *)md.buffer, sumresidue);
-+ mdfour_result(&md, (uchar *)sum);
-+ break;
-+ case CSUM_MD4_BUSTED:
-+ if (sumresidue)
- mdfour_update(&md, (uchar *)md.buffer, sumresidue);
--
- mdfour_result(&md, (uchar *)sum);
--
-- return MD4_DIGEST_LEN;
-+ break;
-+ case CSUM_NONE:
-+ *sum = '\0';
-+ break;
- }
-+
-+ return csum_len_for_type(cursum_type);
- }
-diff --git a/compat.c b/compat.c
-index c792312..505cb7f 100644
---- a/compat.c
-+++ b/compat.c
-@@ -338,4 +338,6 @@ void setup_protocol(int f_out,int f_in)
- } else {
- checksum_seed = read_int(f_in);
- }
-+
-+ init_flist();
- }
-diff --git a/flist.c b/flist.c
-index c1e48b3..acb95f7 100644
---- a/flist.c
-+++ b/flist.c
-@@ -33,6 +33,7 @@ extern int am_sender;
- extern int am_generator;
- extern int inc_recurse;
- extern int always_checksum;
-+extern int checksum_type;
- extern int module_id;
- extern int ignore_errors;
- extern int numeric_ids;
-@@ -137,9 +138,8 @@ void init_flist(void)
- rprintf(FINFO, "FILE_STRUCT_LEN=%d, EXTRA_LEN=%d\n",
- (int)FILE_STRUCT_LEN, (int)EXTRA_LEN);
- }
-- checksum_len = protocol_version < 21 ? 2
-- : protocol_version < 30 ? MD4_DIGEST_LEN
-- : MD5_DIGEST_LEN;
-+ parse_checksum_choice(); /* Sets checksum_type && xfersum_type */
-+ checksum_len = csum_len_for_type(checksum_type);
- }
-
- static int show_filelist_p(void)
-diff --git a/log.c b/log.c
-index 24256de..f7da1e5 100644
---- a/log.c
-+++ b/log.c
-@@ -31,12 +31,13 @@ extern int am_generator;
- extern int local_server;
- extern int quiet;
- extern int module_id;
--extern int checksum_len;
- extern int allow_8bit_chars;
- extern int protocol_version;
- extern int always_checksum;
- extern int preserve_times;
- extern int msgs2stderr;
-+extern int xfersum_type;
-+extern int checksum_type;
- extern int stdout_format_has_i;
- extern int stdout_format_has_o_or_i;
- extern int logfile_format_has_i;
-@@ -46,6 +47,7 @@ extern int64 total_data_written;
- extern int64 total_data_read;
- extern mode_t orig_umask;
- extern char *auth_user;
-+extern char *checksum_choice;
- extern char *stdout_format;
- extern char *logfile_format;
- extern char *logfile_name;
-@@ -669,13 +671,15 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
- n = buf2;
- break;
- case 'C':
-- if (protocol_version >= 30
-- && (iflags & ITEM_TRANSFER
-- || (always_checksum && S_ISREG(file->mode)))) {
-- const char *sum = iflags & ITEM_TRANSFER
-- ? sender_file_sum : F_SUM(file);
-- n = sum_as_hex(sum);
-- } else {
-+ n = NULL;
-+ if (S_ISREG(file->mode)) {
-+ if (always_checksum && canonical_checksum(checksum_type))
-+ n = sum_as_hex(checksum_type, F_SUM(file));
-+ else if (iflags & ITEM_TRANSFER && canonical_checksum(xfersum_type))
-+ n = sum_as_hex(xfersum_type, sender_file_sum);
-+ }
-+ if (!n) {
-+ int checksum_len = csum_len_for_type(always_checksum ? checksum_type : xfersum_type);
- memset(buf2, ' ', checksum_len*2);
- buf2[checksum_len*2] = '\0';
- n = buf2;
-diff --git a/main.c b/main.c
-index 3132aa9..3908ccf 100644
---- a/main.c
-+++ b/main.c
-@@ -1595,8 +1595,6 @@ int main(int argc,char *argv[])
- * that implement getcwd that way "pwd" can't be found after chroot. */
- change_dir(NULL, CD_NORMAL);
-
-- init_flist();
--
- if ((write_batch || read_batch) && !am_server) {
- if (write_batch)
- write_batch_shell_file(orig_argc, orig_argv, argc);
-diff --git a/match.c b/match.c
-index b15f2eb..ff10310 100644
---- a/match.c
-+++ b/match.c
-@@ -24,7 +24,7 @@
-
- extern int checksum_seed;
- extern int append_mode;
--extern int checksum_len;
-+extern int xfersum_type;
-
- int updating_basis_file;
- char sender_file_sum[MAX_DIGEST_LEN];
-@@ -360,13 +360,15 @@ static void hash_search(int f,struct sum_struct *s,
- **/
- void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
- {
-+ int checksum_len;
-+
- last_match = 0;
- false_alarms = 0;
- hash_hits = 0;
- matches = 0;
- data_transfer = 0;
-
-- sum_init(checksum_seed);
-+ sum_init(xfersum_type, checksum_seed);
-
- if (append_mode > 0) {
- if (append_mode == 2) {
-@@ -407,8 +409,7 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
- matched(f, s, buf, len, -1);
- }
-
-- if (sum_end(sender_file_sum) != checksum_len)
-- overflow_exit("checksum_len"); /* Impossible... */
-+ checksum_len = sum_end(sender_file_sum);
-
- /* If we had a read error, send a bad checksum. We use all bits
- * off as long as the checksum doesn't happen to be that, in
-diff --git a/options.c b/options.c
-index 4a5cdc8..308443b 100644
---- a/options.c
-+++ b/options.c
-@@ -182,6 +182,7 @@ char *dest_option = NULL;
- static int remote_option_alloc = 0;
- int remote_option_cnt = 0;
- const char **remote_options = NULL;
-+const char *checksum_choice = NULL;
-
- int quiet = 0;
- int output_motd = 1;
-@@ -721,6 +722,7 @@ void usage(enum logcode F)
- #endif
- rprintf(F," -n, --dry-run perform a trial run with no changes made\n");
- rprintf(F," -W, --whole-file copy files whole (without delta-xfer algorithm)\n");
-+ rprintf(F," --checksum-choice=STR choose the checksum algorithms\n");
- rprintf(F," -x, --one-file-system don't cross filesystem boundaries\n");
- rprintf(F," -B, --block-size=SIZE force a fixed checksum block-size\n");
- rprintf(F," -e, --rsh=COMMAND specify the remote shell to use\n");
-@@ -953,6 +955,7 @@ static struct poptOption long_options[] = {
- {"cvs-exclude", 'C', POPT_ARG_NONE, &cvs_exclude, 0, 0, 0 },
- {"whole-file", 'W', POPT_ARG_VAL, &whole_file, 1, 0, 0 },
- {"no-whole-file", 0, POPT_ARG_VAL, &whole_file, 0, 0, 0 },
-+ {"checksum-choice", 0, POPT_ARG_STRING, &checksum_choice, 0, 0, 0 },
- {"no-W", 0, POPT_ARG_VAL, &whole_file, 0, 0, 0 },
- {"checksum", 'c', POPT_ARG_VAL, &always_checksum, 1, 0, 0 },
- {"no-checksum", 0, POPT_ARG_VAL, &always_checksum, 0, 0, 0 },
-@@ -1814,6 +1817,15 @@ int parse_arguments(int *argc_p, const char ***argv_p)
- }
- }
-
-+ if (checksum_choice && strcmp(checksum_choice, "auto") != 0 && strcmp(checksum_choice, "auto,auto") != 0) {
-+ /* Call this early to verify the args and figure out if we need to force
-+ * --whole-file. Note that the parse function will get called again later,
-+ * just in case an "auto" choice needs to know the protocol_version. */
-+ if (parse_checksum_choice())
-+ whole_file = 1;
-+ } else
-+ checksum_choice = NULL;
-+
- if (human_readable > 1 && argc == 2 && !am_server) {
- /* Allow the old meaning of 'h' (--help) on its own. */
- usage(FINFO);
-@@ -2597,6 +2609,12 @@ void server_options(char **args, int *argc_p)
- args[ac++] = arg;
- }
-
-+ if (checksum_choice) {
-+ if (asprintf(&arg, "--checksum-choice=%s", checksum_choice) < 0)
-+ goto oom;
-+ args[ac++] = arg;
-+ }
-+
- if (am_sender) {
- if (max_delete > 0) {
- if (asprintf(&arg, "--max-delete=%d", max_delete) < 0)
-diff --git a/receiver.c b/receiver.c
-index 4ea4c09..f9b97dd 100644
---- a/receiver.c
-+++ b/receiver.c
-@@ -48,11 +48,11 @@ extern int append_mode;
- extern int sparse_files;
- extern int preallocate_files;
- extern int keep_partial;
--extern int checksum_len;
- extern int checksum_seed;
- extern int inplace;
- extern int allowed_lull;
- extern int delay_updates;
-+extern int xfersum_type;
- extern mode_t orig_umask;
- extern struct stats stats;
- extern char *tmpdir;
-@@ -234,6 +234,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- static char file_sum1[MAX_DIGEST_LEN];
- struct map_struct *mapbuf;
- struct sum_struct sum;
-+ int checksum_len;
- int32 len;
- OFF_T offset = 0;
- OFF_T offset2;
-@@ -269,7 +270,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- } else
- mapbuf = NULL;
-
-- sum_init(checksum_seed);
-+ sum_init(xfersum_type, checksum_seed);
-
- if (append_mode > 0) {
- OFF_T j;
-@@ -393,8 +394,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- exit_cleanup(RERR_FILEIO);
- }
-
-- if (sum_end(file_sum1) != checksum_len)
-- overflow_exit("checksum_len"); /* Impossible... */
-+ checksum_len = sum_end(file_sum1);
-
- if (mapbuf)
- unmap_file(mapbuf);
-diff --git a/rsync.yo b/rsync.yo
-index 8971828..0ec5e55 100644
---- a/rsync.yo
-+++ b/rsync.yo
-@@ -380,6 +380,7 @@ to the detailed description below for a complete description. verb(
- --preallocate allocate dest files before writing
- -n, --dry-run perform a trial run with no changes made
- -W, --whole-file copy files whole (w/o delta-xfer algorithm)
-+ --checksum-choice=STR choose the checksum algorithms
- -x, --one-file-system don't cross filesystem boundaries
- -B, --block-size=SIZE force a fixed checksum block-size
- -e, --rsh=COMMAND specify the remote shell to use
-@@ -1280,14 +1281,27 @@ the "bytes sent", "bytes received", "literal data", and "matched data"
- statistics are too small, and the "speedup" value is equivalent to a run
- where no file transfers were needed.
-
--dit(bf(-W, --whole-file)) With this option rsync's delta-transfer algorithm
--is not used and the whole file is sent as-is instead. The transfer may be
-+dit(bf(-W, --whole-file)) This option disables rsync's delta-transfer algorithm,
-+which causes all transferred files to be sent whole. The transfer may be
- faster if this option is used when the bandwidth between the source and
- destination machines is higher than the bandwidth to disk (especially when the
- "disk" is actually a networked filesystem). This is the default when both
- the source and destination are specified as local paths, but only if no
- batch-writing option is in effect.
-
-+dit(bf(--checksum-choice=STR)) This option overrides the checksum algoriths.
-+If one algorithm name is specified, it is used for both the transfer checksums
-+and (assuming bf(--checksum) is specifed) the pre-transfer checksumming. If two
-+comma-separated names are supplied, the first name affects the transfer
-+checksums, and the second name affects the pre-transfer checksumming.
-+
-+The algorithm choices are "auto", "md4", "md5", and "none". If "none" is
-+specified for the first name, the bf(--whole-file) option is forced on and no
-+checksum verification is performed on the transferred data. If "none" is
-+specified for the second name, the bf(--checksum) option cannot be used. The
-+"auto" option is the default, where rsync bases its algorithm choice on the
-+protocol version (for backward compatibility with older rsync versions).
-+
- dit(bf(-x, --one-file-system)) This tells rsync to avoid crossing a
- filesystem boundary when recursing. This does not limit the user's ability
- to specify items to copy from multiple filesystems, just rsync's recursion
-diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
-index 1813354..64156ae 100644
---- a/rsyncd.conf.yo
-+++ b/rsyncd.conf.yo
-@@ -656,7 +656,7 @@ quote(itemization(
- it() %b the number of bytes actually transferred
- it() %B the permission bits of the file (e.g. rwxrwxrwt)
- it() %c the total size of the block checksums received for the basis file (only when sending)
-- it() %C the full-file MD5 checksum if bf(--checksum) is enabled or a file was transferred (only for protocol 30 or above).
-+ it() %C the full-file checksum if it is known for the file. For older rsync protocols/versions, the checksum was salted, and is thus not a useful value (and is not displayed when that is the case). For the checksum to output for a file, either the bf(--checksum) option must be in-effect or the file must have been transferred without a salted checksum being used. See the bf(--checksum-choice) option for a way to choose the algorithm.
- it() %f the filename (long form on sender; no trailing "/")
- it() %G the gid of the file (decimal) or "DEFAULT"
- it() %h the remote host name (only available for a daemon)
-diff --git a/t_stub.c b/t_stub.c
-index 6002250..26951a6 100644
---- a/t_stub.c
-+++ b/t_stub.c
-@@ -25,7 +25,6 @@ int modify_window = 0;
- int preallocate_files = 0;
- int protect_args = 0;
- int module_id = -1;
--int checksum_len = 0;
- int relative_paths = 0;
- int module_dirlen = 0;
- int preserve_acls = 0;
-@@ -97,3 +96,8 @@ filter_rule_list daemon_filter_list;
- {
- return "tester";
- }
-+
-+ int csum_len_for_type(int cst)
-+{
-+ return cst ? 16 : 1;
-+}
-diff --git a/util2.c b/util2.c
-index cc368af..a892e51 100644
---- a/util2.c
-+++ b/util2.c
-@@ -25,8 +25,6 @@
- #include "itypes.h"
- #include "inums.h"
-
--extern int checksum_len;
--
- /**
- * Sleep for a specified number of milliseconds.
- *
-@@ -79,10 +77,11 @@ void *_realloc_array(void *ptr, unsigned int size, size_t num)
- return realloc(ptr, size * num);
- }
-
--const char *sum_as_hex(const char *sum)
-+const char *sum_as_hex(int csum_type, const char *sum)
- {
- static char buf[MAX_DIGEST_LEN*2+1];
- int i, x1, x2;
-+ int checksum_len = csum_len_for_type(csum_type);
- char *c = buf + checksum_len*2;
-
- assert(c - buf < (int)sizeof buf);
-diff --git a/xattrs.c b/xattrs.c
-index 57833e5..6a77a0b 100644
---- a/xattrs.c
-+++ b/xattrs.c
-@@ -258,7 +258,7 @@ static int rsync_xal_get(const char *fname, item_list *xalp)
- if (datum_len > MAX_FULL_DATUM) {
- /* For large datums, we store a flag and a checksum. */
- name_offset = 1 + MAX_DIGEST_LEN;
-- sum_init(checksum_seed);
-+ sum_init(-1, checksum_seed);
- sum_update(ptr, datum_len);
- free(ptr);
-
-@@ -821,7 +821,7 @@ static int rsync_xal_set(const char *fname, item_list *xalp,
- goto still_abbrev;
- }
-
-- sum_init(checksum_seed);
-+ sum_init(-1, checksum_seed);
- sum_update(ptr, len);
- sum_end(sum);
- if (memcmp(sum, rxas[i].datum + 1, MAX_DIGEST_LEN) != 0) {
+++ /dev/null
-commit f3873b3d88b61167b106e7b9227a20147f8f6197
-Author: Wayne Davison <wayned@samba.org>
-Date: Mon Oct 10 11:49:50 2016 -0700
-
- Support --sparse combined with --preallocate or --inplace.
-
- The new code tries to punch holes in the destination file using newer
- Linux fallocate features. It also supports a --whole-file + --sparse +
- --inplace copy on any filesystem by truncating the destination file.
-
-diff --git a/configure.ac b/configure.ac
-index b5e4049..e01e124 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -614,6 +614,36 @@ if test x"$rsync_cv_have_fallocate" = x"yes"; then
- AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the fallocate function and it compiles and links without error])
- fi
-
-+AC_MSG_CHECKING([for FALLOC_FL_PUNCH_HOLE])
-+AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
-+ #define _GNU_SOURCE 1
-+ #include <linux/falloc.h>
-+ #ifndef FALLOC_FL_PUNCH_HOLE
-+ #error FALLOC_FL_PUNCH_HOLE is missing
-+ #endif
-+ ]])], [
-+ AC_MSG_RESULT([yes])
-+ AC_DEFINE([HAVE_FALLOC_FL_PUNCH_HOLE], [1], [Define if FALLOC_FL_PUNCH_HOLE is available.])
-+ ], [
-+ AC_MSG_RESULT([no])
-+ ]
-+)
-+
-+AC_MSG_CHECKING([for FALLOC_FL_ZERO_RANGE])
-+AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
-+ #define _GNU_SOURCE 1
-+ #include <linux/falloc.h>
-+ #ifndef FALLOC_FL_ZERO_RANGE
-+ #error FALLOC_FL_ZERO_RANGE is missing
-+ #endif
-+ ]])], [
-+ AC_MSG_RESULT([yes])
-+ AC_DEFINE([HAVE_FALLOC_FL_ZERO_RANGE], [1], [Define if FALLOC_FL_ZERO_RANGE is available.])
-+ ], [
-+ AC_MSG_RESULT([no])
-+ ]
-+)
-+
- AC_CACHE_CHECK([for SYS_fallocate],rsync_cv_have_sys_fallocate,[
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/syscall.h>
- #include <sys/types.h>]], [[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);]])],[rsync_cv_have_sys_fallocate=yes],[rsync_cv_have_sys_fallocate=no])])
-diff --git a/fileio.c b/fileio.c
-index 70e079d..1e8a562 100644
---- a/fileio.c
-+++ b/fileio.c
-@@ -35,7 +35,10 @@
-
- extern int sparse_files;
-
-+OFF_T preallocated_len = 0;
-+
- static OFF_T sparse_seek = 0;
-+static OFF_T sparse_past_write = 0;
-
- int sparse_end(int f, OFF_T size)
- {
-@@ -63,8 +66,10 @@ int sparse_end(int f, OFF_T size)
- return ret;
- }
-
--
--static int write_sparse(int f, char *buf, int len)
-+/* Note that the offset is just the caller letting us know where
-+ * the current file position is in the file. The use_seek arg tells
-+ * us that we should seek over matching data instead of writing it. */
-+static int write_sparse(int f, int use_seek, OFF_T offset, const char *buf, int len)
- {
- int l1 = 0, l2 = 0;
- int ret;
-@@ -77,9 +82,24 @@ static int write_sparse(int f, char *buf, int len)
- if (l1 == len)
- return len;
-
-- if (sparse_seek)
-- do_lseek(f, sparse_seek, SEEK_CUR);
-+ if (sparse_seek) {
-+ if (sparse_past_write >= preallocated_len) {
-+ if (do_lseek(f, sparse_seek, SEEK_CUR) < 0)
-+ return -1;
-+ } else if (do_punch_hole(f, sparse_past_write, sparse_seek) < 0) {
-+ sparse_seek = 0;
-+ return -1;
-+ }
-+ }
- sparse_seek = l2;
-+ sparse_past_write = offset + len - l2;
-+
-+ if (use_seek) {
-+ /* The in-place data already matches. */
-+ if (do_lseek(f, len - (l1+l2), SEEK_CUR) < 0)
-+ return -1;
-+ return len;
-+ }
-
- while ((ret = write(f, buf + l1, len - (l1+l2))) <= 0) {
- if (ret < 0 && errno == EINTR)
-@@ -96,7 +116,6 @@ static int write_sparse(int f, char *buf, int len)
- return len;
- }
-
--
- static char *wf_writeBuf;
- static size_t wf_writeBufSize;
- static size_t wf_writeBufCnt;
-@@ -118,12 +137,10 @@ int flush_write_file(int f)
- return ret;
- }
-
--
--/*
-- * write_file does not allow incomplete writes. It loops internally
-- * until len bytes are written or errno is set.
-- */
--int write_file(int f, char *buf, int len)
-+/* write_file does not allow incomplete writes. It loops internally
-+ * until len bytes are written or errno is set. Note that use_seek and
-+ * offset are only used in sparse processing (see write_sparse()). */
-+int write_file(int f, int use_seek, OFF_T offset, const char *buf, int len)
- {
- int ret = 0;
-
-@@ -131,7 +148,8 @@ int write_file(int f, char *buf, int len)
- int r1;
- if (sparse_files > 0) {
- int len1 = MIN(len, SPARSE_WRITE_SIZE);
-- r1 = write_sparse(f, buf, len1);
-+ r1 = write_sparse(f, use_seek, offset, buf, len1);
-+ offset += r1;
- } else {
- if (!wf_writeBuf) {
- wf_writeBufSize = WRITE_SIZE * 8;
-@@ -164,6 +182,30 @@ int write_file(int f, char *buf, int len)
- return ret;
- }
-
-+/* An in-place update found identical data at an identical location. We either
-+ * just seek past it, or (for an in-place sparse update), we give the data to
-+ * the sparse processor with the use_seek flag set. */
-+int skip_matched(int fd, OFF_T offset, const char *buf, int len)
-+{
-+ OFF_T pos;
-+
-+ if (sparse_files > 0) {
-+ if (write_file(fd, 1, offset, buf, len) != len)
-+ return -1;
-+ return 0;
-+ }
-+
-+ if (flush_write_file(fd) < 0)
-+ return -1;
-+
-+ if ((pos = do_lseek(fd, len, SEEK_CUR)) != offset + len) {
-+ rsyserr(FERROR_XFER, errno, "lseek returned %s, not %s",
-+ big_num(pos), big_num(offset));
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-
- /* This provides functionality somewhat similar to mmap() but using read().
- * It gives sliding window access to a file. mmap() is not used because of
-@@ -271,7 +313,6 @@ char *map_ptr(struct map_struct *map, OFF_T offset, int32 len)
- return map->p + align_fudge;
- }
-
--
- int unmap_file(struct map_struct *map)
- {
- int ret;
-diff --git a/options.c b/options.c
-index 308443b..6ba13b7 100644
---- a/options.c
-+++ b/options.c
-@@ -714,7 +714,7 @@ void usage(enum logcode F)
- #ifdef SUPPORT_XATTRS
- rprintf(F," --fake-super store/recover privileged attrs using xattrs\n");
- #endif
-- rprintf(F," -S, --sparse handle sparse files efficiently\n");
-+ rprintf(F," -S, --sparse turn sequences of nulls into sparse blocks\n");
- #ifdef SUPPORT_PREALLOCATION
- rprintf(F," --preallocate allocate dest files before writing them\n");
- #else
-@@ -2237,14 +2237,6 @@ int parse_arguments(int *argc_p, const char ***argv_p)
- bwlimit_writemax = 512;
- }
-
-- if (sparse_files && inplace) {
-- /* Note: we don't check for this below, because --append is
-- * OK with --sparse (as long as redos are handled right). */
-- snprintf(err_buf, sizeof err_buf,
-- "--sparse cannot be used with --inplace\n");
-- return 0;
-- }
--
- if (append_mode) {
- if (whole_file > 0) {
- snprintf(err_buf, sizeof err_buf,
-diff --git a/receiver.c b/receiver.c
-index f9b97dd..bed5328 100644
---- a/receiver.c
-+++ b/receiver.c
-@@ -49,6 +49,7 @@ extern int sparse_files;
- extern int preallocate_files;
- extern int keep_partial;
- extern int checksum_seed;
-+extern int whole_file;
- extern int inplace;
- extern int allowed_lull;
- extern int delay_updates;
-@@ -61,6 +62,9 @@ extern char *basis_dir[MAX_BASIS_DIRS+1];
- extern char sender_file_sum[MAX_DIGEST_LEN];
- extern struct file_list *cur_flist, *first_flist, *dir_flist;
- extern filter_rule_list daemon_filter_list;
-+#ifdef SUPPORT_PREALLOCATION
-+extern OFF_T preallocated_len;
-+#endif
-
- static struct bitbag *delayed_bits = NULL;
- static int phase = 0, redoing = 0;
-@@ -241,22 +245,25 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- char *data;
- int32 i;
- char *map = NULL;
--#ifdef SUPPORT_PREALLOCATION
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
-- OFF_T preallocated_len = 0;
--#endif
-
-+#ifdef SUPPORT_PREALLOCATION
- if (preallocate_files && fd != -1 && total_size > 0 && (!inplace || total_size > size_r)) {
- /* Try to preallocate enough space for file's eventual length. Can
- * reduce fragmentation on filesystems like ext4, xfs, and NTFS. */
-- if (do_fallocate(fd, 0, total_size) == 0) {
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
-- preallocated_len = total_size;
--#endif
-- } else
-+ if ((preallocated_len = do_fallocate(fd, 0, total_size)) < 0)
- rsyserr(FWARNING, errno, "do_fallocate %s", full_fname(fname));
-- }
-+ } else
-+#endif
-+ if (inplace) {
-+#ifdef HAVE_FTRUNCATE
-+ /* The most compatible way to create a sparse file is to start with no length. */
-+ if (sparse_files > 0 && whole_file && fd >= 0 && do_ftruncate(fd, 0) == 0)
-+ preallocated_len = 0;
-+ else
- #endif
-+ preallocated_len = size_r;
-+ } else
-+ preallocated_len = 0;
-
- read_sum_head(f_in, &sum);
-
-@@ -318,7 +325,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
-
- sum_update(data, i);
-
-- if (fd != -1 && write_file(fd,data,i) != i)
-+ if (fd != -1 && write_file(fd, 0, offset, data, i) != i)
- goto report_write_error;
- offset += i;
- continue;
-@@ -348,37 +355,33 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
-
- if (updating_basis_or_equiv) {
- if (offset == offset2 && fd != -1) {
-- OFF_T pos;
-- if (flush_write_file(fd) < 0)
-+ if (skip_matched(fd, offset, map, len) < 0)
- goto report_write_error;
- offset += len;
-- if ((pos = do_lseek(fd, len, SEEK_CUR)) != offset) {
-- rsyserr(FERROR_XFER, errno,
-- "lseek of %s returned %s, not %s",
-- full_fname(fname),
-- big_num(pos), big_num(offset));
-- exit_cleanup(RERR_FILEIO);
-- }
- continue;
- }
- }
-- if (fd != -1 && map && write_file(fd, map, len) != (int)len)
-+ if (fd != -1 && map && write_file(fd, 0, offset, map, len) != (int)len)
- goto report_write_error;
- offset += len;
- }
-
-- if (flush_write_file(fd) < 0)
-- goto report_write_error;
-+ if (fd != -1 && offset > 0) {
-+ if (sparse_files > 0) {
-+ if (sparse_end(fd, offset) != 0)
-+ goto report_write_error;
-+ } else if (flush_write_file(fd) < 0) {
-+ report_write_error:
-+ rsyserr(FERROR_XFER, errno, "write failed on %s", full_fname(fname));
-+ exit_cleanup(RERR_FILEIO);
-+ }
-+ }
-
- #ifdef HAVE_FTRUNCATE
- /* inplace: New data could be shorter than old data.
- * preallocate_files: total_size could have been an overestimate.
- * Cut off any extra preallocated zeros from dest file. */
-- if ((inplace
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
-- || preallocated_len > offset
--#endif
-- ) && fd != -1 && do_ftruncate(fd, offset) < 0) {
-+ if ((inplace || preallocated_len > offset) && fd != -1 && do_ftruncate(fd, offset) < 0) {
- rsyserr(FERROR_XFER, errno, "ftruncate failed on %s",
- full_fname(fname));
- }
-@@ -387,13 +390,6 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- if (INFO_GTE(PROGRESS, 1))
- end_progress(total_size);
-
-- if (fd != -1 && offset > 0 && sparse_end(fd, offset) != 0) {
-- report_write_error:
-- rsyserr(FERROR_XFER, errno, "write failed on %s",
-- full_fname(fname));
-- exit_cleanup(RERR_FILEIO);
-- }
--
- checksum_len = sum_end(file_sum1);
-
- if (mapbuf)
-diff --git a/rsync.yo b/rsync.yo
-index bfe43b9..d1e6fdf 100644
---- a/rsync.yo
-+++ b/rsync.yo
-@@ -376,7 +376,7 @@ to the detailed description below for a complete description. verb(
- -J, --omit-link-times omit symlinks from --times
- --super receiver attempts super-user activities
- --fake-super store/recover privileged attrs using xattrs
-- -S, --sparse handle sparse files efficiently
-+ -S, --sparse turn sequences of nulls into sparse blocks
- --preallocate allocate dest files before writing
- -n, --dry-run perform a trial run with no changes made
- -W, --whole-file copy files whole (w/o delta-xfer algorithm)
-@@ -873,9 +873,7 @@ the same or longer than the size on the sender, the file is skipped. This
- does not interfere with the updating of a file's non-content attributes
- (e.g. permissions, ownership, etc.) when the file does not need to be
- transferred, nor does it affect the updating of any non-regular files.
--Implies bf(--inplace),
--but does not conflict with bf(--sparse) (since it is always extending a
--file's length).
-+Implies bf(--inplace).
-
- The use of bf(--append) can be dangerous if you aren't 100% sure that the files
- that are longer have only grown by the appending of data onto the end. You
-@@ -1252,20 +1250,30 @@ This option is overridden by both bf(--super) and bf(--no-super).
- See also the "fake super" setting in the daemon's rsyncd.conf file.
-
- dit(bf(-S, --sparse)) Try to handle sparse files efficiently so they take
--up less space on the destination. Conflicts with bf(--inplace) because it's
--not possible to overwrite data in a sparse fashion.
-+up less space on the destination. If combined with bf(--inplace) the
-+file created might not end up with sparse blocks with some combinations
-+of kernel version and/or filesystem type. If bf(--whole-file) is in
-+effect (e.g. for a local copy) then it will always work because rsync
-+truncates the file prior to writing out the updated version.
-+
-+Note that versions of rsync older than 3.1.3 will reject the combination of
-+bf(--sparse) and bf(--inplace).
-
- dit(bf(--preallocate)) This tells the receiver to allocate each destination
--file to its eventual size before writing data to the file. Rsync will only use
--the real filesystem-level preallocation support provided by Linux's
-+file to its eventual size before writing data to the file. Rsync will only
-+use the real filesystem-level preallocation support provided by Linux's
- bf(fallocate)(2) system call or Cygwin's bf(posix_fallocate)(3), not the slow
--glibc implementation that writes a zero byte into each block.
-+glibc implementation that writes a null byte into each block.
-
- Without this option, larger files may not be entirely contiguous on the
- filesystem, but with this option rsync will probably copy more slowly. If the
- destination is not an extent-supporting filesystem (such as ext4, xfs, NTFS,
- etc.), this option may have no positive effect at all.
-
-+If combined with bf(--sparse), the file will only have sparse blocks (as
-+opposed to allocated sequences of null bytes) if the kernel version and
-+filesystem type support creating holes in the allocated data.
-+
- dit(bf(-n, --dry-run)) This makes rsync perform a trial run that doesn't
- make any changes (and produces mostly the same output as a real run). It
- is most commonly used in combination with the bf(-v, --verbose) and/or
-diff --git a/syscall.c b/syscall.c
-index ecca2f1..fa53b63 100644
---- a/syscall.c
-+++ b/syscall.c
-@@ -38,6 +38,8 @@ extern int am_root;
- extern int am_sender;
- extern int read_only;
- extern int list_only;
-+extern int inplace;
-+extern int preallocate_files;
- extern int preserve_perms;
- extern int preserve_executability;
-
-@@ -423,27 +425,80 @@ int do_utime(const char *fname, time_t modtime, UNUSED(uint32 mod_nsec))
- #endif
-
- #ifdef SUPPORT_PREALLOCATION
--int do_fallocate(int fd, OFF_T offset, OFF_T length)
--{
- #ifdef FALLOC_FL_KEEP_SIZE
- #define DO_FALLOC_OPTIONS FALLOC_FL_KEEP_SIZE
- #else
- #define DO_FALLOC_OPTIONS 0
- #endif
-+
-+OFF_T do_fallocate(int fd, OFF_T offset, OFF_T length)
-+{
-+ int opts = inplace || preallocate_files ? 0 : DO_FALLOC_OPTIONS;
-+ int ret;
- RETURN_ERROR_IF(dry_run, 0);
- RETURN_ERROR_IF_RO_OR_LO;
-+ if (length & 1) /* make the length not match the desired length */
-+ length++;
-+ else
-+ length--;
- #if defined HAVE_FALLOCATE
-- return fallocate(fd, DO_FALLOC_OPTIONS, offset, length);
-+ ret = fallocate(fd, opts, offset, length);
- #elif defined HAVE_SYS_FALLOCATE
-- return syscall(SYS_fallocate, fd, DO_FALLOC_OPTIONS, (loff_t)offset, (loff_t)length);
-+ ret = syscall(SYS_fallocate, fd, opts, (loff_t)offset, (loff_t)length);
- #elif defined HAVE_EFFICIENT_POSIX_FALLOCATE
-- return posix_fallocate(fd, offset, length);
-+ ret = posix_fallocate(fd, offset, length);
- #else
- #error Coding error in SUPPORT_PREALLOCATION logic.
- #endif
-+ if (ret < 0)
-+ return ret;
-+ if (opts == 0) {
-+ STRUCT_STAT st;
-+ if (do_fstat(fd, &st) < 0)
-+ return length;
-+ return st.st_blocks * 512;
-+ }
-+ return 0;
- }
- #endif
-
-+/* Punch a hole at pos for len bytes. The current file position must be at pos and will be
-+ * changed to be at pos + len. */
-+int do_punch_hole(int fd, UNUSED(OFF_T pos), int len)
-+{
-+#ifdef HAVE_FALLOCATE
-+# ifdef HAVE_FALLOC_FL_PUNCH_HOLE
-+ if (fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, pos, len) == 0) {
-+ if (do_lseek(fd, len, SEEK_CUR) != pos + len)
-+ return -1;
-+ return 0;
-+ }
-+# endif
-+# ifdef HAVE_FALLOC_FL_ZERO_RANGE
-+ if (fallocate(fd, FALLOC_FL_ZERO_RANGE, pos, len) == 0) {
-+ if (do_lseek(fd, len, SEEK_CUR) != pos + len)
-+ return -1;
-+ return 0;
-+ }
-+# endif
-+#endif
-+ {
-+ char zeros[4096];
-+ memset(zeros, 0, sizeof zeros);
-+ while (len > 0) {
-+ int chunk = len > (int)sizeof zeros ? (int)sizeof zeros : len;
-+ int wrote = write(fd, zeros, chunk);
-+ if (wrote <= 0) {
-+ if (wrote < 0 && errno == EINTR)
-+ continue;
-+ return -1;
-+ }
-+ len -= wrote;
-+ }
-+ }
-+ return 0;
-+}
-+
- int do_open_nofollow(const char *pathname, int flags)
- {
- #ifndef O_NOFOLLOW
-diff --git a/t_stub.c b/t_stub.c
-index 26951a6..fc1ee3b 100644
---- a/t_stub.c
-+++ b/t_stub.c
-@@ -21,6 +21,7 @@
-
- #include "rsync.h"
-
-+int inplace = 0;
- int modify_window = 0;
- int preallocate_files = 0;
- int protect_args = 0;
-diff --git a/tls.c b/tls.c
-index 45d1e10..d5a2896 100644
---- a/tls.c
-+++ b/tls.c
-@@ -51,6 +51,8 @@ int link_owner = 0;
- int nsec_times = 0;
- int preserve_perms = 0;
- int preserve_executability = 0;
-+int preallocate_files = 0;
-+int inplace = 0;
-
- #ifdef SUPPORT_XATTRS
-
-diff --git a/trimslash.c b/trimslash.c
-index 207eaf2..5db6f3e 100644
---- a/trimslash.c
-+++ b/trimslash.c
-@@ -28,6 +28,8 @@ int read_only = 1;
- int list_only = 0;
- int preserve_perms = 0;
- int preserve_executability = 0;
-+int preallocate_files = 0;
-+int inplace = 0;
-
- int
- main(int argc, char **argv)
-diff --git a/util.c b/util.c
-index ca38f3e..49c5b71 100644
---- a/util.c
-+++ b/util.c
-@@ -323,9 +323,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
- int ifd;
- char buf[1024 * 8];
- int len; /* Number of bytes read into `buf'. */
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
-- OFF_T preallocated_len = 0, offset = 0;
--#endif
-+ OFF_T prealloc_len = 0, offset = 0;
-
- if ((ifd = do_open(source, O_RDONLY, 0)) < 0) {
- int save_errno = errno;
-@@ -365,11 +363,8 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
- if (do_fstat(ifd, &srcst) < 0)
- rsyserr(FWARNING, errno, "fstat %s", full_fname(source));
- else if (srcst.st_size > 0) {
-- if (do_fallocate(ofd, 0, srcst.st_size) == 0) {
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
-- preallocated_len = srcst.st_size;
--#endif
-- } else
-+ prealloc_len = do_fallocate(ofd, 0, srcst.st_size);
-+ if (prealloc_len < 0)
- rsyserr(FWARNING, errno, "do_fallocate %s", full_fname(dest));
- }
- }
-@@ -384,9 +379,7 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
- errno = save_errno;
- return -1;
- }
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
- offset += len;
--#endif
- }
-
- if (len < 0) {
-@@ -403,15 +396,13 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode)
- full_fname(source));
- }
-
--#ifdef PREALLOCATE_NEEDS_TRUNCATE
- /* Source file might have shrunk since we fstatted it.
- * Cut off any extra preallocated zeros from dest file. */
-- if (offset < preallocated_len && do_ftruncate(ofd, offset) < 0) {
-+ if (offset < prealloc_len && do_ftruncate(ofd, offset) < 0) {
- /* If we fail to truncate, the dest file may be wrong, so we
- * must trigger the "partial transfer" error. */
- rsyserr(FERROR_XFER, errno, "ftruncate %s", full_fname(dest));
- }
--#endif
-
- if (close(ofd) < 0) {
- int save_errno = errno;
+++ /dev/null
-commit e02b89d0d35ab8acbd522983c08d2519d8bd12d4
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Oct 29 14:33:44 2016 -0700
-
- We need a LF after filelist-progress with a CR.
- Fixes bug 12367.
-
-diff --git a/flist.c b/flist.c
-index acb95f7..4a9f4e6 100644
---- a/flist.c
-+++ b/flist.c
-@@ -156,7 +156,9 @@ static void start_filelist_progress(char *kind)
-
- static void emit_filelist_progress(int count)
- {
-+ output_needs_newline = 0; /* avoid a newline in the middle of this filelist-progress output */
- rprintf(FCLIENT, " %d files...\r", count);
-+ output_needs_newline = 1;
- }
-
- static void maybe_emit_filelist_progress(int count)
+++ /dev/null
-commit ff66fd4bb6cc76488c6ea1e4b651a869847f6375
-Author: Wayne Davison <wayned@samba.org>
-Date: Sat Oct 29 14:47:58 2016 -0700
-
- More fixes for --progress quirks.
-
- This patch avoids inconsistent evaluation of options in the
- show_filelist_p() function by turning it into a var. We
- also avoid setting "output_needs_newline" if --quiet was
- specified.
-
-diff --git a/flist.c b/flist.c
-index 4a9f4e6..54ced36 100644
---- a/flist.c
-+++ b/flist.c
-@@ -37,6 +37,7 @@ extern int checksum_type;
- extern int module_id;
- extern int ignore_errors;
- extern int numeric_ids;
-+extern int quiet;
- extern int recurse;
- extern int use_qsort;
- extern int xfer_dirs;
-@@ -128,6 +129,7 @@ static char tmp_sum[MAX_DIGEST_LEN];
-
- static char empty_sum[MAX_DIGEST_LEN];
- static int flist_count_offset; /* for --delete --progress */
-+static int show_filelist_progress;
-
- static void flist_sort_and_clean(struct file_list *flist, int strip_root);
- static void output_flist(struct file_list *flist);
-@@ -140,15 +142,14 @@ void init_flist(void)
- }
- parse_checksum_choice(); /* Sets checksum_type && xfersum_type */
- checksum_len = csum_len_for_type(checksum_type);
--}
-
--static int show_filelist_p(void)
--{
-- return INFO_GTE(FLIST, 1) && xfer_dirs && !am_server && !inc_recurse;
-+ show_filelist_progress = INFO_GTE(FLIST, 1) && xfer_dirs && !am_server && !inc_recurse;
- }
-
- static void start_filelist_progress(char *kind)
- {
-+ if (quiet)
-+ return;
- rprintf(FCLIENT, "%s ... ", kind);
- output_needs_newline = 1;
- rflush(FINFO);
-@@ -156,25 +157,28 @@ static void start_filelist_progress(char *kind)
-
- static void emit_filelist_progress(int count)
- {
-- output_needs_newline = 0; /* avoid a newline in the middle of this filelist-progress output */
-+ if (quiet)
-+ return;
-+ if (output_needs_newline == 2) /* avoid a newline in the middle of this filelist-progress output */
-+ output_needs_newline = 0;
- rprintf(FCLIENT, " %d files...\r", count);
-- output_needs_newline = 1;
-+ output_needs_newline = 2;
- }
-
- static void maybe_emit_filelist_progress(int count)
- {
-- if (INFO_GTE(FLIST, 2) && show_filelist_p() && (count % 100) == 0)
-+ if (INFO_GTE(FLIST, 2) && show_filelist_progress && (count % 100) == 0)
- emit_filelist_progress(count);
- }
-
- static void finish_filelist_progress(const struct file_list *flist)
- {
-+ output_needs_newline = 0;
- if (INFO_GTE(FLIST, 2)) {
- /* This overwrites the progress line */
- rprintf(FINFO, "%d file%sto consider\n",
- flist->used, flist->used == 1 ? " " : "s ");
- } else {
-- output_needs_newline = 0;
- rprintf(FINFO, "done\n");
- }
- }
-@@ -2089,7 +2093,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
- int implied_dot_dir = 0;
-
- rprintf(FLOG, "building file list\n");
-- if (show_filelist_p())
-+ if (show_filelist_progress)
- start_filelist_progress("building file list");
- else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server)
- rprintf(FCLIENT, "sending incremental file list\n");
-@@ -2363,7 +2367,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
- idev_destroy();
- #endif
-
-- if (show_filelist_p())
-+ if (show_filelist_progress)
- finish_filelist_progress(flist);
-
- gettimeofday(&end_tv, NULL);
-@@ -2445,7 +2449,7 @@ struct file_list *recv_file_list(int f, int dir_ndx)
- int64 start_read;
-
- if (!first_flist) {
-- if (show_filelist_p())
-+ if (show_filelist_progress)
- start_filelist_progress("receiving file list");
- else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server)
- rprintf(FCLIENT, "receiving incremental file list\n");
-@@ -2541,7 +2545,7 @@ struct file_list *recv_file_list(int f, int dir_ndx)
- if (DEBUG_GTE(FLIST, 2))
- rprintf(FINFO, "received %d names\n", flist->used);
-
-- if (show_filelist_p())
-+ if (show_filelist_progress)
- finish_filelist_progress(flist);
-
- if (need_unsorted_flist) {
-diff --git a/progress.c b/progress.c
-index 3858fc4..d19fa25 100644
---- a/progress.c
-+++ b/progress.c
-@@ -25,6 +25,7 @@
-
- extern int am_server;
- extern int flist_eof;
-+extern int quiet;
- extern int need_unsorted_flist;
- extern int output_needs_newline;
- extern struct stats stats;
-@@ -127,7 +128,7 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now,
- pct = ofs == size ? 100 : (int) (100.0 * ofs / size);
- rprintf(FCLIENT, "\r%15s %3d%% %7.2f%s %s%s",
- human_num(ofs), pct, rate, units, rembuf, eol);
-- if (!is_last) {
-+ if (!is_last && !quiet) {
- output_needs_newline = 1;
- rflush(FCLIENT);
- }
+++ /dev/null
-commit 7b8a4ecd6ff9cdf4e5d3850ebf822f1e989255b3
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Oct 24 15:40:37 2017 -0700
-
- Handle archaic checksums properly.
-
-diff --git a/checksum.c b/checksum.c
-index 8b38833..9382694 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -27,7 +27,7 @@ extern int proper_seed_order;
- extern char *checksum_choice;
-
- #define CSUM_NONE 0
--#define CSUM_ARCHAIC 1
-+#define CSUM_MD4_ARCHAIC 1
- #define CSUM_MD4_BUSTED 2
- #define CSUM_MD4_OLD 3
- #define CSUM_MD4 4
-@@ -60,7 +60,7 @@ int parse_csum_name(const char *name, int len)
- return CSUM_MD4_OLD;
- if (protocol_version >= 21)
- return CSUM_MD4_BUSTED;
-- return CSUM_ARCHAIC;
-+ return CSUM_MD4_ARCHAIC;
- }
- if (len == 3 && strncasecmp(name, "md4", 3) == 0)
- return CSUM_MD4;
-@@ -78,7 +78,7 @@ int csum_len_for_type(int cst)
- switch (cst) {
- case CSUM_NONE:
- return 1;
-- case CSUM_ARCHAIC:
-+ case CSUM_MD4_ARCHAIC:
- return 2;
- case CSUM_MD4:
- case CSUM_MD4_OLD:
-@@ -143,7 +143,8 @@ void get_checksum2(char *buf, int32 len, char *sum)
- }
- case CSUM_MD4:
- case CSUM_MD4_OLD:
-- case CSUM_MD4_BUSTED: {
-+ case CSUM_MD4_BUSTED:
-+ case CSUM_MD4_ARCHAIC: {
- int32 i;
- static char *buf1;
- static int32 len1;
-@@ -174,7 +175,7 @@ void get_checksum2(char *buf, int32 len, char *sum)
- * are multiples of 64. This is fixed by calling mdfour_update()
- * even when there are no more bytes.
- */
-- if (len - i > 0 || xfersum_type != CSUM_MD4_BUSTED)
-+ if (len - i > 0 || xfersum_type > CSUM_MD4_BUSTED)
- mdfour_update(&m, (uchar *)(buf1+i), len-i);
-
- mdfour_result(&m, (uchar *)sum);
-@@ -217,6 +218,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
- case CSUM_MD4:
- case CSUM_MD4_OLD:
- case CSUM_MD4_BUSTED:
-+ case CSUM_MD4_ARCHAIC:
- mdfour_begin(&m);
-
- for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
-@@ -229,7 +231,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
- * are multiples of 64. This is fixed by calling mdfour_update()
- * even when there are no more bytes. */
- remainder = (int32)(len - i);
-- if (remainder > 0 || checksum_type != CSUM_MD4_BUSTED)
-+ if (remainder > 0 || checksum_type > CSUM_MD4_BUSTED)
- mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
-
- mdfour_result(&m, (uchar *)sum);
-@@ -265,6 +267,7 @@ void sum_init(int csum_type, int seed)
- break;
- case CSUM_MD4_OLD:
- case CSUM_MD4_BUSTED:
-+ case CSUM_MD4_ARCHAIC:
- mdfour_begin(&md);
- sumresidue = 0;
- SIVAL(s, 0, seed);
-@@ -321,6 +324,10 @@ void sum_update(const char *p, int32 len)
- }
- }
-
-+/* NOTE: all the callers of sum_end() pass in a pointer to a buffer that is
-+ * MAX_DIGEST_LEN in size, so even if the csum-len is shorter that that (i.e.
-+ * CSUM_MD4_ARCHAIC), we don't have to worry about limiting the data we write
-+ * into the "sum" buffer. */
- int sum_end(char *sum)
- {
- switch (cursum_type) {
-@@ -333,6 +340,7 @@ int sum_end(char *sum)
- mdfour_result(&md, (uchar *)sum);
- break;
- case CSUM_MD4_BUSTED:
-+ case CSUM_MD4_ARCHAIC:
- if (sumresidue)
- mdfour_update(&md, (uchar *)md.buffer, sumresidue);
- mdfour_result(&md, (uchar *)sum);
+++ /dev/null
-commit c252546ceeb0925eb8a4061315e3ff0a8c55b48b
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Oct 24 20:42:41 2017 -0700
-
- Don't forget to tweak sum_update().
-
-diff --git a/checksum.c b/checksum.c
-index 9382694..c119f97 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -295,6 +295,7 @@ void sum_update(const char *p, int32 len)
- case CSUM_MD4:
- case CSUM_MD4_OLD:
- case CSUM_MD4_BUSTED:
-+ case CSUM_MD4_ARCHAIC:
- if (len + sumresidue < CSUM_CHUNK) {
- memcpy(md.buffer + sumresidue, p, len);
- sumresidue += len;
+++ /dev/null
-commit 9a480deec4d20277d8e20bc55515ef0640ca1e55
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Oct 24 20:44:37 2017 -0700
-
- Only allow a modern checksum method for passwords.
-
-diff --git a/authenticate.c b/authenticate.c
-index d60ee20..a106b0f 100644
---- a/authenticate.c
-+++ b/authenticate.c
-@@ -22,6 +22,7 @@
- #include "itypes.h"
-
- extern int read_only;
-+extern int protocol_version;
- extern char *password_file;
-
- /***************************************************************************
-@@ -237,6 +238,11 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
- if (!users || !*users)
- return "";
-
-+ if (protocol_version < 21) { /* Don't allow a weak checksum for the password. */
-+ rprintf(FERROR, "ERROR: protocol version is too old!\n");
-+ exit_cleanup(RERR_PROTOCOL);
-+ }
-+
- gen_challenge(addr, challenge);
-
- io_printf(f_out, "%s%s\n", leader, challenge);
+++ /dev/null
-commit bc112b0e7feece62ce98708092306639a8a53cce
-Author: Wayne Davison <wayned@samba.org>
-Date: Mon Oct 30 09:11:16 2017 -0700
-
- Use full MD4 len for archaic protocol auth.
-
-diff --git a/authenticate.c b/authenticate.c
-index a106b0f..519429d 100644
---- a/authenticate.c
-+++ b/authenticate.c
-@@ -22,7 +22,6 @@
- #include "itypes.h"
-
- extern int read_only;
--extern int protocol_version;
- extern char *password_file;
-
- /***************************************************************************
-@@ -75,6 +74,8 @@ static void gen_challenge(const char *addr, char *challenge)
- sum_init(-1, 0);
- sum_update(input, sizeof input);
- len = sum_end(digest);
-+ if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
-+ len = MD4_DIGEST_LEN;
-
- base64_encode(digest, len, challenge, 0);
- }
-@@ -90,6 +91,8 @@ static void generate_hash(const char *in, const char *challenge, char *out)
- sum_update(in, strlen(in));
- sum_update(challenge, strlen(challenge));
- len = sum_end(buf);
-+ if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
-+ len = MD4_DIGEST_LEN;
-
- base64_encode(buf, len, out, 0);
- }
-@@ -238,11 +241,6 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
- if (!users || !*users)
- return "";
-
-- if (protocol_version < 21) { /* Don't allow a weak checksum for the password. */
-- rprintf(FERROR, "ERROR: protocol version is too old!\n");
-- exit_cleanup(RERR_PROTOCOL);
-- }
--
- gen_challenge(addr, challenge);
-
- io_printf(f_out, "%s%s\n", leader, challenge);
-diff --git a/checksum.c b/checksum.c
-index c119f97..741ad7d 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -86,6 +86,8 @@ int csum_len_for_type(int cst)
- return MD4_DIGEST_LEN;
- case CSUM_MD5:
- return MD5_DIGEST_LEN;
-+ default: /* paranoia to prevent missing case values */
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
- return 0;
- }
-@@ -181,6 +183,8 @@ void get_checksum2(char *buf, int32 len, char *sum)
- mdfour_result(&m, (uchar *)sum);
- break;
- }
-+ default: /* paranoia to prevent missing case values */
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
- }
-
-@@ -275,6 +279,8 @@ void sum_init(int csum_type, int seed)
- break;
- case CSUM_NONE:
- break;
-+ default: /* paranoia to prevent missing case values */
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
- }
-
-@@ -322,6 +328,8 @@ void sum_update(const char *p, int32 len)
- break;
- case CSUM_NONE:
- break;
-+ default: /* paranoia to prevent missing case values */
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
- }
-
-@@ -349,6 +357,8 @@ int sum_end(char *sum)
- case CSUM_NONE:
- *sum = '\0';
- break;
-+ default: /* paranoia to prevent missing case values */
-+ exit_cleanup(RERR_UNSUPPORTED);
- }
-
- return csum_len_for_type(cursum_type);
+++ /dev/null
-commit 47a63d90e71d3e19e0e96052bb8c6b9cb140ecc1
-Author: Wayne Davison <wayned@samba.org>
-Date: Sun Nov 5 11:33:15 2017 -0800
-
- Enforce trailing \0 when receiving xattr name values.
- Fixes bug 13112.
-
-diff --git a/xattrs.c b/xattrs.c
-index 68305d7..4867e6f 100644
---- a/xattrs.c
-+++ b/xattrs.c
-@@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
- out_of_memory("receive_xattr");
- name = ptr + dget_len + extra_len;
- read_buf(f, name, name_len);
-+ if (name_len < 1 || name[name_len-1] != '\0') {
-+ rprintf(FERROR, "Invalid xattr name received (missing trailing \\0).\n");
-+ exit_cleanup(RERR_FILEIO);
-+ }
- if (dget_len == datum_len)
- read_buf(f, ptr, dget_len);
- else {
+++ /dev/null
-commit 416e719bea4f5466c8dd2b34cac0059b6ff84ff3
-Author: Wayne Davison <wayned@samba.org>
-Date: Tue Nov 7 14:01:13 2017 -0800
-
- More archaic-checksum improvements. This makes the len vars clearer
- and ensures that only the flist code gets the 2-byte digest len.
-
-diff --git a/authenticate.c b/authenticate.c
-index 519429d..d60ee20 100644
---- a/authenticate.c
-+++ b/authenticate.c
-@@ -74,8 +74,6 @@ static void gen_challenge(const char *addr, char *challenge)
- sum_init(-1, 0);
- sum_update(input, sizeof input);
- len = sum_end(digest);
-- if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
-- len = MD4_DIGEST_LEN;
-
- base64_encode(digest, len, challenge, 0);
- }
-@@ -91,8 +89,6 @@ static void generate_hash(const char *in, const char *challenge, char *out)
- sum_update(in, strlen(in));
- sum_update(challenge, strlen(challenge));
- len = sum_end(buf);
-- if (len == 2) /* The archaic checksum is 2 bytes, but sum_end() filled in the full MD4 checksum for us. */
-- len = MD4_DIGEST_LEN;
-
- base64_encode(buf, len, out, 0);
- }
-diff --git a/checksum.c b/checksum.c
-index 741ad7d..4c9351c 100644
---- a/checksum.c
-+++ b/checksum.c
-@@ -73,13 +73,15 @@ int parse_csum_name(const char *name, int len)
- exit_cleanup(RERR_UNSUPPORTED);
- }
-
--int csum_len_for_type(int cst)
-+int csum_len_for_type(int cst, int flist_csum)
- {
- switch (cst) {
- case CSUM_NONE:
- return 1;
- case CSUM_MD4_ARCHAIC:
-- return 2;
-+ /* The oldest checksum code is rather weird: the file-list code only sent
-+ * 2-byte checksums, but all other checksums were full MD4 length. */
-+ return flist_csum ? 2 : MD4_DIGEST_LEN;
- case CSUM_MD4:
- case CSUM_MD4_OLD:
- case CSUM_MD4_BUSTED:
-@@ -361,5 +363,5 @@ int sum_end(char *sum)
- exit_cleanup(RERR_UNSUPPORTED);
- }
-
-- return csum_len_for_type(cursum_type);
-+ return csum_len_for_type(cursum_type, 0);
- }
-diff --git a/flist.c b/flist.c
-index 24b3506..bedba63 100644
---- a/flist.c
-+++ b/flist.c
-@@ -91,7 +91,7 @@ extern iconv_t ic_send, ic_recv;
- #define PTR_SIZE (sizeof (struct file_struct *))
-
- int io_error;
--int checksum_len;
-+int flist_csum_len;
- dev_t filesystem_dev; /* used to implement -x */
-
- struct file_list *cur_flist, *first_flist, *dir_flist;
-@@ -141,7 +141,7 @@ void init_flist(void)
- (int)FILE_STRUCT_LEN, (int)EXTRA_LEN);
- }
- parse_checksum_choice(); /* Sets checksum_type && xfersum_type */
-- checksum_len = csum_len_for_type(checksum_type);
-+ flist_csum_len = csum_len_for_type(checksum_type, 1);
-
- show_filelist_progress = INFO_GTE(FLIST, 1) && xfer_dirs && !am_server && !inc_recurse;
- }
-@@ -638,7 +638,7 @@ static void send_file_entry(int f, const char *fname, struct file_struct *file,
- /* Prior to 28, we sent a useless set of nulls. */
- sum = empty_sum;
- }
-- write_buf(f, sum, checksum_len);
-+ write_buf(f, sum, flist_csum_len);
- }
-
- #ifdef SUPPORT_HARD_LINKS
-@@ -1094,9 +1094,9 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x
- }
- if (first_hlink_ndx >= flist->ndx_start) {
- struct file_struct *first = flist->files[first_hlink_ndx - flist->ndx_start];
-- memcpy(bp, F_SUM(first), checksum_len);
-+ memcpy(bp, F_SUM(first), flist_csum_len);
- } else
-- read_buf(f, bp, checksum_len);
-+ read_buf(f, bp, flist_csum_len);
- }
-
- #ifdef SUPPORT_ACLS
-@@ -1384,7 +1384,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
- }
-
- if (sender_keeps_checksum && S_ISREG(st.st_mode))
-- memcpy(F_SUM(file), tmp_sum, checksum_len);
-+ memcpy(F_SUM(file), tmp_sum, flist_csum_len);
-
- if (unsort_ndx)
- F_NDX(file) = stats.num_dirs;
-diff --git a/generator.c b/generator.c
-index af2e290..3d65839 100644
---- a/generator.c
-+++ b/generator.c
-@@ -74,7 +74,7 @@ extern int protocol_version;
- extern int file_total;
- extern int fuzzy_basis;
- extern int always_checksum;
--extern int checksum_len;
-+extern int flist_csum_len;
- extern char *partial_dir;
- extern int compare_dest;
- extern int copy_dest;
-@@ -583,7 +583,7 @@ int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
- if (always_checksum > 0 && S_ISREG(st->st_mode)) {
- char sum[MAX_DIGEST_LEN];
- file_checksum(fn, st, sum);
-- return memcmp(sum, F_SUM(file), checksum_len) == 0;
-+ return memcmp(sum, F_SUM(file), flist_csum_len) == 0;
- }
-
- if (size_only > 0)
-diff --git a/log.c b/log.c
-index b145ee1..7b23a2c 100644
---- a/log.c
-+++ b/log.c
-@@ -673,14 +673,15 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
- n = NULL;
- if (S_ISREG(file->mode)) {
- if (always_checksum && canonical_checksum(checksum_type))
-- n = sum_as_hex(checksum_type, F_SUM(file));
-+ n = sum_as_hex(checksum_type, F_SUM(file), 1);
- else if (iflags & ITEM_TRANSFER && canonical_checksum(xfersum_type))
-- n = sum_as_hex(xfersum_type, sender_file_sum);
-+ n = sum_as_hex(xfersum_type, sender_file_sum, 0);
- }
- if (!n) {
-- int checksum_len = csum_len_for_type(always_checksum ? checksum_type : xfersum_type);
-- memset(buf2, ' ', checksum_len*2);
-- buf2[checksum_len*2] = '\0';
-+ int sum_len = csum_len_for_type(always_checksum ? checksum_type : xfersum_type,
-+ always_checksum);
-+ memset(buf2, ' ', sum_len*2);
-+ buf2[sum_len*2] = '\0';
- n = buf2;
- }
- break;
-diff --git a/match.c b/match.c
-index ff10310..280038b 100644
---- a/match.c
-+++ b/match.c
-@@ -360,7 +360,7 @@ static void hash_search(int f,struct sum_struct *s,
- **/
- void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
- {
-- int checksum_len;
-+ int sum_len;
-
- last_match = 0;
- false_alarms = 0;
-@@ -409,22 +409,22 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)
- matched(f, s, buf, len, -1);
- }
-
-- checksum_len = sum_end(sender_file_sum);
-+ sum_len = sum_end(sender_file_sum);
-
- /* If we had a read error, send a bad checksum. We use all bits
- * off as long as the checksum doesn't happen to be that, in
- * which case we turn the last 0 bit into a 1. */
- if (buf && buf->status != 0) {
- int i;
-- for (i = 0; i < checksum_len && sender_file_sum[i] == 0; i++) {}
-- memset(sender_file_sum, 0, checksum_len);
-- if (i == checksum_len)
-+ for (i = 0; i < sum_len && sender_file_sum[i] == 0; i++) {}
-+ memset(sender_file_sum, 0, sum_len);
-+ if (i == sum_len)
- sender_file_sum[i-1]++;
- }
-
- if (DEBUG_GTE(DELTASUM, 2))
- rprintf(FINFO,"sending file_sum\n");
-- write_buf(f, sender_file_sum, checksum_len);
-+ write_buf(f, sender_file_sum, sum_len);
-
- if (DEBUG_GTE(DELTASUM, 2)) {
- rprintf(FINFO, "false_alarms=%d hash_hits=%d matches=%d\n",
-diff --git a/receiver.c b/receiver.c
-index 3d9bc65..baae3a9 100644
---- a/receiver.c
-+++ b/receiver.c
-@@ -236,7 +236,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- static char file_sum1[MAX_DIGEST_LEN];
- struct map_struct *mapbuf;
- struct sum_struct sum;
-- int checksum_len;
-+ int sum_len;
- int32 len;
- OFF_T offset = 0;
- OFF_T offset2;
-@@ -388,15 +388,15 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
- if (INFO_GTE(PROGRESS, 1))
- end_progress(total_size);
-
-- checksum_len = sum_end(file_sum1);
-+ sum_len = sum_end(file_sum1);
-
- if (mapbuf)
- unmap_file(mapbuf);
-
-- read_buf(f_in, sender_file_sum, checksum_len);
-+ read_buf(f_in, sender_file_sum, sum_len);
- if (DEBUG_GTE(DELTASUM, 2))
- rprintf(FINFO,"got file_sum\n");
-- if (fd != -1 && memcmp(file_sum1, sender_file_sum, checksum_len) != 0)
-+ if (fd != -1 && memcmp(file_sum1, sender_file_sum, sum_len) != 0)
- return 0;
- return 1;
- }
-diff --git a/t_stub.c b/t_stub.c
-index fc1ee3b..0c49d9c 100644
---- a/t_stub.c
-+++ b/t_stub.c
-@@ -98,7 +98,7 @@ filter_rule_list daemon_filter_list;
- return "tester";
- }
-
-- int csum_len_for_type(int cst)
-+ int csum_len_for_type(int cst, int flg)
- {
-- return cst ? 16 : 1;
-+ return cst || !flg ? 16 : 1;
- }
-diff --git a/util2.c b/util2.c
-index a892e51..b1adf81 100644
---- a/util2.c
-+++ b/util2.c
-@@ -77,18 +77,18 @@ void *_realloc_array(void *ptr, unsigned int size, size_t num)
- return realloc(ptr, size * num);
- }
-
--const char *sum_as_hex(int csum_type, const char *sum)
-+const char *sum_as_hex(int csum_type, const char *sum, int flist_csum)
- {
- static char buf[MAX_DIGEST_LEN*2+1];
- int i, x1, x2;
-- int checksum_len = csum_len_for_type(csum_type);
-- char *c = buf + checksum_len*2;
-+ int sum_len = csum_len_for_type(csum_type, flist_csum);
-+ char *c = buf + sum_len*2;
-
- assert(c - buf < (int)sizeof buf);
-
- *c = '\0';
-
-- for (i = checksum_len; --i >= 0; ) {
-+ for (i = sum_len; --i >= 0; ) {
- x1 = CVAL(sum, i);
- x2 = x1 >> 4;
- x1 &= 0xF;
+++ /dev/null
-commit 3e06d40029cfdce9d0f73d87cfd4edaf54be9c51
-Author: Jeriko One <jeriko.one@gmx.us>
-Date: Thu Nov 2 23:44:19 2017 -0700
-
- Check fname in recv_files sooner.
-
-diff --git a/receiver.c b/receiver.c
-index baae3a9..9fdafa1 100644
---- a/receiver.c
-+++ b/receiver.c
-@@ -574,6 +574,12 @@ int recv_files(int f_in, int f_out, char *local_name)
- file = dir_flist->files[cur_flist->parent_ndx];
- fname = local_name ? local_name : f_name(file, fbuf);
-
-+ if (daemon_filter_list.head
-+ && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
-+ rprintf(FERROR, "attempt to hack rsync failed.\n");
-+ exit_cleanup(RERR_PROTOCOL);
-+ }
-+
- if (DEBUG_GTE(RECV, 1))
- rprintf(FINFO, "recv_files(%s)\n", fname);
-
-@@ -645,12 +651,6 @@ int recv_files(int f_in, int f_out, char *local_name)
-
- cleanup_got_literal = 0;
-
-- if (daemon_filter_list.head
-- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
-- rprintf(FERROR, "attempt to hack rsync failed.\n");
-- exit_cleanup(RERR_PROTOCOL);
-- }
--
- if (read_batch) {
- int wanted = redoing
- ? we_want_redo(ndx)
+++ /dev/null
-commit 5509597decdbd7b91994210f700329d8a35e70a1
-Author: Jeriko One <jeriko.one@gmx.us>
-Date: Thu Nov 16 17:26:03 2017 -0800
-
- Check daemon filter against fnamecmp in recv_files().
-
-diff --git a/receiver.c b/receiver.c
-index 9fdafa1..9c46242 100644
---- a/receiver.c
-+++ b/receiver.c
-@@ -722,7 +722,7 @@ int recv_files(int f_in, int f_out, char *local_name)
- break;
- }
- if (!fnamecmp || (daemon_filter_list.head
-- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0)) {
-+ && check_filter(&daemon_filter_list, FLOG, fnamecmp, 0) < 0)) {
- fnamecmp = fname;
- fnamecmp_type = FNAMECMP_FNAME;
- }
+++ /dev/null
-commit 70aeb5fddd1b2f8e143276f8d5a085db16c593b9
-Author: Jeriko One <jeriko.one@gmx.us>
-Date: Thu Nov 16 17:05:42 2017 -0800
-
- Sanitize xname in read_ndx_and_attrs.
-
-diff --git a/rsync.c b/rsync.c
-index b82e598..a0945ba 100644
---- a/rsync.c
-+++ b/rsync.c
-@@ -49,6 +49,7 @@ extern int flist_eof;
- extern int file_old_total;
- extern int keep_dirlinks;
- extern int make_backups;
-+extern int sanitize_paths;
- extern struct file_list *cur_flist, *first_flist, *dir_flist;
- extern struct chmod_mode_struct *daemon_chmod_modes;
- #ifdef ICONV_OPTION
-@@ -396,6 +397,11 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
- if (iflags & ITEM_XNAME_FOLLOWS) {
- if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0)
- exit_cleanup(RERR_PROTOCOL);
-+
-+ if (sanitize_paths) {
-+ sanitize_path(buf, buf, "", 0, SP_DEFAULT);
-+ len = strlen(buf);
-+ }
- } else {
- *buf = '\0';
- len = -1;
PKG_HASH:=8972c02e39a826a10c02c2bdd5025f7251dce9589c57befd9bb55c65f02e4934
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/scapy
SECTION:=net
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/seafile-ccnet
SECTION:=net
PKG_MIRROR_HASH:=511500c40dd7b1009f77109c6df810df1cf2c17a84a8f6841d592a9e05d22064
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/seafile-seahub
SECTION:=net
+++ seafile-seahub-6.2.2/Makefile 2017-10-22 22:46:18.007470936 +0200
@@ -1,3 +1,6 @@
+include $(TOPDIR)/rules.mk
-+$(call include_mk, python-package.mk)
++include $(TOPDIR)/feeds/packages/lang/python/python-package.mk
+
PROJECT=seahub
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
-$(call include_mk, python-package.mk)
+include ../../lang/python/python-package.mk
define Package/seafile-server
SECTION:=net
PKG_NAME:=ser2net
PKG_VERSION:=3.5
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/ser2net
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ser2net $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc
- $(INSTALL_CONF) $(PKG_BUILD_DIR)/ser2net.conf $(1)/etc/
+ $(INSTALL_CONF) ./files/ser2net.conf $(1)/etc/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/ser2net.config $(1)/etc/config/ser2net
-config global
+config ser2net global
option enabled 1
config controlport
config_load ser2net
- config_get_bool enabled ser2net enabled 0
+ config_get_bool enabled global enabled 0
[ "$enabled" -gt 0 ] || return 0
cat "$STATICCFGFILE" - 2>/dev/null <<-EOF > "$DYNAMICCFGFILE"
# - check if default mode has changed from being tcp_only
#
PKG_NAME:=shadowsocks-libev
-PKG_VERSION:=3.1.2
+PKG_VERSION:=3.1.3
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$(PKG_VERSION)
-PKG_HASH:=3611f09793af923d988ecbd15ad89fb66839e51a0059685d8f88c0131658e4a7
+PKG_HASH:=58fb438d2cfe33cfa6ac8c50e587e2138c50e59a4b943f88d22883bf2e192a96
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
}
ss_mkjson_ss_redir_conf() {
- ss_mkjson_server_conf || return 1
- [ "$disable_sni" = 0 ] && disable_sni=false || disable_sni=true
- cat <<-EOF
- "disable_sni": $disable_sni,
- EOF
+ ss_mkjson_server_conf
}
ss_mkjson_ss_server_conf() {
}
validate_server_section() {
- validate_common_server_options_ server "$1" "${2}"
+ validate_common_server_options_ server "$1" "$2"
}
validate_ss_local_section() {
- validate_common_client_options_ ss_local "$1" "${2}"
+ validate_common_client_options_ ss_local "$1" "$2"
}
validate_ss_redir_section() {
- validate_common_client_options_ ss_redir "$1" \
- "${2}" \
- 'disable_sni:bool:0'
+ validate_common_client_options_ ss_redir "$1" "$2"
}
validate_ss_rules_section() {
validate_ss_server_section() {
validate_common_server_options_ ss_server "$1" \
validate_common_options_ \
- "${2}" \
+ "$2" \
'bind_address:ipaddr'
}
validate_ss_tunnel_section() {
validate_common_client_options_ ss_tunnel "$1" \
- "${2}" \
+ "$2" \
'tunnel_address:regex(".+\:[0-9]+")'
}
include $(TOPDIR)/rules.mk
PKG_NAME:=shorewall-core
-PKG_MAJOR_MINOR_VERSION:=5.1
-PKG_BUGFIX_MAJOR_VERSION:=10
-PKG_BUGFIX_MINOR_VERSION:=.2
+PKG_MAJOR_MINOR_VERSION:=5.2
+PKG_BUGFIX_MAJOR_VERSION:=0
+PKG_BUGFIX_MINOR_VERSION:=.1
PKG_VERSION:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)$(PKG_BUGFIX_MINOR_VERSION)
PKG_DIRECTORY:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)
PKG_RELEASE:=1
http://shorewall.de/pub/shorewall/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/ \
http://www.shorewall.com.au/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=33d43545b430ba48166b89ca32e375f0afc7cfafa4d4cfb020520ac4b64c400a
+PKG_HASH:=5913e3f8e2b2d38cef1669d0add21720cc72bcf8bc275c765eb1f50896a97b87
PKG_MAINTAINER:=Willem van den Akker <wvdakker@wilsoft.nl>
PKG_LICENSE:=GPL-2.0+
include $(TOPDIR)/rules.mk
PKG_NAME:=shorewall-lite
-PKG_MAJOR_MINOR_VERSION:=5.1
-PKG_BUGFIX_MAJOR_VERSION:=10
-PKG_BUGFIX_MINOR_VERSION:=.2
+PKG_MAJOR_MINOR_VERSION:=5.2
+PKG_BUGFIX_MAJOR_VERSION:=0
+PKG_BUGFIX_MINOR_VERSION:=.1
PKG_VERSION:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)$(PKG_BUGFIX_MINOR_VERSION)
PKG_DIRECTORY:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)
PKG_RELEASE:=1
http://shorewall.de/pub/shorewall/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/ \
http://www.shorewall.com.au/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=d368209804fb339a7085e220049c9cc7a683c9af657c71cefe3a13423e955498
+PKG_HASH:=4a7f931868456b32fa69b6c851e4401a0bda60e4e0091773ac711da953116f6b
PKG_MAINTAINER:=Willem van den Akker <wvdakker@wilsoft.nl>
PKG_LICENSE:=GPL-2.0+
include $(TOPDIR)/rules.mk
PKG_NAME:=shorewall
-PKG_MAJOR_MINOR_VERSION:=5.1
-PKG_BUGFIX_MAJOR_VERSION:=10
-PKG_BUGFIX_MINOR_VERSION:=.2
+PKG_MAJOR_MINOR_VERSION:=5.2
+PKG_BUGFIX_MAJOR_VERSION:=0
+PKG_BUGFIX_MINOR_VERSION:=.1
PKG_VERSION:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)$(PKG_BUGFIX_MINOR_VERSION)
PKG_DIRECTORY:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)
PKG_RELEASE:=1
http://shorewall.de/pub/shorewall/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/ \
http://www.shorewall.com.au/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=c38e7894c0db663233e5ab6d2cf21951fe373bdcbc778ba19c5be20c2c7ef95d
+PKG_HASH:=a2e962e0eb898cc50fc711763f72639bfa8589abdc95a81e20e4bee8a228cd1d
PKG_MAINTAINER:=Willem van den Akker <wvdakker@wilsoft.nl>
PKG_LICENSE:=GPL-2.0+
include $(TOPDIR)/rules.mk
PKG_NAME:=shorewall6-lite
-PKG_MAJOR_MINOR_VERSION:=5.1
-PKG_BUGFIX_MAJOR_VERSION:=10
-PKG_BUGFIX_MINOR_VERSION:=.2
+PKG_MAJOR_MINOR_VERSION:=5.2
+PKG_BUGFIX_MAJOR_VERSION:=0
+PKG_BUGFIX_MINOR_VERSION:=.1
PKG_VERSION:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)$(PKG_BUGFIX_MINOR_VERSION)
PKG_DIRECTORY:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)
PKG_RELEASE:=1
http://shorewall.de/pub/shorewall/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/ \
http://www.shorewall.com.au/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=7971f8d906122f65ac59a782051a137d0be5f6288ed06e0fd773fb95e95d37c4
+PKG_HASH:=1ff0f4e264afa75034e5fb94878339367a442f7da55b5fc61ed70dd1fd4f6027
PKG_MAINTAINER:=Willem van den Akker <wvdakker@wilsoft.nl>
PKG_LICENSE:=GPL-2.0+
include $(TOPDIR)/rules.mk
PKG_NAME:=shorewall6
-PKG_MAJOR_MINOR_VERSION:=5.1
-PKG_BUGFIX_MAJOR_VERSION:=10
-PKG_BUGFIX_MINOR_VERSION:=.2
+PKG_MAJOR_MINOR_VERSION:=5.2
+PKG_BUGFIX_MAJOR_VERSION:=0
+PKG_BUGFIX_MINOR_VERSION:=.1
PKG_VERSION:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)$(PKG_BUGFIX_MINOR_VERSION)
PKG_DIRECTORY:=$(PKG_MAJOR_MINOR_VERSION).$(PKG_BUGFIX_MAJOR_VERSION)
PKG_RELEASE:=1
http://shorewall.de/pub/shorewall/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/ \
http://www.shorewall.com.au/$(PKG_MAJOR_MINOR_VERSION)/shorewall-$(PKG_DIRECTORY)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=f86937c117346d7dbd1a1e7410cf45189a93ec7cd3f6fb5d0419b3e398b681df
+PKG_HASH:=29cab053cbb2e800d117805135be4158b75fbe08be964da2a14bf34ed3aada17
PKG_MAINTAINER:=Willem van den Akker <wvdakker@wilsoft.nl>
PKG_LICENSE:=GPL-2.0+
include $(TOPDIR)/rules.mk
PKG_NAME:=simple-adblock
-PKG_VERSION:=1.5.7
-PKG_RELEASE:=10
+PKG_VERSION:=1.5.8
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
$(INSTALL_CONF) ./files/simple-adblock.conf $(1)/etc/config/simple-adblock
endef
+define Package/$(PKG_NAME)/prerm
+ #!/bin/sh
+ # check if we are on real system
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Stopping service and removing rc.d symlink for simple-adblock"
+ /etc/init.d/simple-adblock stop || true
+ /etc/init.d/simple-adblock killcache || true
+ /etc/init.d/simple-adblock disable
+ fi
+ exit 0
+endef
+
$(eval $(call BuildPackage,$(PKG_NAME)))
## Requirements
-This service requires the following packages to be installed on your router: ```dnsmasq``` or ```dnsmasq-full``` and either ```wget``` and ```libopenssl``` (for OpenWrt CC 15.05.1) or ```uclient-fetch``` and ```libustream-mbedtls``` (for OpenWrt DD trunk and all LEDE Project release and snapshot builds). Additionally installation of ```coreutils-sort``` is highly recommended as it speeds up blocklist processing.
+This service requires the following packages to be installed on your router: ```dnsmasq``` or ```dnsmasq-full``` and either ```ca-certificates```, ```wget``` and ```libopenssl``` (for OpenWrt 15.05.1) or ```uclient-fetch``` and ```libustream-mbedtls``` (for OpenWrt DD trunk and all LEDE Project builds). Additionally installation of ```coreutils-sort``` is highly recommended as it speeds up blocklist processing.
To satisfy the requirements for connect to your router via ssh and run the following commands:
-###### OpenWrt CC 15.05.1
+###### OpenWrt 15.05.1
```sh
-opkg update; opkg install wget libopenssl coreutils-sort dnsmasq
+opkg update; opkg install ca-certificates wget libopenssl coreutils-sort dnsmasq
```
-###### LEDE Project and OpenWrt DD trunk
+###### LEDE Project 17.01.x and OpenWrt 18.xx or later
```sh
opkg update; opkg install uclient-fetch libustream-mbedtls coreutils-sort dnsmasq
```
#### Add custom repo to your router
If your router is not set up with the access to repository containing these packages you will need to add custom repository to your router by connecting to your router via ssh and running the following commands:
-###### OpenWrt CC 15.05.1
+###### OpenWrt 15.05.1
```sh
-opkg update; opkg install wget libopenssl
+opkg update; opkg install ca-certificates wget libopenssl
echo -e -n 'untrusted comment: public key 7ffc7517c4cc0c56\nRWR//HUXxMwMVnx7fESOKO7x8XoW4/dRidJPjt91hAAU2L59mYvHy0Fa\n' > /tmp/stangri-repo.pub && opkg-key add /tmp/stangri-repo.pub
! grep -q 'stangri_repo' /etc/opkg/customfeeds.conf && echo 'src/gz stangri_repo https://raw.githubusercontent.com/stangri/openwrt-repo/master' >> /etc/opkg/customfeeds.conf
opkg update
```
-###### LEDE Project and OpenWrt DD trunk
+###### LEDE Project and OpenWrt 18.xx or later
```sh
opkg update; opkg install uclient-fetch libustream-mbedtls
echo -e -n 'untrusted comment: public key 7ffc7517c4cc0c56\nRWR//HUXxMwMVnx7fESOKO7x8XoW4/dRidJPjt91hAAU2L59mYvHy0Fa\n' > /tmp/stangri-repo.pub && opkg-key add /tmp/stangri-repo.pub
Please head to [OpenWrt Forum](https://forum.openwrt.org/viewtopic.php?pid=307950) or [LEDE Project Forum](https://forum.lede-project.org/t/simple-adblock-fast-lean-and-fully-uci-luci-configurable-adblocking/1327/) for discussion of this package.
## What's New
+1.5.8:
+- Better start/stop/reload logic.
+- Better uninstall logic.
+- Better start/stop/reload from Web UI.
+- New command-line ```check``` command.
+
1.5.7:
- Much stricter filters for hosts and domains lists resulting in better garbage removal.
-
-1.5.6:
- Better handling of service start/enable from Web UI and enabled flag management.
-
-1.5.5:
- Implemented support to set one of the router LEDs on/off based on the AdBlocking status.
- Fixed the output bug when verbosity=1.
-
-1.5.3:
- No longer using enabled in config file, Simple AdBlocking Web UI now enables/disables service directly.
-
-1.5.1:
- Reworked console/system log output logic and formatting.
-
-1.5.0:
- Processes already downloaded lists in the background while downloading next list from config, dramatically increasing overall speed.
1.0.0:
option enabled '0'
option verbosity '2'
option force_dns '1'
- option run_in_background '0'
option hosts_file '/var/dnsmasq.d/simple-adblock'
list whitelist_domain 'raw.githubusercontent.com'
# list blacklist_hosts_url 'http://support.it-mate.co.uk/downloads/hosts.txt'
export START=94
export USE_PROCD=1
-#PROCD_DEBUG=1
readonly A_TMP='/var/hosts.allowed.tmp'
readonly B_TMP='/var/hosts.blocked.tmp'
readonly h_filter='/localhost/d;/^#/d;/^[^0-9]/d;s/^0\.0\.0\.0.//;s/^127\.0\.0\.1.//;s/[[:space:]]*#.*$//;s/[[:cntrl:]]$//;s/[[:space:]]//g;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;'
readonly d_filter='/^#/d;s/[[:space:]]*#.*$//;s/[[:space:]]*$//;s/[[:cntrl:]]$//;/[[:space:]]/d;/[`~!@#\$%\^&\*()=+;:"'\'',<>?/\|[{}]/d;/]/d;/\./!d;/^$/d;'
readonly f_filter='s|^|local=/|;s|$|/|'
-readonly _ok_='\033[0;32m\xe2\x9c\x93\033[0m'
-readonly _fail_='\033[0;31m\xe2\x9c\x97\033[0m'
-readonly __ok__='\033[0;32m[\xe2\x9c\x93]\033[0m'
-readonly __fail__='\033[0;31m[\xe2\x9c\x97]\033[0m'
-readonly _error_='\033[0;31mERROR\033[0m'
+readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
+readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
+readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
+readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
+readonly _ERROR_='\033[0;31mERROR\033[0m'
-readonly packageName="simple-adblock"
+export EXTRA_COMMANDS="check killcache"
+export EXTRA_HELP=" check Checks if specified <string> is found in current blacklist"
+
+readonly packageName='simple-adblock'
readonly serviceName="$packageName $PKG_VERSION"
-ok() { case $verbosity in 1) output "$_ok_";; 2) output "$__ok__\n";; esac; }
-okn() { case $verbosity in 1) output "$_ok_\n";; 2) output "$__ok__\n";; esac; }
-fail() { case $verbosity in 1) output "$_fail_";; 2) output "$__fail__\n";; esac; }
-failn() { case $verbosity in 1) output "$_fail_\n";; 2) output "$__fail__\n";; esac; }
+ok() { case $verbosity in 1) output "$_OK_";; 2) output "$__OK__\n";; esac; }
+okn() { case $verbosity in 1) output "$_OK_\n";; 2) output "$__OK__\n";; esac; }
+fail() { case $verbosity in 1) output "$_FAIL_";; 2) output "$__FAIL__\n";; esac; }
+failn() { case $verbosity in 1) output "$_FAIL_\n";; 2) output "$__FAIL__\n";; esac; }
output() { [[ $# -ne 1 ]] && { [[ ! $((verbosity & $1)) -gt 0 ]] && return 0 || shift; }; local msg; msg=$(echo -n "${1/$serviceName /service }" | sed 's|\\033\[[0-9]\?;\?[0-9]\?[0-9]\?m||g'); [[ -t 1 ]] && echo -e -n "$1"; [[ $(echo -e -n "$msg" | wc -l) -gt 0 ]] && logger -t "${packageName:-service} [$$]" "$(echo -e -n ${logmsg}${msg})" && logmsg='' || logmsg=${logmsg}${msg}; }
led_on(){ [[ -n "$led" && -e "$led/trigger" ]] && echo "default-on" > "$led/trigger"; }
led_off(){ [[ -n "$led" && -e "$led/trigger" ]] && echo "none" > "$led/trigger"; }
-export verbosity force_dns bgrun debug led wan_if wan_gw wanphysdev hosts_file
+export serviceEnabled verbosity force_dns debug led wan_if wan_gw wanphysdev hosts_file
boot() { ( sleep 120 && rc_procd start_service && rc_procd service_triggers | cat &); }
-is_enabled () {
- local c=1 enabled
- config_load $packageName
- config_get_bool enabled 'config' 'enabled' 1
- config_get_bool bgrun 'config' 'run_in_background' 0
- config_get_bool force_dns 'config' 'force_dns' 1
- config_get_bool debug 'config' 'debug' 0
- config_get verbosity 'config' 'verbosity' '2'
- config_get hosts_file 'config' 'hosts_file' "/var/dnsmasq.d/${packageName}"
- config_get led 'config' 'led'
+load_package_config() {
+ config_load "$packageName"
+ config_get_bool serviceEnabled 'config' 'enabled' 1
+ config_get_bool force_dns 'config' 'force_dns' 1
+ config_get_bool debug 'config' 'debug' 0
+ config_get verbosity 'config' 'verbosity' '2'
+ config_get hosts_file 'config' 'hosts_file' "/var/dnsmasq.d/${packageName}"
+ config_get led 'config' 'led'
+ source /lib/functions/network.sh
+}
+
+is_enabled() {
+ local sleepCount=1
+ load_package_config
if [ "$debug" -ne 0 ]; then
exec 1>>/tmp/simple-adblock.log
fi
led="${led:+/sys/class/leds/$led}"
- [[ $enabled -gt 0 ]] || { output "$_error_: $serviceName is not enabled.\n"; return 1; }
- source /lib/functions/network.sh
+ [ $serviceEnabled -gt 0 ] || return 1
while : ; do
network_flush_cache; network_find_wan wan_if; network_get_gateway wan_gw $wan_if;
- [[ $c -ge 25 || -n "$wan_gw" ]] && break
- output "$serviceName waiting for wan gateway...\n"; sleep 2; let "c+=1";
+ [[ $sleepCount -ge 25 || -n "$wan_gw" ]] && break
+ output "$serviceName waiting for wan gateway...\n"; sleep 2; let "sleepCount+=1";
done
- [ -n "$wan_gw" ] && return 0 || { output "$_error_: $serviceName failed to discover WAN gateway.\n"; return 1; }
+ [ -n "$wan_gw" ] && return 0
+ output "$_ERROR_: $serviceName failed to discover WAN gateway.\n"; return 1;
}
-reset_iptables() {
- [[ $force_dns -eq 0 ]] && return 0
+iptables_destroy() {
+ [ $force_dns -eq 0 ] && return 0
[ -z "$packageName" ] && return 1
iptables-save | grep -Fv -- "$packageName" | iptables-restore
lsmod | grep -q ip6table_nat && ip6tables-save | grep -Fv -- "$packageName" | ip6tables-restore
- [ ! "$1" == "quiet" ] && output 'No longer forcing local DNS server.\n'
+ [ -z "$1" ] && output 'No longer forcing local DNS server.\n'
}
-set_iptables() {
+iptables_create() {
local ip ipv6 label ipv6wan brname
network_get_ipaddr ip lan; network_get_ipaddr6 ipv6 lan; network_get_device brname lan; network_get_physdev wanphysdev wan;
ipv6wan=$(ifconfig $wanphysdev | grep inet6 | awk '{print $3}')
- if [[ $force_dns -ne 0 ]]; then
+ iptables_destroy 'quiet'
+ if [ $force_dns -ne 0 ]; then
[ -n "$ip" ] && iptables -t nat -A prerouting_rule -i $brname -p tcp --dport 53 -j DNAT --to $ip -m comment --comment "$packageName"
[ -n "$ip" ] && iptables -t nat -A prerouting_rule -i $brname -p udp --dport 53 -j DNAT --to $ip -m comment --comment "$packageName"
if [[ -n "$ipv6" && -n "$ipv6wan" ]] && lsmod | grep -q ip6table_nat; then
else
label="$ip"
fi
- [ -n "$label" ] && output "Forcing local DNS server: $label.\n" || output "$_error_: $serviceName failed to obtain LAN IP address for DNS forcing!\n"
+ if [ -z "$1" ]; then
+ if [ -n "$label" ]; then
+ output "Forcing local DNS server: $label.\n"
+ else
+ output "$_ERROR_: $serviceName failed to obtain LAN IP address for DNS forcing!\n"
+ fi
+ fi
fi
}
-stop_adblocking () {
- [ -f $hosts_file ] && mv $hosts_file $T_TMP
- output 3 "Restarting dnsmasq "
- led_off
- /etc/init.d/dnsmasq restart >/dev/null 2>&1
- [[ $? -eq 0 ]] && { okn; output "$serviceName stopped.\n"; } || { failn; output "$_error_: $serviceName failed to reload dnsmasq!\n"; }
+stop_adblocking() {
+ load_package_config
+ [ -f $hosts_file ] && mv $hosts_file $T_TMP
+ output 3 "Restarting dnsmasq "
+ led_off
+ /etc/init.d/dnsmasq restart >/dev/null 2>&1
+ if [[ $? -eq 0 ]]; then
+ okn; output "$serviceName stopped.\n";
+ else
+ failn; output "$_ERROR_: $serviceName failed to reload dnsmasq!\n";
+ fi
}
process_url() {
{ sed -i "$filter" "$R_TMP"; cat "$R_TMP" >> "$D_TMP"; rm -f "$R_TMP"; } &
}
-start_adblocking () {
+start_adblocking() {
local whitelist_domains blacklist_domains whitelist_domains_urls blacklist_domains_urls blacklist_hosts_urls
config_get whitelist_domains 'config' 'whitelist_domain'
config_get blacklist_domains 'config' 'blacklist_domain'
local hf w_filter
[ ! -d ${hosts_file%/*} ] && mkdir -p ${hosts_file%/*}
+ [ ! -f "$hosts_file" ] && touch "$hosts_file"
if [[ -s $T_TMP && ! "$1" == "reload" ]]; then
output 3 'Found existing data file, reusing it '
mv $T_TMP $hosts_file && okn || failn
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
led_on; okn;
- output "$serviceName blocking $(wc -l < $hosts_file) domains $_ok_\n"
+ output "$serviceName blocking $(wc -l < $hosts_file) domains $_OK_\n"
else
- failn; output "$_error_: $serviceName failed to reload dnsmasq!\n";
+ failn; output "$_ERROR_: $serviceName failed to reload dnsmasq!\n";
exit 1
fi
else
- output "$_error_: $serviceName failed to create its data file!\n"
+ output "$_ERROR_: $serviceName failed to create its data file!\n"
exit 1
fi
}
-reload_service () {
- is_enabled || return 1
- [[ -t 1 && $bgrun -eq 1 ]] && output "Reloading $serviceName...\n"
- [[ ! -t 1 || $bgrun -eq 1 ]] && (start_adblocking 'reload' | cat &) || start_adblocking 'reload'
+check() {
+ load_package_config
+ local string="$1"
+ if [ ! -f $hosts_file ]; then
+ echo "No local blacklist ($hosts_file) found."
+ elif [ -z "$string" ]; then
+ echo "Usage: /etc/init.d/${serviceName} check <string>"
+ elif grep -m1 -q $string $hosts_file; then
+ echo "Found $(grep $string $hosts_file | wc -l) matches for $string in $hosts_file:"
+ grep $string $hosts_file | sed 's|local=/||;s|/$||;'
+ else
+ echo "The $string is not found in current blacklist."
+ fi
}
-start_service () {
+start_service() {
is_enabled || return 1
- [[ -t 1 && $bgrun -eq 1 ]] && output "Starting $serviceName...\n"
- reset_iptables quiet
- set_iptables
- [[ ! -t 1 || $bgrun -eq 1 ]] && (start_adblocking $1 | cat &) || start_adblocking $1
+ if [ -f "$hosts_file" ]; then
+ output "Reloading $serviceName...\n"
+ iptables_create 'quiet'
+ start_adblocking 'reload'
+ else
+ output "Starting $serviceName...\n"
+ iptables_create
+ start_adblocking
+ fi
}
-stop_service () {
- is_enabled || return 1
- [[ -t 1 && $bgrun -eq 1 ]] && output "Stopping $serviceName...\n"
- reset_iptables
- [[ ! -t 1 || $bgrun -eq 1 ]] && (stop_adblocking | cat &) || stop_adblocking
+stop_service() {
+ load_package_config
+ output "Stopping $serviceName...\n"
+ iptables_destroy
+ stop_adblocking
}
-service_triggers () {
- procd_add_reload_trigger 'simple-adblock'
-}
+killcache() { [ -s $T_TMP ] && rm -f $T_TMP; }
+++ /dev/null
-#
-# Copyright (C) 2016 Daniel Engberg <daniel.engberg.lists@pyret.net>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=sipgrep
-PKG_VERSION:=20160914-devel
-PKG_RELEASE:=1
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net>
-PKG_LICENSE:=GPL-3.0
-PKG_LICENSE_FILES:=COPYING
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/sipcapture/sipgrep
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=df8a95b066569be92aa38cad01086ea595b36863
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MIRROR_HASH:=a9131ae443bdce760e3dadd83dcf115d51a894381fc18461cbe62522618418fa
-
-PKG_FIXUP:=autoreconf
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/sipgrep
- SECTION:=net
- CATEGORY:=Network
- DEPENDS:=+libpcap +libpcre +libncursesw
- TITLE:=Display and Troubleshoot SIP signaling in CLI
- URL:=https://github.com/sipcapture/sipgrep
-endef
-
-define Package/sipgrep/description
- SipGrep is a utility for displaying and troubleshooting SIP signaling.
-endef
-
-CONFIGURE_ARGS += \
- --enable-ncurses
-
-define Package/sipgrep/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sipgrep $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,sipgrep))
+++ /dev/null
-#
-# Copyright (C) 2016 Daniel Engberg <daniel.engberg.lists@pyret.net>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=sngrep
-PKG_VERSION=1.4.4-rc2
-PKG_RELEASE:=1
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net>
-PKG_LICENSE:=GPL-3.0
-PKG_LICENSE_FILES:=COPYING
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/irontec/sngrep
-PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=cf5e1da49d00bc7ab1afe9d63daa240db2b9b19c
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=a6cee2caa108a618134fe87d7c04862e93aa2fdf9647d81dfe4abe91a6c9c19f
-
-PKG_FIXUP:=autoreconf
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/sngrep
- SECTION:=net
- CATEGORY:=Network
- DEPENDS:=+libpcap +libpthread +libpcre +libncursesw
- TITLE:=Display SIP calls message flows
- URL:=https://github.com/irontec/sngrep
-endef
-
-define Package/sngrep/description
- sngrep is a tool for displaying SIP calls message flows from terminal.
- It supports live capture to display realtime SIP packets and can also be used as PCAP viewer.
-endef
-
-CONFIGURE_ARGS += \
- --with-pcre \
- --enable-unicode \
-
-define Package/sngrep/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sngrep $(1)/usr/sbin/
-endef
-
-$(eval $(call BuildPackage,sngrep))
include $(TOPDIR)/rules.mk
PKG_NAME:=snort
-PKG_VERSION:=2.9.7.2
-PKG_RELEASE:=4
+PKG_VERSION:=2.9.11.1
+PKG_RELEASE:=5
PKG_LICENSE:=GPL-2.0
-PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.snort.org/downloads/snort/ \
@SF/$(PKG_NAME)
-PKG_HASH:=db57c532919d9ababac127f29dbdc05ed832394880e46cad81a5dde713ccb4be
+PKG_HASH:=9f6b3aeac5a109f55504bd370564ac431cb1773507929dc461626898f33f46cd
PKG_BUILD_DEPENDS:=librpc
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
SUBMENU:=Firewall
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+libdaq +libdnet +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +SNORT_LZMA:liblzma
+ DEPENDS:=+libdaq +libdnet +libnghttp2 +libopenssl +libpcap +libpcre +libpthread +libuuid +zlib +SNORT_LZMA:liblzma
TITLE:=Lightweight Network Intrusion Detection System
URL:=http://www.snort.org/
MENU:=1
}
procd_open_instance
- procd_set_param command $PROG "-q" "--daq-dir" "/usr/lib/daq/" "-i" "$interface" "-s" "-N"
+ procd_set_param command $PROG "-q" "--daq-dir" "/usr/lib/daq/" "-i" "$interface" "-c" "$config_file" "-s" "-N"
procd_set_param file $CONFIGFILE
procd_set_param respawn
procd_close_instance
---- /dev/null
-+++ b/acinclude.m4
-@@ -0,0 +1 @@
-+sinclude(m4/libprelude.m4)
---- a/configure.in
-+++ b/configure.in
-@@ -285,21 +285,7 @@ AC_CHECK_TYPES([int8_t,int16_t,int32_t,i
+diff -u --recursive snort-2.9.11.1-vanilla/configure.in snort-2.9.11.1/configure.in
+--- snort-2.9.11.1-vanilla/configure.in 2018-03-02 15:41:50.601809500 -0500
++++ snort-2.9.11.1/configure.in 2018-03-02 16:19:08.119307772 -0500
+@@ -282,21 +282,7 @@
AC_CHECK_TYPES([boolean])
# In case INADDR_NONE is not defined (like on Solaris)
AC_MSG_RESULT($have_inaddr_none)
if test "x$have_inaddr_none" = "xno"; then
AC_DEFINE([INADDR_NONE],[-1],[For INADDR_NONE definition])
-@@ -433,16 +419,7 @@ if test "x$LPCAP" = "xno"; then
+@@ -428,17 +414,7 @@
+ fi
fi
- AC_MSG_CHECKING([for pcap_lex_destroy])
+-AC_MSG_CHECKING([for pcap_lex_destroy])
-AC_RUN_IFELSE(
-[AC_LANG_PROGRAM(
-[[
AC_MSG_RESULT($have_pcap_lex_destroy)
if test "x$have_pcap_lex_destroy" = "xyes"; then
AC_DEFINE([HAVE_PCAP_LEX_DESTROY],[1],[Can cleanup lex buffer stack created by pcap bpf filter])
-@@ -727,54 +704,21 @@ if test "x$ac_cv_func_daq_dp_add_dc" = "
+@@ -715,18 +691,7 @@
+
+ AC_CHECK_FUNCS([daq_hup_apply] [daq_acquire_with_meta] [daq_dp_add_dc])
+
+-AC_MSG_CHECKING([for daq real addresses])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_PktHdr_t hdr;
+- hdr.n_real_dPort = 0;
+-]])],
+-[have_daq_real_addresses="yes"],
+-[have_daq_real_addresses="no"])
++have_daq_address_space_id="yes"
+ AC_MSG_RESULT($have_daq_real_addresses)
+ if test "x$have_daq_real_addresses" = "xyes"; then
+ AC_DEFINE([HAVE_DAQ_REAL_ADDRESSES],[1],
+@@ -753,56 +718,21 @@
fi
[DAQ version supports flow ID in header.])
fi
--AC_MSG_CHECKING([for DAQ_VERDICT_RETRY])
+-AC_MSG_CHECKING([for daq extended flow modifiers])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_ModFlow_t mod;
+- mod.type = 0;
+- mod.length = 0;
+- mod.value = NULL;
+-]])],
+-[have_daq_ext_modflow="yes"],
+-[have_daq_ext_modflow="no"])
++have_daq_ext_modflow="no"
+ AC_MSG_RESULT($have_daq_ext_modflow)
+ if test "x$have_daq_ext_modflow" = "xyes"; then
+ CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_EXT_MODFLOW"
+@@ -810,20 +740,7 @@
+ [DAQ version supports extended flow modifiers.])
+ fi
+
+-AC_MSG_CHECKING([for daq query flow])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_QueryFlow_t mod;
+- mod.type = 0;
+- mod.length = 0;
+- mod.value = NULL;
+-]])],
+-[have_daq_queryflow="yes"],
+-[have_daq_queryflow="no"])
++have_daq_queryflow="no"
+ AC_MSG_RESULT($have_daq_queryflow)
+ if test "x$have_daq_queryflow" = "xyes"; then
+ CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_QUERYFLOW"
+@@ -831,17 +748,7 @@
+ [DAQ version supports query flow.])
+ fi
+
+-AC_MSG_CHECKING([for daq data channel flags])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_Data_Channel_Params_t params;
+-]])],
+-[have_daq_data_channel_flags="yes"],
+-[have_daq_data_channel_flags="no"])
++have_daq_data_channel_flags="no"
+ AC_MSG_RESULT($have_daq_data_channel_flags)
+ if test "x$have_daq_data_channel_flags" = "xyes"; then
+ CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_DATA_CHANNEL_PARAMS"
+@@ -849,18 +756,7 @@
+ [DAQ version supports data channel.])
+ fi
+
+-AC_MSG_CHECKING([for separate IP versions on pinhole endpoints])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_DP_key_t dpKey;
+- dpKey.src_af = 0;
+-]])],
+-[have_daq_data_channel_separate_ip_versions="yes"],
+-[have_daq_data_channel_separate_ip_versions="no"])
++have_daq_data_channel_separate_ip_versions="no"
+ AC_MSG_RESULT($have_daq_data_channel_separate_ip_versions)
+ if test "x$have_daq_data_channel_separate_ip_versions" = "xyes"; then
+ CCONFIGFLAGS="${CCONFIGFLAGS} -DHAVE_DAQ_DATA_CHANNEL_SEPARATE_IP_VERSIONS"
+@@ -869,35 +765,14 @@
+ fi
+
+ AC_MSG_CHECKING([for DAQ_VERDICT_RETRY])
-AC_RUN_IFELSE(
-[AC_LANG_PROGRAM(
-[[
AC_MSG_RESULT($have_daq_verdict_retry)
if test "x$have_daq_verdict_retry" = "xyes"; then
AC_DEFINE([HAVE_DAQ_VERDICT_RETRY],[1],
+ [DAQ version supports DAQ_VERDICT_RETRY in DAQ_Verdict.])
+ fi
+
+-AC_MSG_CHECKING([for daq packet trace])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_PktHdr_t hdr;
+- hdr.flags = DAQ_PKT_FLAG_TRACE_ENABLED;
+-]])],
+-[have_daq_packet_trace="yes"],
+-[have_daq_packet_trace="no"])
++have_daq_packet_trace="no"
+ AC_MSG_RESULT($have_daq_packet_trace)
+ if test "x$have_daq_packet_trace" = "xyes"; then
+ AC_DEFINE([HAVE_DAQ_PKT_TRACE],[1],
+@@ -906,18 +781,7 @@
+ echo "DAQ version doesn't support packet trace."
+ fi
+
+-AC_MSG_CHECKING([for daq verdict reason])
+-AC_RUN_IFELSE(
+-[AC_LANG_PROGRAM(
+-[[
+-#include <daq.h>
+-]],
+-[[
+- DAQ_ModFlow_t fl;
+- fl.type = DAQ_MODFLOW_TYPE_VER_REASON;
+-]])],
+-[have_daq_verdict_reason="yes"],
+-[have_daq_verdict_reason="no"])
++have_daq_verdict_reason="no"
+ AC_MSG_RESULT($have_daq_verdict_reason)
+ if test "x$have_daq_verdict_reason" = "xyes"; then
+ AC_DEFINE([HAVE_DAQ_VERDICT_REASON],[1],
+++ /dev/null
---- a/configure.in
-+++ b/configure.in
-@@ -11,14 +11,6 @@ AM_INIT_AUTOMAKE(snort,2.9.7.2)
- NO_OPTIMIZE="no"
- ADD_WERROR="no"
-
--# Test for -Werror and sed it out for now since some of the auto tests,
--# for example AC_CHECK_LIB, will fail because of
--# warning: conflicting types for built-in function <func>
--if eval "echo $CFLAGS | grep -e -Werror"; then
-- CFLAGS=`echo $CFLAGS | sed -e "s/-Werror//g"`
-- ADD_WERROR="yes"
--fi
--
- # Disable annoying practice of recursively re-running the autotools
- AM_MAINTAINER_MODE
- AC_PROG_CC_STDC
include $(TOPDIR)/rules.mk
PKG_NAME:=softethervpn
-PKG_VERSION:=4.22-9634
-PKG_VERREL:=beta
-PKG_VERDATE:=2016.11.27
-PKG_RELEASE:=2
+PKG_VERSION:=4.25-9656
+PKG_VERREL:=rtm
+PKG_VERDATE:=2018.01.15
+PKG_RELEASE:=1
PKG_SOURCE:=softether-src-v$(PKG_VERSION)-$(PKG_VERREL).tar.gz
PKG_SOURCE_URL:=http://www.softether-download.com/files/softether/v$(PKG_VERSION)-$(PKG_VERREL)-$(PKG_VERDATE)-tree/Source_Code/
-PKG_HASH:=a37c6edeb7076189382fe2cbeb7c02806b76c13bb64e40bd6a5334fdf47f76c8
+PKG_HASH:=b946dec3da5833ad2be69125224784b8a8e2a4149297d0c0a907ba0e1c4535f8
PKG_BUILD_DIR:=$(BUILD_DIR)/v$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/v$(PKG_VERSION)
-Index: v4.22-9634/src/Mayaqua/Network.c
+Index: v4.25-9656/src/Mayaqua/Network.c
===================================================================
---- v4.22-9634.orig/src/Mayaqua/Network.c
-+++ v4.22-9634/src/Mayaqua/Network.c
-@@ -13013,20 +13013,28 @@ bool StartSSLEx(SOCK *sock, X *x, K *pri
- }\r
- else\r
+--- v4.25-9656.orig/src/Mayaqua/Network.c
++++ v4.25-9656/src/Mayaqua/Network.c
+@@ -13025,7 +13025,7 @@ bool StartSSLEx(SOCK *sock, X *x, K *pri
{\r
-+#ifndef SSL_OP_NO_SSLv3\r
if (client_tls == false)\r
{\r
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L\r
++#ifndef SSL_OP_NO_SSLv3\r
SSL_CTX_set_ssl_version(ssl_ctx, SSLv3_method());\r
- }\r
- else\r
- {\r
-+#endif // SSL_OP_NO_SSLv3\r
- SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_client_method());\r
-+#ifndef SSL_OP_NO_SSLv3\r
- }\r
-+#endif // SSL_OP_NO_SSLv3\r
- }\r
- sock->ssl = SSL_new(ssl_ctx);\r
- SSL_set_fd(sock->ssl, (int)sock->socket);\r
- \r
- #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME\r
-+#ifndef SSL_OP_NO_SSLv3\r
- if (sock->ServerMode == false && client_tls)\r
-+#else\r
-+ if (sock->ServerMode == false)\r
-+#endif // SSL_OP_NO_SSLv3\r
- {\r
- if (IsEmptyStr(sni_hostname) == false)\r
- {\r
+ #else\r
+ SSL_CTX_set_ssl_version(ssl_ctx, SSLv23_method());\r
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://softflowd.googlecode.com/files/
+PKG_SOURCE_URL:=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/softflowd
PKG_HASH:=2313f2c50ea9b3f2db3524e38ec7cd71f9a6e885ac2e3b55ab037bccf8173612
PKG_MAINTAINER:=Ross Vandegrift <ross@kallisti.us>
PKG_LICENSE:=BSD-3-Clause
include $(TOPDIR)/rules.mk
PKG_NAME:=sqm-scripts
-PKG_SOURCE_VERSION:=8217081f7e52af342c362b29480461575c496387
-PKG_VERSION:=1.1.3
+PKG_SOURCE_VERSION:=b124f10c6c14720e3d0e4053a270f6f3c7580e2b
+PKG_VERSION:=1.2.1
PKG_RELEASE:=1
PKG_LICENSE:=GPLv2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.xz
-PKG_MIRROR_HASH:=a287ce3bf68ed76f4fd7ae3df5e0066d99105b5c139c88bce99555dcb1d230a3
+PKG_MIRROR_HASH:=5795e9979194c069b88ffc5f45303f19caaf53ec05dbfe0ab436d8c8bf69e40f
PKG_SOURCE_URL:=https://github.com/tohojo/sqm-scripts.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)
uci delete ucitrack.@sqm[0]
uci del_list ucitrack.@firewall[0].affects=sqm
uci commit
-}
+} || exit 0
endef
$(eval $(call BuildPackage,sqm-scripts))
#
-# Copyright (C) 2009-2017 OpenWrt.org
+# Copyright (C) 2009-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=sslh
-PKG_VERSION:=v1.18
-PKG_RELEASE:=2
+PKG_VERSION:=v1.19c
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://rutschle.net/tech/sslh/
-PKG_HASH:=1601a5b377dcafc6b47d2fbb8d4d25cceb83053a4adcc5874d501a2d5a7745ad
+PKG_SOURCE_URL:=https://rutschle.net/tech/sslh/
+PKG_HASH:=bb11dfa88b27ae1ec825a1b8156000c3f17f7e8f042311f19b7a249193c47bf3
PKG_LICENSE:=GPL-2.0+
PKG_LICENSE_FILES:=COPYING
SUBMENU:=Routing and Redirection
TITLE:=SSL/SSH multiplexer
DEPENDS:=+libconfig +USE_UCLIBC:libpcre +USE_MUSL:libpcre
- URL:=http://rutschle.net/tech/sslh.shtml
+ URL:=https://rutschle.net/tech/sslh/README.html
PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
endef
-diff --git a/Makefile b/Makefile
-index b1cf9ce..28f90c3 100644
--- a/Makefile
+++ b/Makefile
-@@ -65,16 +65,12 @@ all: sslh $(MAN) echosrv
+@@ -68,7 +68,7 @@ all: sslh $(MAN) echosrv $(CONDITIONAL_T
version.h:
./genver.sh >version.h
-sslh: sslh-fork sslh-select
+sslh: sslh-fork
- sslh-fork: version.h $(OBJS) sslh-fork.o Makefile common.h
+ $(OBJS): version.h
+
+@@ -76,10 +76,6 @@ sslh-fork: version.h $(OBJS) sslh-fork.o
$(CC) $(CFLAGS) $(LDFLAGS) -o sslh-fork sslh-fork.o $(OBJS) $(LIBS)
#strip sslh-fork
systemd-sslh-generator: systemd-sslh-generator.o
$(CC) $(CFLAGS) $(LDFLAGS) -o systemd-sslh-generator systemd-sslh-generator.o -lconfig
-@@ -110,7 +106,7 @@ distclean: clean
+@@ -115,7 +111,7 @@ distclean: clean
rm -f tags cscope.*
clean:
-diff --git a/basic.cfg b/basic.cfg
-index 54a799c..d938767 100644
--- a/basic.cfg
+++ b/basic.cfg
@@ -1,3 +1,7 @@
# This is a basic configuration file that should provide
# sensible values for "standard" setup.
-@@ -14,15 +18,16 @@ pidfile: "/var/run/sslh.pid";
+@@ -15,15 +19,16 @@ chroot: "/var/empty";
# Change hostname with your external address name.
listen:
(
protocols:
(
- { name: "ssh"; service: "ssh"; host: "localhost"; port: "22"; },
+ { name: "ssh"; service: "ssh"; host: "localhost"; port: "22"; fork: true; },
{ name: "openvpn"; host: "localhost"; port: "1194"; },
- { name: "xmpp"; host: "localhost"; port: "5222"; },
- { name: "http"; host: "localhost"; port: "80"; },
-+# { name: "xmpp"; host: "localhost"; port: "5222"; },
-+# { name: "http"; host: "localhost"; port: "80"; },
++# { name: "xmpp"; host: "localhost"; port: "5222"; },
++# { name: "http"; host: "localhost"; port: "80"; },
{ name: "ssl"; host: "localhost"; port: "443"; log_level: 0; },
{ name: "anyprot"; host: "localhost"; port: "443"; }
);
include $(TOPDIR)/rules.mk
PKG_NAME:=sstp-client
-PKG_VERSION:=1.0.11
+PKG_VERSION:=1.0.12
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/sstp-client/$(PKG_VERSION)
-PKG_HASH:=1b851b504030ed5522ced431217a5c700b35e8bb72d6f5b40b006c7becb8fb20
+PKG_HASH:=487eb406579689803ce0397f6102b18641e4572ac7bc9b9e5f3027c84dcf67ff
PKG_LICENSE=GPLv2
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/rules.mk
PKG_NAME:=strongswan
-PKG_VERSION:=5.6.1
+PKG_VERSION:=5.6.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=e0c282d8ad418609c5dfb5e8efa01b28b95ef3678070ed47bf2a229f55f4ab53
+PKG_HASH:=e0a60a30ebf3c534c223559e1686497a21ded709a5d605c5123c2f52bcc22e92
PKG_SOURCE_URL:=http://download.strongswan.org/ http://download2.strongswan.org/
PKG_LICENSE:=GPL-2.0+
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PROG=/usr/lib/ipsec/starter
. $IPKG_INSTROOT/lib/functions.sh
+. $IPKG_INSTROOT/lib/functions/network.sh
IPSEC_SECRETS_FILE=/etc/ipsec.secrets
IPSEC_CONN_FILE=/etc/ipsec.conf
IPSEC_VAR_CONN_FILE=/var/ipsec/ipsec.conf
STRONGSWAN_VAR_CONF_FILE=/var/ipsec/strongswan.conf
+WAIT_FOR_INTF=0
+
file_reset() {
: > "$1"
}
[ -n "$routing_table_id" ] && append routing_tables_ignored "$routing_table_id"
done
+ local interface_list=$(config_get "$1" "interface")
+ if [ -z "$interface_list" ]; then
+ WAIT_FOR_INTF=0
+ else
+ for interface in $interface_list; do
+ network_get_device device $interface
+ [ -n "$device" ] && append device_list "$device" ","
+ done
+ [ -n "$device_list" ] && WAIT_FOR_INTF=0 || WAIT_FOR_INTF=1
+ fi
+
swan_xappend "# generated by /etc/init.d/ipsec"
swan_xappend "charon {"
swan_xappend " load_modular = yes"
swan_xappend " install_routes = $install_routes"
[ -n "$routing_tables_ignored" ] && swan_xappend " ignore_routing_tables = $routing_tables_ignored"
+ [ -n "$device_list" ] && swan_xappend " interfaces_use = $device_list"
swan_xappend " plugins {"
swan_xappend " include /etc/strongswan.d/charon/*.conf"
swan_xappend " }"
config_foreach config_remote remote
}
+service_running() {
+ ipsec status > /dev/null 2>&1
+}
+
reload_service() {
- prepare_env
- if ipsec status > /dev/null 2>&1; then
- ipsec rereadall
- ipsec reload
- else
- ipsec start
- fi
+ running && {
+ prepare_env
+ [ $WAIT_FOR_INTF -eq 0 ] && {
+ ipsec rereadall
+ ipsec reload
+ return
+ }
+ }
+
+ start
+}
+
+check_ipsec_interface() {
+ local intf
+
+ for intf in $(config_get "$1" interface); do
+ procd_add_interface_trigger "interface.*" "$intf" /etc/init.d/ipsec reload
+ done
}
service_triggers() {
procd_add_reload_trigger "ipsec"
+ config load "ipsec"
+ config_foreach check_ipsec_interface ipsec
}
start_service() {
prepare_env
+ [ $WAIT_FOR_INTF -eq 1 ] && return
+
procd_open_instance
procd_set_param command $PROG --daemon charon --nofork
--- /dev/null
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=stubby
+PKG_VERSION:=0.2.2
+PKG_RELEASE:=1
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=David Mora <iamperson347+public@gmail.com>
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://github.com/getdnsapi/$(PKG_NAME)
+PKG_SOURCE_VERSION:=1a6acd642c7dc9a04cf092e1a3837c5636d4b465
+PKG_MIRROR_HASH:=f5a270a0ef4e7e2f0387b649ed77d66917ba9bd88dee14e3f9edd2573e8d3c3a
+
+PKG_FIXUP:=autoreconf
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/stubby/Default
+ TITLE:=stubby
+ URL:=https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby
+endef
+
+define Package/stubby/description
+ This package contains the Stubby daemon (which utilizes the getdns library).
+
+ See https://github.com/openwrt/packages/blob/master/net/stubby/files/README.md for more details.
+endef
+
+define Package/stubby
+ $(call Package/stubby/Default)
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=IP Addresses and Names
+ TITLE+= - (daemon that uses getdns)
+ USERID:=stubby=410:stubby=410
+ DEPENDS:= +libyaml +getdns
+endef
+
+define Package/stubby/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/stubby $(1)/usr/sbin/stubby
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/stubby.init $(1)/etc/init.d/stubby
+ $(INSTALL_DIR) $(1)/etc/stubby
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/stubby/stubby.yml $(1)/etc/stubby/stubby.yml.default
+ $(INSTALL_DATA) ./files/stubby.yml $(1)/etc/stubby/stubby.yml
+endef
+
+
+define Package/stubby/conffiles
+ /etc/stubby/stubby.yml
+endef
+
+$(eval $(call BuildPackage,stubby))
--- /dev/null
+# Stubby for OpenWRT
+
+## Stubby Description
+[Stubby](https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Daemon+-+Stubby) is an application that acts as a local DNS Privacy stub resolver (using DNS-over-TLS). Stubby encrypts DNS queries sent from a client machine (desktop or laptop) to a DNS Privacy resolver increasing end user privacy.
+
+Stubby is developed by the [getdns](http://getdnsapi.net/) project.
+
+For more background and FAQ see our [About Stubby](https://dnsprivacy.org/wiki/display/DP/About+Stubby) page. Stubby is in the early stages of development but is suitable for technical/advanced users. A more generally user-friendly version is on the way!
+
+## Prerequisites
+
+You must have a ca cert bundle installed on your device for stubby to make the TLS enabled connections.
+
+- You can install this by running the following: opkg install ca-certificates
+- You can also install this through the LUCI web interface
+
+## Package Overview
+This package has some modifications that makes it differ from the default upstream configuration. They are outlined below.
+
+### General Cleanup
+Comments are removed, etc.
+
+### EDNS Client-Subnet Option Changed to 0
+The value of "edns_client_subnet_private" is '1' in the upstream default config. This informs the upstream resolver to NOT forward your connection's IP to any other upstream servers. This is good for privacy, but could result in sub-optimal routing to CDNs, etc.
+
+To give a more "comparable" DNS experience similar to google/opendns, this package disables this option.
+
+### Default Listening Ports Changed
+The value of "listen_addresses" in the default config does not list port numbers, which will cause stubby to default to port 53. However, Openwrt defaults to dnsmasq as the main name server daemon, which runs on port 53. By setting the listening ports to non-standard values, this allows users to keep the main name server daemon in place (dnsmasq/unbound/etc.) and have that name server forward to stubby.
+
+Additionally, due to the slight overhead involved with DNS-over-TLS, it is recommended to have a caching name server on the network.
+
+### Round Robin Upstream Setting Changed
+
+The default stubby config list multiple upstream resolvers, and because of this, it makes sense to "load balance" between them. However, in this package's default stubby config, the only upstream service listed is quad9. One entry is for ipv6 and one for ipv4.
+
+By setting the "round_robin_upstreams" value to 0, we are simply forcing stubby to try and use ipv6 connectivity to quad9 first, and if not available, simply use the ipv4 service.
+
+quad9 is an Anycast DNS service. This should take care of any needed "failover" in the event that one of quad9's nodes goes down.
+
+### Upstream Resolvers Changed
+
+Most of the default resolvers for stubby are in Europe. To provide a better experience for a larger number of users, this package defaults to using quad9's DNS service.
+
+Note: quad9 has multiple IPs available for their service. The "features" applied are based on the endpoint your DNS client connects to. For this package, the default resolvers are set to the non-filtering, EDNS Client-Subnet capable endpoints.
+
+https://www.quad9.net/faq/#Is_there_a_service_that_Quad9_offers_that_does_not_have_the_blocklist_or_other_security
+
+https://www.quad9.net/faq/#Does_Quad9_support_DNS_over_TLS
+
+``````
+
+# IPv6 addresses
+# Quad 9 IPv6
+ - address_data: 2620:fe::10
+ tls_auth_name: "dns.quad9.net"
+
+# IPv4 addresses
+# Quad 9 service
+ - address_data: 9.9.9.10
+ tls_auth_name: "dns.quad9.net"
+
+``````
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+
+START=50
+STOP=51
+
+PROG=/usr/sbin/stubby
+
+start_service() {
+ procd_open_instance stubby
+ procd_set_param command /usr/sbin/stubby
+
+ procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
+
+ procd_set_param limits core="unlimited"
+
+ procd_set_param file /etc/stubby/stubby.yml
+
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_set_param user stubby
+ procd_close_instance
+}
+
--- /dev/null
+#NOTE: See '/etc/stubby/stubby.yml.default' for original config file and descriptions
+
+resolution_type: GETDNS_RESOLUTION_STUB
+
+dns_transport_list:
+ - GETDNS_TRANSPORT_TLS
+
+tls_authentication: GETDNS_AUTHENTICATION_REQUIRED
+
+tls_query_padding_blocksize: 128
+
+edns_client_subnet_private : 0
+
+idle_timeout: 10000
+
+listen_addresses:
+ - 127.0.0.1@5453
+ - 0::1@5453
+
+round_robin_upstreams: 0
+
+upstream_recursive_servers:
+# Quad 9 IPv6
+ - address_data: 2620:fe::10
+ tls_auth_name: "dns.quad9.net"
+# IPv4 addresses
+# Quad 9 service
+ - address_data: 9.9.9.10
+ tls_auth_name: "dns.quad9.net"
PKG_NAME:=stunnel
PKG_VERSION:=5.44
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0+
-PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net> \
- Florian Eckert <fe@dev.tdt.de>
+PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
PKG_LICENSE_FILES:=COPYING COPYRIGHT.GPL
PKG_SOURCE_URL:= \
PID_FILE="/var/run/stunnel.pid"
CONF_FILE="/tmp/stunnel.conf"
BIN="/usr/bin/stunnel"
+SERVICE_SECTION_FOUND=0
global_defs() {
local debug compression
config_get_bool enabled "$cfg" 'enabled' '1'
[ ${enabled} -gt 0 ] || return 0
+ SERVICE_SECTION_FOUND=1
printf "\n" >> "$CONF_FILE"
printf "[%s]\n" "$cfg" >> "$CONF_FILE"
rm -f "$CONF_FILE"
# Symlink "alt_config_file" since it's a bit easier and safer
ln -s "$alt_config_file" "$CONF_FILE"
+ # Set section found to start service user hopfully knows what you does
+ SERVICE_SECTION_FOUND=1
return 0
}
config_foreach service_section service
}
-reload_service() {
- process_config
- # SIGHUP is used by stunnel to do init.d reload
- procd_send_signal stunnel
-}
-
service_triggers() {
procd_add_reload_trigger "stunnel"
}
start_service() {
- procd_open_instance
- procd_set_param command "$BIN"
- procd_append_param command "$CONF_FILE"
-
process_config
- # set auto respawn behavior
- procd_set_param respawn
- procd_close_instance
+ if [ "$SERVICE_SECTION_FOUND" = 1 ]; then
+ procd_open_instance
+ procd_set_param command "$BIN"
+ procd_append_param command "$CONF_FILE"
+ procd_set_param respawn
+ procd_set_param file "$CONF_FILE"
+ procd_close_instance
+ else
+ logger -t stunnel -p daemon.info "No uci service section enabled or found!"
+ fi
}
PKG_NAME:=subversion
PKG_RELEASE:=1
-PKG_VERSION:=1.9.7
+PKG_VERSION:=1.10.0
PKG_SOURCE_URL:=@APACHE/subversion
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=c3b118333ce12e501d509e66bb0a47bcc34d053990acab45559431ac3e491623
+PKG_HASH:=2cf23f3abb837dea0585a6b0ebd70e80e01f95bddef7c1aa097c18e3eaa6b584
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Val Kulkov <val.kulkov@gmail.com>
--without-junit \
--without-berkeley-db \
--without-apxs \
- --without-sasl
+ --without-sasl \
+ --with-lz4=internal \
+ --with-utf8proc=internal
ifdef $(INTL_FULL)
CONFIGURE_ARGS += --enable-nls
--- /dev/null
+config SYSREPO_PYTHON
+ bool "Generate sysrepo Python2 bindings"
+ depends on PACKAGE_libsysrepo
+ select SYSREPO_BINDINGS
+ default n
+ help
+ This option generates the Python2 language bindings.
+ Disabled by default.
+
+config SYSREPO_LUA
+ bool "Generate sysrepo Lua5.1 bindings"
+ depends on PACKAGE_libsysrepo
+ select SYSREPO_BINDINGS
+ default n
+ help
+ This option generates the Lua5.1 language bindings.
+ Disabled by default.
+
+config SYSREPO_BINDINGS
+ bool
+ depends on PACKAGE_libsysrepo
+ default n
+
PKG_MAINTAINER:=Mislav Novakovic <mislav.novakovic@sartura.hr>
PKG_NAME:=sysrepo
-PKG_VERSION:=0.7.2
+PKG_VERSION:=0.7.3
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=8a188c515ad113adbe0d393fe54dc0cad2d0167a
-PKG_MIRROR_HASH:=b8a387a6ee6692c455815226f27a572984d997ce0c0c85ac0d15a81e8e9c62a3
+PKG_SOURCE_VERSION:=91e65c6f7d8826197b2806ab6d5466d16882b07f
+PKG_MIRROR_HASH:=1662c158d5eac3e6c9f400517bd02b1967632f3d8b3516523da669bbd1c28c4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/sysrepo/sysrepo.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
+ifeq ($(CONFIG_SYSREPO_PYTHON),y)
+$(call include_mk, python-package.mk)
+endif
+
+define Package/libsysrepo/config
+ source "$(SOURCE)/Config_libsysrepo.in"
+endef
+
+PKG_BUILD_DEPENDS:=+SYSREPO_BINDINGS:swig/host
define Package/libsysrepo
SECTION:=utils
CATEGORY:=Utilities
URL:=$(PKG_SOURCE_URL)
TITLE:=YANG-based data store library
- DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt
+ DEPENDS:=+libyang +libprotobuf-c +libev +libredblack +librt +SYSREPO_BINDINGS:libstdcpp +SYSREPO_PYTHON:python-base +SYSREPO_LUA:lua
+ MENU:=1
endef
define Package/sysrepo
-DBUILD_EXAMPLES:BOOL=FALSE \
-DCMAKE_DISABLE_FIND_PACKAGE_SWIG=TRUE \
-DGEN_LANGUAGE_BINDINGS:BOOL=FALSE \
+ -DGEN_PYTHON_BINDINGS=0 \
+ -DGEN_LUA_BINDINGS=0 \
-DREPOSITORY_LOC:PATH=/etc/sysrepo \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DENABLE_NACM:BOOL=FALSE \
-DNOTIF_TIME_WINDOW=20 \
-DUSE_SR_MEM_MGMT=0
+ifeq ($(CONFIG_SYSREPO_LUA),y)
+CMAKE_OPTIONS += \
+ -DGEN_LUA_BINDINGS:BOOL=TRUE \
+ -DGEN_LUA_VERSION=5.1
+endif
+
+ifeq ($(CONFIG_SYSREPO_PYTHON),y)
+CMAKE_OPTIONS += \
+ -DGEN_PYTHON_BINDINGS:BOOL=TRUE \
+ -DGEN_PYTHON_VERSION=2
+endif
+
+ifeq ($(CONFIG_SYSREPO_BINDINGS),y)
+CMAKE_OPTIONS += \
+ -DCMAKE_DISABLE_FIND_PACKAGE_SWIG=FALSE \
+ -DGEN_LANGUAGE_BINDINGS:BOOL=TRUE \
+ -DSWIG_DIR=$(STAGING_DIR)/host/share/swig
+endif
+
define Package/libsysrepo/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/src/libsysrepo.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/libsysrepo.default $(1)/etc/uci-defaults/95_libsysrepo
+
+ifeq ($(CONFIG_SYSREPO_PYTHON),y)
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_BUILD_DIR)/swig/libSysrepo-cpp.so* $(1)/usr/lib
+ $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python2/libsysrepoPython2.py $(1)$(PYTHON_PKG_DIR)
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/python2/_libsysrepoPython2.so $(1)$(PYTHON_PKG_DIR)
+endif
+
+ifeq ($(CONFIG_SYSREPO_LUA),y)
+ $(INSTALL_DIR) $(1)/usr/lib/lua/
+ $(CP) $(PKG_BUILD_DIR)/swig/lua/libSysrepo_Lua.so* $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/swig/lua/libsysrepoLua.so $(1)/usr/lib/lua/libsysrepoLua.so
+endif
endef
define Package/sysrepo/install
include $(TOPDIR)/rules.mk
PKG_NAME:=tor
-PKG_VERSION:=0.3.1.9
+PKG_VERSION:=0.3.2.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://dist.torproject.org/ \
https://archive.torproject.org/tor-package-archive
-PKG_HASH:=6e1b04f7890e782fd56014a0de5075e4ab29b52a35d8bca1f6b80c93f58f3d26
+PKG_HASH:=60df77c31dcf94fdd686c8ca8c34f3b70243b33a7344ecc0b719d5ca2617cbee
PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
PKG_LICENSE_FILES:=LICENSE
## The port on which Tor will listen for local connections from Tor
## controller applications, as documented in control-spec.txt.
-@@ -218,3 +218,4 @@
+@@ -227,3 +227,4 @@
#%include /etc/torrc.d/
#%include /etc/torrc.custom
include $(TOPDIR)/rules.mk
PKG_NAME:=transmission
-PKG_VERSION:=2.92+git
-PKG_RELEASE:=5
+PKG_VERSION:=2.93
+PKG_RELEASE:=7
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/transmission/transmission.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=5b29fe15561d40c40cbee635446df6b33e18d2c2
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
-PKG_MIRROR_HASH:=f99982ae68564da9bf6ad4407285aff2e29508e4fd801ff56f86a8b3dae01819
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GITHUB/transmission/transmission-releases/master
+PKG_HASH:=8815920e0a4499bcdadbbe89a4115092dab42ce5199f71ff9a926cfd12b9b90b
+PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
-
include $(INCLUDE_DIR)/package.mk
define Package/transmission/template
CATEGORY:=Network
TITLE:=BitTorrent client
URL:=http://www.transmissionbt.com
- MAINTAINER:=Rosen Penev <rosenp@gmail.com>
+ DEPENDS:=+ca-bundle +libcurl +libevent2 +libminiupnpc +libnatpmp +libpthread +librt +zlib
endef
define Package/transmission-daemon/Default
$(call Package/transmission/template)
- DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib
USERID:=transmission=224:transmission=224
endef
VARIANT:=mbedtls
endef
-define Package/transmission-cli/Default
- $(call Package/transmission/template)
- DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib
-endef
-
define Package/transmission-cli-openssl
- $(call Package/transmission-cli/Default)
+ $(call Package/transmission/template)
TITLE+= (with OpenSSL)
DEPENDS+=+libopenssl
VARIANT:=openssl
endef
define Package/transmission-cli-mbedtls
- $(call Package/transmission-cli/Default)
+ $(call Package/transmission/template)
TITLE+= (with mbed TLS)
DEPENDS+=+libmbedtls
VARIANT:=mbedtls
endef
-define Package/transmission-remote/Default
- $(call Package/transmission/template)
- DEPENDS:=+libcurl +libpthread +libevent2 +librt +zlib
-endef
-
define Package/transmission-remote-openssl
- $(call Package/transmission-remote/Default)
+ $(call Package/transmission/template)
TITLE+= (with OpenSSL)
DEPENDS+=+libopenssl
VARIANT:=openssl
endef
define Package/transmission-remote-mbedtls
- $(call Package/transmission-remote/Default)
+ $(call Package/transmission/template)
TITLE+= (with mbed TLS)
DEPENDS+=+libmbedtls
VARIANT:=mbedtls
Package/transmission-daemon-mbedtls/conffiles = $(Package/transmission-daemon-openssl/conffiles)
-CONFIGURE_VARS += \
- LIBEVENT_LIBS="$(STAGING_DIR)/usr/lib/libevent-2.0.so.5"
-
CONFIGURE_ARGS += \
--enable-daemon \
--enable-cli \
--without-gtk \
+ --enable-external-natpmp \
--enable-largefile \
--enable-lightweight
MBEDTLS_LIBS="-lmbedtls -lmbedcrypto"
endif
-MAKE_FLAGS += \
- CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE"
-
-TARGET_CFLAGS += -std=gnu99
-
-define Build/Configure
- ( cd $(PKG_BUILD_DIR); ./autogen.sh $(CONFIGURE_ARGS))
- $(call Build/Configure/Default,$CONFIGURE_ARGS)
-endef
-
define Package/transmission-daemon-openssl/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/transmission-daemon $(1)/usr/bin/
config transmission
option enabled 0
option config_dir '/tmp/transmission'
- #option user 'nobody'
+ option config_overwrite '1'
+ option user 'transmission'
+ option group 'transmission'
option mem_percentage 50
option nice 10
- option ionice_flags '-c 3'
option alt_speed_down 50
option alt_speed_enabled false
option alt_speed_time_begin 540
option rpc_authentication_required false
option rpc_bind_address '0.0.0.0'
option rpc_enabled true
+ option rpc_host_whitelist '127.0.0.1,192.168.1.*'
+ option rpc_host_whitelist_enabled false
option rpc_password ''
option rpc_port 9091
option rpc_url '/transmission/'
option rpc_username ''
option rpc_whitelist '127.0.0.1,192.168.1.*'
- option rpc_whitelist_enabled true
+ option rpc_whitelist_enabled false
option scrape_paused_torrents_enabled true
option script_torrent_done_enabled false
option script_torrent_done_filename ''
START=99
USE_PROCD=1
-
LIST_SEP="
"
append_params() {
local p; local v; local s="$1"; shift
- for p in $*; do
+ for p in "$@"; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
[ -n "$v" ] && (
- echo "\""$p"\": "$v"," | sed -e 's|_|-|g' >> $config_file
+ echo "\"$p\": $v," | sed -e 's|_|-|g' >> $config_file
)
done
unset IFS
append_params_quotes() {
local p; local v; local s="$1"; shift
- for p in $*; do
+ for p in "$@"; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
[ -n "$v" ] && (
- echo -n "\""$p | sed -e 's|/|\\/|g;s|_|-|g' >> $config_file; \
- echo "\": \""$v"\"," >> $config_file
+ echo -n "\"$p" | sed -e 's|/|\\/|g;s|_|-|g' >> $config_file; \
+ echo "\": \"$v\"," >> $config_file
)
done
unset IFS
}
section_enabled() {
- config_get_bool enabled "$1" 'enabled' 0
+ config_get_bool enabled "$1" enabled 0
[ $enabled -gt 0 ]
}
local USE
local user
+ local group
+ local config_overwrite
local download_dir config_dir
local mem_percentage
- local config_overwrite nice ionice_flags
+ local nice
local cmdline
section_enabled "$section" || return 1
config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission'
config_get user "$cfg" 'user'
+ config_get group "$cfg" 'group'
config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission'
config_get mem_percentage "$cfg" 'mem_percentage' '50'
config_get config_overwrite "$cfg" config_overwrite 1
config_get nice "$cfg" nice 0
- config_get ionice_flags "$cfg" ionice_flags ''
- which ionice > /dev/null || ionice_flags=''
local MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
if test "$MEM" -gt 1;then
config_file="$config_dir/settings.json"
[ -d $config_dir ] || {
- mkdir -m 0755 -p "$config_dir"
+ mkdir -p $config_dir
+ chmod 0755 $config_dir
touch $config_file
- [ -z "$user" ] || chown -R $user $config_dir
+ [ -z "$user" ] || chown -R "$user:$group" $config_dir
}
[ "$config_overwrite" == 0 ] || {
speed_limit_down speed_limit_down_enabled speed_limit_up \
speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
- watch_dir_enabled
+ watch_dir_enabled rpc_host_whitelist_enabled
append_params_quotes "$cfg" \
blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
- rpc_username rpc_whitelist script_torrent_done_filename watch_dir
+ rpc_username rpc_host_whitelist rpc_whitelist script_torrent_done_filename watch_dir
- echo "\""invalid-key"\": false" >> $config_file
+ echo "\"invalid-key\": false" >> $config_file
echo "}" >> $config_file
}
- cmdline="/usr/bin/transmission-daemon -g $config_dir -f"
- [ "$ionice_flags" ] && cmdline="ionice $ionice_flags $cmdline"
+ cmdline="transmission-daemon -g $config_dir -f"
procd_open_instance
procd_set_param command $cmdline
+ procd_set_param env CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
+ procd_set_param user $user
+ procd_set_param group $group
+ procd_set_param nice $nice
procd_set_param respawn retry=60
- procd_set_param user "$user"
- procd_set_param nice "$nice"
- if test -z "$USE";then
+
+ if test -z $USE; then
procd_set_param limits core="0 0"
else
procd_set_param limits core="0 0" as="$USE $USE"
--- /dev/null
+From bad7f584eb11076ae37fd51cdb21842935c6ea57 Mon Sep 17 00:00:00 2001
+From: Mike Gelfand <mikedld@mikedld.com>
+Date: Wed, 26 Oct 2016 20:37:10 +0300
+Subject: [PATCH] Add support for mbedtls (formely polarssl)
+
+---
+ cmake/FindPolarSSL.cmake | 37 +++++++----
+ configure.ac | 28 ++++----
+ libtransmission/CMakeLists.txt | 4 ++
+ libtransmission/Makefile.am | 3 +
+ libtransmission/crypto-utils-polarssl.c | 112 +++++++++++++++++++-------------
+ 5 files changed, 115 insertions(+), 69 deletions(-)
+
+diff --git a/cmake/FindPolarSSL.cmake b/cmake/FindPolarSSL.cmake
+index 0a958e0..e4e1ac6 100644
+--- a/cmake/FindPolarSSL.cmake
++++ b/cmake/FindPolarSSL.cmake
+@@ -8,21 +8,36 @@ if(POLARSSL_PREFER_STATIC_LIB)
+ endif()
+
+ if(UNIX)
+- find_package(PkgConfig QUIET)
+- pkg_check_modules(_POLARSSL QUIET polarssl)
++ find_package(PkgConfig QUIET)
++ pkg_check_modules(_MBEDTLS QUIET mbedtls)
+ endif()
+
+-find_path(POLARSSL_INCLUDE_DIR NAMES polarssl/version.h HINTS ${_POLARSSL_INCLUDEDIR})
+-find_library(POLARSSL_LIBRARY NAMES polarssl HINTS ${_POLARSSL_LIBDIR})
++find_path(MBEDTLS_INCLUDE_DIR NAMES mbedtls/version.h HINTS ${_MBEDTLS_INCLUDEDIR})
++find_library(MBEDTLS_LIBRARY NAMES mbedtls HINTS ${_MBEDTLS_LIBDIR})
++if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY)
++ set(POLARSSL_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
++ set(POLARSSL_LIBRARY ${MBEDTLS_LIBRARY})
++ set(POLARSSL_VERSION ${_MBEDTLS_VERSION})
++ set(POLARSSL_IS_MBEDTLS ON)
++else()
++ if(UNIX)
++ pkg_check_modules(_POLARSSL QUIET polarssl)
++ endif()
++
++ find_path(POLARSSL_INCLUDE_DIR NAMES polarssl/version.h HINTS ${_POLARSSL_INCLUDEDIR})
++ find_library(POLARSSL_LIBRARY NAMES polarssl HINTS ${_POLARSSL_LIBDIR})
++ set(POLARSSL_VERSION ${_POLARSSL_VERSION})
++ set(POLARSSL_IS_MBEDTLS OFF)
++endif()
+
+-if(POLARSSL_INCLUDE_DIR)
+- if(_POLARSSL_VERSION)
+- set(POLARSSL_VERSION ${_POLARSSL_VERSION})
++if(NOT POLARSSL_VERSION AND POLARSSL_INCLUDE_DIR)
++ if(POLARSSL_IS_MBEDTLS)
++ file(STRINGS "${POLARSSL_INCLUDE_DIR}/mbedtls/version.h" POLARSSL_VERSION_STR REGEX "^#define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[^\"]+\"")
+ else()
+ file(STRINGS "${POLARSSL_INCLUDE_DIR}/polarssl/version.h" POLARSSL_VERSION_STR REGEX "^#define[\t ]+POLARSSL_VERSION_STRING[\t ]+\"[^\"]+\"")
+- if(POLARSSL_VERSION_STR MATCHES "\"([^\"]+)\"")
+- set(POLARSSL_VERSION "${CMAKE_MATCH_1}")
+- endif()
++ endif()
++ if(POLARSSL_VERSION_STR MATCHES "\"([^\"]+)\"")
++ set(POLARSSL_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+
+@@ -39,7 +54,7 @@ find_package_handle_standard_args(PolarSSL
+ POLARSSL_VERSION
+ )
+
+-mark_as_advanced(POLARSSL_INCLUDE_DIR POLARSSL_LIBRARY)
++mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARY POLARSSL_INCLUDE_DIR POLARSSL_LIBRARY)
+
+ if(POLARSSL_PREFER_STATIC_LIB)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${POLARSSL_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+diff --git a/configure.ac b/configure.ac
+index aff673b..cb026df 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -149,23 +149,26 @@ AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xcyassl"], [
+ )
+ ])
+ AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xpolarssl"], [
+- AC_CHECK_HEADER([polarssl/version.h],
+- [AC_EGREP_CPP([version_ok], [#include <polarssl/version.h>
+- #if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
+- version_ok
+- #endif],
+- [AC_CHECK_LIB([polarssl], [dhm_calc_secret],
+- [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
++ PKG_CHECK_MODULES(MBEDTLS, [mbedtls >= $POLARSSL_MINIMUM],
++ [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS="$MBEDTLS_CFLAGS"; CRYPTO_LIBS="$MBEDTLS_LIBS"; POLARSSL_IS_MBEDTLS=yes],
++ [AC_CHECK_HEADER([polarssl/version.h],
++ [AC_EGREP_CPP([version_ok], [#include <polarssl/version.h>
++ #if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
++ version_ok
++ #endif],
++ [AC_CHECK_LIB([polarssl], [dhm_calc_secret],
++ [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
++ [AS_IF([test "x$want_crypto" = "xpolarssl"],
++ [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
++ )]
++ )],
+ [AS_IF([test "x$want_crypto" = "xpolarssl"],
+- [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
++ [AC_MSG_ERROR([PolarSSL support requested, but version not suitable.])]
+ )]
+ )],
+ [AS_IF([test "x$want_crypto" = "xpolarssl"],
+- [AC_MSG_ERROR([PolarSSL support requested, but version not suitable.])]
++ [AC_MSG_ERROR([PolarSSL support requested, but headers not found.])]
+ )]
+- )],
+- [AS_IF([test "x$want_crypto" = "xpolarssl"],
+- [AC_MSG_ERROR([PolarSSL support requested, but headers not found.])]
+ )]
+ )
+ ])
+@@ -180,6 +183,7 @@ AS_IF([test "x$CRYPTO_PKG" = "x"], [
+ AM_CONDITIONAL([CRYPTO_USE_OPENSSL],[test "x$CRYPTO_PKG" = "xopenssl"])
+ AM_CONDITIONAL([CRYPTO_USE_CYASSL],[test "x$CRYPTO_PKG" = "xcyassl"])
+ AM_CONDITIONAL([CRYPTO_USE_POLARSSL],[test "x$CRYPTO_PKG" = "xpolarssl"])
++AM_CONDITIONAL([POLARSSL_IS_MBEDTLS],[test "x$POLARSSL_IS_MBEDTLS" = "xyes"])
+ AC_SUBST(CRYPTO_PKG)
+ AC_SUBST(CRYPTO_CFLAGS)
+ AC_SUBST(CRYPTO_LIBS)
+diff --git a/libtransmission/CMakeLists.txt b/libtransmission/CMakeLists.txt
+index 4865dee..b5230b9 100644
+--- a/libtransmission/CMakeLists.txt
++++ b/libtransmission/CMakeLists.txt
+@@ -194,6 +194,10 @@ if(USE_SYSTEM_B64)
+ add_definitions(-DUSE_SYSTEM_B64)
+ endif()
+
++if(POLARSSL_IS_MBEDTLS)
++ add_definitions(-DPOLARSSL_IS_MBEDTLS)
++endif()
++
+ include_directories(
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+diff --git a/libtransmission/Makefile.am b/libtransmission/Makefile.am
+index f91769a..4d7e85a 100644
+--- a/libtransmission/Makefile.am
++++ b/libtransmission/Makefile.am
+@@ -102,6 +102,9 @@ libtransmission_a_SOURCES += crypto-utils-cyassl.c
+ endif
+ if CRYPTO_USE_POLARSSL
+ libtransmission_a_SOURCES += crypto-utils-polarssl.c
++if POLARSSL_IS_MBEDTLS
++AM_CPPFLAGS += -DPOLARSSL_IS_MBEDTLS
++endif
+ endif
+
+ noinst_HEADERS = \
+diff --git a/libtransmission/crypto-utils-polarssl.c b/libtransmission/crypto-utils-polarssl.c
+index 1c59a7f..e98c13d 100644
+--- a/libtransmission/crypto-utils-polarssl.c
++++ b/libtransmission/crypto-utils-polarssl.c
+@@ -1,5 +1,5 @@
+ /*
+- * This file Copyright (C) 2014-2015 Mnemosyne LLC
++ * This file Copyright (C) 2014-2016 Mnemosyne LLC
+ *
+ * It may be used under the GNU GPL versions 2 or 3
+ * or any future license endorsed by Mnemosyne LLC.
+@@ -7,15 +7,25 @@
+ * $Id$
+ */
+
++#if defined (POLARSSL_IS_MBEDTLS)
++ #define API_HEADER(x) <mbedtls/x>
++ #define API(x) mbedtls_##x
++ #define API_VERSION_NUMBER MBEDTLS_VERSION_NUMBER
++#else
++ #define API_HEADER(x) <polarssl/x>
++ #define API(x) x
++ #define API_VERSION_NUMBER POLARSSL_VERSION_NUMBER
++#endif
++
+ #include <assert.h>
+
+-#include <polarssl/arc4.h>
+-#include <polarssl/base64.h>
+-#include <polarssl/ctr_drbg.h>
+-#include <polarssl/dhm.h>
+-#include <polarssl/error.h>
+-#include <polarssl/sha1.h>
+-#include <polarssl/version.h>
++#include API_HEADER (arc4.h)
++#include API_HEADER (base64.h)
++#include API_HEADER (ctr_drbg.h)
++#include API_HEADER (dhm.h)
++#include API_HEADER (error.h)
++#include API_HEADER (sha1.h)
++#include API_HEADER (version.h)
+
+ #include "transmission.h"
+ #include "crypto-utils.h"
+@@ -41,7 +51,9 @@ log_polarssl_error (int error_code,
+ {
+ char error_message[256];
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030000
++#if defined (POLARSSL_IS_MBEDTLS)
++ mbedtls_strerror (error_code, error_message, sizeof (error_message));
++#elif API_VERSION_NUMBER >= 0x01030000
+ polarssl_strerror (error_code, error_message, sizeof (error_message));
+ #else
+ error_strerror (error_code, error_message, sizeof (error_message));
+@@ -51,7 +63,7 @@ log_polarssl_error (int error_code,
+ }
+ }
+
+-#define log_error(error_code) log_polarssl_error(error_code, __FILE__, __LINE__)
++#define log_error(error_code) log_polarssl_error ((error_code), __FILE__, __LINE__)
+
+ static bool
+ check_polarssl_result (int result,
+@@ -83,15 +95,20 @@ my_rand (void * context UNUSED, unsigned char * buffer, size_t buffer_size)
+ return 0;
+ }
+
+-static ctr_drbg_context *
++static API (ctr_drbg_context) *
+ get_rng (void)
+ {
+- static ctr_drbg_context rng;
++ static API (ctr_drbg_context) rng;
+ static bool rng_initialized = false;
+
+ if (!rng_initialized)
+ {
+- if (!check_result (ctr_drbg_init (&rng, &my_rand, NULL, NULL, 0)))
++#if API_VERSION_NUMBER >= 0x02000000
++ API (ctr_drbg_init) (&rng);
++ if (!check_result (API (ctr_drbg_seed) (&rng, &my_rand, NULL, NULL, 0)))
++#else
++ if (!check_result (API (ctr_drbg_init) (&rng, &my_rand, NULL, NULL, 0)))
++#endif
+ return NULL;
+ rng_initialized = true;
+ }
+@@ -117,13 +134,13 @@ get_rng_lock (void)
+ tr_sha1_ctx_t
+ tr_sha1_init (void)
+ {
+- sha1_context * handle = tr_new0 (sha1_context, 1);
++ API (sha1_context) * handle = tr_new0 (API (sha1_context), 1);
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030800
+- sha1_init (handle);
++#if API_VERSION_NUMBER >= 0x01030800
++ API (sha1_init) (handle);
+ #endif
+
+- sha1_starts (handle);
++ API (sha1_starts) (handle);
+ return handle;
+ }
+
+@@ -139,7 +156,7 @@ tr_sha1_update (tr_sha1_ctx_t handle,
+
+ assert (data != NULL);
+
+- sha1_update (handle, data, data_length);
++ API (sha1_update) (handle, data, data_length);
+ return true;
+ }
+
+@@ -151,11 +168,11 @@ tr_sha1_final (tr_sha1_ctx_t handle,
+ {
+ assert (handle != NULL);
+
+- sha1_finish (handle, hash);
++ API (sha1_finish) (handle, hash);
+ }
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030800
+- sha1_free (handle);
++#if API_VERSION_NUMBER >= 0x01030800
++ API (sha1_free) (handle);
+ #endif
+
+ tr_free (handle);
+@@ -169,10 +186,10 @@ tr_sha1_final (tr_sha1_ctx_t handle,
+ tr_rc4_ctx_t
+ tr_rc4_new (void)
+ {
+- arc4_context * handle = tr_new0 (arc4_context, 1);
++ API (arc4_context) * handle = tr_new0 (API (arc4_context), 1);
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030800
+- arc4_init (handle);
++#if API_VERSION_NUMBER >= 0x01030800
++ API (arc4_init) (handle);
+ #endif
+
+ return handle;
+@@ -181,8 +198,8 @@ tr_rc4_new (void)
+ void
+ tr_rc4_free (tr_rc4_ctx_t handle)
+ {
+-#if POLARSSL_VERSION_NUMBER >= 0x01030800
+- arc4_free (handle);
++#if API_VERSION_NUMBER >= 0x01030800
++ API (arc4_free) (handle);
+ #endif
+
+ tr_free (handle);
+@@ -196,7 +213,7 @@ tr_rc4_set_key (tr_rc4_ctx_t handle,
+ assert (handle != NULL);
+ assert (key != NULL);
+
+- arc4_setup (handle, key, key_length);
++ API (arc4_setup) (handle, key, key_length);
+ }
+
+ void
+@@ -213,7 +230,7 @@ tr_rc4_process (tr_rc4_ctx_t handle,
+ assert (input != NULL);
+ assert (output != NULL);
+
+- arc4_crypt (handle, length, input, output);
++ API (arc4_crypt) (handle, length, input, output);
+ }
+
+ /***
+@@ -226,19 +243,19 @@ tr_dh_new (const uint8_t * prime_num,
+ const uint8_t * generator_num,
+ size_t generator_num_length)
+ {
+- dhm_context * handle = tr_new0 (dhm_context, 1);
++ API (dhm_context) * handle = tr_new0 (API (dhm_context), 1);
+
+ assert (prime_num != NULL);
+ assert (generator_num != NULL);
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030800
+- dhm_init (handle);
++#if API_VERSION_NUMBER >= 0x01030800
++ API (dhm_init) (handle);
+ #endif
+
+- if (!check_result (mpi_read_binary (&handle->P, prime_num, prime_num_length)) ||
+- !check_result (mpi_read_binary (&handle->G, generator_num, generator_num_length)))
++ if (!check_result (API (mpi_read_binary) (&handle->P, prime_num, prime_num_length)) ||
++ !check_result (API (mpi_read_binary) (&handle->G, generator_num, generator_num_length)))
+ {
+- dhm_free (handle);
++ API (dhm_free) (handle);
+ return NULL;
+ }
+
+@@ -253,7 +270,7 @@ tr_dh_free (tr_dh_ctx_t handle)
+ if (handle == NULL)
+ return;
+
+- dhm_free (handle);
++ API (dhm_free) (handle);
+ }
+
+ bool
+@@ -262,7 +279,7 @@ tr_dh_make_key (tr_dh_ctx_t raw_handle,
+ uint8_t * public_key,
+ size_t * public_key_length)
+ {
+- dhm_context * handle = raw_handle;
++ API (dhm_context) * handle = raw_handle;
+
+ assert (handle != NULL);
+ assert (public_key != NULL);
+@@ -270,8 +287,8 @@ tr_dh_make_key (tr_dh_ctx_t raw_handle,
+ if (public_key_length != NULL)
+ *public_key_length = handle->len;
+
+- return check_result (dhm_make_public (handle, private_key_length, public_key,
+- handle->len, my_rand, NULL));
++ return check_result (API (dhm_make_public) (handle, private_key_length, public_key,
++ handle->len, my_rand, NULL));
+ }
+
+ tr_dh_secret_t
+@@ -279,26 +296,29 @@ tr_dh_agree (tr_dh_ctx_t raw_handle,
+ const uint8_t * other_public_key,
+ size_t other_public_key_length)
+ {
+- dhm_context * handle = raw_handle;
++ API (dhm_context) * handle = raw_handle;
+ struct tr_dh_secret * ret;
+ size_t secret_key_length;
+
+ assert (handle != NULL);
+ assert (other_public_key != NULL);
+
+- if (!check_result (dhm_read_public (handle, other_public_key,
+- other_public_key_length)))
++ if (!check_result (API (dhm_read_public )(handle, other_public_key,
++ other_public_key_length)))
+ return NULL;
+
+ ret = tr_dh_secret_new (handle->len);
+
+ secret_key_length = handle->len;
+
+-#if POLARSSL_VERSION_NUMBER >= 0x01030000
+- if (!check_result (dhm_calc_secret (handle, ret->key,
+- &secret_key_length, my_rand, NULL)))
++#if API_VERSION_NUMBER >= 0x02000000
++ if (!check_result (API (dhm_calc_secret) (handle, ret->key, secret_key_length,
++ &secret_key_length, my_rand, NULL)))
++#elif API_VERSION_NUMBER >= 0x01030000
++ if (!check_result (API (dhm_calc_secret) (handle, ret->key,
++ &secret_key_length, my_rand, NULL)))
+ #else
+- if (!check_result (dhm_calc_secret (handle, ret->key, &secret_key_length)))
++ if (!check_result (API (dhm_calc_secret) (handle, ret->key, &secret_key_length)))
+ #endif
+ {
+ tr_dh_secret_free (ret);
+@@ -324,7 +344,7 @@ tr_rand_buffer (void * buffer,
+ assert (buffer != NULL);
+
+ tr_lockLock (rng_lock);
+- ret = check_result (ctr_drbg_random (get_rng (), buffer, length));
++ ret = check_result (API (ctr_drbg_random) (get_rng (), buffer, length));
+ tr_lockUnlock (rng_lock);
+
+ return ret;
+--
+2.7.4
+
--- /dev/null
+From 94fa0bba88740b9ab58c5805ddb24b05b2635f34 Mon Sep 17 00:00:00 2001
+From: Mike Gelfand <mikedld@mikedld.com>
+Date: Fri, 26 Jan 2018 08:31:16 +0300
+Subject: [PATCH] Fix FTCBFS due to AC_RUN_IFELSE (patch by Helmut Grohne)
+
+Fixes: #475
+---
+ configure.ac | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index cb026df..335f4a7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -390,14 +390,12 @@ dnl Let's hope it's 1.7 or higher, since it provides
+ dnl MINIUPNPC_API_VERSION and we won't have to figure
+ dnl it out on our own
+ if test "x$upnp_version" = "xunknown" ; then
+- AC_RUN_IFELSE(
++ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <stdlib.h>
+ #include <miniupnpc/miniupnpc.h>],
+- [#ifdef MINIUPNPC_API_VERSION
+- return EXIT_SUCCESS;
+- #else
+- return EXIT_FAILURE;
++ [#ifndef MINIUPNPC_API_VERSION
++ #error MINIUPNPC_API_VERSION undefined
+ #endif]
+ )],
+ [upnp_version=">= 1.7"]
+--
+2.7.4
+
+++ /dev/null
---- a/configure.ac
-+++ b/configure.ac
-@@ -386,7 +386,7 @@ dnl See if ANY version of miniupnpc is i
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
- [struct UPNPDev dev;])],
-- [upnp_version="unknown"],
-+ [upnp_version="none"],
- [upnp_version="none"]
- )
-
--- /dev/null
+From d6655cca7db1b960456811b8206ce222700e010d Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Tue, 30 Jan 2018 13:19:58 -0800
+Subject: [PATCH] Remove compressed responses from web servers.
+
+While zlib is mandatory for transmission, it is not mandatory for curl.
+
+A libcurl that has been compiled with no support for zlib will return no data if compressed responses are set to on.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ libtransmission/web.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libtransmission/web.c b/libtransmission/web.c
+index c7f0627..db34976 100644
+--- a/libtransmission/web.c
++++ b/libtransmission/web.c
+@@ -180,7 +180,7 @@ createEasy (tr_session * s, struct tr_web * web, struct tr_web_task * task)
+ task->timeout_secs = getTimeoutFromURL (task);
+
+ curl_easy_setopt (e, CURLOPT_AUTOREFERER, 1L);
+- curl_easy_setopt (e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity");
++ curl_easy_setopt (e, CURLOPT_ENCODING, "");
+ curl_easy_setopt (e, CURLOPT_FOLLOWLOCATION, 1L);
+ curl_easy_setopt (e, CURLOPT_MAXREDIRS, -1L);
+ curl_easy_setopt (e, CURLOPT_NOSIGNAL, 1L);
+--
+2.7.4
+
+++ /dev/null
---- a/configure.ac
-+++ b/configure.ac
-@@ -154,24 +154,8 @@ AS_IF([test "x$want_crypto" = "xauto" -o
- AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xpolarssl"], [
- PKG_CHECK_MODULES(MBEDTLS, [mbedtls >= $POLARSSL_MINIMUM],
- [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS="$MBEDTLS_CFLAGS"; CRYPTO_LIBS="$MBEDTLS_LIBS"; POLARSSL_IS_MBEDTLS=yes],
-- [AC_CHECK_HEADER([polarssl/version.h],
-- [AC_EGREP_CPP([version_ok], [#include <polarssl/version.h>
-- #if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
-- version_ok
-- #endif],
-- [AC_CHECK_LIB([polarssl], [dhm_calc_secret],
-- [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
-- [AS_IF([test "x$want_crypto" = "xpolarssl"],
-- [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
-- )]
-- )],
-- [AS_IF([test "x$want_crypto" = "xpolarssl"],
-- [AC_MSG_ERROR([PolarSSL support requested, but version not suitable.])]
-- )]
-- )],
-- [AS_IF([test "x$want_crypto" = "xpolarssl"],
-- [AC_MSG_ERROR([PolarSSL support requested, but headers not found.])]
-- )]
-+ [AS_IF([test "x$want_crypto" = "xpolarssl"],
-+ [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
- )]
- )
- ])
--- /dev/null
+From 6de0a3d7a3cd0b2ca6d1b33b5d4d7f44908c1ac3 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Thu, 1 Mar 2018 11:21:43 -0800
+Subject: [PATCH] portcheck: Switch to HTTPS.
+
+Useful for OpenWrt.
+---
+ libtransmission/rpcimpl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libtransmission/rpcimpl.c b/libtransmission/rpcimpl.c
+index 46fd3192c..dcd96df59 100644
+--- a/libtransmission/rpcimpl.c
++++ b/libtransmission/rpcimpl.c
+@@ -1455,7 +1455,7 @@ portTest (tr_session * session,
+ struct tr_rpc_idle_data * idle_data)
+ {
+ const int port = tr_sessionGetPeerPort (session);
+- char * url = tr_strdup_printf ("http://portcheck.transmissionbt.com/%d", port);
++ char * url = tr_strdup_printf ("https://portcheck.transmissionbt.com/%d", port);
+ tr_webRun (session, url, portTested, idle_data);
+ tr_free (url);
+ return NULL;
+--
+2.14.3
+
--- /dev/null
+From 405d768bfea661c418e2c75686a7bac95e4bb17b Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Thu, 1 Mar 2018 11:25:15 -0800
+Subject: [PATCH] fix web interface with Safari.
+
+Backport of bcfe147e6a41ce7774f569ede6179a7ed2c7f560
+---
+ web/javascript/common.js | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/web/javascript/common.js b/web/javascript/common.js
+index 7162d3f82..77bf96857 100644
+--- a/web/javascript/common.js
++++ b/web/javascript/common.js
+@@ -61,7 +61,7 @@ $(document).ready(function() {
+ // Fix min height for isMobileDevice when run in full screen mode from home screen
+ // so the footer appears in the right place
+ $('body div#torrent_container').css('min-height', '338px');
+- $("label[for=torrent_upload_url]").text("URL: ");
++ $("label[for=torrent_upload_url]").text = "URL: ";
+ } else {
+ // Fix for non-Safari-3 browsers: dark borders to replace shadows.
+ $('div.dialog_container div.dialog_window').css('border', '1px solid #777');
+--
+2.14.3
+
+++ /dev/null
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -42,8 +42,8 @@ set(TR_NAME ${PROJECT_NAME})
- # "Z" for unsupported trunk builds,
- # "0" for stable, supported releases
- # these should be the only two lines you need to change
--set(TR_USER_AGENT_PREFIX "2.92+")
--set(TR_PEER_ID_PREFIX "-TR292Z-")
-+set(TR_USER_AGENT_PREFIX "2.92")
-+set(TR_PEER_ID_PREFIX "-TR2920-")
-
- string(REGEX MATCH "^([0-9]+)\\.([0-9]+).*" TR_VERSION "${TR_USER_AGENT_PREFIX}")
- set(TR_VERSION_MAJOR "${CMAKE_MATCH_1}")
---- a/configure.ac
-+++ b/configure.ac
-@@ -3,8 +3,8 @@ dnl STATUS: "X" for prerelease beta buil
- dnl "Z" for unsupported trunk builds,
- dnl "0" for stable, supported releases
- dnl these should be the only two lines you need to change
--m4_define([user_agent_prefix],[2.92+])
--m4_define([peer_id_prefix],[-TR292Z-])
-+m4_define([user_agent_prefix],[2.92])
-+m4_define([peer_id_prefix],[-TR2920-])
-
- AC_INIT([transmission],[user_agent_prefix],[https://trac.transmissionbt.com/newticket])
- AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
+++ /dev/null
-diff --git a/daemon/daemon.c b/daemon/daemon.c
-index 7b2a3b425..5b19d105a 100644
---- a/daemon/daemon.c
-+++ b/daemon/daemon.c
-@@ -715,12 +715,7 @@ static int daemon_start(void* raw_arg, bool foreground)
- }
-
- #ifdef HAVE_SYSLOG
--
-- if (!foreground)
-- {
-- openlog(MY_NAME, LOG_CONS | LOG_PID, LOG_DAEMON);
-- }
--
-+ openlog(MY_NAME, LOG_CONS | LOG_PID, LOG_DAEMON);
- #endif
-
- /* Create new timer event to report daemon status */
-@@ -772,11 +767,8 @@ cleanup:
- /* shutdown */
- #ifdef HAVE_SYSLOG
-
-- if (!foreground)
-- {
- syslog(LOG_INFO, "%s", "Closing session");
- closelog();
-- }
-
- #endif
-
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
-PKG_VERSION:=1.0.2
+PKG_VERSION:=1.2.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
SECTION:=net
CATEGORY:=Network
TITLE:=A wlan connection manager for travel router
- DEPENDS:=+iwinfo +jshn +jsonfilter
+ DEPENDS:=+iwinfo +jshn +jsonfilter +uclient-fetch
PKGARCH:=all
endef
## Description
If you’re planning an upcoming vacation or a business trip, taking your laptop, tablet or smartphone give you the ability to connect with friends or complete work on the go. But many hotels don’t have a secure wireless network setup or you’re limited on using a single device at once. Investing in a portable, mini travel router is a great way to connect all of your devices at once while having total control over your own personalized wireless network.
-A logical combination of AP+STA mode on one physical radio allows most of OpenWrt/LEDE supported router devices to connect to a wireless hotspot/station (STA) and provide a wireless access point (AP) from that hotspot at the same time. Downside of this solution: whenever the STA interface looses the connection it will go into an active scan cycle which renders the radio unusable for AP mode operation, therefore the AP is taken down if the STA looses its association.
+A logical combination of AP+STA mode on one physical radio allows most of OpenWrt supported router devices to connect to a wireless hotspot/station (STA) and provide a wireless access point (AP) from that hotspot at the same time. Downside of this solution: whenever the STA interface looses the connection it will go into an active scan cycle which renders the radio unusable for AP mode operation, therefore the AP is taken down if the STA looses its association.
To avoid these kind of deadlocks, travelmate set all station interfaces in an "always off" mode and connects automatically to available/configured hotspots.
## Main Features
* STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible
-* easy setup within normal OpenWrt/LEDE environment
+* easy setup within normal OpenWrt environment
* strong LuCI-Support with builtin interface wizard and a wireless station manager
* fast uplink connections
* support all kinds of uplinks, incl. hidden and enterprise uplinks
-* trigger- or automatic-mode support, the latter one is the default and checks the existing uplink connection regardless of ifdown event trigger actions every n seconds
+* continuously checks the existing uplink connection (quality), e.g. for conditional uplink (dis-) connections
+* captive portal detection with internet online check and a 'heartbeat' function to keep the uplink connection up & running
* support of devices with multiple radios
* procd init and hotplug support
* runtime information available via LuCI & via 'status' init command
* status & debug logging to syslog
+* optional: the LuCI frontend shows the WiFi QR codes from all configured Access Points. It allows you to connect your Android or iOS devices to your router’s WiFi using the QR code
## Prerequisites
-* [LEDE](https://www.lede-project.org) 17.01 or latest snapshot
-* iwinfo for wlan scanning
+* [OpenWrt](https://openwrt.org), tested with the stable release series (17.01.x) and with the latest OpenWrt snapshot
+* iwinfo for wlan scanning, uclient-fetch for captive portal detection
+* optional: qrencode 4.x for QR code support
-## LEDE trunk Installation & Usage
-* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/packages)
+## Installation & Usage
+* download the package [here](https://downloads.openwrt.org/snapshots/packages/x86_64/packages)
* install 'travelmate' (_opkg install travelmate_)
* configure your network:
* recommended: use the LuCI frontend with builtin interface wizard and a wireless station manager
- * manual: see detailed configure steps below
+ * manual: see detailed configuration steps below
* at least you need one configured AP and one STA interface
## LuCI travelmate companion package
-* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/luci)
+* download the package [here](https://downloads.openwrt.org/snapshots/packages/x86_64/luci)
* install 'luci-app-travelmate' (_opkg install luci-app-travelmate_)
* the application is located in LuCI under 'Services' menu
## Travelmate config options
-* usually the pre-configured travelmate setup works quite well and no manual config overrides are needed, all listed options apply to the 'global' config section:
- * trm\_enabled => main switch to enable/disable the travelmate service (default: '0', disabled)
- * trm\_debug => enable/disable debug logging (default: '0', disabled)
- * trm\_automatic => keep travelmate in an active state (default: '1', enabled)
- * trm\_maxwait => how long (in seconds) should travelmate wait for a successful wlan interface reload action (default: '30')
- * trm\_maxretry => how many times should travelmate try to connect to an uplink, '0' means unlimited retries. (default: '3')
- * trm\_timeout => timeout in seconds for "automatic mode" (default: '60')
+* usually the pre-configured travelmate setup works quite well and no manual config overrides are needed, all listed options apply to the 'global' section:
+ * trm\_enabled => main switch to enable/disable the travelmate service (bool/default: '0', disabled)
+ * trm\_debug => enable/disable debug logging (bool/default: '0', disabled)
+ * trm\_captive => enable/disable the captive portal detection (bool/default: '1', enabled)
+ * trm\_minquality => minimum signal quality threshold as percent for conditional uplink (dis-) connections (int/default: '35', valid range: 20-80)
+ * trm\_maxwait => how long (in seconds) should travelmate wait for a successful wlan interface reload action (int/default: '30', valid range: 20-40)
+ * trm\_maxretry => how many times should travelmate try to connect to an uplink (int/default: '3', valid range: 1-10)
+ * trm\_timeout => overall retry timeout in seconds (int/default: '60', valid range: 30-300)
* trm\_radio => limit travelmate to a dedicated radio, e.g. 'radio0' (default: not set, use all radios)
* trm\_iface => main uplink / procd trigger network interface (default: trm_wwan)
- * trm\_triggerdelay => additional trigger delay in seconds before travelmate processing starts (default: '2')
+ * trm\_triggerdelay => additional trigger delay in seconds before travelmate processing begins (int/default: '2')
## Runtime information
**receive travelmate runtime information:**
<pre><code>
+~# /etc/init.d/travelmate status
::: travelmate runtime information
- travelmate_version : 1.0.0
- station_connection : true
- station_id : blackhole/04:F0:21:2F:B7:64
- station_interface : trm_wwan
- station_radio : radio1
- last_rundate : 15.12.2017 13:51:30
- system : TP-LINK RE450, OpenWrt SNAPSHOT r5422+84-9fe59abef8
+ + travelmate_status : connected (net ok/37)
+ + travelmate_version : 1.2.0
+ + station_id : blackhole/01:02:03:04:05:06
+ + station_interface : trm_wwan
+ + station_radio : radio0
+ + last_rundate : 04.04.2018 13:00:24
+ + system : GL.iNet GL-AR750, OpenWrt SNAPSHOT r6588-16efb0c1c6
</code></pre>
## Manual Setup
option device 'radio0'
option network 'trm_wwan'
option mode 'sta'
- option ssid 'example_01'
+ option ssid 'example_usual'
option encryption 'psk2+ccmp'
option key 'abc'
option disabled '1'
option device 'radio0'
option network 'trm_wwan'
option mode 'sta'
- option ssid 'example_02'
+ option ssid 'example_hidden'
+ option bssid '00:11:22:33:44:55'
option encryption 'psk2+ccmp'
option key 'xyz'
option disabled '1'
</code></pre>
## FAQ
-**Q:** What's about 'trigger' and 'automatic' mode?
-**A:** In "trigger" mode travelmate will be triggered solely by procd interface down events, whenever an uplink disappears travelmate tries n times (default 3) to find a new uplink or reconnect to the old one. The 'automatic' mode keeps travelmate in an active state and checks every n seconds the connection status / the uplink availability regardless of procd event trigger.
-
**Q:** What happen with misconfigured uplinks, e.g. due to outdated wlan passwords?
-**A:** Travelmate tries n times (default 3) to connect, then the respective uplink SSID will be marked / renamed to '_SSID_\_err'. In this case use the builtin wireless station manager to update your wireless credentials. To disable this functionality at all set the Connection Limit ('trm\_maxretry') to '0', which means unlimited retries.
-
-**Q:** Is travelmate compatible with CC/Openwrt?
-**A:** Travelmate was never tested with an ancient CC/OpenWrt release ... it should still work, but no promises.
+**A:** Travelmate tries n times (default 3) to connect, then the respective uplink SSID will be marked / renamed to '_SSID_\_err' and travelmate no longer attends this uplink. In this case use the builtin wireless station manager to update your wireless credentials.
+**Q:** How to connect to hidden uplinks?
+**A:** See 'example\_hidden' STA configuration above, option 'SSID' and 'BSSID' must be specified for successful connections.
-[...] to be continued [...]
## Support
Please join the travelmate discussion in this [forum thread](https://forum.lede-project.org/t/travelmate-support-thread/5155) or contact me by [mail](mailto:dev@brenken.org)
config travelmate 'global'
option trm_enabled '0'
+ option trm_captive '1'
+ option trm_iface 'trm_wwan'
+ option trm_triggerdelay '2'
option trm_debug '0'
- option trm_triggerdelay '1'
- option trm_automatic '1'
- option trm_maxwait '30'
option trm_maxretry '3'
+ option trm_minquality '35'
+ option trm_maxwait '30'
option trm_timeout '60'
- option trm_iface 'trm_wwan'
option trm_rtfile '/tmp/trm_runtime.json'
trm_init="/etc/init.d/travelmate"
trm_script="/usr/bin/travelmate.sh"
+trm_pidfile="/var/run/travelmate.pid"
boot()
{
fi
}
+reload_service()
+{
+ [ -s "${trm_pidfile}" ] && return 1
+ "${trm_init}" restart
+}
+
stop_service()
{
- local rtfile="$(uci -q get travelmate.global.trm_rtfile)"
+ local rtfile="$(uci_get travelmate global trm_rtfile)"
rtfile="${rtfile:-"/tmp/trm_runtime.json"}"
> "${rtfile}"
status()
{
- local key keylist value rtfile="$(uci_get travelmate.global.trm_rtfile)"
+ local key keylist value rtfile="$(uci_get travelmate global trm_rtfile)"
rtfile="${rtfile:-"/tmp/trm_runtime.json"}"
if [ -s "${rtfile}" ]
service_triggers()
{
- local auto="$(uci_get travelmate.global.trm_automatic)"
+ local trigger="$(uci_get travelmate global trm_iface)"
+ local delay="$(uci_get travelmate global trm_triggerdelay)"
- if [ "${auto}" = "0" ]
- then
- local trigger="$(uci_get travelmate.global.trm_iface)"
- local delay="$(uci_get travelmate.global.trm_triggerdelay)"
-
- PROCD_RELOAD_DELAY=$((${delay:-2} * 1000))
- procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" start
- fi
+ PROCD_RELOAD_DELAY=$((${delay:-2} * 1000))
+ procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" reload
procd_add_reload_trigger "travelmate"
}
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="1.0.2"
+trm_ver="1.2.0"
trm_sysver="unknown"
trm_enabled=0
trm_debug=0
-trm_automatic=1
+trm_captive=1
+trm_captiveurl="http://captive.apple.com"
+trm_minquality=35
trm_maxretry=3
trm_maxwait=30
trm_timeout=60
-trm_iwinfo="$(command -v iwinfo)"
trm_radio=""
+trm_connection=""
trm_rtfile="/tmp/trm_runtime.json"
+trm_fetch="$(command -v uclient-fetch)"
+trm_iwinfo="$(command -v iwinfo)"
trm_wpa="$(command -v wpa_supplicant)"
+trm_action="${1:-"start"}"
+trm_pidfile="/var/run/travelmate.pid"
# load travelmate environment
#
trm_sysver="${sys_model}, ${sys_desc}"
fi
- # initialize lists
+ # (re-)initialize global list variables
#
trm_devlist=""
trm_stalist=""
trm_radiolist=""
- # load uci config and check 'enabled' option
+ # load config and check 'enabled' option
#
option_cb()
{
if [ ${trm_enabled} -ne 1 ]
then
f_log "info" "travelmate is currently disabled, please set 'trm_enabled' to '1' to use this service"
+ config_load wireless
+ config_foreach f_prep wifi-iface
+ uci_commit wireless
+ ubus call network reload
exit 0
fi
- # check eap capabilities
+ # validate input ranges
#
- trm_eap="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" ${?})"
+ if [ ${trm_minquality} -lt 20 ] || [ ${trm_minquality} -gt 80 ]
+ then
+ trm_minquality=35
+ fi
+ if [ ${trm_maxretry} -lt 1 ] || [ ${trm_maxretry} -gt 10 ]
+ then
+ trm_maxretry=3
+ fi
+ if [ ${trm_maxwait} -lt 20 ] || [ ${trm_maxwait} -gt 40 ] || [ ${trm_maxwait} -ge ${trm_timeout} ]
+ then
+ trm_maxwait=30
+ fi
+ if [ ${trm_timeout} -lt 30 ] || [ ${trm_timeout} -gt 300 ] || [ ${trm_timeout} -le ${trm_maxwait} ]
+ then
+ trm_timeout=60
+ fi
}
# gather radio information & bring down all STA interfaces
#
f_prep()
{
- local config="${1}"
- local mode="$(uci -q get wireless."${config}".mode)"
- local network="$(uci -q get wireless."${config}".network)"
- local radio="$(uci -q get wireless."${config}".device)"
- local disabled="$(uci -q get wireless."${config}".disabled)"
- local eaptype="$(uci -q get wireless."${config}".eap_type)"
+ local eap_rc=0 config="${1}"
+ local mode="$(uci_get wireless "${config}" mode)"
+ local network="$(uci_get wireless "${config}" network)"
+ local radio="$(uci_get wireless "${config}" device)"
+ local disabled="$(uci_get wireless "${config}" disabled)"
+ local eaptype="$(uci_get wireless "${config}" eap_type)"
if ([ -z "${trm_radio}" ] || [ "${trm_radio}" = "${radio}" ]) && \
[ -z "$(printf "%s" "${trm_radiolist}" | grep -Fo " ${radio}")" ]
then
if [ -z "${disabled}" ] || [ "${disabled}" = "0" ]
then
- uci -q set wireless."${config}".disabled=1
+ uci_set wireless "${config}" disabled 1
+ fi
+ if [ -n "${eaptype}" ]
+ then
+ eap_rc="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" ${?})"
fi
- if [ -z "${eaptype}" ] || [ ${trm_eap} -eq 0 ]
+ if [ -z "${eaptype}" ] || [ ${eap_rc} -eq 0 ]
then
trm_stalist="${trm_stalist} ${config}_${radio}"
fi
fi
- f_log "debug" "f_prep ::: config: ${config}, mode: ${mode}, network: ${network}, radio: ${radio}, disabled: ${disabled}"
+ f_log "debug" "f_prep ::: config: ${config}, mode: ${mode}, network: ${network}, eap_rc: ${eap_rc}, radio: ${radio}, trm_radio: ${trm_radio:-"-"}, disabled: ${disabled}"
}
# check interface status
#
f_check()
{
- local ifname radio dev_status cnt=1 mode="${1}" status="${2:-"false"}"
+ local ifname radio dev_status config sta_essid sta_bssid result wait=1 mode="${1}" status="${2:-"false"}" IFS=" "
+ trm_ifquality=0
trm_ifstatus="false"
- ubus call network reload
- while [ ${cnt} -le ${trm_maxwait} ]
+ if [ "${mode}" != "initial" ]
+ then
+ ubus call network reload
+ fi
+ while [ ${wait} -le ${trm_maxwait} ]
do
dev_status="$(ubus -S call network.wireless status 2>/dev/null)"
if [ -n "${dev_status}" ]
fi
for radio in ${trm_radiolist}
do
- trm_ifstatus="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e "@.${radio}.up")"
- if [ "${trm_ifstatus}" = "true" ] && [ -z "$(printf "%s" "${trm_devlist}" | grep -Fo " ${radio}")" ]
+ result="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e "@.${radio}.up")"
+ if [ "${result}" = "true" ] && [ -z "$(printf "%s" "${trm_devlist}" | grep -Fo " ${radio}")" ]
then
trm_devlist="${trm_devlist} ${radio}"
fi
done
- if [ "${trm_radiolist}" = "${trm_devlist}" ] || [ ${cnt} -eq ${trm_maxwait} ] || [ "${status}" = "false" ]
+ if [ "${trm_devlist}" = "${trm_radiolist}" ] || [ ${wait} -eq ${trm_maxwait} ]
then
ifname="${trm_devlist}"
break
+ else
+ trm_devlist=""
fi
+ elif [ "${mode}" = "rev" ]
+ then
+ wait=$(( ${trm_maxwait} / 3 ))
+ sleep ${wait}
+ break
else
ifname="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].ifname')"
if [ -n "${ifname}" ]
then
- trm_ifstatus="$(ubus -S call network.interface dump 2>/dev/null | jsonfilter -l1 -e "@.interface[@.device=\"${ifname}\"].up")"
+ trm_ifquality="$(${trm_iwinfo} ${ifname} info 2>/dev/null | awk -F "[\/| ]" '/Link Quality:/{printf "%i\n", (100 / $NF * $(NF-1)) }')"
+ if [ ${trm_ifquality} -ge ${trm_minquality} ]
+ then
+ trm_ifstatus="$(ubus -S call network.interface dump 2>/dev/null | jsonfilter -l1 -e "@.interface[@.device=\"${ifname}\"].up")"
+ elif [ "${mode}" = "initial" ] && [ ${trm_ifquality} -lt ${trm_minquality} ]
+ then
+ trm_ifstatus="${status}"
+ sta_essid="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].*.ssid')"
+ sta_bssid="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].*.bssid')"
+ f_log "info" "uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' is out of range (${trm_ifquality}/${trm_minquality}), uplink disconnected (${trm_sysver})"
+ fi
fi
fi
if [ "${mode}" = "initial" ] || [ "${trm_ifstatus}" = "true" ]
then
- if [ "${mode}" != "initial" ] && [ "${trm_ifstatus}" != "${status}" ]
+ if ([ "${trm_ifstatus}" != "true" ] && [ "${trm_ifstatus}" != "${status}" ]) || [ ${trm_ifquality} -lt ${trm_minquality} ]
then
f_jsnup
fi
+ if [ "${mode}" = "initial" ] && [ "${trm_captive}" -eq 1 ] && [ "${trm_ifstatus}" = "true" ]
+ then
+ result="$(${trm_fetch} --timeout=$(( ${trm_maxwait} / 3 )) --spider "${trm_captiveurl}" 2>&1 | awk '/^Redirected/{printf "%s" "net cp \047"$NF"\047";exit}/^Download completed/{printf "%s" "net ok";exit}/^Failed|^Connection error/{printf "%s" "net nok";exit}')"
+ if [ -n "${result}" ] && ([ -z "${trm_connection}" ] || [ "${result}" != "${trm_connection%/*}" ])
+ then
+ trm_connection="${result}/${trm_ifquality}"
+ f_jsnup
+ fi
+ fi
break
fi
fi
- cnt=$((cnt+1))
+ wait=$(( wait + 1 ))
sleep 1
done
- f_log "debug" "f_check::: mode: ${mode}, name: ${ifname}, status: ${trm_ifstatus}, cnt: ${cnt}, max-wait: ${trm_maxwait}, automatic: ${trm_automatic}"
+ f_log "debug" "f_check::: mode: ${mode}, name: ${ifname:-"-"}, status: ${trm_ifstatus}, quality: ${trm_ifquality}, connection: ${trm_connection:-"-"}, wait: ${wait}, max_wait: ${trm_maxwait}, min_quality: ${trm_minquality}, captive: ${trm_captive}"
}
# update runtime information
#
f_jsnup()
{
- local status iface="${1}" radio="${2}" essid="${3}" bssid="${4}"
+ local config sta_iface sta_radio sta_essid sta_bssid dev_status status="${trm_ifstatus}"
- if [ "${trm_ifstatus}" = "true" ]
- then
- status="connected"
- elif [ "${trm_ifstatus}" = "false" ]
- then
- status="not connected"
- elif [ "${trm_ifstatus}" = "running" ]
+ if [ "${status}" = "true" ]
then
- status="running"
- elif [ "${trm_ifstatus}" = "error" ]
+ status="connected (${trm_connection:-"-"})"
+ else
+ trm_connection=""
+ if [ "${status}" = "false" ]
+ then
+ status="not connected"
+ fi
+ fi
+
+ dev_status="$(ubus -S call network.wireless status 2>/dev/null)"
+ if [ -n "${dev_status}" ]
then
- status="error"
+ config="$(printf "%s" "${dev_status}" | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].section')"
+ if [ -n "${config}" ]
+ then
+ sta_iface="$(uci_get wireless "${config}" network)"
+ sta_radio="$(uci_get wireless "${config}" device)"
+ sta_essid="$(uci_get wireless "${config}" ssid)"
+ sta_bssid="$(uci_get wireless "${config}" bssid)"
+ fi
fi
json_init
json_add_object "data"
json_add_string "travelmate_status" "${status}"
json_add_string "travelmate_version" "${trm_ver}"
- json_add_string "station_id" "${essid:-"-"}/${bssid:-"-"}"
- json_add_string "station_interface" "${iface:-"n/a"}"
- json_add_string "station_radio" "${radio:-"n/a"}"
+ json_add_string "station_id" "${sta_essid:-"-"}/${sta_bssid:-"-"}"
+ json_add_string "station_interface" "${sta_iface:-"-"}"
+ json_add_string "station_radio" "${sta_radio:-"-"}"
json_add_string "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")"
json_add_string "system" "${trm_sysver}"
json_close_object
json_dump > "${trm_rtfile}"
+ f_log "debug" "f_jsnup::: config: ${config:-"-"}, status: ${status:-"-"}, sta_iface: ${sta_iface:-"-"}, sta_radio: ${sta_radio:-"-"}, sta_essid: ${sta_essid:-"-"}, sta_bssid: ${sta_bssid:-"-"}"
}
# write to syslog
#
f_main()
{
- local dev config raw_scan essid_list bssid_list sta_essid sta_bssid sta_radio sta_iface cnt=1
+ local cnt dev config scan scan_list scan_essid scan_bssid scan_quality sta sta_essid sta_bssid sta_radio sta_iface IFS=" "
f_check "initial"
if [ "${trm_ifstatus}" != "true" ]
then
config_load wireless
config_foreach f_prep wifi-iface
- if [ -n "$(uci -q changes wireless)" ]
- then
- uci -q commit wireless
- fi
+ uci_commit wireless
f_check "dev" "running"
- f_log "debug" "f_main ::: iwinfo: ${trm_iwinfo}, eap_rc: ${trm_eap}, dev_list: ${trm_devlist}, sta_list: ${trm_stalist}"
+ f_log "debug" "f_main ::: iwinfo: ${trm_iwinfo}, dev_list: ${trm_devlist}, sta_list: ${trm_stalist:0:800}"
for dev in ${trm_devlist}
do
- cnt=1
if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${dev}")" ]
then
continue
fi
+ cnt=1
while [ ${trm_maxretry} -eq 0 ] || [ ${cnt} -le ${trm_maxretry} ]
do
- raw_scan="$(${trm_iwinfo} "${dev}" scan)"
- essid_list="$(printf "%s" "${raw_scan}" | awk '/ESSID: "/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
- bssid_list="$(printf "%s" "${raw_scan}" | awk '/Address: /{ORS=" ";if (!seen[$5]++) print $5}')"
- f_log "debug" "f_main ::: dev: ${dev}, ssid_list: ${essid_list}, bssid_list: ${bssid_list}"
- if [ -n "${essid_list}" ] || [ -n "${bssid_list}" ]
+ scan_list="$(${trm_iwinfo} "${dev}" scan 2>/dev/null | awk 'BEGIN{FS="[/ ]"}/Address:/{var1=$NF}/ESSID:/{var2="";for(i=12;i<=NF;i++)if(var2==""){var2=$i}else{var2=var2" "$i}}/Quality:/{printf "%i,%s,%s\n",(100/$NF*$(NF-1)),var1,var2}' | sort -rn | awk '{ORS=",";print $0}')"
+ f_log "debug" "f_main ::: dev: ${dev}, scan_list: ${scan_list:0:800}, cnt: ${cnt}, max_cnt: ${trm_maxretry}"
+ if [ -n "${scan_list}" ]
then
for sta in ${trm_stalist}
do
config="${sta%%_*}"
sta_radio="${sta##*_}"
- sta_essid="$(uci -q get wireless."${config}".ssid)"
- sta_bssid="$(uci -q get wireless."${config}".bssid)"
- sta_iface="$(uci -q get wireless."${config}".network)"
- if (([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] && [ -z "${sta_bssid}" ]) || \
- ([ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ] && [ -z "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ]) || \
- ([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] && [ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ])) && \
- [ "${dev}" = "${sta_radio}" ]
- then
- uci -q set wireless."${config}".disabled=0
- f_check "sta"
- if [ "${trm_ifstatus}" = "true" ]
+ sta_essid="$(uci_get wireless "${config}" ssid)"
+ sta_bssid="$(uci_get wireless "${config}" bssid)"
+ sta_iface="$(uci_get wireless "${config}" network)"
+ IFS=","
+ for scan in ${scan_list}
+ do
+ if [ -z "${scan_quality}" ]
then
- uci -q commit wireless
- f_log "info" "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
- f_jsnup "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
- return 0
- elif [ ${trm_maxretry} -ne 0 ] && [ ${cnt} -eq ${trm_maxretry} ]
+ scan_quality="${scan}"
+ elif [ -z "${scan_bssid}" ]
then
- uci -q set wireless."${config}".disabled=1
- if [ -n "${sta_essid}" ]
- then
- uci -q set wireless."${config}".ssid="${sta_essid}_err"
- fi
- if [ -n "${sta_bssid}" ]
- then
- uci -q set wireless."${config}".bssid="${sta_bssid}_err"
- fi
- uci -q commit wireless
- f_check "dev"
- f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}), uplink disabled (${trm_sysver})"
- else
- if [ ${trm_maxretry} -eq 0 ]
+ scan_bssid="${scan}"
+ elif [ -z "${scan_essid}" ]
+ then
+ scan_essid="${scan}"
+ fi
+ if [ -n "${scan_quality}" ] && [ -n "${scan_bssid}" ] && [ -n "${scan_essid}" ]
+ then
+ if [ ${scan_quality} -ge ${trm_minquality} ]
then
- cnt=0
+ if (([ "${scan_essid}" = "\"${sta_essid}\"" ] && ([ -z "${sta_bssid}" ] || [ "${scan_bssid}" = "${sta_bssid}" ])) || \
+ ([ "${scan_bssid}" = "${sta_bssid}" ] && [ "${scan_essid}" = "unknown" ])) && [ "${dev}" = "${sta_radio}" ]
+ then
+ f_log "debug" "f_main ::: scan_quality: ${scan_quality}, scan_bssid: ${scan_bssid}, scan_essid: ${scan_essid}"
+ uci_set wireless "${config}" disabled 0
+ f_check "sta"
+ if [ "${trm_ifstatus}" = "true" ]
+ then
+ uci_commit wireless
+ f_log "info" "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
+ return 0
+ elif [ ${cnt} -eq ${trm_maxretry} ]
+ then
+ uci_set wireless "${config}" disabled 1
+ if [ -n "${sta_essid}" ]
+ then
+ uci_set wireless "${config}" ssid "${sta_essid}_err"
+ fi
+ if [ -n "${sta_bssid}" ]
+ then
+ uci_set wireless "${config}" bssid "${sta_bssid}_err"
+ fi
+ uci_commit wireless
+ f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}', uplink disabled (${trm_sysver})"
+ f_check "rev"
+ else
+ uci -q revert wireless
+ f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
+ f_check "rev"
+ fi
+ fi
fi
- uci -q revert wireless
- f_check "dev"
- f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}) (${trm_sysver})"
+ scan_quality=""
+ scan_bssid=""
+ scan_essid=""
fi
- f_jsnup "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
- fi
+ done
+ IFS=" "
done
fi
- cnt=$((cnt+1))
- sleep 5
+ cnt=$(( cnt + 1 ))
+ sleep $(( ${trm_maxwait} / 6 ))
done
done
if [ ! -s "${trm_rtfile}" ]
trm_ifstatus="false"
f_jsnup
fi
- else
- if [ ! -s "${trm_rtfile}" ]
- then
- config="$(ubus -S call network.wireless status | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].section')"
- sta_radio="$(uci -q get wireless."${config}".device)"
- sta_essid="$(uci -q get wireless."${config}".ssid)"
- sta_bssid="$(uci -q get wireless."${config}".bssid)"
- sta_iface="$(uci -q get wireless."${config}".network)"
- f_jsnup "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
- fi
+ elif [ ! -s "${trm_rtfile}" ]
+ then
+ f_jsnup
fi
}
# control travelmate actions
#
-f_envload
-f_main
-while [ ${trm_automatic} -eq 1 ]
+while true
do
- sleep ${trm_timeout}
+ if [ -z "${trm_action}" ]
+ then
+ > "${trm_pidfile}"
+ sleep ${trm_timeout}
+ else
+ printf '%s' "${$}" > "${trm_pidfile}"
+ trm_action=""
+ fi
f_envload
f_main
done
-exit 0
+
define Package/ulogd-mod-dbi
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libdbi
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-dbi:libdbi
TITLE:=Output plugin for logging to a database using libdbi
endef
define Package/ulogd-mod-json
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +jansson
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-json:jansson
TITLE:=JSON output plugin
endef
define Package/ulogd-mod-mysql
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libmysqlclient
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-mysql:libmysqlclient
TITLE:=Output plugin for logging to a MySQL database
endef
define Package/ulogd-mod-nfacct
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libnetfilter-acct
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-nfacct:libnetfilter-acct
TITLE:=Input plugin for flow-based logging (accounting)
endef
define Package/ulogd-mod-nfct
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libnetfilter-conntrack
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-nfct:libnetfilter-conntrack
TITLE:=Input plugin for flow-based logging (conntracking)
endef
define Package/ulogd-mod-nflog
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libnetfilter-log
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-nflog:libnetfilter-log
TITLE:=Input plugin using NFLOG
endef
define Package/ulogd-mod-pcap
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libpcap
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-pcap:libpcap
TITLE:=Output plugin for logging in pcap format
endef
define Package/ulogd-mod-pgsql
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libpq
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-pgsql:libpq
TITLE:=Output plugin for logging to a PostgreSQL database
endef
define Package/ulogd-mod-sqlite
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libsqlite3
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-sqlite:libsqlite3
TITLE:=Output plugin for logging to an SQLite database
endef
define Package/ulogd-mod-xml
$(call Package/ulogd/Default)
- DEPENDS:=ulogd +libnetfilter-acct +libnetfilter-conntrack +libnetfilter-log
+ DEPENDS:=ulogd +PACKAGE_ulogd-mod-xml:libnetfilter-acct +PACKAGE_ulogd-mod-xml:libnetfilter-conntrack +PACKAGE_ulogd-mod-xml:libnetfilter-log
TITLE:=XML output plugin
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=unbound
-PKG_VERSION:=1.6.7
-PKG_RELEASE:=2
+PKG_VERSION:=1.7.1
+PKG_RELEASE:=1
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.unbound.net/downloads
-PKG_HASH:=4e7bd43d827004c6d51bef73adf941798e4588bdb40de5e79d89034d69751c9f
+PKG_HASH:=56e085ef582c5372a20207de179d0edb4e541e59f87be7d4ee1d00d12008628d
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/unbound.init $(1)/etc/init.d/unbound
$(INSTALL_DIR) $(1)/usr/lib/unbound
- $(INSTALL_BIN) ./files/odhcpd.sh $(1)/usr/lib/unbound/odhcpd.sh
- $(INSTALL_DATA) ./files/odhcpd.awk $(1)/usr/lib/unbound/odhcpd.awk
+ $(INSTALL_DATA) ./files/defaults.sh $(1)/usr/lib/unbound/defaults.sh
$(INSTALL_DATA) ./files/dnsmasq.sh $(1)/usr/lib/unbound/dnsmasq.sh
$(INSTALL_DATA) ./files/iptools.sh $(1)/usr/lib/unbound/iptools.sh
+ $(INSTALL_BIN) ./files/odhcpd.sh $(1)/usr/lib/unbound/odhcpd.sh
+ $(INSTALL_DATA) ./files/odhcpd.awk $(1)/usr/lib/unbound/odhcpd.awk
$(INSTALL_DATA) ./files/rootzone.sh $(1)/usr/lib/unbound/rootzone.sh
$(INSTALL_DATA) ./files/unbound.sh $(1)/usr/lib/unbound/unbound.sh
endef
## Package Overview
Unbound may be useful on consumer grade embedded hardware. It is _intended_ to be a recursive resolver only. [NLnet Labs NSD](https://www.nlnetlabs.nl/projects/nsd/) is _intended_ for the authoritative task. This is different than [ISC Bind](https://www.isc.org/downloads/bind/) and its inclusive functions. Unbound configuration effort and memory consumption may be easier to control. A consumer could have their own recursive resolver with 8/64 MB router, and remove potential issues from forwarding resolvers outside of their control.
-This package builds on Unbounds capabilities with OpenWrt UCI. Not every Unbound option is in UCI, but rather, UCI simplifies the combination of related options. Unbounds native options are bundled and balanced within a smaller set of choices. Options include resources, DNSSEC, access control, and some TTL tweaking. The UCI also provides an escape option and work at the raw "unbound.conf" level.
+This package builds on Unbounds capabilities with OpenWrt UCI. Not every Unbound option is in UCI, but rather, UCI simplifies the combination of related options. Unbounds native options are bundled and balanced within a smaller set of choices. Options include resources, DNSSEC, access control, and some TTL tweaking. The UCI also provides an escape option and works at the raw "unbound.conf" level.
-## HOW TO Adblocking
+## HOW TO Ad Blocking
The UCI scripts will work with [net/adblock 2.3+](https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md), if it is installed and enabled. Its all detected and integrated automatically. In brief, the adblock scripts create distinct local-zone files that are simply included in the unbound conf file during UCI generation. If you don't want this, then disable adblock or reconfigure adblock to not send these files to Unbound.
## HOW TO Integrate with DHCP
Some UCI options and scripts help Unbound to work with DHCP servers to load the local DNS. The examples provided here are serial dnsmasq-unbound, parallel dnsmasq-unbound, and unbound scripted with odhcpd.
### Serial dnsmasq
-In this case, dnsmasq is not changed *much* with respect to the default OpenWRT/LEDE configuration. Here dnsmasq is forced to use the local Unbound instance as the lone upstream DNS server, instead of your ISP. This may be the easiest implementation, but performance degradation can occur in high volume networks. dnsmasq and Unbound effectively have the same information in memory, and all transfers are double handled.
+In this case, dnsmasq is not changed *much* with respect to the default OpenWrt/LEDE configuration. Here dnsmasq is forced to use the local Unbound instance as the lone upstream DNS server, instead of your ISP. This may be the easiest implementation, but performance degradation can occur in high volume networks. dnsmasq and Unbound effectively have the same information in memory, and all transfers are double handled.
**/etc/config/unbound**:
```
### Unbound and odhcpd
-You may ask, "can Unbound replace dnsmasq?" You can have DHCP-DNS records with Unbound and odhcpd only. The UCI scripts will allow Unbound to act like dnsmasq. When odhcpd configures each DHCP lease, it will call a script. The script provided with Unbound will read the lease file for DHCP-DNS records. You **must install** `unbound-control`, because the lease records are added and removed without starting, stopping, flushing cache, or re-writing conf files. (_restart overhead can be excessive with even a few mobile devices._)
-
-Don't forget to disable or uninstall dnsmasq when you don't intend to use it. Strange results may occur. If you want to use default dnsmasq+odhcpd and add Unbound on top, then use the dnsmasq-serial or dnsmasq-parallel methods above.
+You may ask, "can Unbound replace dnsmasq?" You can have DHCP-DNS records with Unbound and odhcpd only. The UCI scripts will allow Unbound to act like dnsmasq. When odhcpd configures each DHCP lease, it will call a script. The script provided with Unbound will read the lease file for DHCP-DNS records. The unbound-control application is required, because simply rewriting conf-files and restarting unbound is too much overhead.
+- Default OpenWrt has dnsmasq+odhcpd with `odhcpd-ipv6only` limited to DHCPv6.
+- If you use dnsmasq+odhcpd together, then use dnsmasq serial or parallel methods above.
+- You must install package `odhcpd` (full) to use odhcpd alone.
+- You must install package `unbound-control` to load and unload leases.
+- Remember to uninstall (or disable) dnsmasq when you won't use it.
**/etc/config/unbound**:
also can be used to for bad purposes.
option rebind_protection '1'
- Boolean. Prevent RFC 1918 Reponses from global DNS. Example a
- poisoned reponse within "192.168.0.0/24" could be used to turn a
- local browser into an external attack proxy server.
+ Level. Block your local address responses from global DNS. A poisoned
+ reponse within "192.168.0.0/24" or "fd00::/8" could turn a local browser
+ into an external attack proxy server. IP6 GLA may be vulnerable also.
+ 0 - Off
+ 1 - Only RFC 1918 and 4193 responses blocked
+ 2 - Plus GLA /64 on designated interface(s)
+ 3 - Plus DHCP-PD range passed down interfaces (not implemented)
option recursion 'passive'
Unbound has numerous options for how it recurses. This UCI combines
embedded devices don't have a real time power off clock. NTP needs
DNS to resolve servers. This works around the chicken-and-egg.
- list domain_insecure 'www.example.com'
- Domain. Domains that you wish to skip DNSSEC. Your DHCP
- domains and pointers will get this automatically.
+ list domain_forward 'mail.my-isp.com'
+ Domain. Do not recurse, but rather forward the domains to given DNS
+ servers found in resolve.conf.auto from WAN DHCP client. This may
+ provide better access to mirror servers in 'your neigborhood.' This
+ may be useful in keeping local organization lookups on local subnets.
+
+ list domain_insecure 'ntp.somewhere.org'
+ Domain. Domains that you wish to skip DNSSEC. It is one way around NTP
+ chicken and egg. Your DHCP servered domains are automatically included.
+
+ list rebind_interface 'lan'
+ Interface (logical). Works with 'rebind_protection' options 2 and 3.
- list trigger 'lan' 'wan'
+ list trigger_interface 'lan' 'wan'
Interface (logical). This option is a work around for netifd/procd
interaction with WAN DHCPv6. Minor RA or DHCP changes in IP6 can
cause netifd to execute procd interface reload. Limit Unbound procd
--- /dev/null
+#!/bin/sh
+##############################################################################
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Copyright (C) 2016 Eric Luehrsen
+#
+##############################################################################
+
+UNBOUND_LIBDIR=/usr/lib/unbound
+UNBOUND_VARDIR=/var/lib/unbound
+
+UNBOUND_PIDFILE=/var/run/unbound.pid
+
+UNBOUND_SRV_CONF=$UNBOUND_VARDIR/unbound_srv.conf
+UNBOUND_EXT_CONF=$UNBOUND_VARDIR/unbound_ext.conf
+UNBOUND_DHCP_CONF=$UNBOUND_VARDIR/unbound_dhcp.conf
+UNBOUND_CONFFILE=$UNBOUND_VARDIR/unbound.conf
+
+UNBOUND_KEYFILE=$UNBOUND_VARDIR/root.key
+UNBOUND_HINTFILE=$UNBOUND_VARDIR/root.hints
+UNBOUND_TIMEFILE=$UNBOUND_VARDIR/hotplug.time
+
+UNBOUND_CTLKEY_FILE=$UNBOUND_VARDIR/unbound_control.key
+UNBOUND_CTLPEM_FILE=$UNBOUND_VARDIR/unbound_control.pem
+UNBOUND_SRVKEY_FILE=$UNBOUND_VARDIR/unbound_server.key
+UNBOUND_SRVPEM_FILE=$UNBOUND_VARDIR/unbound_server.pem
+
+##############################################################################
+
+UNBOUND_ANCHOR=/usr/sbin/unbound-anchor
+UNBOUND_CONTROL=/usr/sbin/unbound-control
+UNBOUND_CONTROL_CFG="$UNBOUND_CONTROL -c $UNBOUND_CONFFILE"
+
+##############################################################################
+
while ( ( cmd | getline adr ) > 0 ) {
- if (( substr( adr, 1, 5 ) <= "fd00:" ) \
+ if (( substr( adr, 1, 5 ) <= "fdff:" ) \
+ && ( index( adr, "anycast" ) == 0 ) \
&& ( index( adr, "via" ) == 0 )) {
# GA or ULA routed addresses only (not LL or MC)
sub( /\/.*/, "", adr ) ;
adr = ( adr slaac ) ;
- if ( split( adr, tmp0, ":" ) >= 8 ) {
+ if ( split( adr, tmp0, ":" ) > 8 ) {
sub( "::", ":", adr ) ;
}
#
##############################################################################
-# Common file location definitions
-. /usr/lib/unbound/unbound.sh
-
-##############################################################################
-
-odhcpd_settings() {
- # This trigger is out of normal init context, so we need to read some UCI.
- local cfg="$1"
- config_get UNBOUND_D_DHCP_LINK "$cfg" dhcp_link none
- config_get_bool UNBOUND_B_SLAAC6_MAC "$cfg" dhcp4_slaac6 0
- config_get UNBOUND_TXT_DOMAIN "$cfg" domain lan
-}
+. /lib/functions.sh
+. /usr/lib/unbound/defaults.sh
##############################################################################
odhcpd_zonedata() {
+ local longconf dateconf
local dns_ls_add=$UNBOUND_VARDIR/dhcp_dns.add
local dns_ls_del=$UNBOUND_VARDIR/dhcp_dns.del
local dhcp_ls_new=$UNBOUND_VARDIR/dhcp_lease.new
local dhcp_ls_old=$UNBOUND_VARDIR/dhcp_lease.old
local dhcp_ls_add=$UNBOUND_VARDIR/dhcp_lease.add
local dhcp_ls_del=$UNBOUND_VARDIR/dhcp_lease.del
- local dhcp_origin=$( uci_get dhcp.@odhcpd[0].leasefile )
- config_load unbound
- config_foreach odhcpd_settings unbound
+ local dhcp_link=$( uci_get unbound.@unbound[0].dhcp_link )
+ local dhcp4_slaac6=$( uci_get unbound.@unbound[0].dhcp4_slaac6 )
+ local dhcp_domain=$( uci_get unbound.@unbound[0].domain )
+ local dhcp_origin=$( uci_get dhcp.@odhcpd[0].leasefile )
- if [ "$UNBOUND_D_DHCP_LINK" = "odhcpd" -a -f "$dhcp_origin" ] ; then
+ if [ "$dhcp_link" = "odhcpd" -a -f "$dhcp_origin" ] ; then
# Capture the lease file which could be changing often
- cat $dhcp_origin | sort > $dhcp_ls_new
- touch $dhcp_ls_old
- sort $dhcp_ls_new $dhcp_ls_old $dhcp_ls_old | uniq -u > $dhcp_ls_add
- sort $dhcp_ls_old $dhcp_ls_new $dhcp_ls_new | uniq -u > $dhcp_ls_del
-
- # Go through the messy business of coding up A, AAAA, and PTR records
- # This static conf will be available if Unbound restarts asynchronously
- awk -v hostfile=$UNBOUND_DHCP_CONF -v domain=$UNBOUND_TXT_DOMAIN \
- -v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=1 \
- -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_new
-
- # Deleting and adding all records into Unbound can be a burden in a
- # high density environment. Use unbound-control incrementally.
- awk -v hostfile=$dns_ls_del -v domain=$UNBOUND_TXT_DOMAIN \
- -v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=0 \
- -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_del
-
- awk -v hostfile=$dns_ls_add -v domain=$UNBOUND_TXT_DOMAIN \
- -v bslaac=$UNBOUND_B_SLAAC6_MAC -v bisolt=0 -v bconf=0 \
- -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_add
+ sort $dhcp_origin > $dhcp_ls_new
+
+
+ if [ ! -f $UNBOUND_DHCP_CONF -o ! -f $dhcp_ls_old ] ; then
+ longconf=2
+
+ else
+ dateconf=$(( $( date +%s ) - $( date -r $UNBOUND_DHCP_CONF +%s ) ))
+
+
+ if [ $dateconf > 150 ] ; then
+ longconf=1
+ else
+ longconf=0
+ fi
+ fi
+
+
+ if [ $longconf -gt 0 ] ; then
+ # Go through the messy business of coding up A, AAAA, and PTR records
+ # This static conf will be available if Unbound restarts asynchronously
+ awk -v hostfile=$UNBOUND_DHCP_CONF -v domain=$dhcp_domain \
+ -v bslaac=$dhcp4_slaac6 -v bisolt=0 -v bconf=1 \
+ -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_new
+ fi
+
+
+ if [ $longconf -lt 2 ] ; then
+ # Deleting and adding all records into Unbound can be a burden in a
+ # high density environment. Use unbound-control incrementally.
+ sort $dhcp_ls_old $dhcp_ls_new $dhcp_ls_new | uniq -u > $dhcp_ls_del
+ awk -v hostfile=$dns_ls_del -v domain=$dhcp_domain \
+ -v bslaac=$dhcp4_slaac6 -v bisolt=0 -v bconf=0 \
+ -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_del
+
+ sort $dhcp_ls_new $dhcp_ls_old $dhcp_ls_old | uniq -u > $dhcp_ls_add
+ awk -v hostfile=$dns_ls_add -v domain=$dhcp_domain \
+ -v bslaac=$dhcp4_slaac6 -v bisolt=0 -v bconf=0 \
+ -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_add
+
+ else
+ awk -v hostfile=$dns_ls_add -v domain=$dhcp_domain \
+ -v bslaac=$dhcp4_slaac6 -v bisolt=0 -v bconf=0 \
+ -f /usr/lib/unbound/odhcpd.awk $dhcp_ls_new
+ fi
if [ -f "$dns_ls_del" ] ; then
#
##############################################################################
#
-# This component needs to be used within the unbound.sh as an include. It uses
-# defaults and UCI scope variables defined there. It will copy root.key back
-# to /etc/unbound/ periodically, but avoid ROM flash abuse (UCI option).
+# This component will copy root.key back to /etc/unbound/ periodically, but
+# avoid ROM flash abuse (UCI option).
#
##############################################################################
-rootzone_uci() {
- local cfg=$1
-
- # This will likely be called outside of "start_service()" context
- config_get_bool UNBOUND_B_DNSSEC "$cfg" validator 0
- config_get_bool UNBOUND_B_NTP_BOOT "$cfg" validator_ntp 1
- config_get UNBOUND_N_ROOT_AGE "$cfg" root_age 9
-}
-
-##############################################################################
-
roothints_update() {
# TODO: Might not be implemented. Unbound doesn't natively update hints.
# Unbound philosophy is built in root hints are good for machine life.
rootkey_update() {
local basekey_date rootkey_date rootkey_age filestuff
+ local dnssec=$( uci_get unbound.@unbound[0].validator )
+ local dnssec_ntp=$( uci_get unbound.@unbound[0].validator_ntp )
+ local dnssec_age=$( uci_get unbound.@unbound[0].root_age )
+
- if [ "$UNBOUND_N_ROOT_AGE" -gt 90 -o "$UNBOUND_B_DNSSEC" -lt 1 ] ; then
+ if [ "$dnssec_age" -gt 90 -o "$dnssec" -lt 1 ] ; then
# Feature disabled
return 0
- elif [ "$UNBOUND_B_NTP_BOOT" -gt 0 -a ! -f "$UNBOUND_TIMEFILE" ] ; then
+ elif [ "$dnssec_ntp" -gt 0 -a ! -f "$UNBOUND_TIMEFILE" ] ; then
# We don't have time yet
return 0
fi
fi
- if [ "$rootkey_age" -gt "$UNBOUND_N_ROOT_AGE" ] ; then
+ if [ "$rootkey_age" -gt "$dnssec_age" ] ; then
filestuff=$( cat $UNBOUND_KEYFILE )
##############################################################################
rootzone_update() {
- # Partial UCI fetch for this functional group
- config_load unbound
- config_foreach rootzone_uci unbound
-
- # You need root.hints and root.key to boot strap recursion
roothints_update
rootkey_update
}
service_triggers() {
local trigger
- local triggers=$( uci_get unbound.@unbound[0].trigger )
+ local legacy=$( uci_get unbound.@unbound[0].trigger )
+ local triggers=$( uci_get unbound.@unbound[0].trigger_interface )
+ triggers="$triggers $legacy"
PROCD_RELOAD_DELAY=2000
procd_add_reload_trigger "unbound"
+
if [ -n "$triggers" ] ; then
for trigger in $triggers ; do
# due to some netifd/procd interactions with IP6, limit interfaces
UNBOUND_B_LOCL_SERV=1
UNBOUND_B_MAN_CONF=0
UNBOUND_B_NTP_BOOT=1
-UNBOUND_B_PRIV_BLCK=1
UNBOUND_B_QUERY_MIN=0
UNBOUND_B_QRY_MINST=0
UNBOUND_D_DHCP_LINK=none
UNBOUND_D_EXTRA_DNS=0
UNBOUND_D_LAN_FQDN=0
+UNBOUND_D_PRIV_BLCK=1
UNBOUND_D_PROTOCOL=mixed
UNBOUND_D_RESOURCE=small
UNBOUND_D_RECURSION=passive
UNBOUND_TXT_FWD_ZONE=""
UNBOUND_TXT_HOSTNAME=thisrouter
+UNBOUND_LIST_FORWARD=""
UNBOUND_LIST_INSECURE=""
+UNBOUND_LIST_PRV_SUBNET=""
##############################################################################
##############################################################################
-UNBOUND_LIBDIR=/usr/lib/unbound
-UNBOUND_VARDIR=/var/lib/unbound
-
-UNBOUND_PIDFILE=/var/run/unbound.pid
-
-UNBOUND_SRV_CONF=$UNBOUND_VARDIR/unbound_srv.conf
-UNBOUND_EXT_CONF=$UNBOUND_VARDIR/unbound_ext.conf
-UNBOUND_DHCP_CONF=$UNBOUND_VARDIR/unbound_dhcp.conf
-UNBOUND_CONFFILE=$UNBOUND_VARDIR/unbound.conf
-
-UNBOUND_KEYFILE=$UNBOUND_VARDIR/root.key
-UNBOUND_HINTFILE=$UNBOUND_VARDIR/root.hints
-UNBOUND_TIMEFILE=$UNBOUND_VARDIR/hotplug.time
-
-UNBOUND_CTLKEY_FILE=$UNBOUND_VARDIR/unbound_control.key
-UNBOUND_CTLPEM_FILE=$UNBOUND_VARDIR/unbound_control.pem
-UNBOUND_SRVKEY_FILE=$UNBOUND_VARDIR/unbound_server.key
-UNBOUND_SRVPEM_FILE=$UNBOUND_VARDIR/unbound_server.pem
-
-##############################################################################
-
-UNBOUND_ANCHOR=/usr/sbin/unbound-anchor
-UNBOUND_CONTROL=/usr/sbin/unbound-control
-UNBOUND_CONTROL_CFG="$UNBOUND_CONTROL -c $UNBOUND_CONFFILE"
-
-##############################################################################
-
. /lib/functions.sh
. /lib/functions/network.sh
-. $UNBOUND_LIBDIR/dnsmasq.sh
-. $UNBOUND_LIBDIR/iptools.sh
-. $UNBOUND_LIBDIR/rootzone.sh
+. /usr/lib/unbound/defaults.sh
+. /usr/lib/unbound/dnsmasq.sh
+. /usr/lib/unbound/iptools.sh
+. /usr/lib/unbound/rootzone.sh
##############################################################################
##############################################################################
-create_domain_insecure() {
+bundle_domain_forward() {
+ UNBOUND_LIST_FORWARD="$UNBOUND_LIST_FORWARD $1"
+}
+
+##############################################################################
+
+bundle_domain_insecure() {
UNBOUND_LIST_INSECURE="$UNBOUND_LIST_INSECURE $1"
}
##############################################################################
+bundle_private_interface() {
+ local ipcommand ifsubnet ifsubnets ifname
+
+ network_get_device ifname $1
+
+ if [ -n "$ifname" ] ; then
+ ipcommand="ip -6 -o address show $ifname"
+ ifsubnets=$( $ipcommand | awk '/inet6/{ print $4 }' )
+
+
+ if [ -n "$ifsubnets" ] ; then
+ for ifsubnet in $ifsubnets ; do
+ case $ifsubnet in
+ [1-9]*:*[0-9a-f])
+ # Special GLA protection for local block; ULA protected as a catagory
+ UNBOUND_LIST_PRV_SUBNET="$UNBOUND_LIST_PRV_SUBNET $ifsubnet" ;;
+ esac
+ done
+ fi
+ fi
+}
+
+##############################################################################
+
unbound_mkdir() {
- local dhcp_origin=$( uci_get dhcp.@odhcpd[0].leasefile )
- local dhcp_dir=$( dirname $dhcp_origin )
local filestuff
+ if [ "$UNBOUND_D_DHCP_LINK" = "odhcpd" ] ; then
+ local dhcp_origin=$( uci_get dhcp.@odhcpd[0].leasefile )
+ local dhcp_dir=$( dirname $dhcp_origin )
- if [ "$UNBOUND_D_DHCP_LINK" = "odhcpd" -a ! -d "$dhcp_dir" ] ; then
- # make sure odhcpd has a directory to write (not done itself, yet)
- mkdir -p "$dhcp_dir"
- fi
+ if [ ! -d "$dhcp_dir" ] ; then
+ # make sure odhcpd has a directory to write (not done itself, yet)
+ mkdir -p "$dhcp_dir"
+ fi
+ fi
if [ -f $UNBOUND_KEYFILE ] ; then
filestuff=$( cat $UNBOUND_KEYFILE )
##############################################################################
+unbound_forward() {
+ local fdomain fresolver resolvers
+ # Forward selected domains to the upstream (WAN) stub resolver. This may be
+ # faster or local pool addresses to ISP service login page. This may keep
+ # internal organization lookups, well, internal to the organization.
+
+
+ if [ -n "$UNBOUND_LIST_FORWARD" ] ; then
+ resolvers=$( grep nameserver /tmp/resolv.conf.auto | sed "s/nameserver//g" )
+
+
+ if [ -n "$resolvers" ] ; then
+ for fdomain in $UNBOUND_LIST_FORWARD ; do
+ {
+ echo "forward-zone:"
+ echo " name: \"$fdomain.\""
+ for fresolver in $resolvers ; do
+ echo " forward-addr: $fresolver"
+ done
+ echo
+ } >> $UNBOUND_CONFFILE
+ done
+ fi
+ fi
+}
+
+##############################################################################
+
unbound_conf() {
- local rt_mem rt_conn modulestring domain
+ local rt_mem rt_conn modulestring domain ifsubnet
# Make fresh conf file
echo > $UNBOUND_CONFFILE
fi
- if [ "$UNBOUND_B_PRIV_BLCK" -gt 0 ] ; then
+ if [ "$UNBOUND_D_PRIV_BLCK" -gt 0 ] ; then
{
# Remove _upstream_ or global reponses with private addresses.
# Unbounds own "local zone" and "forward zone" may still use these.
echo " private-address: 169.254.0.0/16"
echo " private-address: 172.16.0.0/12"
echo " private-address: 192.168.0.0/16"
- echo " private-address: fc00::/8"
- echo " private-address: fd00::/8"
+ echo " private-address: fc00::/7"
echo " private-address: fe80::/10"
+ echo
} >> $UNBOUND_CONFFILE
fi
+ if [ -n "$UNBOUND_LIST_PRV_SUBNET" -a "$UNBOUND_D_PRIV_BLCK" -gt 1 ] ; then
+ for ifsubnet in $UNBOUND_LIST_PRV_SUBNET ; do
+ # Remove global DNS responses with your local network IP6 GLA
+ echo " private-address: $ifsubnet" >> $UNBOUND_CONFFILE
+ done
+
+
+ echo >> $UNBOUND_CONFFILE
+ fi
+
+
if [ "$UNBOUND_B_LOCL_BLCK" -gt 0 ] ; then
{
# Remove DNS reponses from upstream with loopback IP
echo " private-address: ::1/128"
echo
} >> $UNBOUND_CONFFILE
-
- else
- echo >> $UNBOUND_CONFFILE
fi
config_get_bool UNBOUND_B_MAN_CONF "$cfg" manual_conf 0
config_get_bool UNBOUND_B_QUERY_MIN "$cfg" query_minimize 0
config_get_bool UNBOUND_B_QRY_MINST "$cfg" query_min_strict 0
- config_get_bool UNBOUND_B_PRIV_BLCK "$cfg" rebind_protection 1
config_get_bool UNBOUND_B_LOCL_BLCK "$cfg" rebind_localhost 0
config_get_bool UNBOUND_B_DNSSEC "$cfg" validator 0
config_get_bool UNBOUND_B_NTP_BOOT "$cfg" validator_ntp 1
config_get UNBOUND_D_DHCP_LINK "$cfg" dhcp_link none
config_get UNBOUND_D_EXTRA_DNS "$cfg" add_extra_dns 0
config_get UNBOUND_D_LAN_FQDN "$cfg" add_local_fqdn 0
+ config_get UNBOUND_D_PRIV_BLCK "$cfg" rebind_protection 1
config_get UNBOUND_D_PROTOCOL "$cfg" protocol mixed
config_get UNBOUND_D_RECURSION "$cfg" recursion passive
config_get UNBOUND_D_RESOURCE "$cfg" resource small
config_get UNBOUND_TTL_MIN "$cfg" ttl_min 120
config_get UNBOUND_TXT_DOMAIN "$cfg" domain lan
- config_list_foreach "$cfg" "domain_insecure" create_domain_insecure
+ config_list_foreach "$cfg" "domain_forward" bundle_domain_forward
+ config_list_foreach "$cfg" "domain_insecure" bundle_domain_insecure
+ config_list_foreach "$cfg" "rebind_interface" bundle_private_interface
UNBOUND_LIST_DOMAINS="nowhere $UNBOUND_TXT_DOMAIN"
# unbound is designated to listen on 127.0.0.1#53,
# set resolver file to local.
rm -f /tmp/resolv.conf
+
{
echo "# /tmp/resolv.conf generated by Unbound UCI $( date )"
echo "nameserver 127.0.0.1"
echo "nameserver ::1"
- echo "search $UNBOUND_TXT_DOMAIN"
+ echo "search $UNBOUND_TXT_DOMAIN."
} > /tmp/resolv.conf
}
unbound_records
fi
+
+ unbound_forward
unbound_control
fi
option unbound_control '0'
option validator '0'
option validator_ntp '1'
- list trigger 'lan'
- list trigger 'wan'
- #list domain_insecure 'www.example.com'
+ list trigger_interface 'lan'
+ list trigger_interface 'wan'
+ #list rebind_interface 'lan'
+ #list domain_insecure 'ntp.example.com'
+ #list domain_forward 'mail.example.com'
-#
-# Example configuration file.
-#
--# See unbound.conf(5) man page, version 1.6.7.
+-# See unbound.conf(5) man page, version 1.7.1.
-#
-# this is a comment.
+##############################################################################
include $(TOPDIR)/rules.mk
PKG_NAME:=vpnbypass
-PKG_VERSION:=1.3.0
-PKG_RELEASE:=6
+PKG_VERSION:=1.3.1
+PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
SECTION:=net
CATEGORY:=Network
DEPENDS:=+ipset +iptables
- CONFLICTS:=openvpn-policy-routing
- TITLE:=Simple VPN Bypass Service
+ CONFLICTS:=vpn-policy-routing
+ TITLE:=VPN Bypass Service
PKGARCH:=all
endef
define Package/vpnbypass/description
This service can be used to enable simple VPN split tunnelling.
Supports accessing domains, IP ranges outside of your VPN tunnel.
-Also supports dedicating local ports/IP ranges for direct internet access (outside of your VPN tunnel).
+Also supports dedicating local ports/IP ranges for direct
+internet access (outside of your VPN tunnel).
Please see the README for further information.
endef
$(INSTALL_DATA) ./files/vpnbypass.hotplug $(1)/etc/hotplug.d/firewall/94-vpnbypass
endef
+
+define Package/$(PKG_NAME)/postinst
+ #!/bin/sh
+ # check if we are on real system
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+ while [ ! -z "$(uci -q get ucitrack.@vpnbypass[-1] 2>/dev/null)" ] ; do
+ uci -q delete ucitrack.@vpnbypass[-1]
+ done
+
+ while [ ! -z "$(uci -q get ucitrack.@firewall[-1].affects 2>/dev/null | awk '/vpnbypass/')" ] ; do
+ uci -q del_list ucitrack.@firewall[-1].affects='vpnbypass'
+ done
+
+ uci -q batch <<-EOF >/dev/null
+ add ucitrack vpnbypass
+ set ucitrack.@vpnbypass[-1].init='vpnbypass'
+ add_list ucitrack.@firewall[-1].affects='vpnbypass'
+ commit ucitrack
+ EOF
+ fi
+ exit 0
+endef
+
+define Package/$(PKG_NAME)/prerm
+ #!/bin/sh
+ # check if we are on real system
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+ echo "Stopping service and removing rc.d symlink for vpnbypass"
+ /etc/init.d/vpnbypass stop || true
+ /etc/init.d/vpnbypass disable
+
+ while [ ! -z "$(uci -q get ucitrack.@vpnbypass[-1] 2>/dev/null)" ] ; do
+ uci -q delete ucitrack.@vpnbypass[-1]
+ done
+
+ while [ ! -z "$(uci -q get ucitrack.@firewall[-1].affects 2>/dev/null | awk '/vpnbypass/')" ] ; do
+ uci -q del_list ucitrack.@firewall[-1].affects='vpnbypass'
+ done
+ fi
+ exit 0
+endef
+
$(eval $(call BuildPackage,vpnbypass))
# VPN Bypass
-A simple PROCD-based vpnbypass service for OpenWrt/LEDE Project. Useful if your router accesses internet thru VPN client/tunnel, but you want specific traffic (ports, IP ranges, domains or local IP ranges) to be routed outside of this tunnel.
+A simple PROCD-based ```vpnbypass``` service for OpenWrt/LEDE Project. Useful if your router accesses internet thru VPN client/tunnel, but you want specific traffic (ports, IP ranges, domains or local IP ranges) to be routed outside of this tunnel.
## Features
- Allows to define local ports so that traffic to them is routed outside of the VPN tunnel (by default routes Plex Media Server traffic (port 32400) outside of the VPN tunnel).
#### Add custom repo to your router
If your router is not set up with the access to repository containing these packages you will need to add custom repository to your router by connecting to your router via ssh and running the following commands:
-###### OpenWrt CC 15.05.1
+###### OpenWrt 15.05.1
```sh
-opkg update; opkg install wget libopenssl
+opkg update; opkg install ca-certificates wget libopenssl
echo -e -n 'untrusted comment: public key 7ffc7517c4cc0c56\nRWR//HUXxMwMVnx7fESOKO7x8XoW4/dRidJPjt91hAAU2L59mYvHy0Fa\n' > /tmp/stangri-repo.pub && opkg-key add /tmp/stangri-repo.pub
! grep -q 'stangri_repo' /etc/opkg/customfeeds.conf && echo 'src/gz stangri_repo https://raw.githubusercontent.com/stangri/openwrt-repo/master' >> /etc/opkg/customfeeds.conf
opkg update
```
-###### LEDE Project and OpenWrt DD trunk
+###### LEDE Project 17.01.x and OpenWrt 18.xx or later
```sh
opkg update; opkg install uclient-fetch libustream-mbedtls
echo -e -n 'untrusted comment: public key 7ffc7517c4cc0c56\nRWR//HUXxMwMVnx7fESOKO7x8XoW4/dRidJPjt91hAAU2L59mYvHy0Fa\n' > /tmp/stangri-repo.pub && opkg-key add /tmp/stangri-repo.pub
export START=94
export USE_PROCD=1
-readonly __ok__='\033[0;32m[\xe2\x9c\x93]\033[0m'
-readonly __fail__='\033[0;31m[\xe2\x9c\x97]\033[0m'
-readonly __pass__='\033[0;33m[-]\033[0m'
-readonly __error__='\033[0;31mERROR\033[0m'
+readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
+readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
+readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
+readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
+readonly __PASS__='\033[0;33m[-]\033[0m'
+readonly _ERROR_='\033[0;31mERROR\033[0m'
-export verbosity=2 TID='200' IPSET='vpnbypass' FW_MARK='0x010000' FW_MASK='0xff0000' wan_if4 wan_gw
+export serviceEnabled verbosity=2 TID='200' IPSET='vpnbypass' FW_MARK='0x010000' FW_MASK='0xff0000' wan_if4 wan_gw
-output() { [[ $# -ne 1 ]] && { [[ ! $((verbosity & $1)) -gt 0 ]] && return 0 || shift; }; local msg; msg=$(echo -n "${1/$p_name /service }" | sed 's|\\033\[[0-9]\?;\?[0-9]\?[0-9]\?m||g'); [[ -t 1 ]] && echo -e -n "$1"; [[ $(echo -e -n "$msg" | wc -l) -gt 0 ]] && logger -t "${PKG_NAME:-service} [$$]" "$(echo -e -n ${logmsg}${msg})" && logmsg='' || logmsg=${logmsg}${msg}; }
-PKG_NAME="${PKG_NAME:-vpnbypass}"; p_name="${PKG_NAME} ${PKG_VERSION}"
+output() { [[ $# -ne 1 ]] && { [[ ! $((verbosity & $1)) -gt 0 ]] && return 0 || shift; }; local msg; msg=$(echo -n "${1/$serviceName /service }" | sed 's|\\033\[[0-9]\?;\?[0-9]\?[0-9]\?m||g'); [[ -t 1 ]] && echo -e -n "$1"; [[ $(echo -e -n "$msg" | wc -l) -gt 0 ]] && logger -t "${packageName:-service} [$$]" "$(echo -e -n ${logmsg}${msg})" && logmsg='' || logmsg=${logmsg}${msg}; }
+readonly packageName='vpnbypass'
+readonly serviceName="$packageName $PKG_VERSION"
-is_enabled() {
- local c=1 enabled
- config_load $PKG_NAME
- config_get_bool enabled 'config' 'enabled' 1
- config_get verbosity 'config' 'verbosity' '2'
- config_get TID 'config' 'table_number' '200'
- config_get IPSET 'config' 'ipset' 'vpnbypass'
- config_get FW_MARK 'config' 'fw_mark' '0x010000'
- config_get FW_MASK 'config' 'fw_mask' '0xff0000'
- source /lib/functions/network.sh
- [[ $enabled -gt 0 ]] || { output "$__error__: $p_name is not enabled.\n"; return 1; }
+load_package_config() {
+ config_load "$packageName"
+ config_get_bool serviceEnabled 'config' 'enabled' 1
+ config_get verbosity 'config' 'verbosity' '2'
source /lib/functions/network.sh
+}
+
+is_enabled() {
+ local sleepCount=1
+ load_package_config
while : ; do
network_find_wan wan_if4
+ [ $serviceEnabled -gt 0 ] || return 1
[ -n "$wan_if4" ] && network_get_gateway wan_gw $wan_if4
- [[ $c -ge 25 || -n "$wan_gw" ]] && break
- output "$p_name waiting for wan gateway...\n"
- sleep 2; network_flush_cache; let "c+=1";
+ [[ $sleepCount -ge 25 || -n "$wan_gw" ]] && break
+ output "$serviceName waiting for wan gateway...\n"
+ sleep 2; network_flush_cache; let "sleepCount+=1";
done
- [ -n "$wan_gw" ] && return 0 || { output "$__error__: $p_name failed to discover WAN gateway.\n"; return 1; }
+ [ -n "$wan_gw" ] && return 0
+ output "$__ERROR__: $serviceName failed to discover WAN gateway.\n"; return 1;
}
+is_ovpn() { local dev; dev=$(uci -q get network.$1.ifname); if [[ "${dev:0:3}" == "tun" || "${dev:0:3}" == "tap" || -f "/sys/devices/virtual/net/${dev}/tun_flags" ]]; then return 0; else return 1; fi; }
+is_wan() { if [ -n "$wan_if4" ] && [ "$1" == "$wan_if4" ]; then return 0; else return 1; fi; }
+is_supported_interface() { if is_wan "$1" || is_ovpn "$1"; then return 0; else return 1; fi; }
+
ipt() {
local d; d=$(echo "$*" | sed s/-A/-D/g);
[ "$d" != "$*" ] && iptables $d >/dev/null 2>&1
d=$(echo "$*" | sed s/-N/-X/g)
[ "$d" != "$*" ] && iptables $d >/dev/null 2>&1
d="$*"
- iptables $d >/dev/null 2>&1 || output "\n$__error__: iptables $d\n"
+ iptables $d >/dev/null 2>&1 || output "\n$__ERROR__: iptables $d\n"
}
start_service() {
for ll in ${lports}; do ipt -t mangle -I VPNBYPASS 1 -j MARK --set-mark ${FW_MARK}/${FW_MASK} -p tcp -m multiport --sport "${ll//-/:}"; done
for ll in ${routes}; do ipt -t mangle -I VPNBYPASS 1 -j MARK --set-mark ${FW_MARK}/${FW_MASK} -d "$ll"; done
for ll in ${rports}; do ipt -t mangle -I VPNBYPASS 1 -j MARK --set-mark ${FW_MARK}/${FW_MASK} -p tcp -m multiport --dport "${ll//-/:}"; done
- output "$p_name started with TID: $TID; FW_MARK: $FW_MARK\n"
+ output "$serviceName started with TID: $TID; FW_MARK: $FW_MARK\n"
}
stop_service() {
- is_enabled || return 1
-
+ load_package_config
ip rule del fwmark "$FW_MARK" table "$TID" >/dev/null 2>&1; ipset -q flush "$IPSET"; ipset -q destroy "$IPSET";
ip route flush table "$TID"; ip route flush cache;
- iptables -t mangle -D PREROUTING -m mark --mark 0x00/${FW_MASK} -g VPNBYPASS >/dev/null 2>&1
- iptables -t mangle -F VPNBYPASS >/dev/null 2>&1; iptables -t mangle -X VPNBYPASS >/dev/null 2>&1;
- output "$p_name stopped\n"
-}
-
-reload_service(){
- start_service
+ ipt -t mangle -D PREROUTING -m mark --mark 0x00/${FW_MASK} -g VPNBYPASS
+ ipt -t mangle -F VPNBYPASS; ipt -t mangle -X VPNBYPASS;
+ output "$serviceName stopped\n"
}
-st_load_interfaces(){ local d; config_get d $1 ifname; [[ "$1" == "$wan_if4" || "$d" != "${d/tun}" || "$d" != "${d/tap}" ]] && ifaces=" ${1} ${ifaces}"; }
+service_triggers_load_interface() { is_supported_interface "$1" && ifaces="${ifaces}${1} "; }
service_triggers() {
local ifaces n
- procd_add_reload_trigger 'vpnbypass'
+ config_load network; config_foreach service_triggers_load_interface 'interface';
+ procd_add_reload_trigger 'firewall'
+ procd_add_reload_trigger 'openvpn'
procd_open_trigger
- procd_add_config_trigger "config.change" "vpnbypass" /etc/init.d/vpnbypass reload
- for n in $ifaces; do procd_add_interface_trigger "interface.*" "$n" /etc/init.d/openvpn-policy-routing reload; done;
+ for n in $ifaces; do procd_add_reload_interface_trigger "$n"; procd_add_interface_trigger "interface.*" "$n" /etc/init.d/${packageName} reload; done;
+ output 2 "$serviceName monitoring interfaces: $ifaces $_OK_\n"
procd_close_trigger
}
PKG_NAME:=vpnc
PKG_REV:=550
PKG_VERSION:=0.5.3.r$(PKG_REV)
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://svn.unix-ag.uni-kl.de/vpnc/trunk/
logger -t vpnc "initializing..."
serv_addr=
for ip in $(resolveip -t 10 "$server"); do
- ( proto_add_host_dependency "vpn-$config" "$ip" $interface )
+ ( proto_add_host_dependency "$config" "$ip" $interface )
serv_addr=1
done
[ -n "$serv_addr" ] || {
include $(TOPDIR)/rules.mk
PKG_NAME:=wavemon
-PKG_VERSION:=0.8.1
-PKG_RELEASE:=2
+PKG_VERSION:=0.8.2
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=e00710049c34bf45735085ad59eedf54190e78d1c5f6b43d28ae9bc93d07681e
+PKG_MIRROR_HASH:=4199e2ad11a036f4289f5ad42a8b0fe518f2b5ff77447f4c366dbcf3f23e91d5
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/uoaerg/wavemon.git
--- /dev/null
+#
+# Copyright (C) 2014-2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wifidog-ng
+PKG_VERSION:=1.5.6
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/wifidog-ng.git
+PKG_MIRROR_HASH:=a81e9a4d5feb3facbe1b2b55d2d813944b569865f53421680efbfc6876aa3f5d
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/wifidog-ng/default
+ SUBMENU:=Captive Portals
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=Next generation WifiDog
+ DEPENDS:=+kmod-wifidog-ng +libuci +libuclient +libblobmsg-json +libubus +libcares \
+ +ipset +libpcap
+endef
+
+define Package/wifidog-ng-nossl
+ $(Package/wifidog-ng/default)
+ TITLE += (NO SSL)
+ DEPENDS += +libuhttpd-nossl
+ VARIANT:=nossl
+ CONFLICTS:=wifidog-ng-openssl wifidog-ng-wolfssl wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-openssl
+ $(Package/wifidog-ng/default)
+ TITLE += (openssl)
+ DEPENDS += +libuhttpd-openssl
+ VARIANT:=openssl
+ CONFLICTS:=wifidog-ng-wolfssl wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-wolfssl
+ $(Package/wifidog-ng/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libuhttpd-wolfssl
+ VARIANT:=wolfssl
+ CONFLICTS:=wifidog-ng-mbedtls
+endef
+
+define Package/wifidog-ng-mbedtls
+ $(Package/wifidog-ng/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libuhttpd-mbedtls
+ VARIANT:=mbedtls
+endef
+
+define Package/wifidog-ng/default/install
+ $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config \
+ $(1)/etc/wifidog-ng $(1)//etc/hotplug.d/dhcp
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wifidog-ng $(1)/usr/bin
+ $(INSTALL_BIN) ./files/wifidog-ng.init $(1)/etc/init.d/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.config $(1)/etc/config/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.key $(1)/etc/wifidog-ng
+ $(INSTALL_CONF) ./files/wifidog-ng.crt $(1)/etc/wifidog-ng
+ $(INSTALL_DATA) ./files/wifidog-ng.hotplug $(1)/etc/hotplug.d/dhcp/00-wifidog-ng
+endef
+
+Package/wifidog-ng-nossl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-openssl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-wolfssl/install = $(Package/wifidog-ng/default/install)
+Package/wifidog-ng-mbedtls/install = $(Package/wifidog-ng/default/install)
+
+include $(INCLUDE_DIR)/kernel.mk
+
+define KernelPackage/wifidog-ng
+ SUBMENU:=Other modules
+ TITLE:=Kernel module for wifidog-ng
+ DEPENDS:=+kmod-nf-nat +kmod-ipt-ipset
+ FILES:=$(PKG_BUILD_DIR)/kmod/wifidog-ng.ko
+endef
+
+include $(INCLUDE_DIR)/kernel-defaults.mk
+
+define Build/Compile
+ $(call Build/Compile/Default)
+ $(MAKE) $(KERNEL_MAKEOPTS) SUBDIRS="$(PKG_BUILD_DIR)"/kmod modules
+endef
+
+$(eval $(call BuildPackage,wifidog-ng-nossl))
+$(eval $(call BuildPackage,wifidog-ng-mbedtls))
+$(eval $(call BuildPackage,wifidog-ng-wolfssl))
+$(eval $(call BuildPackage,wifidog-ng-openssl))
+
+$(eval $(call KernelPackage,wifidog-ng))
--- /dev/null
+config gateway
+ option enabled 1
+ option ifname 'br-lan'
+ option port 2060
+ option ssl_port 8443
+ option checkinterval 30
+ option client_timeout 5
+ option temppass_time 30
+
+config authserver
+ option host 'authserver.com'
+ option port 80
+ option ssl 0
+ option path '/wifidog/'
+ option login_path 'login'
+ option portal_path 'portal'
+ option msg_path 'gw_message.php'
+ option ping_path 'ping'
+ option auth_path 'auth'
+
+config popularserver
+ list server www.baidu.com
+ list server www.qq.com
+
+config whitelist
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIID8TCCAtmgAwIBAgICCCUwDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQ04x
+EDAOBgNVBAgMB1RpYW5qaW4xEDAOBgNVBAcMB1RpYW5qaW4xFTATBgNVBAoMDENI
+SU5BU1NMIEluYzEpMCcGA1UEAwwgQ0hJTkFTU0wgQ2VydGlmaWNhdGlvbiBBdXRo
+b3JpdHkwHhcNMTgwMzAzMTQyODQ2WhcNMTkwMzAzMTQyODQ2WjCBgzELMAkGA1UE
+BhMCQ04xEDAOBgNVBAgMB3NpY2h1YW4xEjAQBgNVBAoMCXpoYW9qaDMyOTETMBEG
+A1UECwwKd2lmaWRvZy1uZzEQMA4GA1UEAwwHd2lmaWRvZzEnMCUGCSqGSIb3DQEJ
+ARYYamlhbmh1aXpoYW8zMjlAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAyD8gd3XIJvkYeySP2q0toYsfvhlA+lceUPiMi16U1nR3TD5U
+uTNGsvYBDMiR7vG0NKClFT73u/d8HBcYcTBgbhHfBkz4v9S5aMdUYQsUMQEITBdE
+hPEeXVqqj796Lu6iEkNUFrtam2h3t+kYODjbszk2woBtohaRWfNyOB/AJH6Stv4l
+jkPYwt9NHcKQSm9kjcGsAqQwkgVd4UfHX2G20gaTijimeHlJL2wv61uLBUvYux0E
++98KIcEIYu3BVAfoO2Omg/o73cwH+sFTswEXPuXirwrOzmJ850WBLScLkSKSATrY
+1YdU6CRaJuP/POFfSqAhn/mPRNQFU5fAaDcfEwIDAQABo34wfDAJBgNVHRMEAjAA
+MC8GCWCGSAGG+EIBDQQiFiBDSElOQVNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
+eTAdBgNVHQ4EFgQU9XS4dW6j1r1lEOIHWkoJx3zSqqgwHwYDVR0jBBgwFoAUXB8j
++sjhITHC2Df2iPzSb8JUQzMwDQYJKoZIhvcNAQELBQADggEBAFsaq5qehwp0zMqY
+cb0IX5/f4ZnscX587SM/NhORODa0p/bT3EwG3grtljHhRW+s/4c4gPgilrzV0Fxn
+Y5FodLfFdbNVjhgeSrDCRmwIvKSe81LYOe+rbfTBF0g3YYWDwcwc8tFvcwWBxqWn
+4F+u9aIKgHU7HXQokqCxEOTFjrAHVJf1OqtRMTXlBBb6ypVdHn0glfSxOIC/Vp2T
+5UR7oVdD4E8ASqe7Q7MmTeY377CRagfd0WD9XK7o+cbKkLLW1QWc8ht1rHjGp+/2
+gmkxEmpX2Xhpv1FX/b6sj1dTmOc2bXBzpvV6yonRMu5dYsOrdDwbH/T05X+hCFW9
+G86ZLFY=
+-----END CERTIFICATE-----
--- /dev/null
+[ "$ACTION" = "add" -o "$ACTION" = "update" ] || exit 0
+ubus list wifidog-ng > /dev/null 2>&1 || exit 0
+ubus call wifidog-ng roam "{\"mac\":\"$MACADDR\", \"ip\":\"$IPADDR\"}"
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+USE_PROCD=1
+START=95
+
+BIN=/usr/bin/wifidog-ng
+
+parse_whitelist_mac() {
+ local cfg="$1"
+ local mac
+
+ uci_validate_section wifidog-ng whitelist "${1}" \
+ 'mac:macaddr'
+
+ [ $? -ne 0 ] && {
+ echo "validation whitelist_mac failed" >&2
+ exit 1
+ }
+}
+
+parse_whitelist_domain() {
+ local cfg="$1"
+ local domain
+
+ uci_validate_section wifidog-ng whitelist "${1}" \
+ 'domain:host'
+
+ [ $? -ne 0 ] && {
+ echo "validation whitelist_domain failed" >&2
+ exit 1
+ }
+}
+
+start_service() {
+ modprobe wifidog-ng
+
+ config_load wifidog-ng
+ config_foreach parse_whitelist_mac whitelist_mac
+ config_foreach parse_whitelist_domain whitelist_domain
+
+ procd_open_instance
+ procd_set_param command $BIN
+ procd_set_param respawn
+ procd_close_instance
+}
+
+stop_service() {
+ rmmod wifidog-ng
+}
--- /dev/null
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDIPyB3dcgm+Rh7
+JI/arS2hix++GUD6Vx5Q+IyLXpTWdHdMPlS5M0ay9gEMyJHu8bQ0oKUVPve793wc
+FxhxMGBuEd8GTPi/1Llox1RhCxQxAQhMF0SE8R5dWqqPv3ou7qISQ1QWu1qbaHe3
+6Rg4ONuzOTbCgG2iFpFZ83I4H8AkfpK2/iWOQ9jC300dwpBKb2SNwawCpDCSBV3h
+R8dfYbbSBpOKOKZ4eUkvbC/rW4sFS9i7HQT73wohwQhi7cFUB+g7Y6aD+jvdzAf6
+wVOzARc+5eKvCs7OYnznRYEtJwuRIpIBOtjVh1ToJFom4/884V9KoCGf+Y9E1AVT
+l8BoNx8TAgMBAAECggEAK/JmvrDzt1HtxIDWrWhaXly5H7BNKWPbPGv/9EpSoeo3
+kF0RnP+a4YXJ3zNZi7YyFWa4NDx4hCEhdMzAyX6TezSi3LAh23/lHRC5/P5AdSzD
+1Gc6225LerN+QUQFna0zlox+NOrzTK4VsCAQ963K0b+ZvAARj4QibDpYc+bL9XYK
+fVrZSnGJhNY3S6YjTF4oyMejKxk+HPhgCVEcZCHiC0RmXVqfETe6Cu0UtDPTTK5Q
+IXYYZ0HLsqaGWwGCWm/ji6HjNCG1dUhUp/yZR+7X45Utok3Rd3wo0kxZGJ7LHH4N
+541qcFbaT3rX39uPypuK5dSc5lb98FAOl79jL/wnUQKBgQDjEycf6VKZYf8d/MMV
+4+0YrFV7sdi0k4TC+lFmfJZVFHqcPn99q3cO2b9npgLDpQpwpcyBGMh6hWufVXXA
+ctrxg8vjKBHG8MT70Lulvi+G3Fldw7EHVVQGEHRqPaSzA035JyVanDs6lgoqjj9b
+BuMQidIeaj2t28pEhc0rYstW6wKBgQDhwRzoCirKrtJDWclDkjbzkGUfoAKMz2p2
+mSAs2xCdrx8vtFzUXcCLsvlXa+hIEe4O5cUZg+WLPfXiV4gtF74PTkmYADXRTUBl
+dHzfjVWQINEYFsWOEP5eYB0VWiA52JUaCuHuHILt6CSy3h8xPtnq+/oEFTeqh/2C
+XoN+seKeeQKBgQDUE1c/HpLeXf/+6crp7u3JVWqhFADo5b3gvBi6NzHQVEgPFO/N
+Vw7i98sj6pA6WTHe83qEN7lFdMaHETHgg2SonAcYKJwxyTywUspuiampsrJkOBhm
+WPMYltWjQ99GsZdpU343miJXHTpxdFkHku8OyylK7r6cWeIXDUAJfUOb8QKBgFbk
+ZoTljOzwdxvXTkFE4QPEmzed9f1OxHKbo6fANdgLlJxe9rAC2d6rZ49/iCtdQ1zW
+kZOtkceTdLXG7TI2BkCL6IWp5w0Fh/jE6l99XeaYywJTmXyCC/Y1VlxmkSrSsykP
+8UAeF0MM7DswhZ8FywjILcYuiHuJ1ki8qi40t745AoGAT/5imiro59cHMbbGEQb+
+42oBY7RxeHkk6+8WTJA6kqv8tuOK3gvDFm5cRJVCduVF/Jf+276IMoTMEb8kBGQA
+R3CRsYwLPrpdWu2q9Ho1KtH+azt/d+3uglT9g3fhvFieNIwkRgaNNJQC6wmddDeG
+MEYv4HO1LykipsDVsFadVCk=
+-----END PRIVATE KEY-----
PKG_NAME:=wifidog
PKG_VERSION:=1.3.0
-PKG_RELEASE=1
+PKG_RELEASE:=2
PKG_LICENSE:=GPL-2.0
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git
+PKG_SOURCE_URL:=https://github.com/wifidog/wifidog-gateway
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=1.3.0
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=cdab08c11ba04ffa58c2df69c2c62f63196e290a216708fa5b7d43087c18d1b0
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
+PKG_MIRROR_HASH:=9ffd9f3ae54baceb723abb7a04e27a9b6a3ff1479f8a3bfda9b8a496e8b4050f
PKG_FIXUP:=autoreconf
# do not run make install
PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.xinetd.org
+PKG_SOURCE_URL:=https://github.com/xinetd-org/xinetd/archive
PKG_HASH:=bf4e060411c75605e4dcbdf2ac57c6bd9e1904470a2f91e01ba31b50a80a5be3
PKG_LICENSE:=xinetd
PKG_LICENSE_FILES:=COPYRIGHT
SECTION:=net
CATEGORY:=Network
TITLE:=A powerful and secure super-server
- URL:=http://www.xinetd.org/
+ URL:=https://github.com/xinetd-org
PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=xl2tpd
-PKG_VERSION:=1.3.10
-PKG_RELEASE:=2
+PKG_VERSION:=1.3.11
+PKG_RELEASE:=1
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/xelerance/xl2tpd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=090d1bef577cabdb3495d76acd814733fa66ef57
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MIRROR_HASH:=bcddc10e28a74dec607e67cbbea97220f6bfd696b0378a7c30ec8a3e0ac86be1
+PKG_MIRROR_HASH:=fdb5b28ea698515abe5b996460ee8ad3fa6c76f6eed1c26949938543d7f02994
PKG_BUILD_DEPENDS:=libpcap
--- /dev/null
+#
+# Copyright (C) 2009-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=xtables-addons
+PKG_VERSION:=2.14
+PKG_RELEASE:=4
+PKG_HASH:=d215a9a8b8e66aae04b982fa2e1228e8a71e7dfe42320df99e34e5000cbdf152
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@SF/xtables-addons
+PKG_BUILD_DEPENDS:=iptables
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_CHECK_FORMAT_SECURITY:=0
+
+PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
+PKG_LICENSE:=GPL-2.0
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xtables-addons
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Firewall
+ TITLE:=Extensions not distributed in the main Xtables
+ URL:=http://xtables-addons.sourceforge.net/
+endef
+
+# uses GNU configure
+
+CONFIGURE_ARGS+= \
+ --with-kbuild="$(LINUX_DIR)" \
+ --with-xtlibdir="/usr/lib/iptables" \
+
+define Build/Compile
+ +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+ $(KERNEL_MAKE_FLAGS) \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ DEPMOD="/bin/true" \
+ all
+endef
+
+define Build/Install
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(KERNEL_MAKE_FLAGS) \
+ DESTDIR="$(PKG_INSTALL_DIR)" \
+ DEPMOD="/bin/true" \
+ install
+endef
+
+# 1: extension/module suffix used in package name
+# 2: extension/module display name used in package title/description
+# 3: list of extensions to package
+# 4: list of modules to package
+# 5: module load priority
+# 6: module depends
+define BuildTemplate
+
+ ifneq ($(3),)
+ define Package/iptables-mod-$(1)
+ $$(call Package/xtables-addons)
+ CATEGORY:=Network
+ TITLE:=$(2) iptables extension
+ DEPENDS:=iptables $(if $(4),+kmod-ipt-$(1))
+ endef
+
+ define Package/iptables-mod-$(1)/install
+ $(INSTALL_DIR) $$(1)/usr/lib/iptables
+ for m in $(3); do \
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$$$$$${m}.so \
+ $$(1)/usr/lib/iptables/ ; \
+ done
+ endef
+
+ $$(eval $$(call BuildPackage,iptables-mod-$(1)))
+ endif
+
+ ifneq ($(4),)
+ define KernelPackage/ipt-$(1)
+ SUBMENU:=Netfilter Extensions
+ TITLE:=$(2) netfilter module
+ DEPENDS:=+kmod-ipt-core $(5)
+ FILES:=$(foreach mod,$(4),$(PKG_BUILD_DIR)/extensions/$(mod).$(LINUX_KMOD_SUFFIX))
+ AUTOLOAD:=$(call AutoProbe,$(notdir $(4)))
+ endef
+
+ $$(eval $$(call KernelPackage,ipt-$(1)))
+ endif
+
+endef
+
+
+define Package/iptaccount
+ $(call Package/xtables-addons)
+ CATEGORY:=Network
+ TITLE:=iptables-mod-account control utility
+ DEPENDS:=iptables +iptables-mod-account
+endef
+
+define Package/iptaccount/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/libxt_ACCOUNT_cl.so* \
+ $(1)/usr/lib/
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/sbin/iptaccount \
+ $(1)/usr/sbin/
+endef
+
+
+define Package/iptgeoip
+ $(call Package/xtables-addons)
+ CATEGORY:=Network
+ TITLE:=iptables-mod-geoip support scripts for MaxMind GeoIP databases
+ # we could also use wget-nossl but that's more complicated than our
+ # syntax of dependencies permits...
+ DEPENDS:=iptables +iptables-mod-geoip \
+ +perl +perlbase-getopt +perlbase-io +perl-text-csv_xs \
+ +!BUSYBOX_CONFIG_WGET:wget +!BUSYBOX_CONFIG_GZIP:gzip +!BUSYBOX_CONFIG_UNZIP:unzip
+endef
+
+define Package/iptgeoip/install
+ $(INSTALL_DIR) $(1)/usr/lib/xtables-addons
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/xtables-addons/xt_geoip_{build,dl} \
+ $(1)/usr/lib/xtables-addons/
+ $(INSTALL_DIR) $(1)/usr/share/xt_geoip
+endef
+
+
+#$(eval $(call BuildTemplate,SUFFIX,DESCRIPTION,EXTENSION,MODULE,PRIORITY,DEPENDS))
+
+$(eval $(call BuildTemplate,compat-xtables,API compatibilty layer,,compat_xtables,+IPV6:kmod-ip6tables))
+$(eval $(call BuildTemplate,nathelper-rtsp,RTSP Conntrack and NAT,,rtsp/nf_conntrack_rtsp rtsp/nf_nat_rtsp,+kmod-ipt-conntrack-extra +kmod-ipt-nat))
+
+$(eval $(call BuildTemplate,account,ACCOUNT,xt_ACCOUNT,ACCOUNT/xt_ACCOUNT,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,chaos,CHAOS,xt_CHAOS,xt_CHAOS,+kmod-ipt-compat-xtables +kmod-ipt-delude +kmod-ipt-tarpit))
+$(eval $(call BuildTemplate,condition,Condition,xt_condition,xt_condition,))
+$(eval $(call BuildTemplate,delude,DELUDE,xt_DELUDE,xt_DELUDE,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,dhcpmac,DHCPMAC,xt_DHCPMAC,xt_DHCPMAC,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,dnetmap,DNETMAP,xt_DNETMAP,xt_DNETMAP,+kmod-ipt-compat-xtables +kmod-ipt-nat))
+$(eval $(call BuildTemplate,fuzzy,fuzzy,xt_fuzzy,xt_fuzzy,))
+$(eval $(call BuildTemplate,geoip,geoip,xt_geoip,xt_geoip,))
+$(eval $(call BuildTemplate,iface,iface,xt_iface,xt_iface,))
+$(eval $(call BuildTemplate,ipmark,IPMARK,xt_IPMARK,xt_IPMARK,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,ipp2p,IPP2P,xt_ipp2p,xt_ipp2p,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,ipv4options,ipv4options,xt_ipv4options,xt_ipv4options,))
+$(eval $(call BuildTemplate,length2,length2,xt_length2,xt_length2,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,logmark,LOGMARK,xt_LOGMARK,xt_LOGMARK,+kmod-ipt-compat-xtables))
+$(eval $(call BuildTemplate,lscan,lscan,xt_lscan,xt_lscan,))
+$(eval $(call BuildTemplate,lua,Lua PacketScript,xt_LUA,LUA/xt_LUA,+kmod-ipt-conntrack-extra))
+$(eval $(call BuildTemplate,psd,psd,xt_psd,xt_psd,))
+$(eval $(call BuildTemplate,quota2,quota2,xt_quota2,xt_quota2,))
+$(eval $(call BuildTemplate,sysrq,SYSRQ,xt_SYSRQ,xt_SYSRQ,+kmod-ipt-compat-xtables +kmod-crypto-hash))
+$(eval $(call BuildTemplate,tarpit,TARPIT,xt_TARPIT,xt_TARPIT,+kmod-ipt-compat-xtables))
+
+$(eval $(call BuildPackage,iptaccount))
+$(eval $(call BuildPackage,iptgeoip))
--- /dev/null
+--- a/configure.ac
++++ b/configure.ac
+@@ -44,7 +44,7 @@ regular_CFLAGS="-Wall -Waggregate-return
+
+ if test -n "$kbuilddir"; then
+ AC_MSG_CHECKING([kernel version that we will build against])
+- krel="$(make -sC "$kbuilddir" M=$PWD kernelrelease | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"
++ krel="$(make -sC "$kbuilddir" M=$PWD kernelversion | $AWK -v 'FS=[[^0-9.]]' '{print $1; exit}')"
+ save_IFS="$IFS"
+ IFS='.'
+ set x $krel
--- /dev/null
+--- /dev/null
++++ b/extensions/rtsp/Kbuild
+@@ -0,0 +1,4 @@
++# -*- Makefile -*-
++
++obj-m += nf_nat_rtsp.o
++obj-m += nf_conntrack_rtsp.o
+--- /dev/null
++++ b/extensions/rtsp/netfilter_helpers.h
+@@ -0,0 +1,133 @@
++/*
++ * Helpers for netfiler modules. This file provides implementations for basic
++ * functions such as strncasecmp(), etc.
++ *
++ * gcc will warn for defined but unused functions, so we only include the
++ * functions requested. The following macros are used:
++ * NF_NEED_STRNCASECMP nf_strncasecmp()
++ * NF_NEED_STRTOU16 nf_strtou16()
++ * NF_NEED_STRTOU32 nf_strtou32()
++ */
++#ifndef _NETFILTER_HELPERS_H
++#define _NETFILTER_HELPERS_H
++
++/* Only include these functions for kernel code. */
++#ifdef __KERNEL__
++
++#include <linux/ctype.h>
++#define iseol(c) ( (c) == '\r' || (c) == '\n' )
++
++/*
++ * The standard strncasecmp()
++ */
++#ifdef NF_NEED_STRNCASECMP
++static int
++nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
++{
++ if (s1 == NULL || s2 == NULL)
++ {
++ if (s1 == NULL && s2 == NULL)
++ {
++ return 0;
++ }
++ return (s1 == NULL) ? -1 : 1;
++ }
++ while (len > 0 && tolower(*s1) == tolower(*s2))
++ {
++ len--;
++ s1++;
++ s2++;
++ }
++ return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
++}
++#endif /* NF_NEED_STRNCASECMP */
++
++/*
++ * Parse a string containing a 16-bit unsigned integer.
++ * Returns the number of chars used, or zero if no number is found.
++ */
++#ifdef NF_NEED_STRTOU16
++static int
++nf_strtou16(const char* pbuf, u_int16_t* pval)
++{
++ int n = 0;
++
++ *pval = 0;
++ while (isdigit(pbuf[n]))
++ {
++ *pval = (*pval * 10) + (pbuf[n] - '0');
++ n++;
++ }
++
++ return n;
++}
++#endif /* NF_NEED_STRTOU16 */
++
++/*
++ * Parse a string containing a 32-bit unsigned integer.
++ * Returns the number of chars used, or zero if no number is found.
++ */
++#ifdef NF_NEED_STRTOU32
++static int
++nf_strtou32(const char* pbuf, u_int32_t* pval)
++{
++ int n = 0;
++
++ *pval = 0;
++ while (pbuf[n] >= '0' && pbuf[n] <= '9')
++ {
++ *pval = (*pval * 10) + (pbuf[n] - '0');
++ n++;
++ }
++
++ return n;
++}
++#endif /* NF_NEED_STRTOU32 */
++
++/*
++ * Given a buffer and length, advance to the next line and mark the current
++ * line.
++ */
++#ifdef NF_NEED_NEXTLINE
++static int
++nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
++{
++ uint off = *poff;
++ uint physlen = 0;
++
++ if (off >= len)
++ {
++ return 0;
++ }
++
++ while (p[off] != '\n')
++ {
++ if (len-off <= 1)
++ {
++ return 0;
++ }
++
++ physlen++;
++ off++;
++ }
++
++ /* if we saw a crlf, physlen needs adjusted */
++ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
++ {
++ physlen--;
++ }
++
++ /* advance past the newline */
++ off++;
++
++ *plineoff = *poff;
++ *plinelen = physlen;
++ *poff = off;
++
++ return 1;
++}
++#endif /* NF_NEED_NEXTLINE */
++
++#endif /* __KERNEL__ */
++
++#endif /* _NETFILTER_HELPERS_H */
+--- /dev/null
++++ b/extensions/rtsp/netfilter_mime.h
+@@ -0,0 +1,89 @@
++/*
++ * MIME functions for netfilter modules. This file provides implementations
++ * for basic MIME parsing. MIME headers are used in many protocols, such as
++ * HTTP, RTSP, SIP, etc.
++ *
++ * gcc will warn for defined but unused functions, so we only include the
++ * functions requested. The following macros are used:
++ * NF_NEED_MIME_NEXTLINE nf_mime_nextline()
++ */
++#ifndef _NETFILTER_MIME_H
++#define _NETFILTER_MIME_H
++
++/* Only include these functions for kernel code. */
++#ifdef __KERNEL__
++
++#include <linux/ctype.h>
++
++/*
++ * Given a buffer and length, advance to the next line and mark the current
++ * line. If the current line is empty, *plinelen will be set to zero. If
++ * not, it will be set to the actual line length (including CRLF).
++ *
++ * 'line' in this context means logical line (includes LWS continuations).
++ * Returns 1 on success, 0 on failure.
++ */
++#ifdef NF_NEED_MIME_NEXTLINE
++static int
++nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
++{
++ uint off = *poff;
++ uint physlen = 0;
++ int is_first_line = 1;
++
++ if (off >= len)
++ {
++ return 0;
++ }
++
++ do
++ {
++ while (p[off] != '\n')
++ {
++ if (len-off <= 1)
++ {
++ return 0;
++ }
++
++ physlen++;
++ off++;
++ }
++
++ /* if we saw a crlf, physlen needs adjusted */
++ if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
++ {
++ physlen--;
++ }
++
++ /* advance past the newline */
++ off++;
++
++ /* check for an empty line */
++ if (physlen == 0)
++ {
++ break;
++ }
++
++ /* check for colon on the first physical line */
++ if (is_first_line)
++ {
++ is_first_line = 0;
++ if (memchr(p+(*poff), ':', physlen) == NULL)
++ {
++ return 0;
++ }
++ }
++ }
++ while (p[off] == ' ' || p[off] == '\t');
++
++ *plineoff = *poff;
++ *plinelen = (physlen == 0) ? 0 : (off - *poff);
++ *poff = off;
++
++ return 1;
++}
++#endif /* NF_NEED_MIME_NEXTLINE */
++
++#endif /* __KERNEL__ */
++
++#endif /* _NETFILTER_MIME_H */
+--- /dev/null
++++ b/extensions/rtsp/nf_conntrack_rtsp.c
+@@ -0,0 +1,732 @@
++/*
++ * RTSP extension for IP connection tracking
++ * (C) 2003 by Tom Marshall <tmarshall at real.com>
++ *
++ * 2005-02-13: Harald Welte <laforge at netfilter.org>
++ * - port to 2.6
++ * - update to recent post-2.6.11 api changes
++ * 2006-09-14: Steven Van Acker <deepstar at singularity.be>
++ * - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack
++ * 2007-04-18: Michael Guntsche <mike at it-loops.com>
++ * - Port to new NF API
++ * 2013-03-04: Il'inykh Sergey <sergeyi at inango-sw.com>. Inango Systems Ltd
++ * - fixed rtcp nat mapping and other port mapping fixes
++ * - simple TEARDOWN request handling
++ * - codestyle fixes and other less significant bug fixes
++ * 2018-04-17: Alin Nastac <alin.nastac at gmail.com>
++ * Hans Dedecker <dedeckeh at gmail.com>
++ * - use IP address read from SETUP URI in expected connections
++ * 2018-04-18: Hans Dedecker <dedeckeh at gmail.com>
++ * - update RTP expected connection source IP based on SOURCE
++ * in the SETUP reply message
++ *
++ * based on ip_conntrack_irc.c
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version
++ * 2 of the License, or (at your option) any later version.
++ *
++ * Module load syntax:
++ * insmod nf_conntrack_rtsp.o ports=port1,port2,...port<MAX_PORTS>
++ * max_outstanding=n setup_timeout=secs
++ *
++ * If no ports are specified, the default will be port 554.
++ *
++ * With max_outstanding you can define the maximum number of not yet
++ * answered SETUP requests per RTSP session (default 8).
++ * With setup_timeout you can specify how long the system waits for
++ * an expected data channel (default 300 seconds).
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/netfilter.h>
++#include <linux/ip.h>
++#include <linux/inet.h>
++#include <net/tcp.h>
++
++#include <net/netfilter/nf_conntrack.h>
++#include <net/netfilter/nf_conntrack_expect.h>
++#include <net/netfilter/nf_conntrack_helper.h>
++#include "nf_conntrack_rtsp.h"
++
++#define NF_NEED_STRNCASECMP
++#define NF_NEED_STRTOU16
++#define NF_NEED_STRTOU32
++#define NF_NEED_NEXTLINE
++#include "netfilter_helpers.h"
++#define NF_NEED_MIME_NEXTLINE
++#include "netfilter_mime.h"
++
++#include <linux/ctype.h>
++
++#define MAX_PORTS 8
++static int ports[MAX_PORTS];
++static int num_ports = 0;
++static int max_outstanding = 8;
++static unsigned int setup_timeout = 300;
++
++MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
++MODULE_DESCRIPTION("RTSP connection tracking module");
++MODULE_LICENSE("GPL");
++module_param_array(ports, int, &num_ports, 0400);
++MODULE_PARM_DESC(ports, "port numbers of RTSP servers");
++module_param(max_outstanding, int, 0400);
++MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session");
++module_param(setup_timeout, int, 0400);
++MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels");
++
++static char *rtsp_buffer;
++static DEFINE_SPINLOCK(rtsp_buffer_lock);
++
++static struct nf_conntrack_expect_policy rtsp_exp_policy;
++
++unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
++ enum ip_conntrack_info ctinfo,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ unsigned int protoff,
++#endif
++ unsigned int matchoff, unsigned int matchlen,
++ struct ip_ct_rtsp_expect* prtspexp,
++ struct nf_conntrack_expect *rtp_exp,
++ struct nf_conntrack_expect *rtcp_exp);
++
++EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook);
++
++/*
++ * Max mappings we will allow for one RTSP connection (for RTP, the number
++ * of allocated ports is twice this value). Note that SMIL burns a lot of
++ * ports so keep this reasonably high. If this is too low, you will see a
++ * lot of "no free client map entries" messages.
++ */
++#define MAX_PORT_MAPS 16
++
++/*** default port list was here in the masq code: 554, 3030, 4040 ***/
++
++#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
++
++/*
++ * Parse an RTSP packet.
++ *
++ * Returns zero if parsing failed.
++ *
++ * Parameters:
++ * IN ptcp tcp data pointer
++ * IN tcplen tcp data len
++ * IN/OUT ptcpoff points to current tcp offset
++ * OUT phdrsoff set to offset of rtsp headers
++ * OUT phdrslen set to length of rtsp headers
++ * OUT pcseqoff set to offset of CSeq header
++ * OUT pcseqlen set to length of CSeq header
++ */
++static int
++rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff,
++ uint* phdrsoff, uint* phdrslen,
++ uint* pcseqoff, uint* pcseqlen,
++ uint* transoff, uint* translen)
++{
++ uint entitylen = 0;
++ uint lineoff;
++ uint linelen;
++
++ if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen))
++ return 0;
++
++ *phdrsoff = *ptcpoff;
++ while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) {
++ if (linelen == 0) {
++ if (entitylen > 0)
++ *ptcpoff += min(entitylen, tcplen - *ptcpoff);
++ break;
++ }
++ if (lineoff+linelen > tcplen) {
++ pr_info("!! overrun !!\n");
++ break;
++ }
++
++ if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) {
++ *pcseqoff = lineoff;
++ *pcseqlen = linelen;
++ }
++
++ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) {
++ *transoff = lineoff;
++ *translen = linelen;
++ }
++
++ if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) {
++ uint off = lineoff+15;
++ SKIP_WSPACE(ptcp+lineoff, linelen, off);
++ nf_strtou32(ptcp+off, &entitylen);
++ }
++ }
++ *phdrslen = (*ptcpoff) - (*phdrsoff);
++
++ return 1;
++}
++
++/*
++ * Find lo/hi client ports and/or source (if any) in transport header
++ * In:
++ * ptcp, tcplen = packet
++ * tranoff, tranlen = buffer to search
++ *
++ * Out:
++ * pport_lo, pport_hi = lo/hi ports (host endian)
++ * srvaddr
++ *
++ * Returns nonzero if any client ports found
++ *
++ * Note: it is valid (and expected) for the client to request multiple
++ * transports, so we need to parse the entire line.
++ */
++static int
++rtsp_parse_transport(char* ptran, uint tranlen,
++ struct ip_ct_rtsp_expect* prtspexp)
++{
++ int rc = 0;
++ uint off = 0;
++
++ if (tranlen < 10 || !iseol(ptran[tranlen-1]) ||
++ nf_strncasecmp(ptran, "Transport:", 10) != 0) {
++ pr_info("sanity check failed\n");
++ return 0;
++ }
++
++ pr_debug("tran='%.*s'\n", (int)tranlen, ptran);
++ off += 10;
++ SKIP_WSPACE(ptran, tranlen, off);
++
++ /* Transport: tran;field;field=val,tran;field;field=val,... */
++ while (off < tranlen) {
++ const char* pparamend;
++ uint nextparamoff;
++
++ pparamend = memchr(ptran+off, ',', tranlen-off);
++ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
++ nextparamoff = pparamend-ptran;
++
++ while (off < nextparamoff) {
++ const char* pfieldend;
++ uint nextfieldoff;
++
++ pfieldend = memchr(ptran+off, ';', nextparamoff-off);
++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
++
++ if (strncmp(ptran+off, "client_port=", 12) == 0) {
++ u_int16_t port;
++ uint numlen;
++
++ off += 12;
++ numlen = nf_strtou16(ptran+off, &port);
++ off += numlen;
++ if (prtspexp->loport != 0 && prtspexp->loport != port)
++ pr_debug("multiple ports found, port %hu ignored\n", port);
++ else {
++ pr_debug("lo port found : %hu\n", port);
++ prtspexp->loport = prtspexp->hiport = port;
++ if (ptran[off] == '-') {
++ off++;
++ numlen = nf_strtou16(ptran+off, &port);
++ off += numlen;
++ prtspexp->pbtype = pb_range;
++ prtspexp->hiport = port;
++
++ // If we have a range, assume rtp:
++ // loport must be even, hiport must be loport+1
++ if ((prtspexp->loport & 0x0001) != 0 ||
++ prtspexp->hiport != prtspexp->loport+1) {
++ pr_debug("incorrect range: %hu-%hu, correcting\n",
++ prtspexp->loport, prtspexp->hiport);
++ prtspexp->loport &= 0xfffe;
++ prtspexp->hiport = prtspexp->loport+1;
++ }
++ } else if (ptran[off] == '/') {
++ off++;
++ numlen = nf_strtou16(ptran+off, &port);
++ off += numlen;
++ prtspexp->pbtype = pb_discon;
++ prtspexp->hiport = port;
++ }
++ rc = 1;
++ }
++ } else if (strncmp(ptran+off, "source=", 7) == 0) {
++ uint srcaddrlen;
++
++ off += 7;
++ srcaddrlen = nextfieldoff - off - 1;
++
++ if (in4_pton(ptran + off, srcaddrlen,
++ (u8 *)&prtspexp->srvaddr.in,
++ -1, NULL))
++ pr_debug("source found : %pI4\n",
++ &prtspexp->srvaddr.ip);
++ }
++
++ /*
++ * Note we don't look for the destination parameter here.
++ * If we are using NAT, the NAT module will handle it. If not,
++ * and the client is sending packets elsewhere, the expectation
++ * will quietly time out.
++ */
++
++ off = nextfieldoff;
++ }
++
++ off = nextparamoff;
++ }
++
++ return rc;
++}
++
++
++/*** conntrack functions ***/
++
++/* outbound packet: client->server */
++
++static inline int
++help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ struct nf_conn *ct, enum ip_conntrack_info ctinfo,
++ unsigned int protoff)
++#else
++ struct nf_conn *ct, enum ip_conntrack_info ctinfo)
++#endif
++{
++ struct ip_ct_rtsp_expect expinfo;
++
++ int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */
++ //struct tcphdr* tcph = (void*)iph + iph->ihl * 4;
++ //uint tcplen = pktlen - iph->ihl * 4;
++ char* pdata = rb_ptr;
++ //uint datalen = tcplen - tcph->doff * 4;
++ uint dataoff = 0;
++ int ret = NF_ACCEPT;
++
++ struct nf_conntrack_expect *rtp_exp;
++ struct nf_conntrack_expect *rtcp_exp = NULL;
++
++ __be16 be_loport;
++ __be16 be_hiport;
++
++ typeof(nf_nat_rtsp_hook) nf_nat_rtsp;
++
++ memset(&expinfo, 0, sizeof(expinfo));
++
++ while (dataoff < datalen) {
++ uint cmdoff = dataoff;
++ uint hdrsoff = 0;
++ uint hdrslen = 0;
++ uint cseqoff = 0;
++ uint cseqlen = 0;
++ uint transoff = 0;
++ uint translen = 0;
++ uint off;
++ union nf_inet_addr srvaddr;
++
++ if (!rtsp_parse_message(pdata, datalen, &dataoff,
++ &hdrsoff, &hdrslen,
++ &cseqoff, &cseqlen,
++ &transoff, &translen))
++ break; /* not a valid message */
++
++ if (strncmp(pdata+cmdoff, "TEARDOWN ", 9) == 0) {
++ pr_debug("teardown handled\n");
++ nf_ct_remove_expectations(ct); /* FIXME must be session id aware */
++ break;
++ }
++
++ if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0)
++ continue; /* not a SETUP message */
++
++ srvaddr = ct->tuplehash[!dir].tuple.src.u3;
++
++ /* try to get RTP media source from SETUP URI */
++ off = cmdoff + 6;
++ while (off < datalen) {
++ if (strncmp(pdata+off, "://", 3) == 0) {
++ off += 3;
++ cmdoff = off;
++
++ while (off < datalen) {
++ if (pdata[off] == ':' ||
++ pdata[off] == '/' ||
++ pdata[off] == ' ') {
++ in4_pton(pdata + cmdoff,
++ off - cmdoff,
++ (u8 *)&srvaddr.in,
++ -1, NULL);
++ break;
++ }
++ off++;
++ }
++ break;
++ }
++ off++;
++ }
++
++ pr_debug("found a setup message\n");
++
++ off = 0;
++ if(translen)
++ rtsp_parse_transport(pdata+transoff, translen, &expinfo);
++
++ if (expinfo.loport == 0) {
++ pr_debug("no udp transports found\n");
++ continue; /* no udp transports found */
++ }
++
++ pr_debug("udp transport found, ports=(%d,%hu,%hu)\n",
++ (int)expinfo.pbtype, expinfo.loport, expinfo.hiport);
++
++
++ be_loport = htons(expinfo.loport);
++
++ rtp_exp = nf_ct_expect_alloc(ct);
++ if (rtp_exp == NULL) {
++ ret = NF_DROP;
++ goto out;
++ }
++
++ nf_ct_expect_init(rtp_exp, NF_CT_EXPECT_CLASS_DEFAULT,
++ nf_ct_l3num(ct), &srvaddr,
++ &ct->tuplehash[!dir].tuple.dst.u3,
++ IPPROTO_UDP, NULL, &be_loport);
++
++ rtp_exp->flags = 0;
++
++ if (expinfo.pbtype == pb_range) {
++ pr_debug("setup expectation for rtcp\n");
++
++ be_hiport = htons(expinfo.hiport);
++ rtcp_exp = nf_ct_expect_alloc(ct);
++ if (rtcp_exp == NULL) {
++ ret = NF_DROP;
++ goto out1;
++ }
++
++ nf_ct_expect_init(rtcp_exp, NF_CT_EXPECT_CLASS_DEFAULT,
++ nf_ct_l3num(ct), &srvaddr,
++ &ct->tuplehash[!dir].tuple.dst.u3,
++ IPPROTO_UDP, NULL, &be_hiport);
++
++ rtcp_exp->flags = 0;
++
++ pr_debug("expect_related %pI4:%u-%u-%pI4:%u-%u\n",
++ &rtp_exp->tuple.src.u3.ip,
++ ntohs(rtp_exp->tuple.src.u.udp.port),
++ ntohs(rtcp_exp->tuple.src.u.udp.port),
++ &rtp_exp->tuple.dst.u3.ip,
++ ntohs(rtp_exp->tuple.dst.u.udp.port),
++ ntohs(rtcp_exp->tuple.dst.u.udp.port));
++ } else {
++ pr_debug("expect_related %pI4:%u-%pI4:%u\n",
++ &rtp_exp->tuple.src.u3.ip,
++ ntohs(rtp_exp->tuple.src.u.udp.port),
++ &rtp_exp->tuple.dst.u3.ip,
++ ntohs(rtp_exp->tuple.dst.u.udp.port));
++ }
++
++ nf_nat_rtsp = rcu_dereference(nf_nat_rtsp_hook);
++ if (nf_nat_rtsp && ct->status & IPS_NAT_MASK)
++ /* pass the request off to the nat helper */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ ret = nf_nat_rtsp(skb, ctinfo, protoff, hdrsoff, hdrslen,
++ &expinfo, rtp_exp, rtcp_exp);
++#else
++ ret = nf_nat_rtsp(skb, ctinfo, hdrsoff, hdrslen,
++ &expinfo, rtp_exp, rtcp_exp);
++#endif
++ else {
++ if (nf_ct_expect_related(rtp_exp) == 0) {
++ if (rtcp_exp && nf_ct_expect_related(rtcp_exp) != 0) {
++ nf_ct_unexpect_related(rtp_exp);
++ pr_info("nf_conntrack_expect_related failed for rtcp\n");
++ ret = NF_DROP;
++ }
++ } else {
++ pr_info("nf_conntrack_expect_related failed for rtp\n");
++ ret = NF_DROP;
++ }
++ }
++ if (rtcp_exp) {
++ nf_ct_expect_put(rtcp_exp);
++ }
++out1:
++ nf_ct_expect_put(rtp_exp);
++ goto out;
++ }
++out:
++
++ return ret;
++}
++
++
++static inline int
++help_in(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ struct nf_conn *ct, enum ip_conntrack_info ctinfo,
++ unsigned int protoff)
++#else
++ struct nf_conn *ct, enum ip_conntrack_info ctinfo)
++#endif
++ {
++ struct ip_ct_rtsp_expect expinfo;
++ union nf_inet_addr srvaddr;
++ int dir = CTINFO2DIR(ctinfo); /* = IP_CT_DIR_ORIGINAL */
++ int len;
++ char* pdata = rb_ptr;
++ uint dataoff = 0;
++ int ret = NF_ACCEPT;
++ u_int8_t family;
++ struct nf_conntrack_expect *exp_ct = NULL;
++ struct nf_conntrack_tuple t;
++ struct net *net = nf_ct_net(ct);
++
++ memset(&expinfo, 0, sizeof(expinfo));
++
++ while (dataoff < datalen) {
++ uint cmdoff = dataoff;
++ uint hdrsoff = 0;
++ uint hdrslen = 0;
++ uint cseqoff = 0;
++ uint cseqlen = 0;
++ uint transoff = 0;
++ uint translen = 0;
++
++ if (!rtsp_parse_message(pdata, datalen, &dataoff,
++ &hdrsoff, &hdrslen,
++ &cseqoff, &cseqlen,
++ &transoff, &translen))
++ break; /* not a valid message */
++
++ if (strncmp(pdata+cmdoff, "RTSP/", 5) == 0 && translen) {
++ union nf_inet_addr zeroaddr;
++
++ memset(&zeroaddr, 0, sizeof(zeroaddr));
++
++ if (!rtsp_parse_transport(pdata+transoff, translen, &expinfo))
++ continue;
++
++ srvaddr = expinfo.srvaddr;
++
++ if (nf_inet_addr_cmp(&srvaddr, &ct->tuplehash[dir].tuple.src.u3) ||
++ nf_inet_addr_cmp(&srvaddr, &zeroaddr))
++ continue;
++ } else
++ continue; /* not valid RTSP reply */
++
++ if (expinfo.loport == 0) {
++ pr_debug("no udp transports found\n");
++ continue; /* no udp transports found */
++ }
++
++ family = nf_ct_l3num(ct);
++ if (family == AF_INET)
++ len = 4;
++ else
++ len = 16;
++
++ /* replace rtp expect src addr */
++ t.src.l3num = family;
++ t.dst.protonum = IPPROTO_UDP;
++
++ memcpy(&t.src.u3, &ct->tuplehash[dir].tuple.src.u3, len);
++ if (sizeof(t.src.u3) > len)
++ /* address needs to be cleared for nf_ct_tuple_equal */
++ memset((void *)&t.src.u3 + len, 0, sizeof(t.src.u3) - len);
++
++ t.src.u.all = 0;
++
++ memcpy(&t.dst.u3, &ct->tuplehash[dir].tuple.dst.u3, len);
++ if (sizeof(t.dst.u3) > len)
++ /* address needs to be cleared for nf_ct_tuple_equal */
++ memset((void *)&t.dst.u3 + len, 0, sizeof(t.dst.u3) - len);
++
++ t.dst.u.all = htons(expinfo.loport);
++
++ /* get the rtp expect and replace the srcaddr with RTP server addr */
++ exp_ct = nf_ct_expect_find_get(net, nf_ct_zone(ct), &t);
++ if (exp_ct) {
++ memcpy(&exp_ct->tuple.src.u3, &srvaddr, len);
++ if (sizeof(exp_ct->tuple.src.u3) > len)
++ /* address needs to be cleared for nf_ct_tuple_equal */
++ memset((void *)&exp_ct->tuple.src.u3 + len, 0,
++ sizeof(exp_ct->tuple.src.u3) - len);
++ } else
++ goto out;
++
++ /* replace rtcp expect src addr */
++ if (expinfo.pbtype == pb_range) {
++ t.dst.u.all = htons(expinfo.hiport);
++
++ /* get the rtcp expect and replace the srcaddr with RTP server addr */
++ exp_ct = nf_ct_expect_find_get(net, nf_ct_zone(ct), &t);
++ if (exp_ct) {
++ memcpy(&exp_ct->tuple.src.u3, &srvaddr, len);
++ if (sizeof(exp_ct->tuple.src.u3) > len)
++ /* address needs to be cleared for nf_ct_tuple_equal */
++ memset((void *)&exp_ct->tuple.src.u3 + len, 0,
++ sizeof(exp_ct->tuple.src.u3) - len);
++ } else
++ goto out;
++ }
++
++ goto out;
++ }
++out:
++ return ret;
++ }
++
++static int help(struct sk_buff *skb, unsigned int protoff,
++ struct nf_conn *ct, enum ip_conntrack_info ctinfo)
++{
++ struct tcphdr _tcph, *th;
++ unsigned int dataoff, datalen;
++ char *rb_ptr;
++ int ret = NF_DROP;
++
++ /* Until there's been traffic both ways, don't look in packets. */
++ if (ctinfo != IP_CT_ESTABLISHED &&
++ ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
++ pr_debug("conntrackinfo = %u\n", ctinfo);
++ return NF_ACCEPT;
++ }
++
++ /* Not whole TCP header? */
++ th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph);
++
++ if (!th)
++ return NF_ACCEPT;
++
++ /* No data ? */
++ dataoff = protoff + th->doff*4;
++ datalen = skb->len - dataoff;
++ if (dataoff >= skb->len)
++ return NF_ACCEPT;
++
++ spin_lock_bh(&rtsp_buffer_lock);
++ rb_ptr = skb_header_pointer(skb, dataoff,
++ skb->len - dataoff, rtsp_buffer);
++ BUG_ON(rb_ptr == NULL);
++
++#if 0
++ /* Checksum invalid? Ignore. */
++ /* FIXME: Source route IP option packets --RR */
++ if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr,
++ csum_partial((char*)tcph, tcplen, 0)))
++ {
++ DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n",
++ tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
++ return NF_ACCEPT;
++ }
++#endif
++
++ switch (CTINFO2DIR(ctinfo)) {
++ case IP_CT_DIR_ORIGINAL:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ ret = help_out(skb, rb_ptr, datalen, ct, ctinfo, protoff);
++#else
++ ret = help_out(skb, rb_ptr, datalen, ct, ctinfo);
++#endif
++ break;
++ case IP_CT_DIR_REPLY:
++ pr_debug("IP_CT_DIR_REPLY\n");
++ /* inbound packet: server->client */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ ret = help_in(skb, rb_ptr, datalen, ct, ctinfo, protoff);
++#else
++ ret = help_in(skb, rb_ptr, datalen, ct, ctinfo);
++#endif
++ break;
++ }
++
++ spin_unlock_bh(&rtsp_buffer_lock);
++
++ return ret;
++}
++
++static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS];
++static char rtsp_names[MAX_PORTS][10];
++
++/* This function is intentionally _NOT_ defined as __exit */
++static void
++fini(void)
++{
++ int i;
++ for (i = 0; i < num_ports; i++) {
++ pr_debug("unregistering port %d\n", ports[i]);
++ nf_conntrack_helper_unregister(&rtsp_helpers[i]);
++ }
++ kfree(rtsp_buffer);
++}
++
++static int __init
++init(void)
++{
++ int i, ret;
++ struct nf_conntrack_helper *hlpr;
++ char *tmpname;
++
++ printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n");
++
++ if (max_outstanding < 1) {
++ printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n");
++ return -EBUSY;
++ }
++ if (setup_timeout < 0) {
++ printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n");
++ return -EBUSY;
++ }
++
++ rtsp_exp_policy.max_expected = max_outstanding;
++ rtsp_exp_policy.timeout = setup_timeout;
++
++ rtsp_buffer = kmalloc(65536, GFP_KERNEL);
++ if (!rtsp_buffer)
++ return -ENOMEM;
++
++ /* If no port given, default to standard rtsp port */
++ if (ports[0] == 0) {
++ ports[0] = RTSP_PORT;
++ num_ports = 1;
++ }
++
++ for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
++ hlpr = &rtsp_helpers[i];
++ memset(hlpr, 0, sizeof(struct nf_conntrack_helper));
++ hlpr->tuple.src.l3num = AF_INET;
++ hlpr->tuple.src.u.tcp.port = htons(ports[i]);
++ hlpr->tuple.dst.protonum = IPPROTO_TCP;
++ hlpr->expect_policy = &rtsp_exp_policy;
++ hlpr->me = THIS_MODULE;
++ hlpr->help = help;
++
++ tmpname = &rtsp_names[i][0];
++ if (ports[i] == RTSP_PORT) {
++ sprintf(tmpname, "rtsp");
++ } else {
++ sprintf(tmpname, "rtsp-%d", i);
++ }
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
++ strlcpy(hlpr->name, tmpname, sizeof(hlpr->name));
++#else
++ hlpr->name = tmpname;
++#endif
++ pr_debug("port #%d: %d\n", i, ports[i]);
++
++ ret = nf_conntrack_helper_register(hlpr);
++
++ if (ret) {
++ printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]);
++ fini();
++ return -EBUSY;
++ }
++ }
++ return 0;
++}
++
++module_init(init);
++module_exit(fini);
+--- /dev/null
++++ b/extensions/rtsp/nf_conntrack_rtsp.h
+@@ -0,0 +1,73 @@
++/*
++ * RTSP extension for IP connection tracking.
++ * (C) 2003 by Tom Marshall <tmarshall at real.com>
++ * based on ip_conntrack_irc.h
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version
++ * 2 of the License, or (at your option) any later version.
++ *
++ * 2013-03-04: Il'inykh Sergey <sergeyi at inango-sw.com>. Inango Systems Ltd
++ * - conditional compilation for kernel 3.7
++ * - port mapping improvements
++*/
++#ifndef _IP_CONNTRACK_RTSP_H
++#define _IP_CONNTRACK_RTSP_H
++
++#include <linux/version.h>
++
++//#define IP_NF_RTSP_DEBUG 1
++#define IP_NF_RTSP_VERSION "0.7"
++
++#ifdef __KERNEL__
++/* port block types */
++typedef enum {
++ pb_single, /* client_port=x */
++ pb_range, /* client_port=x-y */
++ pb_discon /* client_port=x/y (rtspbis) */
++} portblock_t;
++
++/* We record seq number and length of rtsp headers here, all in host order. */
++
++/*
++ * This structure is per expected connection. It is a member of struct
++ * ip_conntrack_expect. The TCP SEQ for the conntrack expect is stored
++ * there and we are expected to only store the length of the data which
++ * needs replaced. If a packet contains multiple RTSP messages, we create
++ * one expected connection per message.
++ *
++ * We use these variables to mark the entire header block. This may seem
++ * like overkill, but the nature of RTSP requires it. A header may appear
++ * multiple times in a message. We must treat two Transport headers the
++ * same as one Transport header with two entries.
++ */
++struct ip_ct_rtsp_expect
++{
++ u_int32_t len; /* length of header block */
++ portblock_t pbtype; /* Type of port block that was requested */
++ u_int16_t loport; /* Port that was requested, low or first */
++ u_int16_t hiport; /* Port that was requested, high or second */
++ union nf_inet_addr srvaddr; /* src address in SETUP reply */
++#if 0
++ uint method; /* RTSP method */
++ uint cseq; /* CSeq from request */
++#endif
++};
++
++extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
++ enum ip_conntrack_info ctinfo,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ unsigned int protoff,
++#endif
++ unsigned int matchoff,
++ unsigned int matchlen,
++ struct ip_ct_rtsp_expect *prtspexp,
++ struct nf_conntrack_expect *rtp_exp,
++ struct nf_conntrack_expect *rtcp_exp);
++
++#define RTSP_PORT 554
++
++#endif /* __KERNEL__ */
++
++#endif /* _IP_CONNTRACK_RTSP_H */
+--- /dev/null
++++ b/extensions/rtsp/nf_nat_rtsp.c
+@@ -0,0 +1,617 @@
++/*
++ * RTSP extension for TCP NAT alteration
++ * (C) 2003 by Tom Marshall <tmarshall at real.com>
++ *
++ * 2013-03-04: Il'inykh Sergey <sergeyi at inango-sw.com>. Inango Systems Ltd
++ * - fixed rtcp nat mapping and other port mapping fixes
++ * - fixed system hard lock because of bug in the parser
++ * - codestyle fixes and less significant fixes
++ *
++ * based on ip_nat_irc.c
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * as published by the Free Software Foundation; either version
++ * 2 of the License, or (at your option) any later version.
++ *
++ * Module load syntax:
++ * insmod nf_nat_rtsp.o ports=port1,port2,...port<MAX_PORTS>
++ * stunaddr=<address>
++ * destaction=[auto|strip|none]
++ *
++ * If no ports are specified, the default will be port 554 only.
++ *
++ * stunaddr specifies the address used to detect that a client is using STUN.
++ * If this address is seen in the destination parameter, it is assumed that
++ * the client has already punched a UDP hole in the firewall, so we don't
++ * mangle the client_port. If none is specified, it is autodetected. It
++ * only needs to be set if you have multiple levels of NAT. It should be
++ * set to the external address that the STUN clients detect. Note that in
++ * this case, it will not be possible for clients to use UDP with servers
++ * between the NATs.
++ *
++ * If no destaction is specified, auto is used.
++ * destaction=auto: strip destination parameter if it is not stunaddr.
++ * destaction=strip: always strip destination parameter (not recommended).
++ * destaction=none: do not touch destination parameter (not recommended).
++ */
++
++#include <linux/module.h>
++#include <linux/version.h>
++#include <net/tcp.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++# include <net/netfilter/nf_nat.h>
++#else
++# include <net/netfilter/nf_nat_rule.h>
++#endif
++#include <net/netfilter/nf_nat_helper.h>
++#include "nf_conntrack_rtsp.h"
++#include <net/netfilter/nf_conntrack_expect.h>
++
++#include <linux/inet.h>
++#include <linux/ctype.h>
++#define NF_NEED_STRNCASECMP
++#define NF_NEED_STRTOU16
++#include "netfilter_helpers.h"
++#define NF_NEED_MIME_NEXTLINE
++#include "netfilter_mime.h"
++
++#define MAX_PORTS 8
++#define DSTACT_AUTO 0
++#define DSTACT_STRIP 1
++#define DSTACT_NONE 2
++
++static char* stunaddr = NULL;
++static char* destaction = NULL;
++
++static u_int32_t extip = 0;
++static int dstact = 0;
++
++static void nf_nat_rtsp_expected(struct nf_conn* ct, struct nf_conntrack_expect *exp);
++
++MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
++MODULE_DESCRIPTION("RTSP network address translation module");
++MODULE_LICENSE("GPL");
++module_param(stunaddr, charp, 0644);
++MODULE_PARM_DESC(stunaddr, "Address for detecting STUN");
++module_param(destaction, charp, 0644);
++MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)");
++
++#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
++
++/*** helper functions ***/
++
++static void
++get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen)
++{
++ struct iphdr* iph = ip_hdr(skb);
++ struct tcphdr* tcph = (void *)iph + ip_hdrlen(skb);
++
++ *pptcpdata = (char*)tcph + tcph->doff*4;
++ *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata;
++}
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++/* copy of sip_sprintf_addr */
++static int rtsp_sprintf_addr(const struct nf_conn *ct, char *buffer,
++ const union nf_inet_addr *addr, bool delim)
++{
++ if (nf_ct_l3num(ct) == NFPROTO_IPV4) {
++ return sprintf(buffer, "%pI4", &addr->ip);
++ } else {
++ if (delim)
++ return sprintf(buffer, "[%pI6c]", &addr->ip6);
++ else
++ return sprintf(buffer, "%pI6c", &addr->ip6);
++ }
++}
++#endif
++
++/*** nat functions ***/
++
++/*
++ * Mangle the "Transport:" header:
++ * - Replace all occurences of "client_port=<spec>"
++ * - Handle destination parameter
++ *
++ * In:
++ * ct, ctinfo = conntrack context
++ * skb = packet
++ * tranoff = Transport header offset from TCP data
++ * tranlen = Transport header length (incl. CRLF)
++ * rport_lo = replacement low port (host endian)
++ * rport_hi = replacement high port (host endian)
++ *
++ * Returns packet size difference.
++ *
++ * Assumes that a complete transport header is present, ending with CR or LF
++ */
++static int
++rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ unsigned int protoff,
++#endif
++ struct nf_conntrack_expect* rtp_exp,
++ struct nf_conntrack_expect* rtcp_exp,
++ struct ip_ct_rtsp_expect* prtspexp,
++ struct sk_buff* skb, uint tranoff, uint tranlen)
++{
++ char* ptcp;
++ uint tcplen;
++ char* ptran;
++ char rbuf1[16]; /* Replacement buffer (one port) */
++ uint rbuf1len; /* Replacement len (one port) */
++ char rbufa[16]; /* Replacement buffer (all ports) */
++ uint rbufalen; /* Replacement len (all ports) */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ union nf_inet_addr newip;
++#else
++ u_int32_t newip;
++#endif
++ u_int16_t loport, hiport;
++ uint off = 0;
++ uint diff; /* Number of bytes we removed */
++
++ struct nf_conn *ct = rtp_exp->master;
++ /* struct nf_conn *ct = nf_ct_get(skb, &ctinfo); */
++ struct nf_conntrack_tuple *rtp_t;
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ char szextaddr[INET6_ADDRSTRLEN];
++#else
++ char szextaddr[INET_ADDRSTRLEN];
++#endif
++ uint extaddrlen;
++ int is_stun;
++
++ get_skb_tcpdata(skb, &ptcp, &tcplen);
++ ptran = ptcp+tranoff;
++
++ if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen ||
++ tranlen < 10 || !iseol(ptran[tranlen-1]) ||
++ nf_strncasecmp(ptran, "Transport:", 10) != 0) {
++ pr_info("sanity check failed\n");
++ return 0;
++ }
++ off += 10;
++ SKIP_WSPACE(ptcp+tranoff, tranlen, off);
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3;
++ rtp_t = &rtp_exp->tuple;
++ rtp_t->dst.u3 = newip;
++ if (rtcp_exp) {
++ rtcp_exp->tuple.dst.u3 = newip;
++ }
++ extaddrlen = rtsp_sprintf_addr(ct, szextaddr, &newip, true); // FIXME handle extip
++ pr_debug("stunaddr=%s (auto)\n", szextaddr);
++#else
++ newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
++ rtp_t = &rtp_exp->tuple;
++ rtp_t->dst.u3.ip = newip;
++ if (rtcp_exp) {
++ rtcp_exp->tuple.dst.u3.ip = newip;
++ }
++ extaddrlen = extip ? sprintf(szextaddr, "%pI4", &extip)
++ : sprintf(szextaddr, "%pI4", &newip);
++ pr_debug("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto"));
++#endif
++ hiport = 0;
++ rbuf1len = rbufalen = 0;
++ switch (prtspexp->pbtype) {
++ case pb_single:
++ for (loport = prtspexp->loport; loport != 0; loport++) { /* XXX: improper wrap? */
++ rtp_t->dst.u.udp.port = htons(loport);
++ if (nf_ct_expect_related(rtp_exp) == 0) {
++ pr_debug("using port %hu\n", loport);
++ break;
++ }
++ }
++ if (loport != 0) {
++ rbuf1len = sprintf(rbuf1, "%hu", loport);
++ rbufalen = sprintf(rbufa, "%hu", loport);
++ }
++ break;
++ case pb_range:
++ for (loport = prtspexp->loport; loport != 0; loport += 2) { /* XXX: improper wrap? */
++ rtp_t->dst.u.udp.port = htons(loport);
++ if (nf_ct_expect_related(rtp_exp) != 0) {
++ continue;
++ }
++ hiport = loport + 1;
++ rtcp_exp->tuple.dst.u.udp.port = htons(hiport);
++ if (nf_ct_expect_related(rtcp_exp) != 0) {
++ nf_ct_unexpect_related(rtp_exp);
++ continue;
++ }
++
++ /* FIXME: invalid print in case of ipv6 */
++ pr_debug("nat expect_related %pI4:%u-%u-%pI4:%u-%u\n",
++ &rtp_exp->tuple.src.u3.ip,
++ ntohs(rtp_exp->tuple.src.u.udp.port),
++ ntohs(rtcp_exp->tuple.src.u.udp.port),
++ &rtp_exp->tuple.dst.u3.ip,
++ ntohs(rtp_exp->tuple.dst.u.udp.port),
++ ntohs(rtcp_exp->tuple.dst.u.udp.port));
++ break;
++ }
++ if (loport != 0) {
++ rbuf1len = sprintf(rbuf1, "%hu", loport);
++ rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport);
++ }
++ break;
++ case pb_discon:
++ for (loport = prtspexp->loport; loport != 0; loport++) { /* XXX: improper wrap? */
++ rtp_t->dst.u.udp.port = htons(loport);
++ if (nf_ct_expect_related(rtp_exp) == 0) {
++ pr_debug("using port %hu (1 of 2)\n", loport);
++ break;
++ }
++ }
++ for (hiport = prtspexp->hiport; hiport != 0; hiport++) { /* XXX: improper wrap? */
++ rtp_t->dst.u.udp.port = htons(hiport);
++ if (nf_ct_expect_related(rtp_exp) == 0) {
++ pr_debug("using port %hu (2 of 2)\n", hiport);
++ break;
++ }
++ }
++ if (loport != 0 && hiport != 0) {
++ rbuf1len = sprintf(rbuf1, "%hu", loport);
++ rbufalen = sprintf(rbufa, hiport == loport+1 ?
++ "%hu-%hu":"%hu/%hu", loport, hiport);
++ }
++ break;
++ }
++
++ if (rbuf1len == 0)
++ return 0; /* cannot get replacement port(s) */
++
++ /* Transport: tran;field;field=val,tran;field;field=val,...
++ `off` is set to the start of Transport value from start of line
++ */
++ while (off < tranlen) {
++ uint saveoff;
++ const char* pparamend;
++ uint nextparamoff;
++
++ pparamend = memchr(ptran+off, ',', tranlen-off);
++ pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
++ nextparamoff = pparamend-ptran;
++
++ /*
++ * We pass over each param twice. On the first pass, we look for a
++ * destination= field. It is handled by the security policy. If it
++ * is present, allowed, and equal to our external address, we assume
++ * that STUN is being used and we leave the client_port= field alone.
++ */
++ is_stun = 0;
++ saveoff = off;
++ while (off < nextparamoff) {
++ const char* pfieldend;
++ uint nextfieldoff;
++
++ pfieldend = memchr(ptran+off, ';', nextparamoff-off);
++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
++
++ if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0) {
++ if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0)
++ is_stun = 1;
++
++ if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun)) {
++ uint dstoff = (ptran-ptcp)+off;
++ uint dstlen = nextfieldoff-off;
++ char* pdstrep = NULL;
++ uint dstreplen = 0;
++ diff = dstlen;
++ if (dstact == DSTACT_AUTO && !is_stun) {
++ pr_debug("RTSP: replace dst addr\n");
++ dstoff += 12;
++ dstlen -= 13;
++ pdstrep = szextaddr;
++ dstreplen = extaddrlen;
++ diff = nextfieldoff-off-13-extaddrlen;
++ }
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
++ dstoff, dstlen, pdstrep, dstreplen)) {
++#else
++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
++ dstoff, dstlen, pdstrep, dstreplen)) {
++#endif
++ /* mangle failed, all we can do is bail */
++ nf_ct_unexpect_related(rtp_exp);
++ if (rtcp_exp)
++ nf_ct_unexpect_related(rtcp_exp);
++ return 0;
++ }
++ get_skb_tcpdata(skb, &ptcp, &tcplen);
++ ptran = ptcp+tranoff;
++ tranlen -= diff;
++ nextparamoff -= diff;
++ nextfieldoff -= diff;
++ }
++ }
++
++ off = nextfieldoff;
++ }
++
++ if (is_stun)
++ continue;
++
++ off = saveoff;
++ while (off < nextparamoff) {
++ const char* pfieldend;
++ uint nextfieldoff;
++
++ pfieldend = memchr(ptran+off, ';', nextparamoff-off);
++ nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
++
++ if (strncmp(ptran+off, "client_port=", 12) == 0) {
++ u_int16_t port;
++ uint numlen;
++ uint origoff;
++ uint origlen;
++ char* rbuf = rbuf1;
++ uint rbuflen = rbuf1len;
++
++ off += 12;
++ origoff = (ptran-ptcp)+off;
++ origlen = 0;
++ numlen = nf_strtou16(ptran+off, &port);
++ off += numlen;
++ origlen += numlen;
++ if (port != prtspexp->loport) {
++ pr_debug("multiple ports found, port %hu ignored\n", port);
++ } else {
++ if (ptran[off] == '-' || ptran[off] == '/') {
++ off++;
++ origlen++;
++ numlen = nf_strtou16(ptran+off, &port);
++ off += numlen;
++ origlen += numlen;
++ rbuf = rbufa;
++ rbuflen = rbufalen;
++ }
++
++ /*
++ * note we cannot just memcpy() if the sizes are the same.
++ * the mangle function does skb resizing, checks for a
++ * cloned skb, and updates the checksums.
++ *
++ * parameter 4 below is offset from start of tcp data.
++ */
++ diff = origlen-rbuflen;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
++ origoff, origlen, rbuf, rbuflen)) {
++#else
++ if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
++ origoff, origlen, rbuf, rbuflen)) {
++#endif
++ /* mangle failed, all we can do is bail */
++ nf_ct_unexpect_related(rtp_exp);
++ if (rtcp_exp)
++ nf_ct_unexpect_related(rtcp_exp);
++ return 0;
++ }
++ get_skb_tcpdata(skb, &ptcp, &tcplen);
++ ptran = ptcp+tranoff;
++ tranlen -= diff;
++ nextparamoff -= diff;
++ nextfieldoff -= diff;
++ }
++ }
++
++ off = nextfieldoff;
++ }
++
++ off = nextparamoff;
++ }
++
++ return 1;
++}
++
++static uint
++help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ unsigned int protoff,
++#endif
++ unsigned int matchoff, unsigned int matchlen,
++ struct ip_ct_rtsp_expect* prtspexp,
++ struct nf_conntrack_expect* rtp_exp,
++ struct nf_conntrack_expect* rtcp_exp)
++{
++ char* ptcp;
++ uint tcplen;
++ uint hdrsoff;
++ uint hdrslen;
++ uint lineoff;
++ uint linelen;
++ uint off;
++ int dir = CTINFO2DIR(ctinfo);
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ union nf_inet_addr saddr = rtp_exp->master->tuplehash[dir].tuple.src.u3;
++#else
++ __be32 saddr = rtp_exp->master->tuplehash[dir].tuple.src.u3.ip;
++#endif
++
++ //struct iphdr* iph = (struct iphdr*)(*pskb)->nh.iph;
++ //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4);
++
++ get_skb_tcpdata(skb, &ptcp, &tcplen);
++ hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq);
++ hdrslen = matchlen;
++ off = hdrsoff;
++ pr_debug("NAT rtsp help_out\n");
++
++ while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen)) {
++ if (linelen == 0)
++ break;
++
++ if (off > hdrsoff+hdrslen) {
++ pr_info("!! overrun !!");
++ break;
++ }
++ pr_debug("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
++
++ if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) {
++ uint oldtcplen = tcplen;
++ pr_debug("hdr: Transport\n");
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ if (!rtsp_mangle_tran(ctinfo, protoff, rtp_exp, rtcp_exp,
++ prtspexp, skb, lineoff, linelen)) {
++#else
++ if (!rtsp_mangle_tran(ctinfo, rtp_exp, rtcp_exp, prtspexp,
++ skb, lineoff, linelen)) {
++#endif
++ pr_debug("hdr: Transport mangle failed");
++ break;
++ }
++ rtp_exp->expectfn = nf_nat_rtsp_expected;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ rtp_exp->saved_addr = saddr;
++#else
++ rtp_exp->saved_ip = saddr;
++#endif
++ rtp_exp->saved_proto.udp.port = htons(prtspexp->loport);
++ rtp_exp->dir = !dir;
++ if (rtcp_exp) {
++ rtcp_exp->expectfn = nf_nat_rtsp_expected;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ rtcp_exp->saved_addr = saddr;
++#else
++ rtcp_exp->saved_ip = saddr;
++#endif
++ rtcp_exp->saved_proto.udp.port = htons(prtspexp->hiport);
++ rtcp_exp->dir = !dir;
++ }
++ get_skb_tcpdata(skb, &ptcp, &tcplen);
++ hdrslen -= (oldtcplen-tcplen);
++ off -= (oldtcplen-tcplen);
++ lineoff -= (oldtcplen-tcplen);
++ linelen -= (oldtcplen-tcplen);
++ pr_debug("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
++ }
++ }
++
++ return NF_ACCEPT;
++}
++
++static unsigned int
++nf_nat_rtsp(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ unsigned int protoff,
++#endif
++ unsigned int matchoff, unsigned int matchlen,
++ struct ip_ct_rtsp_expect* prtspexp,
++ struct nf_conntrack_expect* rtp_exp,
++ struct nf_conntrack_expect* rtcp_exp)
++{
++ int dir = CTINFO2DIR(ctinfo);
++ int rc = NF_ACCEPT;
++
++ switch (dir) {
++ case IP_CT_DIR_ORIGINAL:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ rc = help_out(skb, ctinfo, protoff, matchoff, matchlen, prtspexp,
++ rtp_exp, rtcp_exp);
++#else
++ rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp,
++ rtp_exp, rtcp_exp);
++#endif
++ break;
++ case IP_CT_DIR_REPLY:
++ pr_debug("unmangle ! %u\n", ctinfo);
++ /* XXX: unmangle */
++ rc = NF_ACCEPT;
++ break;
++ }
++ //UNLOCK_BH(&ip_rtsp_lock);
++
++ return rc;
++}
++
++static void nf_nat_rtsp_expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
++{
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ struct nf_nat_range range;
++#else
++ struct nf_nat_ipv4_range range;
++#endif
++
++ /* This must be a fresh one. */
++ BUG_ON(ct->status & IPS_NAT_DONE_MASK);
++
++ /* For DST manip, map port here to where it's expected. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ range.min_proto = range.max_proto = exp->saved_proto;
++ range.min_addr = range.max_addr = exp->saved_addr;
++#else
++ range.min = range.max = exp->saved_proto;
++ range.min_ip = range.max_ip = exp->saved_ip;
++#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
++ range.flags = (NF_NAT_RANGE_MAP_IPS | NF_NAT_RANGE_PROTO_SPECIFIED);
++ nf_nat_setup_info(ct, &range, NF_NAT_MANIP_DST);
++#else
++ range.flags = (IP_NAT_RANGE_MAP_IPS | IP_NAT_RANGE_PROTO_SPECIFIED);
++ nf_nat_setup_info(ct, &range, IP_NAT_MANIP_DST);
++#endif
++
++ /* Change src to where master sends to, but only if the connection
++ * actually came from the same source. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++ if (nf_inet_addr_cmp(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3,
++ &ct->master->tuplehash[exp->dir].tuple.src.u3)) {
++ range.min_addr = range.max_addr
++ = ct->master->tuplehash[!exp->dir].tuple.dst.u3;
++#else
++ if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip ==
++ ct->master->tuplehash[exp->dir].tuple.src.u3.ip) {
++ range.min_ip = range.max_ip
++ = ct->master->tuplehash[!exp->dir].tuple.dst.u3.ip;
++#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
++ range.flags = NF_NAT_RANGE_MAP_IPS;
++ nf_nat_setup_info(ct, &range, NF_NAT_MANIP_SRC);
++#else
++ range.flags = IP_NAT_RANGE_MAP_IPS;
++ nf_nat_setup_info(ct, &range, IP_NAT_MANIP_SRC);
++#endif
++ }
++}
++
++
++static void __exit fini(void)
++{
++ rcu_assign_pointer(nf_nat_rtsp_hook, NULL);
++ synchronize_net();
++}
++
++static int __init init(void)
++{
++ printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
++
++ BUG_ON(nf_nat_rtsp_hook);
++ rcu_assign_pointer(nf_nat_rtsp_hook, nf_nat_rtsp);
++
++ if (stunaddr != NULL)
++ extip = in_aton(stunaddr);
++
++ if (destaction != NULL) {
++ if (strcmp(destaction, "auto") == 0)
++ dstact = DSTACT_AUTO;
++
++ if (strcmp(destaction, "strip") == 0)
++ dstact = DSTACT_STRIP;
++
++ if (strcmp(destaction, "none") == 0)
++ dstact = DSTACT_NONE;
++ }
++
++ return 0;
++}
++
++module_init(init);
++module_exit(fini);
+--- a/extensions/Kbuild
++++ b/extensions/Kbuild
+@@ -26,6 +26,7 @@ obj-${build_lscan} += xt_lscan.o
+ obj-${build_pknock} += pknock/
+ obj-${build_psd} += xt_psd.o
+ obj-${build_quota2} += xt_quota2.o
++obj-${build_rtsp} += rtsp/
+
+ -include ${M}/*.Kbuild
+ -include ${M}/Kbuild.*
+--- a/mconfig
++++ b/mconfig
+@@ -22,3 +22,4 @@ build_lscan=m
+ build_pknock=m
+ build_psd=m
+ build_quota2=m
++build_rtsp=m
--- /dev/null
+--- /dev/null
++++ b/extensions/LUA/byte_array.c
+@@ -0,0 +1,145 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#include "controller.h"
++
++/* Initialization helper function. This function should be used whenever
++ * a new byte array need to be initialized. Depending on the arguments it
++ * initializes the array in a different way. Have a look at the inline
++ * comments */
++lua_packet_segment * init_byte_array(lua_State *L, unsigned char * start, int length, int do_copy)
++{
++ lua_packet_segment *array;
++
++ if (length < 0)
++ luaL_error(L, "init_byte_array, requested size < 0");
++
++ if (start && do_copy) {
++ /* we have a start address where we copy from */
++ array = lua_newuserdata(L, sizeof(lua_packet_segment) + length);
++ array->start = (unsigned char *)array + sizeof(lua_packet_segment); /* aligning pointer */
++ memcpy(array->start, start, length);
++ }else if (start && !do_copy) {
++ /* just link the start pointer, in this case you have to free the memory yourself */
++ array = lua_newuserdata(L, sizeof(lua_packet_segment));
++ array->start = start;
++ }else{
++ /* create an empty array, fully managed by Lua */
++ array = lua_newuserdata(L, sizeof(lua_packet_segment) + length);
++ array->start = (unsigned char *)array + sizeof(lua_packet_segment); /* aligning pointer */
++ memset(array->start, 0, length);
++ }
++
++ array->length = length;
++ array->offset = 0;
++ array->changes = NULL;
++
++ luaL_getmetatable(L, LUA_BYTE_ARRAY);
++ lua_setmetatable(L, -2);
++
++ return array;
++}
++
++
++
++/* LUA_API: get one byte of the given byte array
++ * access-pattern: array[<index>] */
++static int32_t get_byte_array(lua_State *L)
++{
++ lua_packet_segment * array = checkbytearray(L, 1);
++ int32_t index = luaL_checkinteger(L, 2); /* array starts with index 0 (not 1 as usual in Lua) */
++
++ luaL_argcheck(L, 0 <= index && index < array->length, 1, "index out of range");
++ lua_pushinteger(L, (array->start + array->offset)[index]);
++
++ return 1;
++}
++
++/* LUA_API: set one byte of the given byte array
++ * access-pattern: array[<index>]= 0xFF */
++static int32_t set_byte_array(lua_State *L)
++{
++ lua_packet_segment * array = checkbytearray(L, 1);
++ uint8_t byte;
++ int32_t index = luaL_checkinteger(L, 2); /* array starts with index 0 (not 1 as usual in Lua) */
++ int32_t val = luaL_checkinteger(L, 3);
++ uint32_t nob = 1 << CHAR_BIT; /* we should use something like 1 << CHAR_BIT */
++
++ luaL_argcheck(L, 0 <= index && index < array->length, 1, "index out of range");
++ luaL_argcheck(L, 0 <= val && val < nob, 2, "cannot cast value to char");
++
++ byte = (uint8_t)val;
++
++ (array->start + array->offset)[index] = byte;
++
++ return 0;
++}
++
++/* LUA_API: get size of the given byte array
++ * access-pattern: #array (__length meta-method) */
++static int32_t get_byte_array_size(lua_State *L)
++{
++ lua_packet_segment * array = checkbytearray(L, 1);
++
++ lua_pushnumber(L, array->length);
++
++ return 1;
++}
++
++
++/* LUA_API: converts a given byte array to a string.
++ * access-pattern: implicit through functions calling the
++ * __to_string() metamethod , e.g. print32_t */
++static int32_t byte_array_to_string(lua_State *L)
++{
++ lua_packet_segment * array = checkbytearray(L, 1);
++ uint8_t buf[(array->length * 3) + 255];
++ uint8_t hexval[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
++ char res[255 + (array->length * 3)]; /* make sure the buffer is big enough*/
++ int32_t i, n;
++ uint8_t *ptr = array->start + array->offset;
++
++ for (i = 0; i < array->length; i++) {
++ buf[i * 3] = hexval[(ptr[i] >> 4) & 0xF];
++ buf[(i * 3) + 1] = hexval[ptr[i] & 0x0F];
++ buf[(i * 3) + 2] = ' '; /* seperator */
++ }
++
++ buf[array->length * 3] = '\0';
++ n = sprintf(res, "byte_array: length: %d value: %s", array->length, buf);
++
++ lua_pushlstring(L, res, n);
++
++ return 1;
++}
++
++static const struct luaL_Reg bytearray_lib_m [] = {
++ { "__len", get_byte_array_size },
++ { "__newindex", set_byte_array },
++ { "__index", get_byte_array },
++ { "__tostring", byte_array_to_string },
++ { NULL, NULL }
++};
++
++void luaopen_bytearraylib(lua_State *L)
++{
++ luaL_newmetatable(L, LUA_BYTE_ARRAY);
++ luaL_register(L, NULL, bytearray_lib_m);
++ lua_pop(L, 1);
++}
++
++
+--- /dev/null
++++ b/extensions/LUA/controller.c
+@@ -0,0 +1,604 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#if defined(__KERNEL__)
++ #include <linux/mm.h>
++#endif
++#include "controller.h"
++
++/* the array 'supported_protocols' holds all pointers to the
++ * static and dynamic protocol buffers. It is filled by the
++ * call to register_protbuf */
++static struct protocol_buf * supported_protocols[MAX_NR_OF_PROTOCOLS];
++
++/* C_API: the function 'get_protocol_buf' returns the pointer
++ * to the protocol buffer of a given protocol id. */
++struct protocol_buf * get_protocol_buf(uint32_t protocol_id)
++{
++ return (struct protocol_buf *)supported_protocols[protocol_id];
++}
++
++
++/* LUA_INT: the function 'gc_packet_segment' is triggered by the
++ * garbage collector whenever a userdata annotated with one of
++ * the protocol buffer metatable should be collected. */
++static int32_t gc_packet_segment(lua_State *L)
++{
++ lua_packet_segment * seg = (lua_packet_segment *)lua_touserdata(L, 1);
++ if (seg && seg->changes) {
++ seg->changes->ref_count--;
++ if (seg->changes->ref_count <= 0) {
++ kfree(seg->changes->field_length_changes);
++ kfree(seg->changes->field_offset_changes);
++ kfree(seg->changes);
++ seg->changes = NULL;
++ }
++ }
++ return 0;
++}
++
++
++/* LUA_API: the function 'set_raw' is used to set the bytes of a segment
++ * in 'raw' mode. The function is per default available in each protocol
++ * buffer until it gets overridden by a specific setter function inside
++ * a protocol buffer.
++ *
++ * Parameters:
++ * 1. lua_packet_segment (implicit)
++ * 2. int32_t byte_value
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index, not used in this function
++ *
++ * Return: void
++ */
++static int32_t set_raw(lua_State *L)
++{
++ int32_t i;
++ uint32_t nob;
++ uint8_t byte;
++ uint8_t *ptr;
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ int32_t val = luaL_checkinteger(L, 2);
++
++ nob = 1 << CHAR_BIT;
++
++ luaL_argcheck(L, 0 <= val && val < nob, 2, "cannot cast value to char");
++
++ byte = (uint8_t)val;
++ ptr = seg->start + seg->offset;
++
++ for (i = 0; i < seg->length; i++)
++ ptr[i] = byte;
++
++ return 0;
++}
++
++/* LUA_API: the function 'get_raw' is used to get the bytes of a segment
++ * in 'raw' mode. The function is per default available in each protocol
++ * buffer until it gets overridden by a specific getter function inside
++ * a protocol buffer.
++ *
++ * Parameters:
++ * 1. lua_packet_segment (implicit)
++ * 2. uint32_t offset
++ * 3. uint32_t length
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index, not used in this function
++ *
++ * Return:
++ * the byte array representing the given array
++ */
++static int32_t get_raw(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ init_byte_array(L, seg->start + seg->offset, seg->length, 1);
++
++ return 1;
++}
++/* LUA_API: The function 'get_segment' is used to get a new segment in 'raw' mode.
++ * Typically this function is applied on another raw segment in order
++ * to extract a part of the segment as new segment.
++ *
++ * Parameters:
++ * 1. lua_packet_segment, implicit through object oriented access seg:raw(..)
++ * 2. uint32_t offset, this indicates where to start the new segment, see e.g below.
++ * 3. uint32_t length, this indicates the size of the new segment
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index, not used in this function
++ *
++ * Return:
++ * 1. A lua_packet_segment annotated with the according metatable or False in
++ * case the input data is not valid
++ *
++ * Example:
++ *
++ * +------------------------+---------------------------------------+
++ * | function call | resulting lua_packet_segment |
++ * +========================+===+===+===+===+===+===+===+===+===+===+
++ * | seg = packet:raw(0,10) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
++ * +------------------------+---+---+---+---+---+---+---+---+---+---+
++ * | 1st_half = seg:raw(0,5)| 0 | 1 | 2 | 3 | 4 | |
++ * +------------------------+---+---+---+---+---+---+---+---+---+---+
++ * | 2nd_half = seg:raw(5,5)| | 5 | 6 | 7 | 8 | 9 |
++ * +------------------------+-------------------+---+---+---+---+---+
++ */
++static int32_t get_segment(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ uint32_t offset = luaL_checkinteger(L, 2);
++ uint32_t length = luaL_checkinteger(L, 3);
++ lua_packet_segment * new = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
++
++ new->start = seg->start;
++ new->offset = seg->offset + offset;
++ new->changes = NULL;
++ /* we allow a seg->length == 0 , this enables processing packets where the packetsize is not fixed (0 = not fixed)*/
++ if (seg->length != 0 && length > seg->length) {
++ lua_pushboolean(L, 0);
++ return 1;
++ }
++
++ new->length = length;
++ luaL_getmetatable(L, prot_buf->name);
++ lua_setmetatable(L, -2);
++
++ return 1;
++}
++
++/* LUA_API: the function 'get_segment_size' is used to get the size of a segment.
++ *
++ * Parameters:
++ * 1. lua_packet_segment, implicit through object oriented access seg:raw(..)
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index, not used in this function
++ *
++ * Return:
++ * 1. Size as lua_Number
++ */
++static int32_t get_segment_size(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushnumber(L, seg->length);
++ return 1;
++}
++
++/* LUA_API: the function 'get_segment_offset' is used to get the real offset
++ * of a segment. This function returns the offset of the segment to the start
++ * of the buffer. This means the following
++ * seg1 = packet:raw(2,10)
++ * seg2 = seg1:raw(3,5)
++ * offset = seg2:get_offset()
++ *
++ * will give an offset of 5, since the seg1 starts at offset 2, and seg2 starts
++ * at offset (seg1:get_offset() + 3).
++ *
++ * Parameters:
++ * 1. lua_packet_segment, implicit through object oriented access seg:raw(..)
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index, not used in this function
++ *
++ * Return:
++ * 1. Offset as lua_Number
++ */
++static int32_t get_segment_offset(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushnumber(L, seg->offset);
++ return 1;
++}
++
++/* LUA_API: overwrites the __tostring function of a lua_packet_segment.
++ * this will print32_t a nicely formated string, including length,
++ * offset and name of the protocol buffer.
++ *
++ * Parameters:
++ * 1. lua_packet_segment (implicit)
++ *
++ * Returns:
++ * 1. the representing string
++ */
++static int32_t packet_segment_tostring(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ int32_t n;
++ char buf[128];
++
++ n = sprintf(buf, "type: %s, offset: %d, length: %d", prot_buf->name, seg->offset, seg->length);
++ lua_pushlstring(L, buf, n);
++
++ return 1;
++}
++
++
++static const struct luaL_Reg seg_access_functions [] = {
++ { "set", set_raw },
++ { "get", get_raw },
++ { "raw", get_segment },
++ { "get_offset", get_segment_offset },
++ { "get_size", get_segment_size },
++ { "to_bytes", get_raw },
++ { "__tostring", packet_segment_tostring },
++ { "__gc", gc_packet_segment },
++ { NULL, NULL }
++};
++
++/* C_API: the function 'get_metatable_from_protocol_type' is a helper
++ * used in controller.c as well as it may find usage in the static
++ * protocol buffers and byte array implementation. */
++void get_metatable_from_protocol_type(lua_State *L, int32_t type)
++{
++ char * table;
++ lua_getglobal(L, SUPPORTED_PROTOCOL_TABLE);
++ lua_rawgeti(L, -1, type);
++ table = (char *)luaL_checkstring(L, -1);
++ lua_pop(L, 2); /* pop the table SUPPORTED_PROTOCOL_TABLE and the string pushed by lua_gettable */
++ luaL_getmetatable(L, table);
++ return;
++}
++
++/* C_INT: the function 'payload_contains_protocol' is used internally.
++ * Depending if static or dynamic protocol buffer it calls the right
++ * validation function. */
++static int32_t payload_contains_protocol(lua_State *L, struct protocol_buf *prot_buf, lua_packet_segment *seg, uint32_t prot_type)
++{
++ if (prot_buf->is_dynamic)
++ return has_protocol_dynamic(L, prot_buf, seg, prot_type);
++ else
++ return prot_buf->has_protocol(L, prot_buf, seg, prot_type);
++}
++
++/* C_INT: the function 'protocol_get_field_changes' is used interally.
++ * It requests the field_changes struct calling the protocol buffers
++ * 'get_field_changes' function. This funciton is called, whenever
++ * the payload field with a given protocol type is requested inside
++ * the function 'get_protocol_field' */
++static struct field_changes * protocol_get_field_changes(lua_State *L, struct protocol_buf *prot_buf, lua_packet_segment * seg)
++{
++ struct field_changes * changes = NULL;
++
++ if (prot_buf->get_field_changes) {
++ if (prot_buf->is_dynamic)
++ changes = get_field_changes_dynamic(L, prot_buf, seg);
++ else
++ changes = prot_buf->get_field_changes(L, seg);
++ /* is already 1 when set by helper 'get_allocated_field_changes,
++ * since not every prot_buf may use this function we enforce it. */
++ changes->ref_count = 1;
++ }
++ return changes;
++}
++
++/* C_INT: the function 'get_field_offset_in_bytes' wrapps the logic of
++ * calculating the new length with considering the optional field_changes. */
++static int32_t get_field_offset_in_bytes(struct protocol_field * field, lua_packet_segment * seg, int32_t field_index)
++{
++ uint32_t nr_of_bits, nr_of_bytes, field_offset;
++
++ field_offset = field->offset;
++ /* do we need to manipulate the default values stored inside the protocol buffer ?? */
++ if (seg->changes)
++ field_offset += seg->changes->field_offset_changes[field_index];
++ /* how many bits remain */
++ nr_of_bits = field_offset & (CHAR_BIT - 1);
++ /* assuming CHAR_BIT == 2 ^ 3 */
++ nr_of_bytes = (field_offset - nr_of_bits) >> 3;
++
++ return seg->offset + nr_of_bytes;
++}
++
++/* C_INT: the function 'get_field_length_in_bytes' wrapps the logic of
++ * calculating the new offset with considering the optional field_changes. */
++static int32_t get_field_length_in_bytes(struct protocol_field * field, lua_packet_segment * seg, int32_t field_index)
++{
++ uint32_t nr_of_bits, nr_of_bytes, field_length;
++
++ field_length = field->length;
++ /* if the field length is smaller than 1 byte, we take the size of one byte
++ * we treat the case where field_length == 0 in a special way ...*/
++ if (field_length < CHAR_BIT && field_length > 0)
++ field_length = CHAR_BIT;
++
++ /* do we need to manipulate the default values stored inside the protocol buffer ?? */
++ if (seg->changes)
++ field_length += seg->changes->field_length_changes[field_index];
++ /* how many bits remain */
++ nr_of_bits = field_length & (CHAR_BIT - 1);
++ /* assuming CHAR_BIT == 2 ^ 3 */
++ nr_of_bytes = (field_length - nr_of_bits) >> 3;
++ return nr_of_bytes;
++}
++
++/* C_INT: the function 'initialize_field_getter_and_setter' initializes
++ * the setter and getter function of the field, considering the optional
++ * field manipulator functions defined inside the protocol buffers. */
++static void initialize_field_getter_and_setter(lua_State *L, struct protocol_buf *prot_buf, int32_t field_index)
++{
++ /* lets check if there is a metatable on top of the stack */
++ struct protocol_field * f = (struct protocol_field *)&prot_buf->protocol_fields[field_index];
++
++ if (!lua_istable(L, -1)) luaL_error(L, "cannot initialize getter and setter for field %s->%s, "
++ "not a table on top of the stack, is '%s'", prot_buf->name, f->name, lua_typename(L, lua_type(L, -1)));
++
++ /* is there a 'getter' to initialize ? */
++ lua_pushlightuserdata(L, prot_buf); /* push upvalue 1 */
++ lua_pushinteger(L, field_index); /* push upvalue 2 */
++ if (f->get) {
++ if (prot_buf->is_dynamic)
++ lua_pushcclosure(L, field_dynamic_getter, 2);
++ else
++ lua_pushcclosure(L, f->get, 2);
++ }else
++ /* there is no specific getter defined - fall back to 'get_raw' */
++ lua_pushcclosure(L, get_raw, 2);
++ /* set the metatable field 'get' */
++ lua_setfield(L, -2, "get");
++
++ /* is there a 'setter' to initialize ? */
++ lua_pushlightuserdata(L, prot_buf); /* push upvalue 1 */
++ lua_pushinteger(L, field_index); /* push upvalue 2 */
++ if (f->set) {
++ if (prot_buf->is_dynamic)
++ lua_pushcclosure(L, field_dynamic_setter, 2);
++ else
++ lua_pushcclosure(L, f->set, 2);
++ }else
++ /* there is no specific setter defined - fall back to 'set_raw' */
++ lua_pushcclosure(L, set_raw, 2);
++ /* set the metatable field 'set' */
++ lua_setfield(L, -2, "set");
++}
++
++/* LUA_API: 'get_protocol_field' is used in Lua as a closure for each field of a protocol
++ * buffer. E.g a call to ip = packet:data(packet_ip) will go to this function,
++ * and trigger the conversion of the raw packet to a ip packet. Each call
++ * to a field function of an IP packet, like ip:daddr() uses this function
++ * to to return the right data. In each case you will end up either with a
++ * new packet segment (annotated with the proper metatable) or a boolean
++ * value (False) if something went wrong. In the case everything went fine,
++ * the newly created lua_packet_segment is annotated with the proper
++ * metatable where the fields get and set also contain the specific getter
++ * and setter functions given by the protocol buffer. E.g. the function call
++ * ip:daddr():get() or ip:daddr():set(...) will call the proper function
++ * defined inside the corresponding field definition.
++ *
++ * Parameters:
++ * 1. lua_packet_segment, implicit through object oriented access seg:raw(..)
++ * 2. type of the protocol buffer, optional, and only used if the accessed
++ * field is the payload field. If a type is provided for the access of the
++ * payload field, the function tries to convert the data pointed to by the
++ * payload field to the given type. To check if such a conversion is
++ * possible, it calls the function pointed to by the protocol buffer member
++ * has_protocol. If this function returns True, the conversion takes place.
++ *
++ * Upvalues:
++ * 1. struct protocol_buf*
++ * 2. int32_t field index
++ *
++ * Return:
++ * 1. A lua_packet_segment annotated with the according metatable or False in
++ * case the input data is not valid
++ */
++static int32_t get_protocol_field(lua_State *L)
++{
++ int32_t prot_type;
++ lua_packet_segment * seg, *new;
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ int32_t field_index = lua_tointeger(L, lua_upvalueindex(2));
++ struct protocol_field * field = &prot_buf->protocol_fields[field_index];
++
++ /* get the current packet segment */
++ seg = checkpacketseg(L, 1, prot_buf->name);
++
++ /* initialize the new packet segment */
++ new = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
++ new->start = seg->start; /* the start is unchanged */
++ new->offset = get_field_offset_in_bytes(field, seg, field_index);
++ new->length = get_field_length_in_bytes(field, seg, field_index);
++
++ /* if new->length == 0 then no configuration was done, we guess the size by subtracting the
++ * new offset from the packet length. since the old length is getting initialized by the
++ * netfilter extension this assumption holds for the very last field of the protocol.
++ * this 'feature' should be used by protocol buffers containing a payload, whereas the
++ * payload field is the last field of the buffer. However, at compile-time unknown field
++ * sizes (and offsets) of fields not being placed at the end of the protocol should be
++ * initialized using the 'get_field_changes' hook system. */
++ if (new->length == 0)
++ new->length = (seg->length + seg->offset) - (new->offset);
++ /*
++ printf("%s->%s:: seg->offset %i, seg->length %i, new->offset %i, new->length %i\n",
++ prot_buf->name, field->name, seg->offset, seg->length, new->offset, new->length);
++ */
++ /* special care for packet payload requests */
++ if (prot_buf->payload_field != NULL && strcmp(prot_buf->payload_field, field->name) == 0) {
++ /* we know the payload field is requested */
++ /* the requested payload can be delivered either as a common segment or as
++ * an other packet type, such a conversion needs an extra protocol parameter
++ * ... so lets check */
++
++ if (lua_isnumber(L, 2)) {
++ /* we have an extra parameter, ... lets see if it is a valid protocol
++ * the parameter is the index of the 'supported_protocols'-array member */
++ prot_type = lua_tointeger(L, 2);
++ if (prot_type >= 0 && prot_type < PACKET_SENTINEL) {
++ /* we are sure the purpose of the request is to get the payload data,
++ * converted to the given protocol. lets check if the payload contains
++ * data of the given protocol */
++ if (payload_contains_protocol(L, prot_buf, seg, prot_type)) {
++ /* success, we can push the metatable for the given protocol */
++ get_metatable_from_protocol_type(L, prot_type);
++ if (!lua_isnil(L, -1)) /* check if the metatable was found */
++ /* perhaps the field offsets and lengths of the containing protocol
++ * are not set correctly. request the optional 'field_changes' structure
++ * holding the changes for lengths and offsets. */
++ new->changes = protocol_get_field_changes(L, get_protocol_buf(prot_type), new);
++ else{
++ /* failed, the requested protocol is not available
++ * we push false and return */
++ lua_pop(L, 1); /* pop the userdata */
++ lua_pushboolean(L, 0);
++ return 1;
++ }
++ }else{
++ /* payload does not carry the provided protocol */
++ /* we push false and return */
++ lua_pop(L, 1); /* pop the userdata */
++ lua_pushboolean(L, 0);
++ return 1;
++ }
++ }else{
++ /* unknown protocol */
++ lua_pop(L, 1); /* pop the userdata */
++ luaL_error(L, "provided protocol is unknown");
++ }
++ }
++ }
++
++ /* if there is still the 'new' userdata on the top, we push our own metatable */
++ if (lua_isuserdata(L, -1)) {
++ luaL_getmetatable(L, prot_buf->name);
++ new->changes = seg->changes;
++ if (seg->changes)
++ new->changes->ref_count++;
++ }
++
++ /* a new packet segment is at index -2 , and the proper metatable at index -1 of the stack
++ * lets set the propper setter and getter function for the requested field */
++ initialize_field_getter_and_setter(L, prot_buf, field_index);
++
++ lua_setmetatable(L, -2);
++ return 1;
++}
++
++/* C_API: 'register_protbuf' is only used internally. This function takes a
++ * pointer to a fully initialized protocol buffer struct and registers it
++ * inside the Lua state. Registering means:
++ *
++ * 1. it creates a new metatable with the name of the protocol buffer.
++ * 2. it registers the default functions which are stored in the luaL_Reg
++ * array seg_access_functions.
++ * 3. it loops over the protocol fields stored at prot_buf->protocol_fields
++ * and registers a new function (using the field name) inside the
++ * metatable. Each field points to the function 'get_protocol_field'
++ * which acts as a closure taking a pointer to the protocol buffer as
++ * well as the index of the field as upvalues.
++ * 4. The protocol index, serves as numerical identifier of this protocol
++ * buffer or even of the protocol itself. This index is stored as a
++ * global value inside the Lua state as well as inside the Lua table
++ * 'supported_protocols'. Assuming the name of a procotol buffer is
++ * "packet_ip" the following statements are true:
++ *
++ * supported_protocols[protocol_index] == "packet_ip"
++ * packet_ip == protocol_index
++ *
++ * This allows you to get all registered protocols from within Lua. This
++ * is especially usefull for the dynamic protocol buffers where you have
++ * to provide your own "has_protocol"-function, which probably needs the
++ * information on which protocols it is able to contain.
++ */
++void register_protbuf(lua_State *L, struct protocol_buf * prot_buf, uint32_t protocol_index)
++{
++ int32_t field_index;
++ luaL_Reg *reg = (struct luaL_Reg *)seg_access_functions;
++ struct protocol_field * field = prot_buf->protocol_fields;
++
++ luaL_newmetatable(L, prot_buf->name);
++
++ /* metatable.__index = metatable */
++ lua_pushvalue(L, -1); /* duplicates the metatable */
++ lua_setfield(L, -2, "__index");
++
++ /* pushing default functions */
++ for (; reg->name; reg++) {
++ lua_pushlightuserdata(L, (void *)prot_buf);
++ lua_pushcclosure(L, reg->func, 1);
++ lua_setfield(L, -2, reg->name);
++ }
++
++ /* pushing functions specific to the protocol buffer */
++ for (field_index = 0; field->name; field++, field_index++) {
++ lua_pushlightuserdata(L, (void *)prot_buf); /* upvalue: prot_buf */
++ lua_pushinteger(L, field_index); /* upvalue: index of protocol field */
++ lua_pushcclosure(L, get_protocol_field, 2);
++ lua_setfield(L, -2, field->name);
++ }
++ /* pop the metatable */
++ lua_pop(L, 1);
++
++ /* registering the array-index as the protocol_id*/
++ lua_getglobal(L, "_G");
++ lua_pushinteger(L, protocol_index);
++ lua_setfield(L, -2, prot_buf->name);
++ lua_pop(L, 1); /* pop _G */
++
++ lua_getglobal(L, SUPPORTED_PROTOCOL_TABLE);
++ lua_pushstring(L, prot_buf->name);
++ lua_rawseti(L, -2, protocol_index);
++
++ lua_pop(L, 1); /* pop SUPPORTED_PROTOCOL_TABLE */
++
++ supported_protocols[protocol_index] = prot_buf;
++}
++
++void luaopen_controller(lua_State *L)
++{
++ /* registering a table inside the _G with table[protocol_index] = prot_buf->name */
++ lua_getglobal(L, "_G");
++ lua_newtable(L);
++ lua_setfield(L, -2, SUPPORTED_PROTOCOL_TABLE);
++ lua_pop(L, 1); /* pop _G */
++
++ luaopen_protbuf_raw(L);
++ luaopen_protbuf_eth(L);
++ luaopen_protbuf_ip(L);
++ luaopen_protbuf_icmp(L);
++ luaopen_protbuf_tcp(L);
++ luaopen_protbuf_tcp_options(L);
++ luaopen_protbuf_udp(L);
++ luaopen_protbuf_tftp(L);
++ luaopen_protbuf_dynamic(L);
++ /* should follow all other static buffers */
++#if defined(__KERNEL__)
++ luaopen_nflib(L);
++#endif
++
++ luaopen_bytearraylib(L);
++}
++
++
++
++
+--- /dev/null
++++ b/extensions/LUA/controller.h
+@@ -0,0 +1,264 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef CONTROLLER_H_
++#define CONTROLLER_H_
++
++#include "stdlib.h" /* wrapper */
++#include "string.h" /* wrapper */
++#include "lua.h"
++#include "lualib.h"
++#include "lauxlib.h"
++
++#if defined(__KERNEL__)
++#include <linux/skbuff.h>
++#include <linux/slab.h>
++#include <linux/vmalloc.h>
++#endif
++
++
++/* to compile the stuff in userspace (for testing)*/
++#if !defined(__KERNEL__)
++#include <stdint.h>
++#define pr_debug printf;
++
++#define kmalloc(size, type) malloc(size)
++#define kfree(ptr) free(ptr)
++
++#endif
++
++
++/**********************************************************************/
++/* nf Lua configuration */
++/**********************************************************************/
++#define MAX_NR_OF_PROTOCOLS 16
++#define SUPPORTED_PROTOCOL_TABLE "supported_protocols"
++
++#define MAX_NR_OF_FIELDS_IN_DYN_PROT_BUF 32
++
++
++/**********************************************************************/
++/* Static Protocol Buffer configuration */
++/**********************************************************************/
++
++/* the definitions of the stringified expression of the prot_bufs...
++ * make sure all static prot_bufs are listed and are unique */
++#define LUA_PACKET_SEG_RAW "packet_raw"
++#define LUA_PACKET_SEG_ETH "packet_eth"
++#define LUA_PACKET_SEG_ICMP "packet_icmp"
++#define LUA_PACKET_SEG_IP "packet_ip"
++#define LUA_PACKET_SEG_TCP "packet_tcp"
++#define LUA_PACKET_SEG_TCP_OPT "packet_tcp_opt"
++#define LUA_PACKET_SEG_UDP "packet_udp"
++#define LUA_PACKET_SEG_TFTP "packet_tftp"
++
++/* the enum holding all static prot_bufs... make sure it contains all
++ * static prot_bufs */
++enum PROT_BUF {
++ PACKET_RAW,
++ PACKET_ETH,
++ PACKET_IP,
++ PACKET_ICMP,
++ PACKET_TCP,
++ PACKET_TCP_OPTIONS,
++ PACKET_UDP,
++ PACKET_TFTP,
++ PACKET_DYNAMIC,
++ PACKET_SENTINEL
++};
++
++/* the luaopen-function of the prot_bufs... make sure it is called
++ * inside luaopen_controller */
++void luaopen_protbuf_raw(lua_State *L);
++void luaopen_protbuf_eth(lua_State *L);
++void luaopen_protbuf_ip(lua_State *L);
++void luaopen_protbuf_icmp(lua_State *L);
++void luaopen_protbuf_tcp(lua_State *L);
++void luaopen_protbuf_tcp_options(lua_State *L);
++void luaopen_protbuf_udp(lua_State *L);
++void luaopen_protbuf_tftp(lua_State *L);
++void luaopen_protbuf_dynamic(lua_State *L);
++
++/**********************************************************************/
++/* field changes */
++/**********************************************************************/
++struct field_changes {
++ int ref_count;
++ int *field_length_changes;
++ int *field_offset_changes;
++};
++
++/**********************************************************************/
++/* lua packet segment */
++/* ------------------ */
++/* The struct lua_packet_segment is the integral part of a Lua packet.*/
++/* At the very beginning, when a new packet arrives in `lua_tg`_ such */
++/* a struct is initialized. The field start then points to the lowest */
++/* available header inside the sk_buff structure. During packet */
++/* processing the start pointer remains the same, only the offset and */
++/* length value change. */
++/**********************************************************************/
++#define checkpacketseg(L, i, seg_type) \
++ (lua_packet_segment *)luaL_checkudata(L, i, seg_type)
++
++typedef struct lua_packet_segment {
++ unsigned int offset;
++ unsigned int length;
++ struct field_changes * changes;
++ unsigned char * start; /* need to be at the end because of the memory alignment */
++} lua_packet_segment;
++
++/**********************************************************************/
++/* protocol field */
++/* -------------- */
++/* This structure is a container for the field definitions used by the*/
++/* protocol buffer. Each protocol field is expressed using this struct*/
++/* Have a look at the protocol buffers to see how the struct gets */
++/* initialized. */
++/* */
++/* name: */
++/* This member expresses the name of the field, ending */
++/* in its own Lua function to access the field. */
++/* offset / length: */
++/* These members do specify the position inside the protocol header */
++/* in bits (not bytes!). */
++/* get / set: */
++/* The get and set functions take a function pointer pointing to the*/
++/* specific getter and setter function for this field. */
++/**********************************************************************/
++struct protocol_field {
++ const char * name;
++ uint32_t offset;
++ uint32_t length;
++ lua_CFunction get;
++ lua_CFunction set;
++};
++#define PROT_FIELD_SENTINEL { NULL, 0, 0, NULL, NULL }
++
++
++/**********************************************************************/
++/* protocol_buf */
++/**********************************************************************/
++/* This structure is a container for all the information needed for a
++ * protocol buffer. It gets initialized in each protocol buffer header
++ * file or for the dynamic protocol buffers on runtime using the
++ * 'register_dynamic_protocol_buffer' function.
++ *
++ * name:
++ * This member is used throughout the system. It is also exported
++ * to Lua as a variable name holding the index of the 'supported_protocols'
++ * array. The name is also used as the name of the generated Lua
++ * metatable, that is why inside the macro checkpacketseg_ it
++ * is always the name of a protocol buffer that is passed as the
++ * second parameter.
++ * payload_field:
++ * This member holds the string of the field responsible for payload
++ * data. The payload field of a protocol has an extra property, since
++ * it can be used to invoke another protocol buffer that is applied to
++ * the payload content.
++ * has_protocol:
++ * This member is used together with the payload_field. Since we must
++ * be sure that the payload content does really contain a protocol
++ * of type X. The function pointed to by has_protocol checks if the
++ * protocol buffer X can be applied on the payload_data.
++ * protocol_fields:
++ * This member points to the array of 'protocol_field' structures
++ * get_field_changes:
++ * This member is optional. It is used to return a pointer to an initialized
++ * field_changes struct. The function is called, whenever the payload field
++ * is requested with a given protocol type. Usually this function will
++ * initialize the field_changes struct depending on the content of the
++ * payload data. e.g.
++ * tcp = ip:data(packet_tcp)
++ * such a request will call the 'get_field_changes' function of the tcp
++ * protocol buffer. This enables, that the tcp options field have the proper
++ * length as well as the tcp data start at the right offset.
++ */
++struct protocol_buf {
++ int is_dynamic;
++ const char * name;
++ char * payload_field;
++ int (*has_protocol)(lua_State *L, struct protocol_buf *prot_buf, lua_packet_segment * seg, int type);
++ struct protocol_field * protocol_fields;
++ struct field_changes * (*get_field_changes)(lua_State *L, lua_packet_segment * seg);
++};
++
++/**********************************************************************/
++/* lua byte array library */
++/**********************************************************************/
++#define LUA_BYTE_ARRAY "byte_array"
++#define checkbytearray(L, i) \
++ (lua_packet_segment *)luaL_checkudata(L, i, LUA_BYTE_ARRAY)
++lua_packet_segment * init_byte_array(lua_State *L, unsigned char * start, int length, int do_copy);
++void luaopen_bytearraylib(lua_State *L);
++
++
++/**********************************************************************/
++/* lua netfilter environment library */
++/**********************************************************************/
++#define NETFILTER_LIB "nf"
++#if defined(__KERNEL__)
++ struct lua_env {
++ lua_State *L;
++ /* perhaps more to come here (e.g. a state per CPU) */
++ };
++ #define LUA_ENV "lua_env"
++ #define checkluaenv(L, i) \
++ (struct lua_env *)luaL_checkudata(L, i, LUA_ENV)
++
++ void luaopen_nflib(lua_State *L);
++#endif
++
++void cleanup_dynamic_prot_bufs(void); /* freeing all dynamic prot bufs */
++/**********************************************************************/
++/* lua protbuf helpers */
++/**********************************************************************/
++int get_1_bit_generic(lua_State *L);
++int set_1_bit_generic(lua_State *L);
++int get_lower_4_bit_generic(lua_State *L);
++int set_lower_4_bit_generic(lua_State *L);
++int get_upper_4_bit_generic(lua_State *L);
++int set_upper_4_bit_generic(lua_State *L);
++int get_8_bit_generic(lua_State *L);
++int set_8_bit_generic(lua_State *L);
++int get_16_bit_generic(lua_State *L);
++int set_16_bit_generic(lua_State *L);
++int get_32_bit_generic(lua_State *L);
++int set_32_bit_generic(lua_State *L);
++int set_data_generic(lua_State *L);
++int get_string_generic(lua_State *L);
++int get_byte_generic_str(lua_State *L);
++struct field_changes * get_allocated_field_changes(lua_State *L, int nr_of_fields);
++
++/* only used by the dynamic prot buf subsystem */
++#define MAX_NR_OF_DYN_PROT_BUFS 16
++int field_dynamic_setter(lua_State *L);
++int field_dynamic_getter(lua_State *L);
++int has_protocol_dynamic(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int type);
++struct field_changes * get_field_changes_dynamic(lua_State *L, struct protocol_buf *prot_buf, lua_packet_segment * seg);
++
++/**********************************************************************/
++/* lua controller API */
++/**********************************************************************/
++void luaopen_controller(lua_State *L);
++struct protocol_buf * get_protocol_buf(unsigned int protocol_id);
++void get_metatable_from_protocol_type(lua_State *L, int type);
++void register_protbuf(lua_State *L, struct protocol_buf * prot_buf, unsigned int protocol_index);
++
++
++#endif /* CONTROLLER_H_ */
+--- /dev/null
++++ b/extensions/LUA/Kbuild
+@@ -0,0 +1,49 @@
++# -*- Makefile -*-
++
++# Adding debug options
++EXTRA_CFLAGS += -DDEBUG
++
++obj-m += xt_LUA.o
++
++EXTRA_CFLAGS += -I$(src)/prot_buf_new
++xt_LUA-y += xt_LUA_target.o \
++
++xt_LUA-y += nf_lua.o \
++ prot_buf_helpers.o \
++ byte_array.o \
++ controller.o \
++ prot_buf_ethernet.o \
++ prot_buf_icmp.o \
++ prot_buf_ip.o \
++ prot_buf_raw.o \
++ prot_buf_tcp.o \
++ prot_buf_udp.o \
++ prot_buf_tftp.o \
++ prot_buf_dynamic.o \
++
++
++# Adding Lua Support
++EXTRA_CFLAGS += -I$(src)/lua -I$(src)/lua/include
++xt_LUA-y += lua/lapi.o \
++ lua/lbaselib.o \
++ lua/lcode.o \
++ lua/ldebug.o \
++ lua/ldo.o \
++ lua/ldump.o \
++ lua/lfunc.o \
++ lua/lgc.o \
++ lua/llex.o \
++ lua/lmem.o \
++ lua/lobject.o \
++ lua/lopcodes.o \
++ lua/lparser.o \
++ lua/lstate.o \
++ lua/lstring.o \
++ lua/lstrlib.o \
++ lua/ltable.o \
++ lua/ltablib.o \
++ lua/ltm.o \
++ lua/lundump.o \
++ lua/lvm.o \
++ lua/lzio.o \
++ lua/lauxlib.o \
+--- /dev/null
++++ b/extensions/LUA/libxt_LUA.c
+@@ -0,0 +1,191 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <getopt.h>
++#include <stdio.h>
++#include <stdbool.h>
++#include <stdlib.h>
++#include <string.h>
++#include <xtables.h>
++#include <linux/netfilter.h>
++#include <linux/netfilter/x_tables.h>
++#include "xt_LUA.h"
++
++enum {
++ FLAG_SCRIPT = 1 << 0,
++ FLAG_STATE = 1 << 1,
++ FLAG_FUNCTION = 1 << 2,
++};
++
++static const struct option lua_tg_opts[] = {
++ { .name = "script", .has_arg = true, .val = 's' },
++ { .name = "state", .has_arg = true, .val = 'l' },
++ { .name = "function", .has_arg = true, .val = 'f' },
++ { NULL },
++};
++
++
++static void lua_tg_help(void)
++{
++ printf(
++ "LUA target options:\n"
++ " --script SCRIPT Process packet with the Lua script given by SCRIPT\n"
++ " \n"
++ " --state ID Process packet within the Lua state given by ID.\n"
++ " Omitting --state infers the ID 0, which can be\n"
++ " refered to the 'global' state.\n"
++ " \n"
++ " --function FUNCTION Name of the function that processes the Lua packet\n"
++ "\n");
++}
++
++static void
++lua_tg_init(struct xt_entry_target *target)
++{
++ struct xt_lua_tginfo *info = (void *)target->data;
++
++ info->state_id = 0;
++ strncpy(info->function, "process_packet\0", sizeof("process_packet\0"));
++}
++
++static int
++lua_tg_parse(int32_t c, char **argv, int32_t invert, uint32_t *flags,
++ const void *entry, struct xt_entry_target **target)
++{
++ struct xt_lua_tginfo *info = (void *)(*target)->data;
++ char buf[MAX_SCRIPT_SIZE];
++ long script_size;
++ uint32_t state_id;
++ FILE *file;
++
++ switch (c) {
++ case 's':
++ if (*flags & FLAG_SCRIPT)
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Cannot specify --script more than once");
++
++ if (strlen(optarg) > sizeof(info->filename))
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Maximum script length is %zu",
++ sizeof(info->filename));
++
++ if (strchr(optarg, '\n'))
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Newlines not allowed in script name");
++ file = fopen(optarg, "rb");
++ if (file != NULL) {
++ fseek(file, 0, SEEK_END);
++ script_size = ftell(file);
++ if (script_size > MAX_SCRIPT_SIZE)
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: The size of the script is too big");
++
++ fseek(file, 0, SEEK_SET);
++ fread(buf, script_size, 1, file);
++ fclose(file);
++ } else
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Cannot open script %s", optarg);
++
++ strncpy(info->filename, optarg, sizeof(info->filename));
++ strncpy(info->buf, buf, sizeof(info->buf));
++ info->script_size = script_size;
++
++ *flags |= FLAG_SCRIPT;
++ return true;
++
++ case 'l':
++ if (*flags & FLAG_STATE)
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Cannot specify --state more than once");
++
++ if (!xtables_strtoui(optarg, NULL, &state_id, 0, 8))
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Invalid --state %s", optarg);
++
++ info->state_id = state_id;
++ *flags |= FLAG_STATE;
++ return true;
++
++ case 'f':
++ if (*flags & FLAG_FUNCTION)
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Cannot specify --function more than once");
++ if (strlen(optarg) > sizeof(info->function))
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Maximum function length is %zu",
++ sizeof(info->function));
++
++ if (strchr(optarg, '\n'))
++ xtables_error(PARAMETER_PROBLEM,
++ "LUA: Newlines not allowed in function name");
++
++ strncpy(info->function, optarg, sizeof(info->function));
++
++ *flags |= FLAG_FUNCTION;
++ return true;
++ }
++
++ return false;
++}
++
++static void
++lua_tg_check(uint32_t flags)
++{
++ if (flags == 0)
++ xtables_error(PARAMETER_PROBLEM, "LUA: --script parameter required");
++}
++
++static void
++lua_tg_print(const void *entry, const struct xt_entry_target *target,
++ int32_t numeric)
++{
++ const struct xt_lua_tginfo *info = (const void *)target->data;
++
++ printf("LUA script: %s ", info->filename);
++}
++
++static void
++lua_tg_save(const void *entry, const struct xt_entry_target *target)
++{
++ const struct xt_lua_tginfo *info = (const void *)target->data;
++
++ printf("--script %s ", info->filename);
++}
++
++static struct xtables_target lua_tg_reg = {
++ .name = "LUA",
++ .version = XTABLES_VERSION,
++ .revision = 0,
++ .family = NFPROTO_UNSPEC,
++ .size = XT_ALIGN(sizeof(struct xt_lua_tginfo)),
++ .userspacesize = XT_ALIGN(sizeof(struct xt_lua_tginfo)),
++ .help = lua_tg_help,
++ .init = lua_tg_init,
++ .parse = lua_tg_parse,
++ .final_check = lua_tg_check,
++ .print = lua_tg_print,
++ .save = lua_tg_save,
++ .extra_opts = lua_tg_opts,
++};
++
++static __attribute__((constructor)) void lua_tg_ldr(void)
++{
++ xtables_register_target(&lua_tg_reg);
++}
++
+--- /dev/null
++++ b/extensions/LUA/libxt_LUA.man
+@@ -0,0 +1 @@
++Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+--- /dev/null
++++ b/extensions/LUA/lua/include/ctype.h
+@@ -0,0 +1,11 @@
++#include <linux/ctype.h>
++#undef isalnum
++#define isalnum(c) (((__ismask(c)&(_U|_L|_D)) != 0) && (c > 0))
++#undef isalpha
++#define isalpha(c) (((__ismask(c)&(_U|_L)) != 0) && (c > 0))
++#undef iscntrl
++#define iscntrl(c) (((__ismask(c)&(_C)) != 0) && (c > 0))
++#undef isdigit
++#define isdigit(c) (((__ismask(c)&(_D)) != 0) && (c > 0))
++#undef isspace
++#define isspace(c) (((__ismask(c)&(_S)) != 0) && (c > 0))
+--- /dev/null
++++ b/extensions/LUA/lua/include/errno.h
+@@ -0,0 +1 @@
++#include <linux/errno.h>
+--- /dev/null
++++ b/extensions/LUA/lua/include/locale.h
+@@ -0,0 +1,5 @@
++struct lconv {
++ char * decimal_point ;
++} ;
++
++#define localeconv() NULL
+--- /dev/null
++++ b/extensions/LUA/lua/include/setjmp.h
+@@ -0,0 +1,26 @@
++/*
++ * arch/um/include/sysdep-i386/archsetjmp.h
++ */
++
++#ifndef _KLIBC_ARCHSETJMP_H
++#define _KLIBC_ARCHSETJMP_H
++
++struct __jmp_buf {
++ unsigned int __ebx;
++ unsigned int __esp;
++ unsigned int __ebp;
++ unsigned int __esi;
++ unsigned int __edi;
++ unsigned int __eip;
++};
++
++typedef struct __jmp_buf jmp_buf[1];
++
++#define JB_IP __eip
++#define JB_SP __esp
++
++int setjmp(jmp_buf);
++void longjmp(jmp_buf, int);
++
++#endif /* _SETJMP_H */
++
+--- /dev/null
++++ b/extensions/LUA/lua/include/stdio.h
+@@ -0,0 +1 @@
++#include <linux/kernel.h>
+--- /dev/null
++++ b/extensions/LUA/lua/include/stdlib.h
+@@ -0,0 +1,7 @@
++#include <linux/kernel.h>
++
++#define exit(E) return
++#define strtoul simple_strtoul
++#define strcoll strcmp
++
++#define CHAR_BIT 8
+--- /dev/null
++++ b/extensions/LUA/lua/include/string.h
+@@ -0,0 +1 @@
++#include <linux/string.h>
+--- /dev/null
++++ b/extensions/LUA/lua/lapi.c
+@@ -0,0 +1,1086 @@
++/*
++** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $
++** Lua API
++** See Copyright Notice in lua.h
++*/
++
++#include <stdarg.h>
++#include <math.h>
++#include <assert.h>
++#include <string.h>
++
++#define lapi_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lapi.h"
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lgc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++#include "lundump.h"
++#include "lvm.h"
++
++
++
++const char lua_ident[] =
++ "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n"
++ "$Authors: " LUA_AUTHORS " $\n"
++ "$URL: www.lua.org $\n";
++
++
++
++#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base))
++
++#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject)
++
++#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;}
++
++
++
++static TValue *index2adr (lua_State *L, int idx) {
++ if (idx > 0) {
++ TValue *o = L->base + (idx - 1);
++ api_check(L, idx <= L->ci->top - L->base);
++ if (o >= L->top) return cast(TValue *, luaO_nilobject);
++ else return o;
++ }
++ else if (idx > LUA_REGISTRYINDEX) {
++ api_check(L, idx != 0 && -idx <= L->top - L->base);
++ return L->top + idx;
++ }
++ else switch (idx) { /* pseudo-indices */
++ case LUA_REGISTRYINDEX: return registry(L);
++ case LUA_ENVIRONINDEX: {
++ Closure *func = curr_func(L);
++ sethvalue(L, &L->env, func->c.env);
++ return &L->env;
++ }
++ case LUA_GLOBALSINDEX: return gt(L);
++ default: {
++ Closure *func = curr_func(L);
++ idx = LUA_GLOBALSINDEX - idx;
++ return (idx <= func->c.nupvalues)
++ ? &func->c.upvalue[idx-1]
++ : cast(TValue *, luaO_nilobject);
++ }
++ }
++}
++
++
++static Table *getcurrenv (lua_State *L) {
++ if (L->ci == L->base_ci) /* no enclosing function? */
++ return hvalue(gt(L)); /* use global table as environment */
++ else {
++ Closure *func = curr_func(L);
++ return func->c.env;
++ }
++}
++
++
++void luaA_pushobject (lua_State *L, const TValue *o) {
++ setobj2s(L, L->top, o);
++ api_incr_top(L);
++}
++
++
++LUA_API int lua_checkstack (lua_State *L, int size) {
++ int res = 1;
++ lua_lock(L);
++ if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK)
++ res = 0; /* stack overflow */
++ else if (size > 0) {
++ luaD_checkstack(L, size);
++ if (L->ci->top < L->top + size)
++ L->ci->top = L->top + size;
++ }
++ lua_unlock(L);
++ return res;
++}
++
++
++LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
++ int i;
++ if (from == to) return;
++ lua_lock(to);
++ api_checknelems(from, n);
++ api_check(from, G(from) == G(to));
++ api_check(from, to->ci->top - to->top >= n);
++ from->top -= n;
++ for (i = 0; i < n; i++) {
++ setobj2s(to, to->top++, from->top + i);
++ }
++ lua_unlock(to);
++}
++
++
++LUA_API void lua_setlevel (lua_State *from, lua_State *to) {
++ to->nCcalls = from->nCcalls;
++}
++
++
++LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
++ lua_CFunction old;
++ lua_lock(L);
++ old = G(L)->panic;
++ G(L)->panic = panicf;
++ lua_unlock(L);
++ return old;
++}
++
++
++LUA_API lua_State *lua_newthread (lua_State *L) {
++ lua_State *L1;
++ lua_lock(L);
++ luaC_checkGC(L);
++ L1 = luaE_newthread(L);
++ setthvalue(L, L->top, L1);
++ api_incr_top(L);
++ lua_unlock(L);
++ luai_userstatethread(L, L1);
++ return L1;
++}
++
++
++
++/*
++** basic stack manipulation
++*/
++
++
++LUA_API int lua_gettop (lua_State *L) {
++ return cast_int(L->top - L->base);
++}
++
++
++LUA_API void lua_settop (lua_State *L, int idx) {
++ lua_lock(L);
++ if (idx >= 0) {
++ api_check(L, idx <= L->stack_last - L->base);
++ while (L->top < L->base + idx)
++ setnilvalue(L->top++);
++ L->top = L->base + idx;
++ }
++ else {
++ api_check(L, -(idx+1) <= (L->top - L->base));
++ L->top += idx+1; /* `subtract' index (index is negative) */
++ }
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_remove (lua_State *L, int idx) {
++ StkId p;
++ lua_lock(L);
++ p = index2adr(L, idx);
++ api_checkvalidindex(L, p);
++ while (++p < L->top) setobjs2s(L, p-1, p);
++ L->top--;
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_insert (lua_State *L, int idx) {
++ StkId p;
++ StkId q;
++ lua_lock(L);
++ p = index2adr(L, idx);
++ api_checkvalidindex(L, p);
++ for (q = L->top; q>p; q--) setobjs2s(L, q, q-1);
++ setobjs2s(L, p, L->top);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_replace (lua_State *L, int idx) {
++ StkId o;
++ lua_lock(L);
++ /* explicit test for incompatible code */
++ if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci)
++ luaG_runerror(L, "no calling environment");
++ api_checknelems(L, 1);
++ o = index2adr(L, idx);
++ api_checkvalidindex(L, o);
++ if (idx == LUA_ENVIRONINDEX) {
++ Closure *func = curr_func(L);
++ api_check(L, ttistable(L->top - 1));
++ func->c.env = hvalue(L->top - 1);
++ luaC_barrier(L, func, L->top - 1);
++ }
++ else {
++ setobj(L, o, L->top - 1);
++ if (idx < LUA_GLOBALSINDEX) /* function upvalue? */
++ luaC_barrier(L, curr_func(L), L->top - 1);
++ }
++ L->top--;
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushvalue (lua_State *L, int idx) {
++ lua_lock(L);
++ setobj2s(L, L->top, index2adr(L, idx));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++
++/*
++** access functions (stack -> C)
++*/
++
++
++LUA_API int lua_type (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ return (o == luaO_nilobject) ? LUA_TNONE : ttype(o);
++}
++
++
++LUA_API const char *lua_typename (lua_State *L, int t) {
++ UNUSED(L);
++ return (t == LUA_TNONE) ? "no value" : luaT_typenames[t];
++}
++
++
++LUA_API int lua_iscfunction (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ return iscfunction(o);
++}
++
++
++LUA_API int lua_isnumber (lua_State *L, int idx) {
++ TValue n;
++ const TValue *o = index2adr(L, idx);
++ return tonumber(o, &n);
++}
++
++
++LUA_API int lua_isstring (lua_State *L, int idx) {
++ int t = lua_type(L, idx);
++ return (t == LUA_TSTRING || t == LUA_TNUMBER);
++}
++
++
++LUA_API int lua_isuserdata (lua_State *L, int idx) {
++ const TValue *o = index2adr(L, idx);
++ return (ttisuserdata(o) || ttislightuserdata(o));
++}
++
++
++LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
++ StkId o1 = index2adr(L, index1);
++ StkId o2 = index2adr(L, index2);
++ return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0
++ : luaO_rawequalObj(o1, o2);
++}
++
++
++LUA_API int lua_equal (lua_State *L, int index1, int index2) {
++ StkId o1, o2;
++ int i;
++ lua_lock(L); /* may call tag method */
++ o1 = index2adr(L, index1);
++ o2 = index2adr(L, index2);
++ i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2);
++ lua_unlock(L);
++ return i;
++}
++
++
++LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
++ StkId o1, o2;
++ int i;
++ lua_lock(L); /* may call tag method */
++ o1 = index2adr(L, index1);
++ o2 = index2adr(L, index2);
++ i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0
++ : luaV_lessthan(L, o1, o2);
++ lua_unlock(L);
++ return i;
++}
++
++
++
++LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
++ TValue n;
++ const TValue *o = index2adr(L, idx);
++ if (tonumber(o, &n))
++ return nvalue(o);
++ else
++ return 0;
++}
++
++
++LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) {
++ TValue n;
++ const TValue *o = index2adr(L, idx);
++ if (tonumber(o, &n)) {
++ lua_Integer res;
++ lua_Number num = nvalue(o);
++ lua_number2integer(res, num);
++ return res;
++ }
++ else
++ return 0;
++}
++
++
++LUA_API int lua_toboolean (lua_State *L, int idx) {
++ const TValue *o = index2adr(L, idx);
++ return !l_isfalse(o);
++}
++
++
++LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
++ StkId o = index2adr(L, idx);
++ if (!ttisstring(o)) {
++ lua_lock(L); /* `luaV_tostring' may create a new string */
++ if (!luaV_tostring(L, o)) { /* conversion failed? */
++ if (len != NULL) *len = 0;
++ lua_unlock(L);
++ return NULL;
++ }
++ luaC_checkGC(L);
++ o = index2adr(L, idx); /* previous call may reallocate the stack */
++ lua_unlock(L);
++ }
++ if (len != NULL) *len = tsvalue(o)->len;
++ return svalue(o);
++}
++
++
++LUA_API size_t lua_objlen (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ switch (ttype(o)) {
++ case LUA_TSTRING: return tsvalue(o)->len;
++ case LUA_TUSERDATA: return uvalue(o)->len;
++ case LUA_TTABLE: return luaH_getn(hvalue(o));
++ case LUA_TNUMBER: {
++ size_t l;
++ lua_lock(L); /* `luaV_tostring' may create a new string */
++ l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0);
++ lua_unlock(L);
++ return l;
++ }
++ default: return 0;
++ }
++}
++
++
++LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ return (!iscfunction(o)) ? NULL : clvalue(o)->c.f;
++}
++
++
++LUA_API void *lua_touserdata (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ switch (ttype(o)) {
++ case LUA_TUSERDATA: return (rawuvalue(o) + 1);
++ case LUA_TLIGHTUSERDATA: return pvalue(o);
++ default: return NULL;
++ }
++}
++
++
++LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ return (!ttisthread(o)) ? NULL : thvalue(o);
++}
++
++
++LUA_API const void *lua_topointer (lua_State *L, int idx) {
++ StkId o = index2adr(L, idx);
++ switch (ttype(o)) {
++ case LUA_TTABLE: return hvalue(o);
++ case LUA_TFUNCTION: return clvalue(o);
++ case LUA_TTHREAD: return thvalue(o);
++ case LUA_TUSERDATA:
++ case LUA_TLIGHTUSERDATA:
++ return lua_touserdata(L, idx);
++ default: return NULL;
++ }
++}
++
++
++
++/*
++** push functions (C -> stack)
++*/
++
++
++LUA_API void lua_pushnil (lua_State *L) {
++ lua_lock(L);
++ setnilvalue(L->top);
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
++ lua_lock(L);
++ setnvalue(L->top, n);
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
++ lua_lock(L);
++ setnvalue(L->top, cast_num(n));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
++ lua_lock(L);
++ luaC_checkGC(L);
++ setsvalue2s(L, L->top, luaS_newlstr(L, s, len));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushstring (lua_State *L, const char *s) {
++ if (s == NULL)
++ lua_pushnil(L);
++ else
++ lua_pushlstring(L, s, strlen(s));
++}
++
++
++LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
++ va_list argp) {
++ const char *ret;
++ lua_lock(L);
++ luaC_checkGC(L);
++ ret = luaO_pushvfstring(L, fmt, argp);
++ lua_unlock(L);
++ return ret;
++}
++
++
++LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
++ const char *ret;
++ va_list argp;
++ lua_lock(L);
++ luaC_checkGC(L);
++ va_start(argp, fmt);
++ ret = luaO_pushvfstring(L, fmt, argp);
++ va_end(argp);
++ lua_unlock(L);
++ return ret;
++}
++
++
++LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
++ Closure *cl;
++ lua_lock(L);
++ luaC_checkGC(L);
++ api_checknelems(L, n);
++ cl = luaF_newCclosure(L, n, getcurrenv(L));
++ cl->c.f = fn;
++ L->top -= n;
++ while (n--)
++ setobj2n(L, &cl->c.upvalue[n], L->top+n);
++ setclvalue(L, L->top, cl);
++ lua_assert(iswhite(obj2gco(cl)));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushboolean (lua_State *L, int b) {
++ lua_lock(L);
++ setbvalue(L->top, (b != 0)); /* ensure that true is 1 */
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
++ lua_lock(L);
++ setpvalue(L->top, p);
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API int lua_pushthread (lua_State *L) {
++ lua_lock(L);
++ setthvalue(L, L->top, L);
++ api_incr_top(L);
++ lua_unlock(L);
++ return (G(L)->mainthread == L);
++}
++
++
++
++/*
++** get functions (Lua -> stack)
++*/
++
++
++LUA_API void lua_gettable (lua_State *L, int idx) {
++ StkId t;
++ lua_lock(L);
++ t = index2adr(L, idx);
++ api_checkvalidindex(L, t);
++ luaV_gettable(L, t, L->top - 1, L->top - 1);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
++ StkId t;
++ TValue key;
++ lua_lock(L);
++ t = index2adr(L, idx);
++ api_checkvalidindex(L, t);
++ setsvalue(L, &key, luaS_new(L, k));
++ luaV_gettable(L, t, &key, L->top);
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_rawget (lua_State *L, int idx) {
++ StkId t;
++ lua_lock(L);
++ t = index2adr(L, idx);
++ api_check(L, ttistable(t));
++ setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
++ StkId o;
++ lua_lock(L);
++ o = index2adr(L, idx);
++ api_check(L, ttistable(o));
++ setobj2s(L, L->top, luaH_getnum(hvalue(o), n));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
++ lua_lock(L);
++ luaC_checkGC(L);
++ sethvalue(L, L->top, luaH_new(L, narray, nrec));
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++LUA_API int lua_getmetatable (lua_State *L, int objindex) {
++ const TValue *obj;
++ Table *mt = NULL;
++ int res;
++ lua_lock(L);
++ obj = index2adr(L, objindex);
++ switch (ttype(obj)) {
++ case LUA_TTABLE:
++ mt = hvalue(obj)->metatable;
++ break;
++ case LUA_TUSERDATA:
++ mt = uvalue(obj)->metatable;
++ break;
++ default:
++ mt = G(L)->mt[ttype(obj)];
++ break;
++ }
++ if (mt == NULL)
++ res = 0;
++ else {
++ sethvalue(L, L->top, mt);
++ api_incr_top(L);
++ res = 1;
++ }
++ lua_unlock(L);
++ return res;
++}
++
++
++LUA_API void lua_getfenv (lua_State *L, int idx) {
++ StkId o;
++ lua_lock(L);
++ o = index2adr(L, idx);
++ api_checkvalidindex(L, o);
++ switch (ttype(o)) {
++ case LUA_TFUNCTION:
++ sethvalue(L, L->top, clvalue(o)->c.env);
++ break;
++ case LUA_TUSERDATA:
++ sethvalue(L, L->top, uvalue(o)->env);
++ break;
++ case LUA_TTHREAD:
++ setobj2s(L, L->top, gt(thvalue(o)));
++ break;
++ default:
++ setnilvalue(L->top);
++ break;
++ }
++ api_incr_top(L);
++ lua_unlock(L);
++}
++
++
++/*
++** set functions (stack -> Lua)
++*/
++
++
++LUA_API void lua_settable (lua_State *L, int idx) {
++ StkId t;
++ lua_lock(L);
++ api_checknelems(L, 2);
++ t = index2adr(L, idx);
++ api_checkvalidindex(L, t);
++ luaV_settable(L, t, L->top - 2, L->top - 1);
++ L->top -= 2; /* pop index and value */
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
++ StkId t;
++ TValue key;
++ lua_lock(L);
++ api_checknelems(L, 1);
++ t = index2adr(L, idx);
++ api_checkvalidindex(L, t);
++ setsvalue(L, &key, luaS_new(L, k));
++ luaV_settable(L, t, &key, L->top - 1);
++ L->top--; /* pop value */
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_rawset (lua_State *L, int idx) {
++ StkId t;
++ lua_lock(L);
++ api_checknelems(L, 2);
++ t = index2adr(L, idx);
++ api_check(L, ttistable(t));
++ setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
++ luaC_barriert(L, hvalue(t), L->top-1);
++ L->top -= 2;
++ lua_unlock(L);
++}
++
++
++LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
++ StkId o;
++ lua_lock(L);
++ api_checknelems(L, 1);
++ o = index2adr(L, idx);
++ api_check(L, ttistable(o));
++ setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1);
++ luaC_barriert(L, hvalue(o), L->top-1);
++ L->top--;
++ lua_unlock(L);
++}
++
++
++LUA_API int lua_setmetatable (lua_State *L, int objindex) {
++ TValue *obj;
++ Table *mt;
++ lua_lock(L);
++ api_checknelems(L, 1);
++ obj = index2adr(L, objindex);
++ api_checkvalidindex(L, obj);
++ if (ttisnil(L->top - 1))
++ mt = NULL;
++ else {
++ api_check(L, ttistable(L->top - 1));
++ mt = hvalue(L->top - 1);
++ }
++ switch (ttype(obj)) {
++ case LUA_TTABLE: {
++ hvalue(obj)->metatable = mt;
++ if (mt)
++ luaC_objbarriert(L, hvalue(obj), mt);
++ break;
++ }
++ case LUA_TUSERDATA: {
++ uvalue(obj)->metatable = mt;
++ if (mt)
++ luaC_objbarrier(L, rawuvalue(obj), mt);
++ break;
++ }
++ default: {
++ G(L)->mt[ttype(obj)] = mt;
++ break;
++ }
++ }
++ L->top--;
++ lua_unlock(L);
++ return 1;
++}
++
++
++LUA_API int lua_setfenv (lua_State *L, int idx) {
++ StkId o;
++ int res = 1;
++ lua_lock(L);
++ api_checknelems(L, 1);
++ o = index2adr(L, idx);
++ api_checkvalidindex(L, o);
++ api_check(L, ttistable(L->top - 1));
++ switch (ttype(o)) {
++ case LUA_TFUNCTION:
++ clvalue(o)->c.env = hvalue(L->top - 1);
++ break;
++ case LUA_TUSERDATA:
++ uvalue(o)->env = hvalue(L->top - 1);
++ break;
++ case LUA_TTHREAD:
++ sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1));
++ break;
++ default:
++ res = 0;
++ break;
++ }
++ if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
++ L->top--;
++ lua_unlock(L);
++ return res;
++}
++
++
++/*
++** `load' and `call' functions (run Lua code)
++*/
++
++
++#define adjustresults(L,nres) \
++ { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; }
++
++
++#define checkresults(L,na,nr) \
++ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))
++
++
++LUA_API void lua_call (lua_State *L, int nargs, int nresults) {
++ StkId func;
++ lua_lock(L);
++ api_checknelems(L, nargs+1);
++ checkresults(L, nargs, nresults);
++ func = L->top - (nargs+1);
++ luaD_call(L, func, nresults);
++ adjustresults(L, nresults);
++ lua_unlock(L);
++}
++
++
++
++/*
++** Execute a protected call.
++*/
++struct CallS { /* data to `f_call' */
++ StkId func;
++ int nresults;
++};
++
++
++static void f_call (lua_State *L, void *ud) {
++ struct CallS *c = cast(struct CallS *, ud);
++ luaD_call(L, c->func, c->nresults);
++}
++
++
++
++LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) {
++ struct CallS c;
++ int status;
++ ptrdiff_t func;
++ lua_lock(L);
++ api_checknelems(L, nargs+1);
++ checkresults(L, nargs, nresults);
++ if (errfunc == 0)
++ func = 0;
++ else {
++ StkId o = index2adr(L, errfunc);
++ api_checkvalidindex(L, o);
++ func = savestack(L, o);
++ }
++ c.func = L->top - (nargs+1); /* function to be called */
++ c.nresults = nresults;
++ status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
++ adjustresults(L, nresults);
++ lua_unlock(L);
++ return status;
++}
++
++
++/*
++** Execute a protected C call.
++*/
++struct CCallS { /* data to `f_Ccall' */
++ lua_CFunction func;
++ void *ud;
++};
++
++
++static void f_Ccall (lua_State *L, void *ud) {
++ struct CCallS *c = cast(struct CCallS *, ud);
++ Closure *cl;
++ cl = luaF_newCclosure(L, 0, getcurrenv(L));
++ cl->c.f = c->func;
++ setclvalue(L, L->top, cl); /* push function */
++ api_incr_top(L);
++ setpvalue(L->top, c->ud); /* push only argument */
++ api_incr_top(L);
++ luaD_call(L, L->top - 2, 0);
++}
++
++
++LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) {
++ struct CCallS c;
++ int status;
++ lua_lock(L);
++ c.func = func;
++ c.ud = ud;
++ status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0);
++ lua_unlock(L);
++ return status;
++}
++
++
++LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
++ const char *chunkname) {
++ ZIO z;
++ int status;
++ lua_lock(L);
++ if (!chunkname) chunkname = "?";
++ luaZ_init(L, &z, reader, data);
++ status = luaD_protectedparser(L, &z, chunkname);
++ lua_unlock(L);
++ return status;
++}
++
++
++LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
++ int status;
++ TValue *o;
++ lua_lock(L);
++ api_checknelems(L, 1);
++ o = L->top - 1;
++ if (isLfunction(o))
++ status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0);
++ else
++ status = 1;
++ lua_unlock(L);
++ return status;
++}
++
++
++LUA_API int lua_status (lua_State *L) {
++ return L->status;
++}
++
++
++/*
++** Garbage-collection function
++*/
++
++LUA_API int lua_gc (lua_State *L, int what, int data) {
++ int res = 0;
++ global_State *g;
++ lua_lock(L);
++ g = G(L);
++ switch (what) {
++ case LUA_GCSTOP: {
++ g->GCthreshold = MAX_LUMEM;
++ break;
++ }
++ case LUA_GCRESTART: {
++ g->GCthreshold = g->totalbytes;
++ break;
++ }
++ case LUA_GCCOLLECT: {
++ luaC_fullgc(L);
++ break;
++ }
++ case LUA_GCCOUNT: {
++ /* GC values are expressed in Kbytes: #bytes/2^10 */
++ res = cast_int(g->totalbytes >> 10);
++ break;
++ }
++ case LUA_GCCOUNTB: {
++ res = cast_int(g->totalbytes & 0x3ff);
++ break;
++ }
++ case LUA_GCSTEP: {
++ lu_mem a = (cast(lu_mem, data) << 10);
++ if (a <= g->totalbytes)
++ g->GCthreshold = g->totalbytes - a;
++ else
++ g->GCthreshold = 0;
++ while (g->GCthreshold <= g->totalbytes) {
++ luaC_step(L);
++ if (g->gcstate == GCSpause) { /* end of cycle? */
++ res = 1; /* signal it */
++ break;
++ }
++ }
++ break;
++ }
++ case LUA_GCSETPAUSE: {
++ res = g->gcpause;
++ g->gcpause = data;
++ break;
++ }
++ case LUA_GCSETSTEPMUL: {
++ res = g->gcstepmul;
++ g->gcstepmul = data;
++ break;
++ }
++ default: res = -1; /* invalid option */
++ }
++ lua_unlock(L);
++ return res;
++}
++
++
++
++/*
++** miscellaneous functions
++*/
++
++
++LUA_API int lua_error (lua_State *L) {
++ lua_lock(L);
++ api_checknelems(L, 1);
++ luaG_errormsg(L);
++ lua_unlock(L);
++ return 0; /* to avoid warnings */
++}
++
++
++LUA_API int lua_next (lua_State *L, int idx) {
++ StkId t;
++ int more;
++ lua_lock(L);
++ t = index2adr(L, idx);
++ api_check(L, ttistable(t));
++ more = luaH_next(L, hvalue(t), L->top - 1);
++ if (more) {
++ api_incr_top(L);
++ }
++ else /* no more elements */
++ L->top -= 1; /* remove key */
++ lua_unlock(L);
++ return more;
++}
++
++
++LUA_API void lua_concat (lua_State *L, int n) {
++ lua_lock(L);
++ api_checknelems(L, n);
++ if (n >= 2) {
++ luaC_checkGC(L);
++ luaV_concat(L, n, cast_int(L->top - L->base) - 1);
++ L->top -= (n-1);
++ }
++ else if (n == 0) { /* push empty string */
++ setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
++ api_incr_top(L);
++ }
++ /* else n == 1; nothing to do */
++ lua_unlock(L);
++}
++
++
++LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
++ lua_Alloc f;
++ lua_lock(L);
++ if (ud) *ud = G(L)->ud;
++ f = G(L)->frealloc;
++ lua_unlock(L);
++ return f;
++}
++
++
++LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
++ lua_lock(L);
++ G(L)->ud = ud;
++ G(L)->frealloc = f;
++ lua_unlock(L);
++}
++
++
++LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
++ Udata *u;
++ lua_lock(L);
++ luaC_checkGC(L);
++ u = luaS_newudata(L, size, getcurrenv(L));
++ setuvalue(L, L->top, u);
++ api_incr_top(L);
++ lua_unlock(L);
++ return u + 1;
++}
++
++
++
++
++static const char *aux_upvalue (StkId fi, int n, TValue **val) {
++ Closure *f;
++ if (!ttisfunction(fi)) return NULL;
++ f = clvalue(fi);
++ if (f->c.isC) {
++ if (!(1 <= n && n <= f->c.nupvalues)) return NULL;
++ *val = &f->c.upvalue[n-1];
++ return "";
++ }
++ else {
++ Proto *p = f->l.p;
++ if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
++ *val = f->l.upvals[n-1]->v;
++ return getstr(p->upvalues[n-1]);
++ }
++}
++
++
++LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
++ const char *name;
++ TValue *val;
++ lua_lock(L);
++ name = aux_upvalue(index2adr(L, funcindex), n, &val);
++ if (name) {
++ setobj2s(L, L->top, val);
++ api_incr_top(L);
++ }
++ lua_unlock(L);
++ return name;
++}
++
++
++LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
++ const char *name;
++ TValue *val;
++ StkId fi;
++ lua_lock(L);
++ fi = index2adr(L, funcindex);
++ api_checknelems(L, 1);
++ name = aux_upvalue(fi, n, &val);
++ if (name) {
++ L->top--;
++ setobj(L, val, L->top);
++ luaC_barrier(L, clvalue(fi), L->top);
++ }
++ lua_unlock(L);
++ return name;
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lapi.h
+@@ -0,0 +1,16 @@
++/*
++** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $
++** Auxiliary functions from Lua API
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lapi_h
++#define lapi_h
++
++
++#include "lobject.h"
++
++
++LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lauxlib.c
+@@ -0,0 +1,674 @@
++/*
++** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $
++** Auxiliary functions for building Lua libraries
++** See Copyright Notice in lua.h
++*/
++
++#include <stdarg.h>
++
++#if !defined(__KERNEL__)
++#include <ctype.h>
++#include <errno.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#else
++#include <linux/ctype.h>
++#include <linux/errno.h>
++#include <linux/kernel.h>
++#include <linux/slab.h>
++#include <linux/string.h>
++#endif
++
++/* This file uses only the official API of Lua.
++** Any function declared here could be written as an application function.
++*/
++
++#define lauxlib_c
++#define LUA_LIB
++
++#include "lua.h"
++
++#include "lauxlib.h"
++
++
++#define FREELIST_REF 0 /* free list of references */
++
++
++/* convert a stack index to positive */
++#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \
++ lua_gettop(L) + (i) + 1)
++
++
++/*
++** {======================================================
++** Error-report functions
++** =======================================================
++*/
++
++
++LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
++ lua_Debug ar;
++ if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
++ return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
++ lua_getinfo(L, "n", &ar);
++ if (strcmp(ar.namewhat, "method") == 0) {
++ narg--; /* do not count `self' */
++ if (narg == 0) /* error is in the self argument itself? */
++ return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
++ ar.name, extramsg);
++ }
++ if (ar.name == NULL)
++ ar.name = "?";
++ return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
++ narg, ar.name, extramsg);
++}
++
++
++LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
++ const char *msg = lua_pushfstring(L, "%s expected, got %s",
++ tname, luaL_typename(L, narg));
++ return luaL_argerror(L, narg, msg);
++}
++
++
++static void tag_error (lua_State *L, int narg, int tag) {
++ luaL_typerror(L, narg, lua_typename(L, tag));
++}
++
++
++LUALIB_API void luaL_where (lua_State *L, int level) {
++ lua_Debug ar;
++ if (lua_getstack(L, level, &ar)) { /* check function at level */
++ lua_getinfo(L, "Sl", &ar); /* get info about it */
++ if (ar.currentline > 0) { /* is there info? */
++ lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
++ return;
++ }
++ }
++ lua_pushliteral(L, ""); /* else, no information available... */
++}
++
++
++LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
++ va_list argp;
++ va_start(argp, fmt);
++ luaL_where(L, 1);
++ lua_pushvfstring(L, fmt, argp);
++ va_end(argp);
++ lua_concat(L, 2);
++ return lua_error(L);
++}
++
++/* }====================================================== */
++
++
++LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
++ const char *const lst[]) {
++ const char *name = (def) ? luaL_optstring(L, narg, def) :
++ luaL_checkstring(L, narg);
++ int i;
++ for (i=0; lst[i]; i++)
++ if (strcmp(lst[i], name) == 0)
++ return i;
++ return luaL_argerror(L, narg,
++ lua_pushfstring(L, "invalid option " LUA_QS, name));
++}
++
++
++LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
++ lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
++ if (!lua_isnil(L, -1)) /* name already in use? */
++ return 0; /* leave previous value on top, but return 0 */
++ lua_pop(L, 1);
++ lua_newtable(L); /* create metatable */
++ lua_pushvalue(L, -1);
++ lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
++ return 1;
++}
++
++
++LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
++ void *p = lua_touserdata(L, ud);
++ if (p != NULL) { /* value is a userdata? */
++ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
++ lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
++ if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
++ lua_pop(L, 2); /* remove both metatables */
++ return p;
++ }
++ }
++ }
++ luaL_typerror(L, ud, tname); /* else error */
++ return NULL; /* to avoid warnings */
++}
++
++
++LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
++ if (!lua_checkstack(L, space))
++ luaL_error(L, "stack overflow (%s)", mes);
++}
++
++
++LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
++ if (lua_type(L, narg) != t)
++ tag_error(L, narg, t);
++}
++
++
++LUALIB_API void luaL_checkany (lua_State *L, int narg) {
++ if (lua_type(L, narg) == LUA_TNONE)
++ luaL_argerror(L, narg, "value expected");
++}
++
++
++LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
++ const char *s = lua_tolstring(L, narg, len);
++ if (!s) tag_error(L, narg, LUA_TSTRING);
++ return s;
++}
++
++
++LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
++ const char *def, size_t *len) {
++ if (lua_isnoneornil(L, narg)) {
++ if (len)
++ *len = (def ? strlen(def) : 0);
++ return def;
++ }
++ else return luaL_checklstring(L, narg, len);
++}
++
++
++LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
++ lua_Number d = lua_tonumber(L, narg);
++ if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
++ tag_error(L, narg, LUA_TNUMBER);
++ return d;
++}
++
++
++LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
++ return luaL_opt(L, luaL_checknumber, narg, def);
++}
++
++
++LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
++ lua_Integer d = lua_tointeger(L, narg);
++ if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
++ tag_error(L, narg, LUA_TNUMBER);
++ return d;
++}
++
++
++LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
++ lua_Integer def) {
++ return luaL_opt(L, luaL_checkinteger, narg, def);
++}
++
++
++LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
++ if (!lua_getmetatable(L, obj)) /* no metatable? */
++ return 0;
++ lua_pushstring(L, event);
++ lua_rawget(L, -2);
++ if (lua_isnil(L, -1)) {
++ lua_pop(L, 2); /* remove metatable and metafield */
++ return 0;
++ }
++ else {
++ lua_remove(L, -2); /* remove only metatable */
++ return 1;
++ }
++}
++
++
++LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
++ obj = abs_index(L, obj);
++ if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
++ return 0;
++ lua_pushvalue(L, obj);
++ lua_call(L, 1, 1);
++ return 1;
++}
++
++
++LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
++ const luaL_Reg *l) {
++ luaI_openlib(L, libname, l, 0);
++}
++
++
++static int libsize (const luaL_Reg *l) {
++ int size = 0;
++ for (; l->name; l++) size++;
++ return size;
++}
++
++
++LUALIB_API void luaI_openlib (lua_State *L, const char *libname,
++ const luaL_Reg *l, int nup) {
++ if (libname) {
++ int size = libsize(l);
++ /* check whether lib already exists */
++ luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);
++ lua_getfield(L, -1, libname); /* get _LOADED[libname] */
++ if (!lua_istable(L, -1)) { /* not found? */
++ lua_pop(L, 1); /* remove previous result */
++ /* try global variable (and create one if it does not exist) */
++ if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL)
++ luaL_error(L, "name conflict for module " LUA_QS, libname);
++ lua_pushvalue(L, -1);
++ lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */
++ }
++ lua_remove(L, -2); /* remove _LOADED table */
++ lua_insert(L, -(nup+1)); /* move library table to below upvalues */
++ }
++ for (; l->name; l++) {
++ int i;
++ for (i=0; i<nup; i++) /* copy upvalues to the top */
++ lua_pushvalue(L, -nup);
++ lua_pushcclosure(L, l->func, nup);
++ lua_setfield(L, -(nup+2), l->name);
++ }
++ lua_pop(L, nup); /* remove upvalues */
++}
++
++
++
++/*
++** {======================================================
++** getn-setn: size for arrays
++** =======================================================
++*/
++
++#if defined(LUA_COMPAT_GETN)
++
++static int checkint (lua_State *L, int topop) {
++ int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1;
++ lua_pop(L, topop);
++ return n;
++}
++
++
++static void getsizes (lua_State *L) {
++ lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES");
++ if (lua_isnil(L, -1)) { /* no `size' table? */
++ lua_pop(L, 1); /* remove nil */
++ lua_newtable(L); /* create it */
++ lua_pushvalue(L, -1); /* `size' will be its own metatable */
++ lua_setmetatable(L, -2);
++ lua_pushliteral(L, "kv");
++ lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */
++ lua_pushvalue(L, -1);
++ lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */
++ }
++}
++
++
++LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
++ t = abs_index(L, t);
++ lua_pushliteral(L, "n");
++ lua_rawget(L, t);
++ if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
++ lua_pushliteral(L, "n"); /* use it */
++ lua_pushinteger(L, n);
++ lua_rawset(L, t);
++ }
++ else { /* use `sizes' */
++ getsizes(L);
++ lua_pushvalue(L, t);
++ lua_pushinteger(L, n);
++ lua_rawset(L, -3); /* sizes[t] = n */
++ lua_pop(L, 1); /* remove `sizes' */
++ }
++}
++
++
++LUALIB_API int luaL_getn (lua_State *L, int t) {
++ int n;
++ t = abs_index(L, t);
++ lua_pushliteral(L, "n"); /* try t.n */
++ lua_rawget(L, t);
++ if ((n = checkint(L, 1)) >= 0) return n;
++ getsizes(L); /* else try sizes[t] */
++ lua_pushvalue(L, t);
++ lua_rawget(L, -2);
++ if ((n = checkint(L, 2)) >= 0) return n;
++ return (int)lua_objlen(L, t);
++}
++
++#endif
++
++/* }====================================================== */
++
++
++
++LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
++ const char *r) {
++ const char *wild;
++ size_t l = strlen(p);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "luaL_gsub: cannot allocate memory");
++ luaL_buffinit(L, b);
++ while ((wild = strstr(s, p)) != NULL) {
++ luaL_addlstring(b, s, wild - s); /* push prefix */
++ luaL_addstring(b, r); /* push replacement in place of pattern */
++ s = wild + l; /* continue after `p' */
++ }
++ luaL_addstring(b, s); /* push last suffix */
++ luaL_pushresult(b);
++ kfree(b);
++ return lua_tostring(L, -1);
++}
++
++
++LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
++ const char *fname, int szhint) {
++ const char *e;
++ lua_pushvalue(L, idx);
++ do {
++ e = strchr(fname, '.');
++ if (e == NULL) e = fname + strlen(fname);
++ lua_pushlstring(L, fname, e - fname);
++ lua_rawget(L, -2);
++ if (lua_isnil(L, -1)) { /* no such field? */
++ lua_pop(L, 1); /* remove this nil */
++ lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
++ lua_pushlstring(L, fname, e - fname);
++ lua_pushvalue(L, -2);
++ lua_settable(L, -4); /* set new table into field */
++ }
++ else if (!lua_istable(L, -1)) { /* field has a non-table value? */
++ lua_pop(L, 2); /* remove table and value */
++ return fname; /* return problematic part of the name */
++ }
++ lua_remove(L, -2); /* remove previous table */
++ fname = e + 1;
++ } while (*e == '.');
++ return NULL;
++}
++
++
++
++/*
++** {======================================================
++** Generic Buffer manipulation
++** =======================================================
++*/
++
++
++#define bufflen(B) ((B)->p - (B)->buffer)
++#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B)))
++
++#define LIMIT (LUA_MINSTACK/2)
++
++
++static int emptybuffer (luaL_Buffer *B) {
++ size_t l = bufflen(B);
++ if (l == 0) return 0; /* put nothing on stack */
++ else {
++ lua_pushlstring(B->L, B->buffer, l);
++ B->p = B->buffer;
++ B->lvl++;
++ return 1;
++ }
++}
++
++
++static void adjuststack (luaL_Buffer *B) {
++ if (B->lvl > 1) {
++ lua_State *L = B->L;
++ int toget = 1; /* number of levels to concat */
++ size_t toplen = lua_strlen(L, -1);
++ do {
++ size_t l = lua_strlen(L, -(toget+1));
++ if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
++ toplen += l;
++ toget++;
++ }
++ else break;
++ } while (toget < B->lvl);
++ lua_concat(L, toget);
++ B->lvl = B->lvl - toget + 1;
++ }
++}
++
++
++LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
++ if (emptybuffer(B))
++ adjuststack(B);
++ return B->buffer;
++}
++
++
++LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
++ while (l--)
++ luaL_addchar(B, *s++);
++}
++
++
++LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
++ luaL_addlstring(B, s, strlen(s));
++}
++
++
++LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
++ emptybuffer(B);
++ lua_concat(B->L, B->lvl);
++ B->lvl = 1;
++}
++
++
++LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
++ lua_State *L = B->L;
++ size_t vl;
++ const char *s = lua_tolstring(L, -1, &vl);
++ if (vl <= bufffree(B)) { /* fit into buffer? */
++ memcpy(B->p, s, vl); /* put it there */
++ B->p += vl;
++ lua_pop(L, 1); /* remove from stack */
++ }
++ else {
++ if (emptybuffer(B))
++ lua_insert(L, -2); /* put buffer before new value */
++ B->lvl++; /* add new value into B stack */
++ adjuststack(B);
++ }
++}
++
++
++LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
++ B->L = L;
++ B->p = B->buffer;
++ B->lvl = 0;
++}
++
++/* }====================================================== */
++
++
++LUALIB_API int luaL_ref (lua_State *L, int t) {
++ int ref;
++ t = abs_index(L, t);
++ if (lua_isnil(L, -1)) {
++ lua_pop(L, 1); /* remove from stack */
++ return LUA_REFNIL; /* `nil' has a unique fixed reference */
++ }
++ lua_rawgeti(L, t, FREELIST_REF); /* get first free element */
++ ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */
++ lua_pop(L, 1); /* remove it from stack */
++ if (ref != 0) { /* any free element? */
++ lua_rawgeti(L, t, ref); /* remove it from list */
++ lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */
++ }
++ else { /* no free elements */
++ ref = (int)lua_objlen(L, t);
++ ref++; /* create new reference */
++ }
++ lua_rawseti(L, t, ref);
++ return ref;
++}
++
++
++LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
++ if (ref >= 0) {
++ t = abs_index(L, t);
++ lua_rawgeti(L, t, FREELIST_REF);
++ lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */
++ lua_pushinteger(L, ref);
++ lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */
++ }
++}
++
++
++
++/*
++** {======================================================
++** Load functions
++** =======================================================
++*/
++
++#if !defined(__KERNEL__)
++typedef struct LoadF {
++ int extraline;
++ FILE *f;
++ char buff[LUAL_BUFFERSIZE];
++} LoadF;
++
++
++static const char *getF (lua_State *L, void *ud, size_t *size) {
++ LoadF *lf = (LoadF *)ud;
++ (void)L;
++ if (lf->extraline) {
++ lf->extraline = 0;
++ *size = 1;
++ return "\n";
++ }
++ if (feof(lf->f)) return NULL;
++ *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);
++ return (*size > 0) ? lf->buff : NULL;
++}
++
++
++static int errfile (lua_State *L, const char *what, int fnameindex) {
++ const char *serr = strerror(errno);
++ const char *filename = lua_tostring(L, fnameindex) + 1;
++ lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
++ lua_remove(L, fnameindex);
++ return LUA_ERRFILE;
++}
++
++
++LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
++ LoadF lf;
++ int status, readstatus;
++ int c;
++ int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */
++ lf.extraline = 0;
++ if (filename == NULL) {
++ lua_pushliteral(L, "=stdin");
++ lf.f = stdin;
++ }
++ else {
++ lua_pushfstring(L, "@%s", filename);
++ lf.f = fopen(filename, "r");
++ if (lf.f == NULL) return errfile(L, "open", fnameindex);
++ }
++ c = getc(lf.f);
++ if (c == '#') { /* Unix exec. file? */
++ lf.extraline = 1;
++ while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */
++ if (c == '\n') c = getc(lf.f);
++ }
++ if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
++ lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
++ if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
++ /* skip eventual `#!...' */
++ while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
++ lf.extraline = 0;
++ }
++ ungetc(c, lf.f);
++ status = lua_load(L, getF, &lf, lua_tostring(L, -1));
++ readstatus = ferror(lf.f);
++ if (filename) fclose(lf.f); /* close file (even in case of errors) */
++ if (readstatus) {
++ lua_settop(L, fnameindex); /* ignore results from `lua_load' */
++ return errfile(L, "read", fnameindex);
++ }
++ lua_remove(L, fnameindex);
++ return status;
++}
++#endif
++
++typedef struct LoadS {
++ const char *s;
++ size_t size;
++} LoadS;
++
++
++static const char *getS (lua_State *L, void *ud, size_t *size) {
++ LoadS *ls = (LoadS *)ud;
++ (void)L;
++ if (ls->size == 0) return NULL;
++ *size = ls->size;
++ ls->size = 0;
++ return ls->s;
++}
++
++
++LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
++ const char *name) {
++ LoadS ls;
++ ls.s = buff;
++ ls.size = size;
++ return lua_load(L, getS, &ls, name);
++}
++
++
++LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {
++ return luaL_loadbuffer(L, s, strlen(s), s);
++}
++
++
++
++/* }====================================================== */
++
++
++static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
++ (void)ud;
++ (void)osize;
++ if (nsize == 0) {
++#if !defined(__KERNEL__)
++ free(ptr);
++#else
++ kfree(ptr);
++#endif
++ return NULL;
++ }
++ else
++#if !defined(__KERNEL__)
++ return realloc(ptr, nsize);
++#else
++ return krealloc(ptr, nsize, GFP_ATOMIC);
++#endif
++}
++
++
++static int lpanic (lua_State *L) {
++ (void)L; /* to avoid warnings */
++#if !defined(__KERNEL__)
++ fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n",
++#else
++ printk( "PANIC: unprotected error in call to Lua API (%s)\n",
++#endif
++ lua_tostring(L, -1));
++ return 0;
++}
++
++
++LUALIB_API lua_State *luaL_newstate (void) {
++ lua_State *L = lua_newstate(l_alloc, NULL);
++ if (L) lua_atpanic(L, &lpanic);
++ return L;
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lauxlib.h
+@@ -0,0 +1,184 @@
++/*
++** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
++** Auxiliary functions for building Lua libraries
++** See Copyright Notice in lua.h
++*/
++
++
++#ifndef lauxlib_h
++#define lauxlib_h
++
++
++#include <stddef.h>
++#include <linux/slab.h> /* for kmalloc and kfree when allocating luaL_Buffer */
++
++#if !defined(__KERNEL__)
++#include <stdio.h>
++#endif
++
++#include "lua.h"
++
++
++#if defined(LUA_COMPAT_GETN)
++LUALIB_API int (luaL_getn) (lua_State *L, int t);
++LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
++#else
++#define luaL_getn(L,i) ((int)lua_objlen(L, i))
++#define luaL_setn(L,i,j) ((void)0) /* no op! */
++#endif
++
++#if defined(LUA_COMPAT_OPENLIB)
++#define luaI_openlib luaL_openlib
++#endif
++
++
++/* extra error code for `luaL_load' */
++#define LUA_ERRFILE (LUA_ERRERR+1)
++
++
++typedef struct luaL_Reg {
++ const char *name;
++ lua_CFunction func;
++} luaL_Reg;
++
++
++
++LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
++ const luaL_Reg *l, int nup);
++LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
++ const luaL_Reg *l);
++LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
++LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
++LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
++LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
++LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
++ size_t *l);
++LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
++ const char *def, size_t *l);
++LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
++LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
++
++LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
++LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
++ lua_Integer def);
++
++LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
++LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
++LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
++
++LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
++LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
++
++LUALIB_API void (luaL_where) (lua_State *L, int lvl);
++LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
++
++LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
++ const char *const lst[]);
++
++LUALIB_API int (luaL_ref) (lua_State *L, int t);
++LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
++
++#if !defined(__KERNEL__)
++LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
++#endif
++
++LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
++ const char *name);
++LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
++
++LUALIB_API lua_State *(luaL_newstate) (void);
++
++
++LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
++ const char *r);
++
++LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
++ const char *fname, int szhint);
++
++
++
++
++/*
++** ===============================================================
++** some useful macros
++** ===============================================================
++*/
++
++#define luaL_argcheck(L, cond,numarg,extramsg) \
++ ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
++#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
++#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
++#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
++#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
++#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
++#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
++
++#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
++
++#if !defined(__KERNEL__)
++#define luaL_dofile(L, fn) \
++ (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
++#endif
++
++#define luaL_dostring(L, s) \
++ (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
++
++#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
++
++#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
++
++/*
++** {======================================================
++** Generic Buffer manipulation
++** =======================================================
++*/
++
++
++
++typedef struct luaL_Buffer {
++ char *p; /* current position in buffer */
++ int lvl; /* number of strings in the stack (level) */
++ lua_State *L;
++ char buffer[LUAL_BUFFERSIZE];
++} luaL_Buffer;
++
++#define luaL_addchar(B,c) \
++ ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
++ (*(B)->p++ = (char)(c)))
++
++/* compatibility only */
++#define luaL_putchar(B,c) luaL_addchar(B,c)
++
++#define luaL_addsize(B,n) ((B)->p += (n))
++
++
++LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
++LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
++LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
++LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
++LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
++LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
++
++
++/* }====================================================== */
++
++
++/* compatibility with ref system */
++
++/* pre-defined references */
++#define LUA_NOREF (-2)
++#define LUA_REFNIL (-1)
++
++#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
++ (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
++
++#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
++
++#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
++
++
++#define luaL_reg luaL_Reg
++
++#endif
++
++
+--- /dev/null
++++ b/extensions/LUA/lua/lbaselib.c
+@@ -0,0 +1,647 @@
++/*
++** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $
++** Basic library
++** See Copyright Notice in lua.h
++*/
++
++
++#include <linux/kernel.h>
++#include <linux/ctype.h>
++#include <linux/string.h>
++
++#define lbaselib_c
++#define LUA_LIB
++
++#include "lua.h"
++
++#include "lauxlib.h"
++#include "lualib.h"
++
++
++
++
++/*
++** If your system does not support `stdout', you can just remove this function.
++** If you need, you can define your own `print' function, following this
++** model but changing `fputs' to put the strings at a proper place
++** (a console window or a log file, for instance).
++*/
++static int luaB_print (lua_State *L) {
++ int n = lua_gettop(L); /* number of arguments */
++ int i;
++ lua_getglobal(L, "tostring");
++ for (i=1; i<=n; i++) {
++ const char *s;
++ lua_pushvalue(L, -1); /* function to be called */
++ lua_pushvalue(L, i); /* value to print */
++ lua_call(L, 1, 1);
++ s = lua_tostring(L, -1); /* get result */
++ if (s == NULL)
++ return luaL_error(L, LUA_QL("tostring") " must return a string to "
++ LUA_QL("print"));
++ printk(KERN_INFO "LUA[print]: %s", s);
++ lua_pop(L, 1); /* pop result */
++ }
++ return 0;
++}
++
++
++static int luaB_tonumber (lua_State *L) {
++ int base = luaL_optint(L, 2, 10);
++ if (base == 10) { /* standard conversion */
++ luaL_checkany(L, 1);
++ if (lua_isnumber(L, 1)) {
++ lua_pushnumber(L, lua_tonumber(L, 1));
++ return 1;
++ }
++ }
++ else {
++ const char *s1 = luaL_checkstring(L, 1);
++ char *s2;
++ unsigned long n;
++ luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
++ n = simple_strtoul(s1, &s2, base);
++ if (s1 != s2) { /* at least one valid digit? */
++ while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */
++ if (*s2 == '\0') { /* no invalid trailing characters? */
++ lua_pushnumber(L, (lua_Number)n);
++ return 1;
++ }
++ }
++ }
++ lua_pushnil(L); /* else not a number */
++ return 1;
++}
++
++
++static int luaB_error (lua_State *L) {
++ int level = luaL_optint(L, 2, 1);
++ lua_settop(L, 1);
++ if (lua_isstring(L, 1) && level > 0) { /* add extra information? */
++ luaL_where(L, level);
++ lua_pushvalue(L, 1);
++ lua_concat(L, 2);
++ }
++ return lua_error(L);
++}
++
++
++static int luaB_getmetatable (lua_State *L) {
++ luaL_checkany(L, 1);
++ if (!lua_getmetatable(L, 1)) {
++ lua_pushnil(L);
++ return 1; /* no metatable */
++ }
++ luaL_getmetafield(L, 1, "__metatable");
++ return 1; /* returns either __metatable field (if present) or metatable */
++}
++
++
++static int luaB_setmetatable (lua_State *L) {
++ int t = lua_type(L, 2);
++ luaL_checktype(L, 1, LUA_TTABLE);
++ luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
++ "nil or table expected");
++ if (luaL_getmetafield(L, 1, "__metatable"))
++ luaL_error(L, "cannot change a protected metatable");
++ lua_settop(L, 2);
++ lua_setmetatable(L, 1);
++ return 1;
++}
++
++
++static void getfunc (lua_State *L, int opt) {
++ if (lua_isfunction(L, 1)) lua_pushvalue(L, 1);
++ else {
++ lua_Debug ar;
++ int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
++ luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
++ if (lua_getstack(L, level, &ar) == 0)
++ luaL_argerror(L, 1, "invalid level");
++ lua_getinfo(L, "f", &ar);
++ if (lua_isnil(L, -1))
++ luaL_error(L, "no function environment for tail call at level %d",
++ level);
++ }
++}
++
++
++static int luaB_getfenv (lua_State *L) {
++ getfunc(L, 1);
++ if (lua_iscfunction(L, -1)) /* is a C function? */
++ lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */
++ else
++ lua_getfenv(L, -1);
++ return 1;
++}
++
++
++static int luaB_setfenv (lua_State *L) {
++ luaL_checktype(L, 2, LUA_TTABLE);
++ getfunc(L, 0);
++ lua_pushvalue(L, 2);
++ if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) {
++ /* change environment of current thread */
++ lua_pushthread(L);
++ lua_insert(L, -2);
++ lua_setfenv(L, -2);
++ return 0;
++ }
++ else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
++ luaL_error(L,
++ LUA_QL("setfenv") " cannot change environment of given object");
++ return 1;
++}
++
++
++static int luaB_rawequal (lua_State *L) {
++ luaL_checkany(L, 1);
++ luaL_checkany(L, 2);
++ lua_pushboolean(L, lua_rawequal(L, 1, 2));
++ return 1;
++}
++
++
++static int luaB_rawget (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ luaL_checkany(L, 2);
++ lua_settop(L, 2);
++ lua_rawget(L, 1);
++ return 1;
++}
++
++static int luaB_rawset (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ luaL_checkany(L, 2);
++ luaL_checkany(L, 3);
++ lua_settop(L, 3);
++ lua_rawset(L, 1);
++ return 1;
++}
++
++
++static int luaB_gcinfo (lua_State *L) {
++ lua_pushinteger(L, lua_getgccount(L));
++ return 1;
++}
++
++static int luaB_collectgarbage (lua_State *L) {
++ static const char *const opts[] = {"stop", "restart", "collect",
++ "count", "step", "setpause", "setstepmul", NULL};
++ static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
++ LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
++ int o = luaL_checkoption(L, 1, "collect", opts);
++ int ex = luaL_optint(L, 2, 0);
++ int res = lua_gc(L, optsnum[o], ex);
++ switch (optsnum[o]) {
++ case LUA_GCCOUNT: {
++ int b = lua_gc(L, LUA_GCCOUNTB, 0);
++ lua_pushnumber(L, res + ((lua_Number)b/1024));
++ return 1;
++ }
++ case LUA_GCSTEP: {
++ lua_pushboolean(L, res);
++ return 1;
++ }
++ default: {
++ lua_pushnumber(L, res);
++ return 1;
++ }
++ }
++}
++
++
++static int luaB_type (lua_State *L) {
++ luaL_checkany(L, 1);
++ lua_pushstring(L, luaL_typename(L, 1));
++ return 1;
++}
++
++
++static int luaB_next (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ lua_settop(L, 2); /* create a 2nd argument if there isn't one */
++ if (lua_next(L, 1))
++ return 2;
++ else {
++ lua_pushnil(L);
++ return 1;
++ }
++}
++
++
++static int luaB_pairs (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */
++ lua_pushvalue(L, 1); /* state, */
++ lua_pushnil(L); /* and initial value */
++ return 3;
++}
++
++
++static int ipairsaux (lua_State *L) {
++ int i = luaL_checkint(L, 2);
++ luaL_checktype(L, 1, LUA_TTABLE);
++ i++; /* next value */
++ lua_pushinteger(L, i);
++ lua_rawgeti(L, 1, i);
++ return (lua_isnil(L, -1)) ? 0 : 2;
++}
++
++
++static int luaB_ipairs (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */
++ lua_pushvalue(L, 1); /* state, */
++ lua_pushinteger(L, 0); /* and initial value */
++ return 3;
++}
++
++
++static int load_aux (lua_State *L, int status) {
++ if (status == 0) /* OK? */
++ return 1;
++ else {
++ lua_pushnil(L);
++ lua_insert(L, -2); /* put before error message */
++ return 2; /* return nil plus error message */
++ }
++}
++
++
++static int luaB_loadstring (lua_State *L) {
++ size_t l;
++ const char *s = luaL_checklstring(L, 1, &l);
++ const char *chunkname = luaL_optstring(L, 2, s);
++ return load_aux(L, luaL_loadbuffer(L, s, l, chunkname));
++}
++
++/*
++static int luaB_loadfile (lua_State *L) {
++ const char *fname = luaL_optstring(L, 1, NULL);
++ return load_aux(L, luaL_loadfile(L, fname));
++}
++*/
++
++/*
++** Reader for generic `load' function: `lua_load' uses the
++** stack for internal stuff, so the reader cannot change the
++** stack top. Instead, it keeps its resulting string in a
++** reserved slot inside the stack.
++*/
++static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
++ (void)ud; /* to avoid warnings */
++ luaL_checkstack(L, 2, "too many nested functions");
++ lua_pushvalue(L, 1); /* get function */
++ lua_call(L, 0, 1); /* call it */
++ if (lua_isnil(L, -1)) {
++ *size = 0;
++ return NULL;
++ }
++ else if (lua_isstring(L, -1)) {
++ lua_replace(L, 3); /* save string in a reserved stack slot */
++ return lua_tolstring(L, 3, size);
++ }
++ else luaL_error(L, "reader function must return a string");
++ return NULL; /* to avoid warnings */
++}
++
++
++static int luaB_load (lua_State *L) {
++ int status;
++ const char *cname = luaL_optstring(L, 2, "=(load)");
++ luaL_checktype(L, 1, LUA_TFUNCTION);
++ lua_settop(L, 3); /* function, eventual name, plus one reserved slot */
++ status = lua_load(L, generic_reader, NULL, cname);
++ return load_aux(L, status);
++}
++
++/*
++static int luaB_dofile (lua_State *L) {
++ const char *fname = luaL_optstring(L, 1, NULL);
++ int n = lua_gettop(L);
++ if (luaL_loadfile(L, fname) != 0) lua_error(L);
++ lua_call(L, 0, LUA_MULTRET);
++ return lua_gettop(L) - n;
++}
++*/
++
++static int luaB_assert (lua_State *L) {
++ luaL_checkany(L, 1);
++ if (!lua_toboolean(L, 1))
++ return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
++ return lua_gettop(L);
++}
++
++
++static int luaB_unpack (lua_State *L) {
++ int i, e, n;
++ luaL_checktype(L, 1, LUA_TTABLE);
++ i = luaL_optint(L, 2, 1);
++ e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
++ if (i > e) return 0; /* empty range */
++ n = e - i + 1; /* number of elements */
++ if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
++ return luaL_error(L, "too many results to unpack");
++ lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
++ while (i++ < e) /* push arg[i + 1...e] */
++ lua_rawgeti(L, 1, i);
++ return n;
++}
++
++
++static int luaB_select (lua_State *L) {
++ int n = lua_gettop(L);
++ if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
++ lua_pushinteger(L, n-1);
++ return 1;
++ }
++ else {
++ int i = luaL_checkint(L, 1);
++ if (i < 0) i = n + i;
++ else if (i > n) i = n;
++ luaL_argcheck(L, 1 <= i, 1, "index out of range");
++ return n - i;
++ }
++}
++
++
++static int luaB_pcall (lua_State *L) {
++ int status;
++ luaL_checkany(L, 1);
++ status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0);
++ lua_pushboolean(L, (status == 0));
++ lua_insert(L, 1);
++ return lua_gettop(L); /* return status + all results */
++}
++
++
++static int luaB_xpcall (lua_State *L) {
++ int status;
++ luaL_checkany(L, 2);
++ lua_settop(L, 2);
++ lua_insert(L, 1); /* put error function under function to be called */
++ status = lua_pcall(L, 0, LUA_MULTRET, 1);
++ lua_pushboolean(L, (status == 0));
++ lua_replace(L, 1);
++ return lua_gettop(L); /* return status + all results */
++}
++
++
++static int luaB_tostring (lua_State *L) {
++ luaL_checkany(L, 1);
++ if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */
++ return 1; /* use its value */
++ switch (lua_type(L, 1)) {
++ case LUA_TNUMBER:
++ lua_pushstring(L, lua_tostring(L, 1));
++ break;
++ case LUA_TSTRING:
++ lua_pushvalue(L, 1);
++ break;
++ case LUA_TBOOLEAN:
++ lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false"));
++ break;
++ case LUA_TNIL:
++ lua_pushliteral(L, "nil");
++ break;
++ default:
++ lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1));
++ break;
++ }
++ return 1;
++}
++
++
++static int luaB_newproxy (lua_State *L) {
++ lua_settop(L, 1);
++ lua_newuserdata(L, 0); /* create proxy */
++ if (lua_toboolean(L, 1) == 0)
++ return 1; /* no metatable */
++ else if (lua_isboolean(L, 1)) {
++ lua_newtable(L); /* create a new metatable `m' ... */
++ lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */
++ lua_pushboolean(L, 1);
++ lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */
++ }
++ else {
++ int validproxy = 0; /* to check if weaktable[metatable(u)] == true */
++ if (lua_getmetatable(L, 1)) {
++ lua_rawget(L, lua_upvalueindex(1));
++ validproxy = lua_toboolean(L, -1);
++ lua_pop(L, 1); /* remove value */
++ }
++ luaL_argcheck(L, validproxy, 1, "boolean or proxy expected");
++ lua_getmetatable(L, 1); /* metatable is valid; get it */
++ }
++ lua_setmetatable(L, 2);
++ return 1;
++}
++
++
++static const luaL_Reg base_funcs[] = {
++ {"assert", luaB_assert},
++ {"collectgarbage", luaB_collectgarbage},
++// {"dofile", luaB_dofile},
++ {"error", luaB_error},
++ {"gcinfo", luaB_gcinfo},
++ {"getfenv", luaB_getfenv},
++ {"getmetatable", luaB_getmetatable},
++// {"loadfile", luaB_loadfile},
++ {"load", luaB_load},
++ {"loadstring", luaB_loadstring},
++ {"next", luaB_next},
++ {"pcall", luaB_pcall},
++ {"print", luaB_print},
++ {"rawequal", luaB_rawequal},
++ {"rawget", luaB_rawget},
++ {"rawset", luaB_rawset},
++ {"select", luaB_select},
++ {"setfenv", luaB_setfenv},
++ {"setmetatable", luaB_setmetatable},
++ {"tonumber", luaB_tonumber},
++ {"tostring", luaB_tostring},
++ {"type", luaB_type},
++ {"unpack", luaB_unpack},
++ {"xpcall", luaB_xpcall},
++ {NULL, NULL}
++};
++
++
++/*
++** {======================================================
++** Coroutine library
++** =======================================================
++*/
++
++#define CO_RUN 0 /* running */
++#define CO_SUS 1 /* suspended */
++#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */
++#define CO_DEAD 3
++
++static const char *const statnames[] =
++ {"running", "suspended", "normal", "dead"};
++
++static int costatus (lua_State *L, lua_State *co) {
++ if (L == co) return CO_RUN;
++ switch (lua_status(co)) {
++ case LUA_YIELD:
++ return CO_SUS;
++ case 0: {
++ lua_Debug ar;
++ if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */
++ return CO_NOR; /* it is running */
++ else if (lua_gettop(co) == 0)
++ return CO_DEAD;
++ else
++ return CO_SUS; /* initial state */
++ }
++ default: /* some error occured */
++ return CO_DEAD;
++ }
++}
++
++
++static int luaB_costatus (lua_State *L) {
++ lua_State *co = lua_tothread(L, 1);
++ luaL_argcheck(L, co, 1, "coroutine expected");
++ lua_pushstring(L, statnames[costatus(L, co)]);
++ return 1;
++}
++
++
++static int auxresume (lua_State *L, lua_State *co, int narg) {
++ int status = costatus(L, co);
++ if (!lua_checkstack(co, narg))
++ luaL_error(L, "too many arguments to resume");
++ if (status != CO_SUS) {
++ lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]);
++ return -1; /* error flag */
++ }
++ lua_xmove(L, co, narg);
++ lua_setlevel(L, co);
++ status = lua_resume(co, narg);
++ if (status == 0 || status == LUA_YIELD) {
++ int nres = lua_gettop(co);
++ if (!lua_checkstack(L, nres + 1))
++ luaL_error(L, "too many results to resume");
++ lua_xmove(co, L, nres); /* move yielded values */
++ return nres;
++ }
++ else {
++ lua_xmove(co, L, 1); /* move error message */
++ return -1; /* error flag */
++ }
++}
++
++
++static int luaB_coresume (lua_State *L) {
++ lua_State *co = lua_tothread(L, 1);
++ int r;
++ luaL_argcheck(L, co, 1, "coroutine expected");
++ r = auxresume(L, co, lua_gettop(L) - 1);
++ if (r < 0) {
++ lua_pushboolean(L, 0);
++ lua_insert(L, -2);
++ return 2; /* return false + error message */
++ }
++ else {
++ lua_pushboolean(L, 1);
++ lua_insert(L, -(r + 1));
++ return r + 1; /* return true + `resume' returns */
++ }
++}
++
++
++static int luaB_auxwrap (lua_State *L) {
++ lua_State *co = lua_tothread(L, lua_upvalueindex(1));
++ int r = auxresume(L, co, lua_gettop(L));
++ if (r < 0) {
++ if (lua_isstring(L, -1)) { /* error object is a string? */
++ luaL_where(L, 1); /* add extra info */
++ lua_insert(L, -2);
++ lua_concat(L, 2);
++ }
++ lua_error(L); /* propagate error */
++ }
++ return r;
++}
++
++
++static int luaB_cocreate (lua_State *L) {
++ lua_State *NL = lua_newthread(L);
++ luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
++ "Lua function expected");
++ lua_pushvalue(L, 1); /* move function to top */
++ lua_xmove(L, NL, 1); /* move function from L to NL */
++ return 1;
++}
++
++
++static int luaB_cowrap (lua_State *L) {
++ luaB_cocreate(L);
++ lua_pushcclosure(L, luaB_auxwrap, 1);
++ return 1;
++}
++
++
++static int luaB_yield (lua_State *L) {
++ return lua_yield(L, lua_gettop(L));
++}
++
++
++static int luaB_corunning (lua_State *L) {
++ if (lua_pushthread(L))
++ lua_pushnil(L); /* main thread is not a coroutine */
++ return 1;
++}
++
++
++static const luaL_Reg co_funcs[] = {
++ {"create", luaB_cocreate},
++ {"resume", luaB_coresume},
++ {"running", luaB_corunning},
++ {"status", luaB_costatus},
++ {"wrap", luaB_cowrap},
++ {"yield", luaB_yield},
++ {NULL, NULL}
++};
++
++/* }====================================================== */
++
++
++static void auxopen (lua_State *L, const char *name,
++ lua_CFunction f, lua_CFunction u) {
++ lua_pushcfunction(L, u);
++ lua_pushcclosure(L, f, 1);
++ lua_setfield(L, -2, name);
++}
++
++
++static void base_open (lua_State *L) {
++ /* set global _G */
++ lua_pushvalue(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "_G");
++ /* open lib into global table */
++ luaL_register(L, "_G", base_funcs);
++ lua_pushliteral(L, LUA_VERSION);
++ lua_setglobal(L, "_VERSION"); /* set global _VERSION */
++ /* `ipairs' and `pairs' need auxliliary functions as upvalues */
++ auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
++ auxopen(L, "pairs", luaB_pairs, luaB_next);
++ /* `newproxy' needs a weaktable as upvalue */
++ lua_createtable(L, 0, 1); /* new table `w' */
++ lua_pushvalue(L, -1); /* `w' will be its own metatable */
++ lua_setmetatable(L, -2);
++ lua_pushliteral(L, "kv");
++ lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */
++ lua_pushcclosure(L, luaB_newproxy, 1);
++ lua_setglobal(L, "newproxy"); /* set global `newproxy' */
++}
++
++
++LUALIB_API int luaopen_base (lua_State *L) {
++ base_open(L);
++ luaL_register(L, LUA_COLIBNAME, co_funcs);
++ return 2;
++}
+--- /dev/null
++++ b/extensions/LUA/lua/lcode.c
+@@ -0,0 +1,838 @@
++/*
++** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
++** Code generator for Lua
++** See Copyright Notice in lua.h
++*/
++
++#include <stdlib.h>
++
++#define lcode_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lcode.h"
++#include "ldebug.h"
++#include "ldo.h"
++#include "lgc.h"
++#include "llex.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lparser.h"
++#include "ltable.h"
++
++
++#define hasjumps(e) ((e)->t != (e)->f)
++
++
++static int isnumeral(expdesc *e) {
++ return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);
++}
++
++
++void luaK_nil (FuncState *fs, int from, int n) {
++ Instruction *previous;
++ if (fs->pc > fs->lasttarget) { /* no jumps to current position? */
++ if (fs->pc == 0) { /* function start? */
++ if (from >= fs->nactvar)
++ return; /* positions are already clean */
++ }
++ else {
++ previous = &fs->f->code[fs->pc-1];
++ if (GET_OPCODE(*previous) == OP_LOADNIL) {
++ int pfrom = GETARG_A(*previous);
++ int pto = GETARG_B(*previous);
++ if (pfrom <= from && from <= pto+1) { /* can connect both? */
++ if (from+n-1 > pto)
++ SETARG_B(*previous, from+n-1);
++ return;
++ }
++ }
++ }
++ }
++ luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */
++}
++
++
++int luaK_jump (FuncState *fs) {
++ int jpc = fs->jpc; /* save list of jumps to here */
++ int j;
++ fs->jpc = NO_JUMP;
++ j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
++ luaK_concat(fs, &j, jpc); /* keep them on hold */
++ return j;
++}
++
++
++void luaK_ret (FuncState *fs, int first, int nret) {
++ luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);
++}
++
++
++static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
++ luaK_codeABC(fs, op, A, B, C);
++ return luaK_jump(fs);
++}
++
++
++static void fixjump (FuncState *fs, int pc, int dest) {
++ Instruction *jmp = &fs->f->code[pc];
++ int offset = dest-(pc+1);
++ lua_assert(dest != NO_JUMP);
++ if (abs(offset) > MAXARG_sBx)
++ luaX_syntaxerror(fs->ls, "control structure too long");
++ SETARG_sBx(*jmp, offset);
++}
++
++
++/*
++** returns current `pc' and marks it as a jump target (to avoid wrong
++** optimizations with consecutive instructions not in the same basic block).
++*/
++int luaK_getlabel (FuncState *fs) {
++ fs->lasttarget = fs->pc;
++ return fs->pc;
++}
++
++
++static int getjump (FuncState *fs, int pc) {
++ int offset = GETARG_sBx(fs->f->code[pc]);
++ if (offset == NO_JUMP) /* point to itself represents end of list */
++ return NO_JUMP; /* end of list */
++ else
++ return (pc+1)+offset; /* turn offset into absolute position */
++}
++
++
++static Instruction *getjumpcontrol (FuncState *fs, int pc) {
++ Instruction *pi = &fs->f->code[pc];
++ if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))
++ return pi-1;
++ else
++ return pi;
++}
++
++
++/*
++** check whether list has any jump that do not produce a value
++** (or produce an inverted value)
++*/
++static int need_value (FuncState *fs, int list) {
++ for (; list != NO_JUMP; list = getjump(fs, list)) {
++ Instruction i = *getjumpcontrol(fs, list);
++ if (GET_OPCODE(i) != OP_TESTSET) return 1;
++ }
++ return 0; /* not found */
++}
++
++
++static int patchtestreg (FuncState *fs, int node, int reg) {
++ Instruction *i = getjumpcontrol(fs, node);
++ if (GET_OPCODE(*i) != OP_TESTSET)
++ return 0; /* cannot patch other instructions */
++ if (reg != NO_REG && reg != GETARG_B(*i))
++ SETARG_A(*i, reg);
++ else /* no register to put value or register already has the value */
++ *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));
++
++ return 1;
++}
++
++
++static void removevalues (FuncState *fs, int list) {
++ for (; list != NO_JUMP; list = getjump(fs, list))
++ patchtestreg(fs, list, NO_REG);
++}
++
++
++static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
++ int dtarget) {
++ while (list != NO_JUMP) {
++ int next = getjump(fs, list);
++ if (patchtestreg(fs, list, reg))
++ fixjump(fs, list, vtarget);
++ else
++ fixjump(fs, list, dtarget); /* jump to default target */
++ list = next;
++ }
++}
++
++
++static void dischargejpc (FuncState *fs) {
++ patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
++ fs->jpc = NO_JUMP;
++}
++
++
++void luaK_patchlist (FuncState *fs, int list, int target) {
++ if (target == fs->pc)
++ luaK_patchtohere(fs, list);
++ else {
++ lua_assert(target < fs->pc);
++ patchlistaux(fs, list, target, NO_REG, target);
++ }
++}
++
++
++void luaK_patchtohere (FuncState *fs, int list) {
++ luaK_getlabel(fs);
++ luaK_concat(fs, &fs->jpc, list);
++}
++
++
++void luaK_concat (FuncState *fs, int *l1, int l2) {
++ if (l2 == NO_JUMP) return;
++ else if (*l1 == NO_JUMP)
++ *l1 = l2;
++ else {
++ int list = *l1;
++ int next;
++ while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */
++ list = next;
++ fixjump(fs, list, l2);
++ }
++}
++
++
++void luaK_checkstack (FuncState *fs, int n) {
++ int newstack = fs->freereg + n;
++ if (newstack > fs->f->maxstacksize) {
++ if (newstack >= MAXSTACK)
++ luaX_syntaxerror(fs->ls, "function or expression too complex");
++ fs->f->maxstacksize = cast_byte(newstack);
++ }
++}
++
++
++void luaK_reserveregs (FuncState *fs, int n) {
++ luaK_checkstack(fs, n);
++ fs->freereg += n;
++}
++
++
++static void freereg (FuncState *fs, int reg) {
++ if (!ISK(reg) && reg >= fs->nactvar) {
++ fs->freereg--;
++ lua_assert(reg == fs->freereg);
++ }
++}
++
++
++static void freeexp (FuncState *fs, expdesc *e) {
++ if (e->k == VNONRELOC)
++ freereg(fs, e->u.s.info);
++}
++
++
++static int addk (FuncState *fs, TValue *k, TValue *v) {
++ lua_State *L = fs->L;
++ TValue *idx = luaH_set(L, fs->h, k);
++ Proto *f = fs->f;
++ int oldsize = f->sizek;
++ if (ttisnumber(idx)) {
++ lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v));
++ return cast_int(nvalue(idx));
++ }
++ else { /* constant not found; create a new entry */
++ setnvalue(idx, cast_num(fs->nk));
++ luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,
++ MAXARG_Bx, "constant table overflow");
++ while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
++ setobj(L, &f->k[fs->nk], v);
++ luaC_barrier(L, f, v);
++ return fs->nk++;
++ }
++}
++
++
++int luaK_stringK (FuncState *fs, TString *s) {
++ TValue o;
++ setsvalue(fs->L, &o, s);
++ return addk(fs, &o, &o);
++}
++
++
++int luaK_numberK (FuncState *fs, lua_Number r) {
++ TValue o;
++ setnvalue(&o, r);
++ return addk(fs, &o, &o);
++}
++
++
++static int boolK (FuncState *fs, int b) {
++ TValue o;
++ setbvalue(&o, b);
++ return addk(fs, &o, &o);
++}
++
++
++static int nilK (FuncState *fs) {
++ TValue k, v;
++ setnilvalue(&v);
++ /* cannot use nil as key; instead use table itself to represent nil */
++ sethvalue(fs->L, &k, fs->h);
++ return addk(fs, &k, &v);
++}
++
++
++void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
++ if (e->k == VCALL) { /* expression is an open function call? */
++ SETARG_C(getcode(fs, e), nresults+1);
++ }
++ else if (e->k == VVARARG) {
++ SETARG_B(getcode(fs, e), nresults+1);
++ SETARG_A(getcode(fs, e), fs->freereg);
++ luaK_reserveregs(fs, 1);
++ }
++}
++
++
++void luaK_setoneret (FuncState *fs, expdesc *e) {
++ if (e->k == VCALL) { /* expression is an open function call? */
++ e->k = VNONRELOC;
++ e->u.s.info = GETARG_A(getcode(fs, e));
++ }
++ else if (e->k == VVARARG) {
++ SETARG_B(getcode(fs, e), 2);
++ e->k = VRELOCABLE; /* can relocate its simple result */
++ }
++}
++
++
++void luaK_dischargevars (FuncState *fs, expdesc *e) {
++ switch (e->k) {
++ case VLOCAL: {
++ e->k = VNONRELOC;
++ break;
++ }
++ case VUPVAL: {
++ e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0);
++ e->k = VRELOCABLE;
++ break;
++ }
++ case VGLOBAL: {
++ e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info);
++ e->k = VRELOCABLE;
++ break;
++ }
++ case VINDEXED: {
++ freereg(fs, e->u.s.aux);
++ freereg(fs, e->u.s.info);
++ e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux);
++ e->k = VRELOCABLE;
++ break;
++ }
++ case VVARARG:
++ case VCALL: {
++ luaK_setoneret(fs, e);
++ break;
++ }
++ default: break; /* there is one value available (somewhere) */
++ }
++}
++
++
++static int code_label (FuncState *fs, int A, int b, int jump) {
++ luaK_getlabel(fs); /* those instructions may be jump targets */
++ return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);
++}
++
++
++static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
++ luaK_dischargevars(fs, e);
++ switch (e->k) {
++ case VNIL: {
++ luaK_nil(fs, reg, 1);
++ break;
++ }
++ case VFALSE: case VTRUE: {
++ luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
++ break;
++ }
++ case VK: {
++ luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info);
++ break;
++ }
++ case VKNUM: {
++ luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
++ break;
++ }
++ case VRELOCABLE: {
++ Instruction *pc = &getcode(fs, e);
++ SETARG_A(*pc, reg);
++ break;
++ }
++ case VNONRELOC: {
++ if (reg != e->u.s.info)
++ luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0);
++ break;
++ }
++ default: {
++ lua_assert(e->k == VVOID || e->k == VJMP);
++ return; /* nothing to do... */
++ }
++ }
++ e->u.s.info = reg;
++ e->k = VNONRELOC;
++}
++
++
++static void discharge2anyreg (FuncState *fs, expdesc *e) {
++ if (e->k != VNONRELOC) {
++ luaK_reserveregs(fs, 1);
++ discharge2reg(fs, e, fs->freereg-1);
++ }
++}
++
++
++static void exp2reg (FuncState *fs, expdesc *e, int reg) {
++ discharge2reg(fs, e, reg);
++ if (e->k == VJMP)
++ luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */
++ if (hasjumps(e)) {
++ int final; /* position after whole expression */
++ int p_f = NO_JUMP; /* position of an eventual LOAD false */
++ int p_t = NO_JUMP; /* position of an eventual LOAD true */
++ if (need_value(fs, e->t) || need_value(fs, e->f)) {
++ int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);
++ p_f = code_label(fs, reg, 0, 1);
++ p_t = code_label(fs, reg, 1, 0);
++ luaK_patchtohere(fs, fj);
++ }
++ final = luaK_getlabel(fs);
++ patchlistaux(fs, e->f, final, reg, p_f);
++ patchlistaux(fs, e->t, final, reg, p_t);
++ }
++ e->f = e->t = NO_JUMP;
++ e->u.s.info = reg;
++ e->k = VNONRELOC;
++}
++
++
++void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
++ luaK_dischargevars(fs, e);
++ freeexp(fs, e);
++ luaK_reserveregs(fs, 1);
++ exp2reg(fs, e, fs->freereg - 1);
++}
++
++
++int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
++ luaK_dischargevars(fs, e);
++ if (e->k == VNONRELOC) {
++ if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */
++ if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */
++ exp2reg(fs, e, e->u.s.info); /* put value on it */
++ return e->u.s.info;
++ }
++ }
++ luaK_exp2nextreg(fs, e); /* default */
++ return e->u.s.info;
++}
++
++
++void luaK_exp2val (FuncState *fs, expdesc *e) {
++ if (hasjumps(e))
++ luaK_exp2anyreg(fs, e);
++ else
++ luaK_dischargevars(fs, e);
++}
++
++
++int luaK_exp2RK (FuncState *fs, expdesc *e) {
++ luaK_exp2val(fs, e);
++ switch (e->k) {
++ case VKNUM:
++ case VTRUE:
++ case VFALSE:
++ case VNIL: {
++ if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
++ e->u.s.info = (e->k == VNIL) ? nilK(fs) :
++ (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
++ boolK(fs, (e->k == VTRUE));
++ e->k = VK;
++ return RKASK(e->u.s.info);
++ }
++ else break;
++ }
++ case VK: {
++ if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */
++ return RKASK(e->u.s.info);
++ else break;
++ }
++ default: break;
++ }
++ /* not a constant in the right range: put it in a register */
++ return luaK_exp2anyreg(fs, e);
++}
++
++
++void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
++ switch (var->k) {
++ case VLOCAL: {
++ freeexp(fs, ex);
++ exp2reg(fs, ex, var->u.s.info);
++ return;
++ }
++ case VUPVAL: {
++ int e = luaK_exp2anyreg(fs, ex);
++ luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0);
++ break;
++ }
++ case VGLOBAL: {
++ int e = luaK_exp2anyreg(fs, ex);
++ luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info);
++ break;
++ }
++ case VINDEXED: {
++ int e = luaK_exp2RK(fs, ex);
++ luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e);
++ break;
++ }
++ default: {
++ lua_assert(0); /* invalid var kind to store */
++ break;
++ }
++ }
++ freeexp(fs, ex);
++}
++
++
++void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
++ int func;
++ luaK_exp2anyreg(fs, e);
++ freeexp(fs, e);
++ func = fs->freereg;
++ luaK_reserveregs(fs, 2);
++ luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key));
++ freeexp(fs, key);
++ e->u.s.info = func;
++ e->k = VNONRELOC;
++}
++
++
++static void invertjump (FuncState *fs, expdesc *e) {
++ Instruction *pc = getjumpcontrol(fs, e->u.s.info);
++ lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&
++ GET_OPCODE(*pc) != OP_TEST);
++ SETARG_A(*pc, !(GETARG_A(*pc)));
++}
++
++
++static int jumponcond (FuncState *fs, expdesc *e, int cond) {
++ if (e->k == VRELOCABLE) {
++ Instruction ie = getcode(fs, e);
++ if (GET_OPCODE(ie) == OP_NOT) {
++ fs->pc--; /* remove previous OP_NOT */
++ return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);
++ }
++ /* else go through */
++ }
++ discharge2anyreg(fs, e);
++ freeexp(fs, e);
++ return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond);
++}
++
++
++void luaK_goiftrue (FuncState *fs, expdesc *e) {
++ int pc; /* pc of last jump */
++ luaK_dischargevars(fs, e);
++ switch (e->k) {
++ case VK: case VKNUM: case VTRUE: {
++ pc = NO_JUMP; /* always true; do nothing */
++ break;
++ }
++ case VFALSE: {
++ pc = luaK_jump(fs); /* always jump */
++ break;
++ }
++ case VJMP: {
++ invertjump(fs, e);
++ pc = e->u.s.info;
++ break;
++ }
++ default: {
++ pc = jumponcond(fs, e, 0);
++ break;
++ }
++ }
++ luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */
++ luaK_patchtohere(fs, e->t);
++ e->t = NO_JUMP;
++}
++
++
++static void luaK_goiffalse (FuncState *fs, expdesc *e) {
++ int pc; /* pc of last jump */
++ luaK_dischargevars(fs, e);
++ switch (e->k) {
++ case VNIL: case VFALSE: {
++ pc = NO_JUMP; /* always false; do nothing */
++ break;
++ }
++ case VTRUE: {
++ pc = luaK_jump(fs); /* always jump */
++ break;
++ }
++ case VJMP: {
++ pc = e->u.s.info;
++ break;
++ }
++ default: {
++ pc = jumponcond(fs, e, 1);
++ break;
++ }
++ }
++ luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */
++ luaK_patchtohere(fs, e->f);
++ e->f = NO_JUMP;
++}
++
++
++static void codenot (FuncState *fs, expdesc *e) {
++ luaK_dischargevars(fs, e);
++ switch (e->k) {
++ case VNIL: case VFALSE: {
++ e->k = VTRUE;
++ break;
++ }
++ case VK: case VKNUM: case VTRUE: {
++ e->k = VFALSE;
++ break;
++ }
++ case VJMP: {
++ invertjump(fs, e);
++ break;
++ }
++ case VRELOCABLE:
++ case VNONRELOC: {
++ discharge2anyreg(fs, e);
++ freeexp(fs, e);
++ e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0);
++ e->k = VRELOCABLE;
++ break;
++ }
++ default: {
++ lua_assert(0); /* cannot happen */
++ break;
++ }
++ }
++ /* interchange true and false lists */
++ { int temp = e->f; e->f = e->t; e->t = temp; }
++ removevalues(fs, e->f);
++ removevalues(fs, e->t);
++}
++
++
++void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
++ t->u.s.aux = luaK_exp2RK(fs, k);
++ t->k = VINDEXED;
++}
++
++
++static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
++ lua_Number v1, v2, r;
++ if (!isnumeral(e1) || !isnumeral(e2)) return 0;
++ v1 = e1->u.nval;
++ v2 = e2->u.nval;
++ switch (op) {
++ case OP_ADD: r = luai_numadd(v1, v2); break;
++ case OP_SUB: r = luai_numsub(v1, v2); break;
++ case OP_MUL: r = luai_nummul(v1, v2); break;
++ case OP_DIV:
++ if (v2 == 0) return 0; /* do not attempt to divide by 0 */
++ r = luai_numdiv(v1, v2); break;
++ case OP_MOD:
++ if (v2 == 0) return 0; /* do not attempt to divide by 0 */
++ r = luai_nummod(v1, v2); break;
++ case OP_POW: r = luai_numpow(v1, v2); break;
++ case OP_UNM: r = luai_numunm(v1); break;
++ case OP_LEN: return 0; /* no constant folding for 'len' */
++ default: lua_assert(0); r = 0; break;
++ }
++ if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
++ e1->u.nval = r;
++ return 1;
++}
++
++
++static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) {
++ if (constfolding(op, e1, e2))
++ return;
++ else {
++ int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;
++ int o1 = luaK_exp2RK(fs, e1);
++ if (o1 > o2) {
++ freeexp(fs, e1);
++ freeexp(fs, e2);
++ }
++ else {
++ freeexp(fs, e2);
++ freeexp(fs, e1);
++ }
++ e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2);
++ e1->k = VRELOCABLE;
++ }
++}
++
++
++static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
++ expdesc *e2) {
++ int o1 = luaK_exp2RK(fs, e1);
++ int o2 = luaK_exp2RK(fs, e2);
++ freeexp(fs, e2);
++ freeexp(fs, e1);
++ if (cond == 0 && op != OP_EQ) {
++ int temp; /* exchange args to replace by `<' or `<=' */
++ temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
++ cond = 1;
++ }
++ e1->u.s.info = condjump(fs, op, cond, o1, o2);
++ e1->k = VJMP;
++}
++
++
++void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
++ expdesc e2;
++ e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
++ switch (op) {
++ case OPR_MINUS: {
++ if (!isnumeral(e))
++ luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */
++ codearith(fs, OP_UNM, e, &e2);
++ break;
++ }
++ case OPR_NOT: codenot(fs, e); break;
++ case OPR_LEN: {
++ luaK_exp2anyreg(fs, e); /* cannot operate on constants */
++ codearith(fs, OP_LEN, e, &e2);
++ break;
++ }
++ default: lua_assert(0);
++ }
++}
++
++
++void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
++ switch (op) {
++ case OPR_AND: {
++ luaK_goiftrue(fs, v);
++ break;
++ }
++ case OPR_OR: {
++ luaK_goiffalse(fs, v);
++ break;
++ }
++ case OPR_CONCAT: {
++ luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */
++ break;
++ }
++ case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
++ case OPR_MOD: case OPR_POW: {
++ if (!isnumeral(v)) luaK_exp2RK(fs, v);
++ break;
++ }
++ default: {
++ luaK_exp2RK(fs, v);
++ break;
++ }
++ }
++}
++
++
++void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
++ switch (op) {
++ case OPR_AND: {
++ lua_assert(e1->t == NO_JUMP); /* list must be closed */
++ luaK_dischargevars(fs, e2);
++ luaK_concat(fs, &e2->f, e1->f);
++ *e1 = *e2;
++ break;
++ }
++ case OPR_OR: {
++ lua_assert(e1->f == NO_JUMP); /* list must be closed */
++ luaK_dischargevars(fs, e2);
++ luaK_concat(fs, &e2->t, e1->t);
++ *e1 = *e2;
++ break;
++ }
++ case OPR_CONCAT: {
++ luaK_exp2val(fs, e2);
++ if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
++ lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1);
++ freeexp(fs, e1);
++ SETARG_B(getcode(fs, e2), e1->u.s.info);
++ e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info;
++ }
++ else {
++ luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
++ codearith(fs, OP_CONCAT, e1, e2);
++ }
++ break;
++ }
++ case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break;
++ case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break;
++ case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break;
++ case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break;
++ case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break;
++ case OPR_POW: codearith(fs, OP_POW, e1, e2); break;
++ case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break;
++ case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break;
++ case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break;
++ case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break;
++ case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break;
++ case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break;
++ default: lua_assert(0);
++ }
++}
++
++
++void luaK_fixline (FuncState *fs, int line) {
++ fs->f->lineinfo[fs->pc - 1] = line;
++}
++
++
++static int luaK_code (FuncState *fs, Instruction i, int line) {
++ Proto *f = fs->f;
++ dischargejpc(fs); /* `pc' will change */
++ /* put new instruction in code array */
++ luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
++ MAX_INT, "code size overflow");
++ f->code[fs->pc] = i;
++ /* save corresponding line information */
++ luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
++ MAX_INT, "code size overflow");
++ f->lineinfo[fs->pc] = line;
++ return fs->pc++;
++}
++
++
++int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
++ lua_assert(getOpMode(o) == iABC);
++ lua_assert(getBMode(o) != OpArgN || b == 0);
++ lua_assert(getCMode(o) != OpArgN || c == 0);
++ return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline);
++}
++
++
++int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
++ lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
++ lua_assert(getCMode(o) == OpArgN);
++ return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline);
++}
++
++
++void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
++ int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
++ int b = (tostore == LUA_MULTRET) ? 0 : tostore;
++ lua_assert(tostore != 0);
++ if (c <= MAXARG_C)
++ luaK_codeABC(fs, OP_SETLIST, base, b, c);
++ else {
++ luaK_codeABC(fs, OP_SETLIST, base, b, 0);
++ luaK_code(fs, cast(Instruction, c), fs->ls->lastline);
++ }
++ fs->freereg = base + 1; /* free registers with list values */
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lcode.h
+@@ -0,0 +1,76 @@
++/*
++** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $
++** Code generator for Lua
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lcode_h
++#define lcode_h
++
++#include "llex.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lparser.h"
++
++
++/*
++** Marks the end of a patch list. It is an invalid value both as an absolute
++** address, and as a list link (would link an element to itself).
++*/
++#define NO_JUMP (-1)
++
++
++/*
++** grep "ORDER OPR" if you change these enums
++*/
++typedef enum BinOpr {
++ OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,
++ OPR_CONCAT,
++ OPR_NE, OPR_EQ,
++ OPR_LT, OPR_LE, OPR_GT, OPR_GE,
++ OPR_AND, OPR_OR,
++ OPR_NOBINOPR
++} BinOpr;
++
++
++typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
++
++
++#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info])
++
++#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
++
++#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
++
++LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
++LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
++LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
++LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
++LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);
++LUAI_FUNC void luaK_checkstack (FuncState *fs, int n);
++LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);
++LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r);
++LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);
++LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);
++LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);
++LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);
++LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);
++LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
++LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
++LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);
++LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);
++LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);
++LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e);
++LUAI_FUNC int luaK_jump (FuncState *fs);
++LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
++LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
++LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
++LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
++LUAI_FUNC int luaK_getlabel (FuncState *fs);
++LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);
++LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
++LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
++LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/ldebug.c
+@@ -0,0 +1,637 @@
++/*
++** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $
++** Debug Interface
++** See Copyright Notice in lua.h
++*/
++
++
++#include <stdarg.h>
++#include <stddef.h>
++#include <string.h>
++
++#define ldebug_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lapi.h"
++#include "lcode.h"
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++#include "lvm.h"
++
++
++
++static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
++
++
++static int currentpc (lua_State *L, CallInfo *ci) {
++ if (!isLua(ci)) return -1; /* function is not a Lua function? */
++ if (ci == L->ci)
++ ci->savedpc = L->savedpc;
++ return pcRel(ci->savedpc, ci_func(ci)->l.p);
++}
++
++
++static int currentline (lua_State *L, CallInfo *ci) {
++ int pc = currentpc(L, ci);
++ if (pc < 0)
++ return -1; /* only active lua functions have current-line information */
++ else
++ return getline(ci_func(ci)->l.p, pc);
++}
++
++
++/*
++** this function can be called asynchronous (e.g. during a signal)
++*/
++LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
++ if (func == NULL || mask == 0) { /* turn off hooks? */
++ mask = 0;
++ func = NULL;
++ }
++ L->hook = func;
++ L->basehookcount = count;
++ resethookcount(L);
++ L->hookmask = cast_byte(mask);
++ return 1;
++}
++
++
++LUA_API lua_Hook lua_gethook (lua_State *L) {
++ return L->hook;
++}
++
++
++LUA_API int lua_gethookmask (lua_State *L) {
++ return L->hookmask;
++}
++
++
++LUA_API int lua_gethookcount (lua_State *L) {
++ return L->basehookcount;
++}
++
++
++LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
++ int status;
++ CallInfo *ci;
++ lua_lock(L);
++ for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) {
++ level--;
++ if (f_isLua(ci)) /* Lua function? */
++ level -= ci->tailcalls; /* skip lost tail calls */
++ }
++ if (level == 0 && ci > L->base_ci) { /* level found? */
++ status = 1;
++ ar->i_ci = cast_int(ci - L->base_ci);
++ }
++ else if (level < 0) { /* level is of a lost tail call? */
++ status = 1;
++ ar->i_ci = 0;
++ }
++ else status = 0; /* no such level */
++ lua_unlock(L);
++ return status;
++}
++
++
++static Proto *getluaproto (CallInfo *ci) {
++ return (isLua(ci) ? ci_func(ci)->l.p : NULL);
++}
++
++
++static const char *findlocal (lua_State *L, CallInfo *ci, int n) {
++ const char *name;
++ Proto *fp = getluaproto(ci);
++ if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL)
++ return name; /* is a local variable in a Lua function */
++ else {
++ StkId limit = (ci == L->ci) ? L->top : (ci+1)->func;
++ if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */
++ return "(*temporary)";
++ else
++ return NULL;
++ }
++}
++
++
++LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
++ CallInfo *ci = L->base_ci + ar->i_ci;
++ const char *name = findlocal(L, ci, n);
++ lua_lock(L);
++ if (name)
++ luaA_pushobject(L, ci->base + (n - 1));
++ lua_unlock(L);
++ return name;
++}
++
++
++LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
++ CallInfo *ci = L->base_ci + ar->i_ci;
++ const char *name = findlocal(L, ci, n);
++ lua_lock(L);
++ if (name)
++ setobjs2s(L, ci->base + (n - 1), L->top - 1);
++ L->top--; /* pop value */
++ lua_unlock(L);
++ return name;
++}
++
++
++static void funcinfo (lua_Debug *ar, Closure *cl) {
++ if (cl->c.isC) {
++ ar->source = "=[C]";
++ ar->linedefined = -1;
++ ar->lastlinedefined = -1;
++ ar->what = "C";
++ }
++ else {
++ ar->source = getstr(cl->l.p->source);
++ ar->linedefined = cl->l.p->linedefined;
++ ar->lastlinedefined = cl->l.p->lastlinedefined;
++ ar->what = (ar->linedefined == 0) ? "main" : "Lua";
++ }
++ luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
++}
++
++
++static void info_tailcall (lua_Debug *ar) {
++ ar->name = ar->namewhat = "";
++ ar->what = "tail";
++ ar->lastlinedefined = ar->linedefined = ar->currentline = -1;
++ ar->source = "=(tail call)";
++ luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
++ ar->nups = 0;
++}
++
++
++static void collectvalidlines (lua_State *L, Closure *f) {
++ if (f == NULL || f->c.isC) {
++ setnilvalue(L->top);
++ }
++ else {
++ Table *t = luaH_new(L, 0, 0);
++ int *lineinfo = f->l.p->lineinfo;
++ int i;
++ for (i=0; i<f->l.p->sizelineinfo; i++)
++ setbvalue(luaH_setnum(L, t, lineinfo[i]), 1);
++ sethvalue(L, L->top, t);
++ }
++ incr_top(L);
++}
++
++
++static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
++ Closure *f, CallInfo *ci) {
++ int status = 1;
++ if (f == NULL) {
++ info_tailcall(ar);
++ return status;
++ }
++ for (; *what; what++) {
++ switch (*what) {
++ case 'S': {
++ funcinfo(ar, f);
++ break;
++ }
++ case 'l': {
++ ar->currentline = (ci) ? currentline(L, ci) : -1;
++ break;
++ }
++ case 'u': {
++ ar->nups = f->c.nupvalues;
++ break;
++ }
++ case 'n': {
++ ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL;
++ if (ar->namewhat == NULL) {
++ ar->namewhat = ""; /* not found */
++ ar->name = NULL;
++ }
++ break;
++ }
++ case 'L':
++ case 'f': /* handled by lua_getinfo */
++ break;
++ default: status = 0; /* invalid option */
++ }
++ }
++ return status;
++}
++
++
++LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
++ int status;
++ Closure *f = NULL;
++ CallInfo *ci = NULL;
++ lua_lock(L);
++ if (*what == '>') {
++ StkId func = L->top - 1;
++ luai_apicheck(L, ttisfunction(func));
++ what++; /* skip the '>' */
++ f = clvalue(func);
++ L->top--; /* pop function */
++ }
++ else if (ar->i_ci != 0) { /* no tail call? */
++ ci = L->base_ci + ar->i_ci;
++ lua_assert(ttisfunction(ci->func));
++ f = clvalue(ci->func);
++ }
++ status = auxgetinfo(L, what, ar, f, ci);
++ if (strchr(what, 'f')) {
++ if (f == NULL) setnilvalue(L->top);
++ else setclvalue(L, L->top, f);
++ incr_top(L);
++ }
++ if (strchr(what, 'L'))
++ collectvalidlines(L, f);
++ lua_unlock(L);
++ return status;
++}
++
++
++/*
++** {======================================================
++** Symbolic Execution and code checker
++** =======================================================
++*/
++
++#define check(x) if (!(x)) return 0;
++
++#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode)
++
++#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize)
++
++
++
++static int precheck (const Proto *pt) {
++ check(pt->maxstacksize <= MAXSTACK);
++ check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize);
++ check(!(pt->is_vararg & VARARG_NEEDSARG) ||
++ (pt->is_vararg & VARARG_HASARG));
++ check(pt->sizeupvalues <= pt->nups);
++ check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0);
++ check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN);
++ return 1;
++}
++
++
++#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1])
++
++int luaG_checkopenop (Instruction i) {
++ switch (GET_OPCODE(i)) {
++ case OP_CALL:
++ case OP_TAILCALL:
++ case OP_RETURN:
++ case OP_SETLIST: {
++ check(GETARG_B(i) == 0);
++ return 1;
++ }
++ default: return 0; /* invalid instruction after an open call */
++ }
++}
++
++
++static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) {
++ switch (mode) {
++ case OpArgN: check(r == 0); break;
++ case OpArgU: break;
++ case OpArgR: checkreg(pt, r); break;
++ case OpArgK:
++ check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize);
++ break;
++ }
++ return 1;
++}
++
++
++static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
++ int pc;
++ int last; /* stores position of last instruction that changed `reg' */
++ last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */
++ check(precheck(pt));
++ for (pc = 0; pc < lastpc; pc++) {
++ Instruction i = pt->code[pc];
++ OpCode op = GET_OPCODE(i);
++ int a = GETARG_A(i);
++ int b = 0;
++ int c = 0;
++ check(op < NUM_OPCODES);
++ checkreg(pt, a);
++ switch (getOpMode(op)) {
++ case iABC: {
++ b = GETARG_B(i);
++ c = GETARG_C(i);
++ check(checkArgMode(pt, b, getBMode(op)));
++ check(checkArgMode(pt, c, getCMode(op)));
++ break;
++ }
++ case iABx: {
++ b = GETARG_Bx(i);
++ if (getBMode(op) == OpArgK) check(b < pt->sizek);
++ break;
++ }
++ case iAsBx: {
++ b = GETARG_sBx(i);
++ if (getBMode(op) == OpArgR) {
++ int dest = pc+1+b;
++ check(0 <= dest && dest < pt->sizecode);
++ if (dest > 0) {
++ int j;
++ /* check that it does not jump to a setlist count; this
++ is tricky, because the count from a previous setlist may
++ have the same value of an invalid setlist; so, we must
++ go all the way back to the first of them (if any) */
++ for (j = 0; j < dest; j++) {
++ Instruction d = pt->code[dest-1-j];
++ if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break;
++ }
++ /* if 'j' is even, previous value is not a setlist (even if
++ it looks like one) */
++ check((j&1) == 0);
++ }
++ }
++ break;
++ }
++ }
++ if (testAMode(op)) {
++ if (a == reg) last = pc; /* change register `a' */
++ }
++ if (testTMode(op)) {
++ check(pc+2 < pt->sizecode); /* check skip */
++ check(GET_OPCODE(pt->code[pc+1]) == OP_JMP);
++ }
++ switch (op) {
++ case OP_LOADBOOL: {
++ if (c == 1) { /* does it jump? */
++ check(pc+2 < pt->sizecode); /* check its jump */
++ check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST ||
++ GETARG_C(pt->code[pc+1]) != 0);
++ }
++ break;
++ }
++ case OP_LOADNIL: {
++ if (a <= reg && reg <= b)
++ last = pc; /* set registers from `a' to `b' */
++ break;
++ }
++ case OP_GETUPVAL:
++ case OP_SETUPVAL: {
++ check(b < pt->nups);
++ break;
++ }
++ case OP_GETGLOBAL:
++ case OP_SETGLOBAL: {
++ check(ttisstring(&pt->k[b]));
++ break;
++ }
++ case OP_SELF: {
++ checkreg(pt, a+1);
++ if (reg == a+1) last = pc;
++ break;
++ }
++ case OP_CONCAT: {
++ check(b < c); /* at least two operands */
++ break;
++ }
++ case OP_TFORLOOP: {
++ check(c >= 1); /* at least one result (control variable) */
++ checkreg(pt, a+2+c); /* space for results */
++ if (reg >= a+2) last = pc; /* affect all regs above its base */
++ break;
++ }
++ case OP_FORLOOP:
++ case OP_FORPREP:
++ checkreg(pt, a+3);
++ /* go through */
++ case OP_JMP: {
++ int dest = pc+1+b;
++ /* not full check and jump is forward and do not skip `lastpc'? */
++ if (reg != NO_REG && pc < dest && dest <= lastpc)
++ pc += b; /* do the jump */
++ break;
++ }
++ case OP_CALL:
++ case OP_TAILCALL: {
++ if (b != 0) {
++ checkreg(pt, a+b-1);
++ }
++ c--; /* c = num. returns */
++ if (c == LUA_MULTRET) {
++ check(checkopenop(pt, pc));
++ }
++ else if (c != 0)
++ checkreg(pt, a+c-1);
++ if (reg >= a) last = pc; /* affect all registers above base */
++ break;
++ }
++ case OP_RETURN: {
++ b--; /* b = num. returns */
++ if (b > 0) checkreg(pt, a+b-1);
++ break;
++ }
++ case OP_SETLIST: {
++ if (b > 0) checkreg(pt, a + b);
++ if (c == 0) {
++ pc++;
++ check(pc < pt->sizecode - 1);
++ }
++ break;
++ }
++ case OP_CLOSURE: {
++ int nup, j;
++ check(b < pt->sizep);
++ nup = pt->p[b]->nups;
++ check(pc + nup < pt->sizecode);
++ for (j = 1; j <= nup; j++) {
++ OpCode op1 = GET_OPCODE(pt->code[pc + j]);
++ check(op1 == OP_GETUPVAL || op1 == OP_MOVE);
++ }
++ if (reg != NO_REG) /* tracing? */
++ pc += nup; /* do not 'execute' these pseudo-instructions */
++ break;
++ }
++ case OP_VARARG: {
++ check((pt->is_vararg & VARARG_ISVARARG) &&
++ !(pt->is_vararg & VARARG_NEEDSARG));
++ b--;
++ if (b == LUA_MULTRET) check(checkopenop(pt, pc));
++ checkreg(pt, a+b-1);
++ break;
++ }
++ default: break;
++ }
++ }
++ return pt->code[last];
++}
++
++#undef check
++#undef checkjump
++#undef checkreg
++
++/* }====================================================== */
++
++
++int luaG_checkcode (const Proto *pt) {
++ return (symbexec(pt, pt->sizecode, NO_REG) != 0);
++}
++
++
++static const char *kname (Proto *p, int c) {
++ if (ISK(c) && ttisstring(&p->k[INDEXK(c)]))
++ return svalue(&p->k[INDEXK(c)]);
++ else
++ return "?";
++}
++
++
++static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos,
++ const char **name) {
++ if (isLua(ci)) { /* a Lua function? */
++ Proto *p = ci_func(ci)->l.p;
++ int pc = currentpc(L, ci);
++ Instruction i;
++ *name = luaF_getlocalname(p, stackpos+1, pc);
++ if (*name) /* is a local? */
++ return "local";
++ i = symbexec(p, pc, stackpos); /* try symbolic execution */
++ lua_assert(pc != -1);
++ switch (GET_OPCODE(i)) {
++ case OP_GETGLOBAL: {
++ int g = GETARG_Bx(i); /* global index */
++ lua_assert(ttisstring(&p->k[g]));
++ *name = svalue(&p->k[g]);
++ return "global";
++ }
++ case OP_MOVE: {
++ int a = GETARG_A(i);
++ int b = GETARG_B(i); /* move from `b' to `a' */
++ if (b < a)
++ return getobjname(L, ci, b, name); /* get name for `b' */
++ break;
++ }
++ case OP_GETTABLE: {
++ int k = GETARG_C(i); /* key index */
++ *name = kname(p, k);
++ return "field";
++ }
++ case OP_GETUPVAL: {
++ int u = GETARG_B(i); /* upvalue index */
++ *name = p->upvalues ? getstr(p->upvalues[u]) : "?";
++ return "upvalue";
++ }
++ case OP_SELF: {
++ int k = GETARG_C(i); /* key index */
++ *name = kname(p, k);
++ return "method";
++ }
++ default: break;
++ }
++ }
++ return NULL; /* no useful name found */
++}
++
++
++static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
++ Instruction i;
++ if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1))
++ return NULL; /* calling function is not Lua (or is unknown) */
++ ci--; /* calling function */
++ i = ci_func(ci)->l.p->code[currentpc(L, ci)];
++ if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL ||
++ GET_OPCODE(i) == OP_TFORLOOP)
++ return getobjname(L, ci, GETARG_A(i), name);
++ else
++ return NULL; /* no useful name can be found */
++}
++
++
++/* only ANSI way to check whether a pointer points to an array */
++static int isinstack (CallInfo *ci, const TValue *o) {
++ StkId p;
++ for (p = ci->base; p < ci->top; p++)
++ if (o == p) return 1;
++ return 0;
++}
++
++
++void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
++ const char *name = NULL;
++ const char *t = luaT_typenames[ttype(o)];
++ const char *kind = (isinstack(L->ci, o)) ?
++ getobjname(L, L->ci, cast_int(o - L->base), &name) :
++ NULL;
++ if (kind)
++ luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
++ op, kind, name, t);
++ else
++ luaG_runerror(L, "attempt to %s a %s value", op, t);
++}
++
++
++void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
++ if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
++ lua_assert(!ttisstring(p1) && !ttisnumber(p1));
++ luaG_typeerror(L, p1, "concatenate");
++}
++
++
++void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
++ TValue temp;
++ if (luaV_tonumber(p1, &temp) == NULL)
++ p2 = p1; /* first operand is wrong */
++ luaG_typeerror(L, p2, "perform arithmetic on");
++}
++
++
++int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
++ const char *t1 = luaT_typenames[ttype(p1)];
++ const char *t2 = luaT_typenames[ttype(p2)];
++ if (t1[2] == t2[2])
++ luaG_runerror(L, "attempt to compare two %s values", t1);
++ else
++ luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
++ return 0;
++}
++
++
++static void addinfo (lua_State *L, const char *msg) {
++ CallInfo *ci = L->ci;
++ if (isLua(ci)) { /* is Lua code? */
++ char buff[LUA_IDSIZE]; /* add file:line information */
++ int line = currentline(L, ci);
++ luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE);
++ luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
++ }
++}
++
++
++void luaG_errormsg (lua_State *L) {
++ if (L->errfunc != 0) { /* is there an error handling function? */
++ StkId errfunc = restorestack(L, L->errfunc);
++ if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
++ setobjs2s(L, L->top, L->top - 1); /* move argument */
++ setobjs2s(L, L->top - 1, errfunc); /* push function */
++ incr_top(L);
++ luaD_call(L, L->top - 2, 1); /* call it */
++ }
++ luaD_throw(L, LUA_ERRRUN);
++}
++
++
++void luaG_runerror (lua_State *L, const char *fmt, ...) {
++ va_list argp;
++ va_start(argp, fmt);
++ addinfo(L, luaO_pushvfstring(L, fmt, argp));
++ va_end(argp);
++ luaG_errormsg(L);
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/ldebug.h
+@@ -0,0 +1,33 @@
++/*
++** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $
++** Auxiliary functions from Debug Interface module
++** See Copyright Notice in lua.h
++*/
++
++#ifndef ldebug_h
++#define ldebug_h
++
++
++#include "lstate.h"
++
++
++#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
++
++#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
++
++#define resethookcount(L) (L->hookcount = L->basehookcount)
++
++
++LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o,
++ const char *opname);
++LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2);
++LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1,
++ const TValue *p2);
++LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1,
++ const TValue *p2);
++LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...);
++LUAI_FUNC void luaG_errormsg (lua_State *L);
++LUAI_FUNC int luaG_checkcode (const Proto *pt);
++LUAI_FUNC int luaG_checkopenop (Instruction i);
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/ldo.c
+@@ -0,0 +1,515 @@
++/*
++** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $
++** Stack and Call structure of Lua
++** See Copyright Notice in lua.h
++*/
++
++#include <setjmp.h>
++#include <stdlib.h>
++#include <string.h>
++
++#define ldo_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lgc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lparser.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++#include "lundump.h"
++#include "lvm.h"
++#include "lzio.h"
++
++
++
++/*
++** {======================================================
++** Error-recovery functions
++** =======================================================
++*/
++
++
++/* chain list of long jump buffers */
++struct lua_longjmp {
++ struct lua_longjmp *previous;
++ luai_jmpbuf b;
++ volatile int status; /* error code */
++};
++
++
++void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {
++ switch (errcode) {
++ case LUA_ERRMEM: {
++ setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG));
++ break;
++ }
++ case LUA_ERRERR: {
++ setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
++ break;
++ }
++ case LUA_ERRSYNTAX:
++ case LUA_ERRRUN: {
++ setobjs2s(L, oldtop, L->top - 1); /* error message on current top */
++ break;
++ }
++ }
++ L->top = oldtop + 1;
++}
++
++
++static void restore_stack_limit (lua_State *L) {
++ lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);
++ if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */
++ int inuse = cast_int(L->ci - L->base_ci);
++ if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */
++ luaD_reallocCI(L, LUAI_MAXCALLS);
++ }
++}
++
++
++static void resetstack (lua_State *L, int status) {
++ L->ci = L->base_ci;
++ L->base = L->ci->base;
++ luaF_close(L, L->base); /* close eventual pending closures */
++ luaD_seterrorobj(L, status, L->base);
++ L->nCcalls = L->baseCcalls;
++ L->allowhook = 1;
++ restore_stack_limit(L);
++ L->errfunc = 0;
++ L->errorJmp = NULL;
++}
++
++
++void luaD_throw (lua_State *L, int errcode) {
++ if (L->errorJmp) {
++ L->errorJmp->status = errcode;
++ LUAI_THROW(L, L->errorJmp);
++ }
++ else {
++ L->status = cast_byte(errcode);
++ if (G(L)->panic) {
++ resetstack(L, errcode);
++ lua_unlock(L);
++ G(L)->panic(L);
++ }
++ exit(EXIT_FAILURE);
++ }
++}
++
++
++int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
++ struct lua_longjmp lj;
++ lj.status = 0;
++ lj.previous = L->errorJmp; /* chain new error handler */
++ L->errorJmp = &lj;
++ LUAI_TRY(L, &lj,
++ (*f)(L, ud);
++ );
++ L->errorJmp = lj.previous; /* restore old error handler */
++ return lj.status;
++}
++
++/* }====================================================== */
++
++
++static void correctstack (lua_State *L, TValue *oldstack) {
++ CallInfo *ci;
++ GCObject *up;
++ L->top = (L->top - oldstack) + L->stack;
++ for (up = L->openupval; up != NULL; up = up->gch.next)
++ gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;
++ for (ci = L->base_ci; ci <= L->ci; ci++) {
++ ci->top = (ci->top - oldstack) + L->stack;
++ ci->base = (ci->base - oldstack) + L->stack;
++ ci->func = (ci->func - oldstack) + L->stack;
++ }
++ L->base = (L->base - oldstack) + L->stack;
++}
++
++
++void luaD_reallocstack (lua_State *L, int newsize) {
++ TValue *oldstack = L->stack;
++ int realsize = newsize + 1 + EXTRA_STACK;
++ lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1);
++ luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue);
++ L->stacksize = realsize;
++ L->stack_last = L->stack+newsize;
++ correctstack(L, oldstack);
++}
++
++
++void luaD_reallocCI (lua_State *L, int newsize) {
++ CallInfo *oldci = L->base_ci;
++ luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo);
++ L->size_ci = newsize;
++ L->ci = (L->ci - oldci) + L->base_ci;
++ L->end_ci = L->base_ci + L->size_ci - 1;
++}
++
++
++void luaD_growstack (lua_State *L, int n) {
++ if (n <= L->stacksize) /* double size is enough? */
++ luaD_reallocstack(L, 2*L->stacksize);
++ else
++ luaD_reallocstack(L, L->stacksize + n);
++}
++
++
++static CallInfo *growCI (lua_State *L) {
++ if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */
++ luaD_throw(L, LUA_ERRERR);
++ else {
++ luaD_reallocCI(L, 2*L->size_ci);
++ if (L->size_ci > LUAI_MAXCALLS)
++ luaG_runerror(L, "stack overflow");
++ }
++ return ++L->ci;
++}
++
++
++void luaD_callhook (lua_State *L, int event, int line) {
++ lua_Hook hook = L->hook;
++ if (hook && L->allowhook) {
++ ptrdiff_t top = savestack(L, L->top);
++ ptrdiff_t ci_top = savestack(L, L->ci->top);
++ lua_Debug ar;
++ ar.event = event;
++ ar.currentline = line;
++ if (event == LUA_HOOKTAILRET)
++ ar.i_ci = 0; /* tail call; no debug information about it */
++ else
++ ar.i_ci = cast_int(L->ci - L->base_ci);
++ luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
++ L->ci->top = L->top + LUA_MINSTACK;
++ lua_assert(L->ci->top <= L->stack_last);
++ L->allowhook = 0; /* cannot call hooks inside a hook */
++ lua_unlock(L);
++ (*hook)(L, &ar);
++ lua_lock(L);
++ lua_assert(!L->allowhook);
++ L->allowhook = 1;
++ L->ci->top = restorestack(L, ci_top);
++ L->top = restorestack(L, top);
++ }
++}
++
++
++static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {
++ int i;
++ int nfixargs = p->numparams;
++ Table *htab = NULL;
++ StkId base, fixed;
++ for (; actual < nfixargs; ++actual)
++ setnilvalue(L->top++);
++#if defined(LUA_COMPAT_VARARG)
++ if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */
++ int nvar = actual - nfixargs; /* number of extra arguments */
++ lua_assert(p->is_vararg & VARARG_HASARG);
++ luaC_checkGC(L);
++ htab = luaH_new(L, nvar, 1); /* create `arg' table */
++ for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */
++ setobj2n(L, luaH_setnum(L, htab, i+1), L->top - nvar + i);
++ /* store counter in field `n' */
++ setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar));
++ }
++#endif
++ /* move fixed parameters to final position */
++ fixed = L->top - actual; /* first fixed argument */
++ base = L->top; /* final position of first argument */
++ for (i=0; i<nfixargs; i++) {
++ setobjs2s(L, L->top++, fixed+i);
++ setnilvalue(fixed+i);
++ }
++ /* add `arg' parameter */
++ if (htab) {
++ sethvalue(L, L->top++, htab);
++ lua_assert(iswhite(obj2gco(htab)));
++ }
++ return base;
++}
++
++
++static StkId tryfuncTM (lua_State *L, StkId func) {
++ const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
++ StkId p;
++ ptrdiff_t funcr = savestack(L, func);
++ if (!ttisfunction(tm))
++ luaG_typeerror(L, func, "call");
++ /* Open a hole inside the stack at `func' */
++ for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
++ incr_top(L);
++ func = restorestack(L, funcr); /* previous call may change stack */
++ setobj2s(L, func, tm); /* tag method is the new function to be called */
++ return func;
++}
++
++
++
++#define inc_ci(L) \
++ ((L->ci == L->end_ci) ? growCI(L) : \
++ (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci))
++
++
++int luaD_precall (lua_State *L, StkId func, int nresults) {
++ LClosure *cl;
++ ptrdiff_t funcr;
++ if (!ttisfunction(func)) /* `func' is not a function? */
++ func = tryfuncTM(L, func); /* check the `function' tag method */
++ funcr = savestack(L, func);
++ cl = &clvalue(func)->l;
++ L->ci->savedpc = L->savedpc;
++ if (!cl->isC) { /* Lua function? prepare its call */
++ CallInfo *ci;
++ StkId st, base;
++ Proto *p = cl->p;
++ luaD_checkstack(L, p->maxstacksize);
++ func = restorestack(L, funcr);
++ if (!p->is_vararg) { /* no varargs? */
++ base = func + 1;
++ if (L->top > base + p->numparams)
++ L->top = base + p->numparams;
++ }
++ else { /* vararg function */
++ int nargs = cast_int(L->top - func) - 1;
++ base = adjust_varargs(L, p, nargs);
++ func = restorestack(L, funcr); /* previous call may change the stack */
++ }
++ ci = inc_ci(L); /* now `enter' new function */
++ ci->func = func;
++ L->base = ci->base = base;
++ ci->top = L->base + p->maxstacksize;
++ lua_assert(ci->top <= L->stack_last);
++ L->savedpc = p->code; /* starting point */
++ ci->tailcalls = 0;
++ ci->nresults = nresults;
++ for (st = L->top; st < ci->top; st++)
++ setnilvalue(st);
++ L->top = ci->top;
++ if (L->hookmask & LUA_MASKCALL) {
++ L->savedpc++; /* hooks assume 'pc' is already incremented */
++ luaD_callhook(L, LUA_HOOKCALL, -1);
++ L->savedpc--; /* correct 'pc' */
++ }
++ return PCRLUA;
++ }
++ else { /* if is a C function, call it */
++ CallInfo *ci;
++ int n;
++ luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */
++ ci = inc_ci(L); /* now `enter' new function */
++ ci->func = restorestack(L, funcr);
++ L->base = ci->base = ci->func + 1;
++ ci->top = L->top + LUA_MINSTACK;
++ lua_assert(ci->top <= L->stack_last);
++ ci->nresults = nresults;
++ if (L->hookmask & LUA_MASKCALL)
++ luaD_callhook(L, LUA_HOOKCALL, -1);
++ lua_unlock(L);
++ n = (*curr_func(L)->c.f)(L); /* do the actual call */
++ lua_lock(L);
++ if (n < 0) /* yielding? */
++ return PCRYIELD;
++ else {
++ luaD_poscall(L, L->top - n);
++ return PCRC;
++ }
++ }
++}
++
++
++static StkId callrethooks (lua_State *L, StkId firstResult) {
++ ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */
++ luaD_callhook(L, LUA_HOOKRET, -1);
++ if (f_isLua(L->ci)) { /* Lua function? */
++ while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */
++ luaD_callhook(L, LUA_HOOKTAILRET, -1);
++ }
++ return restorestack(L, fr);
++}
++
++
++int luaD_poscall (lua_State *L, StkId firstResult) {
++ StkId res;
++ int wanted, i;
++ CallInfo *ci;
++ if (L->hookmask & LUA_MASKRET)
++ firstResult = callrethooks(L, firstResult);
++ ci = L->ci--;
++ res = ci->func; /* res == final position of 1st result */
++ wanted = ci->nresults;
++ L->base = (ci - 1)->base; /* restore base */
++ L->savedpc = (ci - 1)->savedpc; /* restore savedpc */
++ /* move results to correct place */
++ for (i = wanted; i != 0 && firstResult < L->top; i--)
++ setobjs2s(L, res++, firstResult++);
++ while (i-- > 0)
++ setnilvalue(res++);
++ L->top = res;
++ return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */
++}
++
++
++/*
++** Call a function (C or Lua). The function to be called is at *func.
++** The arguments are on the stack, right after the function.
++** When returns, all the results are on the stack, starting at the original
++** function position.
++*/
++void luaD_call (lua_State *L, StkId func, int nResults) {
++ if (++L->nCcalls >= LUAI_MAXCCALLS) {
++ if (L->nCcalls == LUAI_MAXCCALLS)
++ luaG_runerror(L, "C stack overflow");
++ else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
++ luaD_throw(L, LUA_ERRERR); /* error while handing stack error */
++ }
++ if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */
++ luaV_execute(L, 1); /* call it */
++ L->nCcalls--;
++ luaC_checkGC(L);
++}
++
++
++static void resume (lua_State *L, void *ud) {
++ StkId firstArg = cast(StkId, ud);
++ CallInfo *ci = L->ci;
++ if (L->status == 0) { /* start coroutine? */
++ lua_assert(ci == L->base_ci && firstArg > L->base);
++ if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)
++ return;
++ }
++ else { /* resuming from previous yield */
++ lua_assert(L->status == LUA_YIELD);
++ L->status = 0;
++ if (!f_isLua(ci)) { /* `common' yield? */
++ /* finish interrupted execution of `OP_CALL' */
++ lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
++ GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL);
++ if (luaD_poscall(L, firstArg)) /* complete it... */
++ L->top = L->ci->top; /* and correct top if not multiple results */
++ }
++ else /* yielded inside a hook: just continue its execution */
++ L->base = L->ci->base;
++ }
++ luaV_execute(L, cast_int(L->ci - L->base_ci));
++}
++
++
++static int resume_error (lua_State *L, const char *msg) {
++ L->top = L->ci->base;
++ setsvalue2s(L, L->top, luaS_new(L, msg));
++ incr_top(L);
++ lua_unlock(L);
++ return LUA_ERRRUN;
++}
++
++
++LUA_API int lua_resume (lua_State *L, int nargs) {
++ int status;
++ lua_lock(L);
++ if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
++ return resume_error(L, "cannot resume non-suspended coroutine");
++ if (L->nCcalls >= LUAI_MAXCCALLS)
++ return resume_error(L, "C stack overflow");
++ luai_userstateresume(L, nargs);
++ lua_assert(L->errfunc == 0);
++ L->baseCcalls = ++L->nCcalls;
++ status = luaD_rawrunprotected(L, resume, L->top - nargs);
++ if (status != 0) { /* error? */
++ L->status = cast_byte(status); /* mark thread as `dead' */
++ luaD_seterrorobj(L, status, L->top);
++ L->ci->top = L->top;
++ }
++ else {
++ lua_assert(L->nCcalls == L->baseCcalls);
++ status = L->status;
++ }
++ --L->nCcalls;
++ lua_unlock(L);
++ return status;
++}
++
++
++LUA_API int lua_yield (lua_State *L, int nresults) {
++ luai_userstateyield(L, nresults);
++ lua_lock(L);
++ if (L->nCcalls > L->baseCcalls)
++ luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
++ L->base = L->top - nresults; /* protect stack slots below */
++ L->status = LUA_YIELD;
++ lua_unlock(L);
++ return -1;
++}
++
++
++int luaD_pcall (lua_State *L, Pfunc func, void *u,
++ ptrdiff_t old_top, ptrdiff_t ef) {
++ int status;
++ unsigned short oldnCcalls = L->nCcalls;
++ ptrdiff_t old_ci = saveci(L, L->ci);
++ lu_byte old_allowhooks = L->allowhook;
++ ptrdiff_t old_errfunc = L->errfunc;
++ L->errfunc = ef;
++ status = luaD_rawrunprotected(L, func, u);
++ if (status != 0) { /* an error occurred? */
++ StkId oldtop = restorestack(L, old_top);
++ luaF_close(L, oldtop); /* close eventual pending closures */
++ luaD_seterrorobj(L, status, oldtop);
++ L->nCcalls = oldnCcalls;
++ L->ci = restoreci(L, old_ci);
++ L->base = L->ci->base;
++ L->savedpc = L->ci->savedpc;
++ L->allowhook = old_allowhooks;
++ restore_stack_limit(L);
++ }
++ L->errfunc = old_errfunc;
++ return status;
++}
++
++
++
++/*
++** Execute a protected parser.
++*/
++struct SParser { /* data to `f_parser' */
++ ZIO *z;
++ Mbuffer buff; /* buffer to be used by the scanner */
++ const char *name;
++};
++
++static void f_parser (lua_State *L, void *ud) {
++ int i;
++ Proto *tf;
++ Closure *cl;
++ struct SParser *p = cast(struct SParser *, ud);
++ int c = luaZ_lookahead(p->z);
++ luaC_checkGC(L);
++ tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
++ &p->buff, p->name);
++ cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
++ cl->l.p = tf;
++ for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */
++ cl->l.upvals[i] = luaF_newupval(L);
++ setclvalue(L, L->top, cl);
++ incr_top(L);
++}
++
++
++int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
++ struct SParser p;
++ int status;
++ p.z = z; p.name = name;
++ luaZ_initbuffer(L, &p.buff);
++ status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);
++ luaZ_freebuffer(L, &p.buff);
++ return status;
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/ldo.h
+@@ -0,0 +1,57 @@
++/*
++** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
++** Stack and Call structure of Lua
++** See Copyright Notice in lua.h
++*/
++
++#ifndef ldo_h
++#define ldo_h
++
++
++#include "lobject.h"
++#include "lstate.h"
++#include "lzio.h"
++
++
++#define luaD_checkstack(L,n) \
++ if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
++ luaD_growstack(L, n); \
++ else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
++
++
++#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
++
++#define savestack(L,p) ((char *)(p) - (char *)L->stack)
++#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
++
++#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
++#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
++
++
++/* results from luaD_precall */
++#define PCRLUA 0 /* initiated a call to a Lua function */
++#define PCRC 1 /* did a call to a C function */
++#define PCRYIELD 2 /* C funtion yielded */
++
++
++/* type of protected functions, to be ran by `runprotected' */
++typedef void (*Pfunc) (lua_State *L, void *ud);
++
++LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
++LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
++LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
++LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
++LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
++ ptrdiff_t oldtop, ptrdiff_t ef);
++LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
++LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
++LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
++LUAI_FUNC void luaD_growstack (lua_State *L, int n);
++
++LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
++LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
++
++LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
++
++#endif
++
+--- /dev/null
++++ b/extensions/LUA/lua/ldump.c
+@@ -0,0 +1,164 @@
++/*
++** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
++** save precompiled Lua chunks
++** See Copyright Notice in lua.h
++*/
++
++#include <stddef.h>
++
++#define ldump_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lobject.h"
++#include "lstate.h"
++#include "lundump.h"
++
++typedef struct {
++ lua_State* L;
++ lua_Writer writer;
++ void* data;
++ int strip;
++ int status;
++} DumpState;
++
++#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D)
++#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D)
++
++static void DumpBlock(const void* b, size_t size, DumpState* D)
++{
++ if (D->status==0)
++ {
++ lua_unlock(D->L);
++ D->status=(*D->writer)(D->L,b,size,D->data);
++ lua_lock(D->L);
++ }
++}
++
++static void DumpChar(int y, DumpState* D)
++{
++ char x=(char)y;
++ DumpVar(x,D);
++}
++
++static void DumpInt(int x, DumpState* D)
++{
++ DumpVar(x,D);
++}
++
++static void DumpNumber(lua_Number x, DumpState* D)
++{
++ DumpVar(x,D);
++}
++
++static void DumpVector(const void* b, int n, size_t size, DumpState* D)
++{
++ DumpInt(n,D);
++ DumpMem(b,n,size,D);
++}
++
++static void DumpString(const TString* s, DumpState* D)
++{
++ if (s==NULL || getstr(s)==NULL)
++ {
++ size_t size=0;
++ DumpVar(size,D);
++ }
++ else
++ {
++ size_t size=s->tsv.len+1; /* include trailing '\0' */
++ DumpVar(size,D);
++ DumpBlock(getstr(s),size,D);
++ }
++}
++
++#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D)
++
++static void DumpFunction(const Proto* f, const TString* p, DumpState* D);
++
++static void DumpConstants(const Proto* f, DumpState* D)
++{
++ int i,n=f->sizek;
++ DumpInt(n,D);
++ for (i=0; i<n; i++)
++ {
++ const TValue* o=&f->k[i];
++ DumpChar(ttype(o),D);
++ switch (ttype(o))
++ {
++ case LUA_TNIL:
++ break;
++ case LUA_TBOOLEAN:
++ DumpChar(bvalue(o),D);
++ break;
++ case LUA_TNUMBER:
++ DumpNumber(nvalue(o),D);
++ break;
++ case LUA_TSTRING:
++ DumpString(rawtsvalue(o),D);
++ break;
++ default:
++ lua_assert(0); /* cannot happen */
++ break;
++ }
++ }
++ n=f->sizep;
++ DumpInt(n,D);
++ for (i=0; i<n; i++) DumpFunction(f->p[i],f->source,D);
++}
++
++static void DumpDebug(const Proto* f, DumpState* D)
++{
++ int i,n;
++ n= (D->strip) ? 0 : f->sizelineinfo;
++ DumpVector(f->lineinfo,n,sizeof(int),D);
++ n= (D->strip) ? 0 : f->sizelocvars;
++ DumpInt(n,D);
++ for (i=0; i<n; i++)
++ {
++ DumpString(f->locvars[i].varname,D);
++ DumpInt(f->locvars[i].startpc,D);
++ DumpInt(f->locvars[i].endpc,D);
++ }
++ n= (D->strip) ? 0 : f->sizeupvalues;
++ DumpInt(n,D);
++ for (i=0; i<n; i++) DumpString(f->upvalues[i],D);
++}
++
++static void DumpFunction(const Proto* f, const TString* p, DumpState* D)
++{
++ DumpString((f->source==p || D->strip) ? NULL : f->source,D);
++ DumpInt(f->linedefined,D);
++ DumpInt(f->lastlinedefined,D);
++ DumpChar(f->nups,D);
++ DumpChar(f->numparams,D);
++ DumpChar(f->is_vararg,D);
++ DumpChar(f->maxstacksize,D);
++ DumpCode(f,D);
++ DumpConstants(f,D);
++ DumpDebug(f,D);
++}
++
++static void DumpHeader(DumpState* D)
++{
++ char h[LUAC_HEADERSIZE];
++ luaU_header(h);
++ DumpBlock(h,LUAC_HEADERSIZE,D);
++}
++
++/*
++** dump Lua function as precompiled chunk
++*/
++int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)
++{
++ DumpState D;
++ D.L=L;
++ D.writer=w;
++ D.data=data;
++ D.strip=strip;
++ D.status=0;
++ DumpHeader(&D);
++ DumpFunction(f,NULL,&D);
++ return D.status;
++}
+--- /dev/null
++++ b/extensions/LUA/lua/lfunc.c
+@@ -0,0 +1,174 @@
++/*
++** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $
++** Auxiliary functions to manipulate prototypes and closures
++** See Copyright Notice in lua.h
++*/
++
++
++#include <stddef.h>
++
++#define lfunc_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lfunc.h"
++#include "lgc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++
++
++
++Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) {
++ Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems)));
++ luaC_link(L, obj2gco(c), LUA_TFUNCTION);
++ c->c.isC = 1;
++ c->c.env = e;
++ c->c.nupvalues = cast_byte(nelems);
++ return c;
++}
++
++
++Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) {
++ Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems)));
++ luaC_link(L, obj2gco(c), LUA_TFUNCTION);
++ c->l.isC = 0;
++ c->l.env = e;
++ c->l.nupvalues = cast_byte(nelems);
++ while (nelems--) c->l.upvals[nelems] = NULL;
++ return c;
++}
++
++
++UpVal *luaF_newupval (lua_State *L) {
++ UpVal *uv = luaM_new(L, UpVal);
++ luaC_link(L, obj2gco(uv), LUA_TUPVAL);
++ uv->v = &uv->u.value;
++ setnilvalue(uv->v);
++ return uv;
++}
++
++
++UpVal *luaF_findupval (lua_State *L, StkId level) {
++ global_State *g = G(L);
++ GCObject **pp = &L->openupval;
++ UpVal *p;
++ UpVal *uv;
++ while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) {
++ lua_assert(p->v != &p->u.value);
++ if (p->v == level) { /* found a corresponding upvalue? */
++ if (isdead(g, obj2gco(p))) /* is it dead? */
++ changewhite(obj2gco(p)); /* ressurect it */
++ return p;
++ }
++ pp = &p->next;
++ }
++ uv = luaM_new(L, UpVal); /* not found: create a new one */
++ uv->tt = LUA_TUPVAL;
++ uv->marked = luaC_white(g);
++ uv->v = level; /* current value lives in the stack */
++ uv->next = *pp; /* chain it in the proper position */
++ *pp = obj2gco(uv);
++ uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */
++ uv->u.l.next = g->uvhead.u.l.next;
++ uv->u.l.next->u.l.prev = uv;
++ g->uvhead.u.l.next = uv;
++ lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
++ return uv;
++}
++
++
++static void unlinkupval (UpVal *uv) {
++ lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
++ uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */
++ uv->u.l.prev->u.l.next = uv->u.l.next;
++}
++
++
++void luaF_freeupval (lua_State *L, UpVal *uv) {
++ if (uv->v != &uv->u.value) /* is it open? */
++ unlinkupval(uv); /* remove from open list */
++ luaM_free(L, uv); /* free upvalue */
++}
++
++
++void luaF_close (lua_State *L, StkId level) {
++ UpVal *uv;
++ global_State *g = G(L);
++ while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) {
++ GCObject *o = obj2gco(uv);
++ lua_assert(!isblack(o) && uv->v != &uv->u.value);
++ L->openupval = uv->next; /* remove from `open' list */
++ if (isdead(g, o))
++ luaF_freeupval(L, uv); /* free upvalue */
++ else {
++ unlinkupval(uv);
++ setobj(L, &uv->u.value, uv->v);
++ uv->v = &uv->u.value; /* now current value lives here */
++ luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */
++ }
++ }
++}
++
++
++Proto *luaF_newproto (lua_State *L) {
++ Proto *f = luaM_new(L, Proto);
++ luaC_link(L, obj2gco(f), LUA_TPROTO);
++ f->k = NULL;
++ f->sizek = 0;
++ f->p = NULL;
++ f->sizep = 0;
++ f->code = NULL;
++ f->sizecode = 0;
++ f->sizelineinfo = 0;
++ f->sizeupvalues = 0;
++ f->nups = 0;
++ f->upvalues = NULL;
++ f->numparams = 0;
++ f->is_vararg = 0;
++ f->maxstacksize = 0;
++ f->lineinfo = NULL;
++ f->sizelocvars = 0;
++ f->locvars = NULL;
++ f->linedefined = 0;
++ f->lastlinedefined = 0;
++ f->source = NULL;
++ return f;
++}
++
++
++void luaF_freeproto (lua_State *L, Proto *f) {
++ luaM_freearray(L, f->code, f->sizecode, Instruction);
++ luaM_freearray(L, f->p, f->sizep, Proto *);
++ luaM_freearray(L, f->k, f->sizek, TValue);
++ luaM_freearray(L, f->lineinfo, f->sizelineinfo, int);
++ luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar);
++ luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *);
++ luaM_free(L, f);
++}
++
++
++void luaF_freeclosure (lua_State *L, Closure *c) {
++ int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) :
++ sizeLclosure(c->l.nupvalues);
++ luaM_freemem(L, c, size);
++}
++
++
++/*
++** Look for n-th local variable at line `line' in function `func'.
++** Returns NULL if not found.
++*/
++const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
++ int i;
++ for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {
++ if (pc < f->locvars[i].endpc) { /* is variable active? */
++ local_number--;
++ if (local_number == 0)
++ return getstr(f->locvars[i].varname);
++ }
++ }
++ return NULL; /* not found */
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lfunc.h
+@@ -0,0 +1,34 @@
++/*
++** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $
++** Auxiliary functions to manipulate prototypes and closures
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lfunc_h
++#define lfunc_h
++
++
++#include "lobject.h"
++
++
++#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
++ cast(int, sizeof(TValue)*((n)-1)))
++
++#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
++ cast(int, sizeof(TValue *)*((n)-1)))
++
++
++LUAI_FUNC Proto *luaF_newproto (lua_State *L);
++LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
++LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
++LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
++LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
++LUAI_FUNC void luaF_close (lua_State *L, StkId level);
++LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
++LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c);
++LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);
++LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
++ int pc);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lgc.c
+@@ -0,0 +1,711 @@
++/*
++** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $
++** Garbage Collector
++** See Copyright Notice in lua.h
++*/
++
++#include <string.h>
++
++#define lgc_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lgc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++
++
++#define GCSTEPSIZE 1024u
++#define GCSWEEPMAX 40
++#define GCSWEEPCOST 10
++#define GCFINALIZECOST 100
++
++
++#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS))
++
++#define makewhite(g,x) \
++ ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g)))
++
++#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
++#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT)
++
++#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT)
++
++
++#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT)
++#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT)
++
++
++#define KEYWEAK bitmask(KEYWEAKBIT)
++#define VALUEWEAK bitmask(VALUEWEAKBIT)
++
++
++
++#define markvalue(g,o) { checkconsistency(o); \
++ if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); }
++
++#define markobject(g,t) { if (iswhite(obj2gco(t))) \
++ reallymarkobject(g, obj2gco(t)); }
++
++
++#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause)
++
++
++static void removeentry (Node *n) {
++ lua_assert(ttisnil(gval(n)));
++ if (iscollectable(gkey(n)))
++ setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */
++}
++
++
++static void reallymarkobject (global_State *g, GCObject *o) {
++ lua_assert(iswhite(o) && !isdead(g, o));
++ white2gray(o);
++ switch (o->gch.tt) {
++ case LUA_TSTRING: {
++ return;
++ }
++ case LUA_TUSERDATA: {
++ Table *mt = gco2u(o)->metatable;
++ gray2black(o); /* udata are never gray */
++ if (mt) markobject(g, mt);
++ markobject(g, gco2u(o)->env);
++ return;
++ }
++ case LUA_TUPVAL: {
++ UpVal *uv = gco2uv(o);
++ markvalue(g, uv->v);
++ if (uv->v == &uv->u.value) /* closed? */
++ gray2black(o); /* open upvalues are never black */
++ return;
++ }
++ case LUA_TFUNCTION: {
++ gco2cl(o)->c.gclist = g->gray;
++ g->gray = o;
++ break;
++ }
++ case LUA_TTABLE: {
++ gco2h(o)->gclist = g->gray;
++ g->gray = o;
++ break;
++ }
++ case LUA_TTHREAD: {
++ gco2th(o)->gclist = g->gray;
++ g->gray = o;
++ break;
++ }
++ case LUA_TPROTO: {
++ gco2p(o)->gclist = g->gray;
++ g->gray = o;
++ break;
++ }
++ default: lua_assert(0);
++ }
++}
++
++
++static void marktmu (global_State *g) {
++ GCObject *u = g->tmudata;
++ if (u) {
++ do {
++ u = u->gch.next;
++ makewhite(g, u); /* may be marked, if left from previous GC */
++ reallymarkobject(g, u);
++ } while (u != g->tmudata);
++ }
++}
++
++
++/* move `dead' udata that need finalization to list `tmudata' */
++size_t luaC_separateudata (lua_State *L, int all) {
++ global_State *g = G(L);
++ size_t deadmem = 0;
++ GCObject **p = &g->mainthread->next;
++ GCObject *curr;
++ while ((curr = *p) != NULL) {
++ if (!(iswhite(curr) || all) || isfinalized(gco2u(curr)))
++ p = &curr->gch.next; /* don't bother with them */
++ else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) {
++ markfinalized(gco2u(curr)); /* don't need finalization */
++ p = &curr->gch.next;
++ }
++ else { /* must call its gc method */
++ deadmem += sizeudata(gco2u(curr));
++ markfinalized(gco2u(curr));
++ *p = curr->gch.next;
++ /* link `curr' at the end of `tmudata' list */
++ if (g->tmudata == NULL) /* list is empty? */
++ g->tmudata = curr->gch.next = curr; /* creates a circular list */
++ else {
++ curr->gch.next = g->tmudata->gch.next;
++ g->tmudata->gch.next = curr;
++ g->tmudata = curr;
++ }
++ }
++ }
++ return deadmem;
++}
++
++
++static int traversetable (global_State *g, Table *h) {
++ int i;
++ int weakkey = 0;
++ int weakvalue = 0;
++ const TValue *mode;
++ if (h->metatable)
++ markobject(g, h->metatable);
++ mode = gfasttm(g, h->metatable, TM_MODE);
++ if (mode && ttisstring(mode)) { /* is there a weak mode? */
++ weakkey = (strchr(svalue(mode), 'k') != NULL);
++ weakvalue = (strchr(svalue(mode), 'v') != NULL);
++ if (weakkey || weakvalue) { /* is really weak? */
++ h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */
++ h->marked |= cast_byte((weakkey << KEYWEAKBIT) |
++ (weakvalue << VALUEWEAKBIT));
++ h->gclist = g->weak; /* must be cleared after GC, ... */
++ g->weak = obj2gco(h); /* ... so put in the appropriate list */
++ }
++ }
++ if (weakkey && weakvalue) return 1;
++ if (!weakvalue) {
++ i = h->sizearray;
++ while (i--)
++ markvalue(g, &h->array[i]);
++ }
++ i = sizenode(h);
++ while (i--) {
++ Node *n = gnode(h, i);
++ lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n)));
++ if (ttisnil(gval(n)))
++ removeentry(n); /* remove empty entries */
++ else {
++ lua_assert(!ttisnil(gkey(n)));
++ if (!weakkey) markvalue(g, gkey(n));
++ if (!weakvalue) markvalue(g, gval(n));
++ }
++ }
++ return weakkey || weakvalue;
++}
++
++
++/*
++** All marks are conditional because a GC may happen while the
++** prototype is still being created
++*/
++static void traverseproto (global_State *g, Proto *f) {
++ int i;
++ if (f->source) stringmark(f->source);
++ for (i=0; i<f->sizek; i++) /* mark literals */
++ markvalue(g, &f->k[i]);
++ for (i=0; i<f->sizeupvalues; i++) { /* mark upvalue names */
++ if (f->upvalues[i])
++ stringmark(f->upvalues[i]);
++ }
++ for (i=0; i<f->sizep; i++) { /* mark nested protos */
++ if (f->p[i])
++ markobject(g, f->p[i]);
++ }
++ for (i=0; i<f->sizelocvars; i++) { /* mark local-variable names */
++ if (f->locvars[i].varname)
++ stringmark(f->locvars[i].varname);
++ }
++}
++
++
++
++static void traverseclosure (global_State *g, Closure *cl) {
++ markobject(g, cl->c.env);
++ if (cl->c.isC) {
++ int i;
++ for (i=0; i<cl->c.nupvalues; i++) /* mark its upvalues */
++ markvalue(g, &cl->c.upvalue[i]);
++ }
++ else {
++ int i;
++ lua_assert(cl->l.nupvalues == cl->l.p->nups);
++ markobject(g, cl->l.p);
++ for (i=0; i<cl->l.nupvalues; i++) /* mark its upvalues */
++ markobject(g, cl->l.upvals[i]);
++ }
++}
++
++
++static void checkstacksizes (lua_State *L, StkId max) {
++ int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */
++ int s_used = cast_int(max - L->stack); /* part of stack in use */
++ if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */
++ return; /* do not touch the stacks */
++ if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci)
++ luaD_reallocCI(L, L->size_ci/2); /* still big enough... */
++ condhardstacktests(luaD_reallocCI(L, ci_used + 1));
++ if (4*s_used < L->stacksize &&
++ 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize)
++ luaD_reallocstack(L, L->stacksize/2); /* still big enough... */
++ condhardstacktests(luaD_reallocstack(L, s_used));
++}
++
++
++static void traversestack (global_State *g, lua_State *l) {
++ StkId o, lim;
++ CallInfo *ci;
++ markvalue(g, gt(l));
++ lim = l->top;
++ for (ci = l->base_ci; ci <= l->ci; ci++) {
++ lua_assert(ci->top <= l->stack_last);
++ if (lim < ci->top) lim = ci->top;
++ }
++ for (o = l->stack; o < l->top; o++)
++ markvalue(g, o);
++ for (; o <= lim; o++)
++ setnilvalue(o);
++ checkstacksizes(l, lim);
++}
++
++
++/*
++** traverse one gray object, turning it to black.
++** Returns `quantity' traversed.
++*/
++static l_mem propagatemark (global_State *g) {
++ GCObject *o = g->gray;
++ lua_assert(isgray(o));
++ gray2black(o);
++ switch (o->gch.tt) {
++ case LUA_TTABLE: {
++ Table *h = gco2h(o);
++ g->gray = h->gclist;
++ if (traversetable(g, h)) /* table is weak? */
++ black2gray(o); /* keep it gray */
++ return sizeof(Table) + sizeof(TValue) * h->sizearray +
++ sizeof(Node) * sizenode(h);
++ }
++ case LUA_TFUNCTION: {
++ Closure *cl = gco2cl(o);
++ g->gray = cl->c.gclist;
++ traverseclosure(g, cl);
++ return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
++ sizeLclosure(cl->l.nupvalues);
++ }
++ case LUA_TTHREAD: {
++ lua_State *th = gco2th(o);
++ g->gray = th->gclist;
++ th->gclist = g->grayagain;
++ g->grayagain = o;
++ black2gray(o);
++ traversestack(g, th);
++ return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
++ sizeof(CallInfo) * th->size_ci;
++ }
++ case LUA_TPROTO: {
++ Proto *p = gco2p(o);
++ g->gray = p->gclist;
++ traverseproto(g, p);
++ return sizeof(Proto) + sizeof(Instruction) * p->sizecode +
++ sizeof(Proto *) * p->sizep +
++ sizeof(TValue) * p->sizek +
++ sizeof(int) * p->sizelineinfo +
++ sizeof(LocVar) * p->sizelocvars +
++ sizeof(TString *) * p->sizeupvalues;
++ }
++ default: lua_assert(0); return 0;
++ }
++}
++
++
++static size_t propagateall (global_State *g) {
++ size_t m = 0;
++ while (g->gray) m += propagatemark(g);
++ return m;
++}
++
++
++/*
++** The next function tells whether a key or value can be cleared from
++** a weak table. Non-collectable objects are never removed from weak
++** tables. Strings behave as `values', so are never removed too. for
++** other objects: if really collected, cannot keep them; for userdata
++** being finalized, keep them in keys, but not in values
++*/
++static int iscleared (const TValue *o, int iskey) {
++ if (!iscollectable(o)) return 0;
++ if (ttisstring(o)) {
++ stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */
++ return 0;
++ }
++ return iswhite(gcvalue(o)) ||
++ (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o))));
++}
++
++
++/*
++** clear collected entries from weaktables
++*/
++static void cleartable (GCObject *l) {
++ while (l) {
++ Table *h = gco2h(l);
++ int i = h->sizearray;
++ lua_assert(testbit(h->marked, VALUEWEAKBIT) ||
++ testbit(h->marked, KEYWEAKBIT));
++ if (testbit(h->marked, VALUEWEAKBIT)) {
++ while (i--) {
++ TValue *o = &h->array[i];
++ if (iscleared(o, 0)) /* value was collected? */
++ setnilvalue(o); /* remove value */
++ }
++ }
++ i = sizenode(h);
++ while (i--) {
++ Node *n = gnode(h, i);
++ if (!ttisnil(gval(n)) && /* non-empty entry? */
++ (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) {
++ setnilvalue(gval(n)); /* remove value ... */
++ removeentry(n); /* remove entry from table */
++ }
++ }
++ l = h->gclist;
++ }
++}
++
++
++static void freeobj (lua_State *L, GCObject *o) {
++ switch (o->gch.tt) {
++ case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
++ case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break;
++ case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
++ case LUA_TTABLE: luaH_free(L, gco2h(o)); break;
++ case LUA_TTHREAD: {
++ lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread);
++ luaE_freethread(L, gco2th(o));
++ break;
++ }
++ case LUA_TSTRING: {
++ G(L)->strt.nuse--;
++ luaM_freemem(L, o, sizestring(gco2ts(o)));
++ break;
++ }
++ case LUA_TUSERDATA: {
++ luaM_freemem(L, o, sizeudata(gco2u(o)));
++ break;
++ }
++ default: lua_assert(0);
++ }
++}
++
++
++
++#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM)
++
++
++static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
++ GCObject *curr;
++ global_State *g = G(L);
++ int deadmask = otherwhite(g);
++ while ((curr = *p) != NULL && count-- > 0) {
++ if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */
++ sweepwholelist(L, &gco2th(curr)->openupval);
++ if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */
++ lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT));
++ makewhite(g, curr); /* make it white (for next cycle) */
++ p = &curr->gch.next;
++ }
++ else { /* must erase `curr' */
++ lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT));
++ *p = curr->gch.next;
++ if (curr == g->rootgc) /* is the first element of the list? */
++ g->rootgc = curr->gch.next; /* adjust first */
++ freeobj(L, curr);
++ }
++ }
++ return p;
++}
++
++
++static void checkSizes (lua_State *L) {
++ global_State *g = G(L);
++ /* check size of string hash */
++ if (g->strt.nuse < cast(lu_int32, g->strt.size/4) &&
++ g->strt.size > MINSTRTABSIZE*2)
++ luaS_resize(L, g->strt.size/2); /* table is too big */
++ /* check size of buffer */
++ if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */
++ size_t newsize = luaZ_sizebuffer(&g->buff) / 2;
++ luaZ_resizebuffer(L, &g->buff, newsize);
++ }
++}
++
++
++static void GCTM (lua_State *L) {
++ global_State *g = G(L);
++ GCObject *o = g->tmudata->gch.next; /* get first element */
++ Udata *udata = rawgco2u(o);
++ const TValue *tm;
++ /* remove udata from `tmudata' */
++ if (o == g->tmudata) /* last element? */
++ g->tmudata = NULL;
++ else
++ g->tmudata->gch.next = udata->uv.next;
++ udata->uv.next = g->mainthread->next; /* return it to `root' list */
++ g->mainthread->next = o;
++ makewhite(g, o);
++ tm = fasttm(L, udata->uv.metatable, TM_GC);
++ if (tm != NULL) {
++ lu_byte oldah = L->allowhook;
++ lu_mem oldt = g->GCthreshold;
++ L->allowhook = 0; /* stop debug hooks during GC tag method */
++ g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */
++ setobj2s(L, L->top, tm);
++ setuvalue(L, L->top+1, udata);
++ L->top += 2;
++ luaD_call(L, L->top - 2, 0);
++ L->allowhook = oldah; /* restore hooks */
++ g->GCthreshold = oldt; /* restore threshold */
++ }
++}
++
++
++/*
++** Call all GC tag methods
++*/
++void luaC_callGCTM (lua_State *L) {
++ while (G(L)->tmudata)
++ GCTM(L);
++}
++
++
++void luaC_freeall (lua_State *L) {
++ global_State *g = G(L);
++ int i;
++ g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */
++ sweepwholelist(L, &g->rootgc);
++ for (i = 0; i < g->strt.size; i++) /* free all string lists */
++ sweepwholelist(L, &g->strt.hash[i]);
++}
++
++
++static void markmt (global_State *g) {
++ int i;
++ for (i=0; i<NUM_TAGS; i++)
++ if (g->mt[i]) markobject(g, g->mt[i]);
++}
++
++
++/* mark root set */
++static void markroot (lua_State *L) {
++ global_State *g = G(L);
++ g->gray = NULL;
++ g->grayagain = NULL;
++ g->weak = NULL;
++ markobject(g, g->mainthread);
++ /* make global table be traversed before main stack */
++ markvalue(g, gt(g->mainthread));
++ markvalue(g, registry(L));
++ markmt(g);
++ g->gcstate = GCSpropagate;
++}
++
++
++static void remarkupvals (global_State *g) {
++ UpVal *uv;
++ for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) {
++ lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
++ if (isgray(obj2gco(uv)))
++ markvalue(g, uv->v);
++ }
++}
++
++
++static void atomic (lua_State *L) {
++ global_State *g = G(L);
++ size_t udsize; /* total size of userdata to be finalized */
++ /* remark occasional upvalues of (maybe) dead threads */
++ remarkupvals(g);
++ /* traverse objects cautch by write barrier and by 'remarkupvals' */
++ propagateall(g);
++ /* remark weak tables */
++ g->gray = g->weak;
++ g->weak = NULL;
++ lua_assert(!iswhite(obj2gco(g->mainthread)));
++ markobject(g, L); /* mark running thread */
++ markmt(g); /* mark basic metatables (again) */
++ propagateall(g);
++ /* remark gray again */
++ g->gray = g->grayagain;
++ g->grayagain = NULL;
++ propagateall(g);
++ udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */
++ marktmu(g); /* mark `preserved' userdata */
++ udsize += propagateall(g); /* remark, to propagate `preserveness' */
++ cleartable(g->weak); /* remove collected objects from weak tables */
++ /* flip current white */
++ g->currentwhite = cast_byte(otherwhite(g));
++ g->sweepstrgc = 0;
++ g->sweepgc = &g->rootgc;
++ g->gcstate = GCSsweepstring;
++ g->estimate = g->totalbytes - udsize; /* first estimate */
++}
++
++
++static l_mem singlestep (lua_State *L) {
++ global_State *g = G(L);
++ /*lua_checkmemory(L);*/
++ switch (g->gcstate) {
++ case GCSpause: {
++ markroot(L); /* start a new collection */
++ return 0;
++ }
++ case GCSpropagate: {
++ if (g->gray)
++ return propagatemark(g);
++ else { /* no more `gray' objects */
++ atomic(L); /* finish mark phase */
++ return 0;
++ }
++ }
++ case GCSsweepstring: {
++ lu_mem old = g->totalbytes;
++ sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]);
++ if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */
++ g->gcstate = GCSsweep; /* end sweep-string phase */
++ lua_assert(old >= g->totalbytes);
++ g->estimate -= old - g->totalbytes;
++ return GCSWEEPCOST;
++ }
++ case GCSsweep: {
++ lu_mem old = g->totalbytes;
++ g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);
++ if (*g->sweepgc == NULL) { /* nothing more to sweep? */
++ checkSizes(L);
++ g->gcstate = GCSfinalize; /* end sweep phase */
++ }
++ lua_assert(old >= g->totalbytes);
++ g->estimate -= old - g->totalbytes;
++ return GCSWEEPMAX*GCSWEEPCOST;
++ }
++ case GCSfinalize: {
++ if (g->tmudata) {
++ GCTM(L);
++ if (g->estimate > GCFINALIZECOST)
++ g->estimate -= GCFINALIZECOST;
++ return GCFINALIZECOST;
++ }
++ else {
++ g->gcstate = GCSpause; /* end collection */
++ g->gcdept = 0;
++ return 0;
++ }
++ }
++ default: lua_assert(0); return 0;
++ }
++}
++
++
++void luaC_step (lua_State *L) {
++ global_State *g = G(L);
++ l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul;
++ if (lim == 0)
++ lim = (MAX_LUMEM-1)/2; /* no limit */
++ g->gcdept += g->totalbytes - g->GCthreshold;
++ do {
++ lim -= singlestep(L);
++ if (g->gcstate == GCSpause)
++ break;
++ } while (lim > 0);
++ if (g->gcstate != GCSpause) {
++ if (g->gcdept < GCSTEPSIZE)
++ g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/
++ else {
++ g->gcdept -= GCSTEPSIZE;
++ g->GCthreshold = g->totalbytes;
++ }
++ }
++ else {
++ lua_assert(g->totalbytes >= g->estimate);
++ setthreshold(g);
++ }
++}
++
++
++void luaC_fullgc (lua_State *L) {
++ global_State *g = G(L);
++ if (g->gcstate <= GCSpropagate) {
++ /* reset sweep marks to sweep all elements (returning them to white) */
++ g->sweepstrgc = 0;
++ g->sweepgc = &g->rootgc;
++ /* reset other collector lists */
++ g->gray = NULL;
++ g->grayagain = NULL;
++ g->weak = NULL;
++ g->gcstate = GCSsweepstring;
++ }
++ lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate);
++ /* finish any pending sweep phase */
++ while (g->gcstate != GCSfinalize) {
++ lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep);
++ singlestep(L);
++ }
++ markroot(L);
++ while (g->gcstate != GCSpause) {
++ singlestep(L);
++ }
++ setthreshold(g);
++}
++
++
++void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) {
++ global_State *g = G(L);
++ lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));
++ lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);
++ lua_assert(ttype(&o->gch) != LUA_TTABLE);
++ /* must keep invariant? */
++ if (g->gcstate == GCSpropagate)
++ reallymarkobject(g, v); /* restore invariant */
++ else /* don't mind */
++ makewhite(g, o); /* mark as white just to avoid other barriers */
++}
++
++
++void luaC_barrierback (lua_State *L, Table *t) {
++ global_State *g = G(L);
++ GCObject *o = obj2gco(t);
++ lua_assert(isblack(o) && !isdead(g, o));
++ lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);
++ black2gray(o); /* make table gray (again) */
++ t->gclist = g->grayagain;
++ g->grayagain = o;
++}
++
++
++void luaC_link (lua_State *L, GCObject *o, lu_byte tt) {
++ global_State *g = G(L);
++ o->gch.next = g->rootgc;
++ g->rootgc = o;
++ o->gch.marked = luaC_white(g);
++ o->gch.tt = tt;
++}
++
++
++void luaC_linkupval (lua_State *L, UpVal *uv) {
++ global_State *g = G(L);
++ GCObject *o = obj2gco(uv);
++ o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */
++ g->rootgc = o;
++ if (isgray(o)) {
++ if (g->gcstate == GCSpropagate) {
++ gray2black(o); /* closed upvalues need barrier */
++ luaC_barrier(L, uv, uv->v);
++ }
++ else { /* sweep phase: sweep it (turning it into white) */
++ makewhite(g, o);
++ lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause);
++ }
++ }
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lgc.h
+@@ -0,0 +1,110 @@
++/*
++** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $
++** Garbage Collector
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lgc_h
++#define lgc_h
++
++
++#include "lobject.h"
++
++
++/*
++** Possible states of the Garbage Collector
++*/
++#define GCSpause 0
++#define GCSpropagate 1
++#define GCSsweepstring 2
++#define GCSsweep 3
++#define GCSfinalize 4
++
++
++/*
++** some userful bit tricks
++*/
++#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
++#define setbits(x,m) ((x) |= (m))
++#define testbits(x,m) ((x) & (m))
++#define bitmask(b) (1<<(b))
++#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
++#define l_setbit(x,b) setbits(x, bitmask(b))
++#define resetbit(x,b) resetbits(x, bitmask(b))
++#define testbit(x,b) testbits(x, bitmask(b))
++#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2)))
++#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2)))
++#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2)))
++
++
++
++/*
++** Layout for bit use in `marked' field:
++** bit 0 - object is white (type 0)
++** bit 1 - object is white (type 1)
++** bit 2 - object is black
++** bit 3 - for userdata: has been finalized
++** bit 3 - for tables: has weak keys
++** bit 4 - for tables: has weak values
++** bit 5 - object is fixed (should not be collected)
++** bit 6 - object is "super" fixed (only the main thread)
++*/
++
++
++#define WHITE0BIT 0
++#define WHITE1BIT 1
++#define BLACKBIT 2
++#define FINALIZEDBIT 3
++#define KEYWEAKBIT 3
++#define VALUEWEAKBIT 4
++#define FIXEDBIT 5
++#define SFIXEDBIT 6
++#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
++
++
++#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
++#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
++#define isgray(x) (!isblack(x) && !iswhite(x))
++
++#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
++#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS)
++
++#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
++#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
++
++#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
++
++#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
++
++
++#define luaC_checkGC(L) { \
++ condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
++ if (G(L)->totalbytes >= G(L)->GCthreshold) \
++ luaC_step(L); }
++
++
++#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
++ luaC_barrierf(L,obj2gco(p),gcvalue(v)); }
++
++#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \
++ luaC_barrierback(L,t); }
++
++#define luaC_objbarrier(L,p,o) \
++ { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
++ luaC_barrierf(L,obj2gco(p),obj2gco(o)); }
++
++#define luaC_objbarriert(L,t,o) \
++ { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }
++
++LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all);
++LUAI_FUNC void luaC_callGCTM (lua_State *L);
++LUAI_FUNC void luaC_freeall (lua_State *L);
++LUAI_FUNC void luaC_step (lua_State *L);
++LUAI_FUNC void luaC_fullgc (lua_State *L);
++LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
++LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv);
++LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);
++LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/llex.c
+@@ -0,0 +1,460 @@
++/*
++** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lexical Analyzer
++** See Copyright Notice in lua.h
++*/
++
++#include <ctype.h>
++#include <locale.h>
++#include <string.h>
++
++#define llex_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldo.h"
++#include "llex.h"
++#include "lobject.h"
++#include "lparser.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "lzio.h"
++
++
++
++#define next(ls) (ls->current = zgetc(ls->z))
++
++
++
++
++#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r')
++
++
++/* ORDER RESERVED */
++const char *const luaX_tokens [] = {
++ "and", "break", "do", "else", "elseif",
++ "end", "false", "for", "function", "if",
++ "in", "local", "nil", "not", "or", "repeat",
++ "return", "then", "true", "until", "while",
++ "..", "...", "==", ">=", "<=", "~=",
++ "<number>", "<name>", "<string>", "<eof>",
++ NULL
++};
++
++
++#define save_and_next(ls) (save(ls, ls->current), next(ls))
++
++
++static void save (LexState *ls, int c) {
++ Mbuffer *b = ls->buff;
++ if (b->n + 1 > b->buffsize) {
++ size_t newsize;
++ if (b->buffsize >= MAX_SIZET/2)
++ luaX_lexerror(ls, "lexical element too long", 0);
++ newsize = b->buffsize * 2;
++ luaZ_resizebuffer(ls->L, b, newsize);
++ }
++ b->buffer[b->n++] = cast(char, c);
++}
++
++
++void luaX_init (lua_State *L) {
++ int i;
++ for (i=0; i<NUM_RESERVED; i++) {
++ TString *ts = luaS_new(L, luaX_tokens[i]);
++ luaS_fix(ts); /* reserved words are never collected */
++ lua_assert(strlen(luaX_tokens[i])+1 <= TOKEN_LEN);
++ ts->tsv.reserved = cast_byte(i+1); /* reserved word */
++ }
++}
++
++
++#define MAXSRC 80
++
++
++const char *luaX_token2str (LexState *ls, int token) {
++ if (token < FIRST_RESERVED) {
++ lua_assert(token == cast(unsigned char, token));
++ return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) :
++ luaO_pushfstring(ls->L, "%c", token);
++ }
++ else
++ return luaX_tokens[token-FIRST_RESERVED];
++}
++
++
++static const char *txtToken (LexState *ls, int token) {
++ switch (token) {
++ case TK_NAME:
++ case TK_STRING:
++ case TK_NUMBER:
++ save(ls, '\0');
++ return luaZ_buffer(ls->buff);
++ default:
++ return luaX_token2str(ls, token);
++ }
++}
++
++
++void luaX_lexerror (LexState *ls, const char *msg, int token) {
++ char buff[MAXSRC];
++ luaO_chunkid(buff, getstr(ls->source), MAXSRC);
++ msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
++ if (token)
++ luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token));
++ luaD_throw(ls->L, LUA_ERRSYNTAX);
++}
++
++
++void luaX_syntaxerror (LexState *ls, const char *msg) {
++ luaX_lexerror(ls, msg, ls->t.token);
++}
++
++
++TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
++ lua_State *L = ls->L;
++ TString *ts = luaS_newlstr(L, str, l);
++ TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */
++ if (ttisnil(o))
++ setbvalue(o, 1); /* make sure `str' will not be collected */
++ return ts;
++}
++
++
++static void inclinenumber (LexState *ls) {
++ int old = ls->current;
++ lua_assert(currIsNewline(ls));
++ next(ls); /* skip `\n' or `\r' */
++ if (currIsNewline(ls) && ls->current != old)
++ next(ls); /* skip `\n\r' or `\r\n' */
++ if (++ls->linenumber >= MAX_INT)
++ luaX_syntaxerror(ls, "chunk has too many lines");
++}
++
++
++void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) {
++ ls->decpoint = '.';
++ ls->L = L;
++ ls->lookahead.token = TK_EOS; /* no look-ahead token */
++ ls->z = z;
++ ls->fs = NULL;
++ ls->linenumber = 1;
++ ls->lastline = 1;
++ ls->source = source;
++ luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */
++ next(ls); /* read first char */
++}
++
++
++
++/*
++** =======================================================
++** LEXICAL ANALYZER
++** =======================================================
++*/
++
++
++
++static int check_next (LexState *ls, const char *set) {
++ if (!strchr(set, ls->current))
++ return 0;
++ save_and_next(ls);
++ return 1;
++}
++
++
++static void buffreplace (LexState *ls, char from, char to) {
++ size_t n = luaZ_bufflen(ls->buff);
++ char *p = luaZ_buffer(ls->buff);
++ while (n--)
++ if (p[n] == from) p[n] = to;
++}
++
++
++static void trydecpoint (LexState *ls, SemInfo *seminfo) {
++ /* format error: try to update decimal point separator */
++ char old = ls->decpoint;
++ struct lconv *cv = localeconv();
++ ls->decpoint = (cv ? cv->decimal_point[0] : '.');
++ buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */
++ if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
++ /* format error with correct decimal point: no more options */
++ buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */
++ luaX_lexerror(ls, "malformed number", TK_NUMBER);
++ }
++}
++
++
++/* LUA_NUMBER */
++static void read_numeral (LexState *ls, SemInfo *seminfo) {
++ lua_assert(isdigit(ls->current));
++ do {
++ save_and_next(ls);
++ } while (isdigit(ls->current) || ls->current == '.');
++ if (check_next(ls, "Ee")) /* `E'? */
++ check_next(ls, "+-"); /* optional exponent sign */
++ while (isalnum(ls->current) || ls->current == '_')
++ save_and_next(ls);
++ save(ls, '\0');
++ buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
++ if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */
++ trydecpoint(ls, seminfo); /* try to update decimal point separator */
++}
++
++
++static int skip_sep (LexState *ls) {
++ int count = 0;
++ int s = ls->current;
++ lua_assert(s == '[' || s == ']');
++ save_and_next(ls);
++ while (ls->current == '=') {
++ save_and_next(ls);
++ count++;
++ }
++ return (ls->current == s) ? count : (-count) - 1;
++}
++
++
++static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
++ int cont = 0;
++ (void)(cont); /* avoid warnings when `cont' is not used */
++ save_and_next(ls); /* skip 2nd `[' */
++ if (currIsNewline(ls)) /* string starts with a newline? */
++ inclinenumber(ls); /* skip it */
++ for (;;) {
++ switch (ls->current) {
++ case EOZ:
++ luaX_lexerror(ls, (seminfo) ? "unfinished long string" :
++ "unfinished long comment", TK_EOS);
++ break; /* to avoid warnings */
++#if defined(LUA_COMPAT_LSTR)
++ case '[': {
++ if (skip_sep(ls) == sep) {
++ save_and_next(ls); /* skip 2nd `[' */
++ cont++;
++#if LUA_COMPAT_LSTR == 1
++ if (sep == 0)
++ luaX_lexerror(ls, "nesting of [[...]] is deprecated", '[');
++#endif
++ }
++ break;
++ }
++#endif
++ case ']': {
++ if (skip_sep(ls) == sep) {
++ save_and_next(ls); /* skip 2nd `]' */
++#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2
++ cont--;
++ if (sep == 0 && cont >= 0) break;
++#endif
++ goto endloop;
++ }
++ break;
++ }
++ case '\n':
++ case '\r': {
++ save(ls, '\n');
++ inclinenumber(ls);
++ if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */
++ break;
++ }
++ default: {
++ if (seminfo) save_and_next(ls);
++ else next(ls);
++ }
++ }
++ } endloop:
++ if (seminfo)
++ seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
++ luaZ_bufflen(ls->buff) - 2*(2 + sep));
++}
++
++
++static void read_string (LexState *ls, int del, SemInfo *seminfo) {
++ save_and_next(ls);
++ while (ls->current != del) {
++ switch (ls->current) {
++ case EOZ:
++ luaX_lexerror(ls, "unfinished string", TK_EOS);
++ continue; /* to avoid warnings */
++ case '\n':
++ case '\r':
++ luaX_lexerror(ls, "unfinished string", TK_STRING);
++ continue; /* to avoid warnings */
++ case '\\': {
++ int c;
++ next(ls); /* do not save the `\' */
++ switch (ls->current) {
++ case 'a': c = '\a'; break;
++ case 'b': c = '\b'; break;
++ case 'f': c = '\f'; break;
++ case 'n': c = '\n'; break;
++ case 'r': c = '\r'; break;
++ case 't': c = '\t'; break;
++ case 'v': c = '\v'; break;
++ case '\n': /* go through */
++ case '\r': save(ls, '\n'); inclinenumber(ls); continue;
++ case EOZ: continue; /* will raise an error next loop */
++ default: {
++ if (!isdigit(ls->current))
++ save_and_next(ls); /* handles \\, \", \', and \? */
++ else { /* \xxx */
++ int i = 0;
++ c = 0;
++ do {
++ c = 10*c + (ls->current-'0');
++ next(ls);
++ } while (++i<3 && isdigit(ls->current));
++ if (c > UCHAR_MAX)
++ luaX_lexerror(ls, "escape sequence too large", TK_STRING);
++ save(ls, c);
++ }
++ continue;
++ }
++ }
++ save(ls, c);
++ next(ls);
++ continue;
++ }
++ default:
++ save_and_next(ls);
++ }
++ }
++ save_and_next(ls); /* skip delimiter */
++ seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
++ luaZ_bufflen(ls->buff) - 2);
++}
++
++
++static int llex (LexState *ls, SemInfo *seminfo) {
++ luaZ_resetbuffer(ls->buff);
++ for (;;) {
++ switch (ls->current) {
++ case '\n':
++ case '\r': {
++ inclinenumber(ls);
++ continue;
++ }
++ case '-': {
++ next(ls);
++ if (ls->current != '-') return '-';
++ /* else is a comment */
++ next(ls);
++ if (ls->current == '[') {
++ int sep = skip_sep(ls);
++ luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */
++ if (sep >= 0) {
++ read_long_string(ls, NULL, sep); /* long comment */
++ luaZ_resetbuffer(ls->buff);
++ continue;
++ }
++ }
++ /* else short comment */
++ while (!currIsNewline(ls) && ls->current != EOZ)
++ next(ls);
++ continue;
++ }
++ case '[': {
++ int sep = skip_sep(ls);
++ if (sep >= 0) {
++ read_long_string(ls, seminfo, sep);
++ return TK_STRING;
++ }
++ else if (sep == -1) return '[';
++ else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING);
++ }
++ case '=': {
++ next(ls);
++ if (ls->current != '=') return '=';
++ else { next(ls); return TK_EQ; }
++ }
++ case '<': {
++ next(ls);
++ if (ls->current != '=') return '<';
++ else { next(ls); return TK_LE; }
++ }
++ case '>': {
++ next(ls);
++ if (ls->current != '=') return '>';
++ else { next(ls); return TK_GE; }
++ }
++ case '~': {
++ next(ls);
++ if (ls->current != '=') return '~';
++ else { next(ls); return TK_NE; }
++ }
++ case '"':
++ case '\'': {
++ read_string(ls, ls->current, seminfo);
++ return TK_STRING;
++ }
++ case '.': {
++ save_and_next(ls);
++ if (check_next(ls, ".")) {
++ if (check_next(ls, "."))
++ return TK_DOTS; /* ... */
++ else return TK_CONCAT; /* .. */
++ }
++ else if (!isdigit(ls->current)) return '.';
++ else {
++ read_numeral(ls, seminfo);
++ return TK_NUMBER;
++ }
++ }
++ case EOZ: {
++ return TK_EOS;
++ }
++ default: {
++ if (isspace(ls->current)) {
++ lua_assert(!currIsNewline(ls));
++ next(ls);
++ continue;
++ }
++ else if (isdigit(ls->current)) {
++ read_numeral(ls, seminfo);
++ return TK_NUMBER;
++ }
++ else if (isalpha(ls->current) || ls->current == '_') {
++ /* identifier or reserved word */
++ TString *ts;
++ do {
++ save_and_next(ls);
++ } while (isalnum(ls->current) || ls->current == '_');
++ ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
++ luaZ_bufflen(ls->buff));
++ if (ts->tsv.reserved > 0) /* reserved word? */
++ return ts->tsv.reserved - 1 + FIRST_RESERVED;
++ else {
++ seminfo->ts = ts;
++ return TK_NAME;
++ }
++ }
++ else {
++ int c = ls->current;
++ next(ls);
++ return c; /* single-char tokens (+ - / ...) */
++ }
++ }
++ }
++ }
++}
++
++
++void luaX_next (LexState *ls) {
++ ls->lastline = ls->linenumber;
++ if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
++ ls->t = ls->lookahead; /* use this one */
++ ls->lookahead.token = TK_EOS; /* and discharge it */
++ }
++ else
++ ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */
++}
++
++
++void luaX_lookahead (LexState *ls) {
++ lua_assert(ls->lookahead.token == TK_EOS);
++ ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/llex.h
+@@ -0,0 +1,81 @@
++/*
++** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lexical Analyzer
++** See Copyright Notice in lua.h
++*/
++
++#ifndef llex_h
++#define llex_h
++
++#include "lobject.h"
++#include "lzio.h"
++
++
++#define FIRST_RESERVED 257
++
++/* maximum length of a reserved word */
++#define TOKEN_LEN (sizeof("function")/sizeof(char))
++
++
++/*
++* WARNING: if you change the order of this enumeration,
++* grep "ORDER RESERVED"
++*/
++enum RESERVED {
++ /* terminal symbols denoted by reserved words */
++ TK_AND = FIRST_RESERVED, TK_BREAK,
++ TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
++ TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
++ TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
++ /* other terminal symbols */
++ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
++ TK_NAME, TK_STRING, TK_EOS
++};
++
++/* number of reserved words */
++#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
++
++
++/* array with token `names' */
++LUAI_DATA const char *const luaX_tokens [];
++
++
++typedef union {
++ lua_Number r;
++ TString *ts;
++} SemInfo; /* semantics information */
++
++
++typedef struct Token {
++ int token;
++ SemInfo seminfo;
++} Token;
++
++
++typedef struct LexState {
++ int current; /* current character (charint) */
++ int linenumber; /* input line counter */
++ int lastline; /* line of last token `consumed' */
++ Token t; /* current token */
++ Token lookahead; /* look ahead token */
++ struct FuncState *fs; /* `FuncState' is private to the parser */
++ struct lua_State *L;
++ ZIO *z; /* input stream */
++ Mbuffer *buff; /* buffer for tokens */
++ TString *source; /* current source name */
++ char decpoint; /* locale decimal point */
++} LexState;
++
++
++LUAI_FUNC void luaX_init (lua_State *L);
++LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
++ TString *source);
++LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
++LUAI_FUNC void luaX_next (LexState *ls);
++LUAI_FUNC void luaX_lookahead (LexState *ls);
++LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token);
++LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s);
++LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/llimits.h
+@@ -0,0 +1,125 @@
++/*
++** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
++** Limits, basic types, and some other `installation-dependent' definitions
++** See Copyright Notice in lua.h
++*/
++
++#ifndef llimits_h
++#define llimits_h
++
++#include <stddef.h>
++#include <limits.h>
++
++#include "lua.h"
++
++typedef LUAI_UINT32 lu_int32;
++
++typedef LUAI_UMEM lu_mem;
++
++typedef LUAI_MEM l_mem;
++
++
++
++/* chars used as small naturals (so that `char' is reserved for characters) */
++typedef unsigned char lu_byte;
++
++
++#define MAX_SIZET ((size_t)(~(size_t)0)-2)
++
++#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
++
++
++#define MAX_INT (LUA_INT_MAX-2) /* maximum value of an int (-2 for safety) */
++
++/*
++** conversion of pointer to integer
++** this is for hashing only; there is no problem if the integer
++** cannot hold the whole pointer value
++*/
++#define IntPoint(p) ((unsigned int)(lu_mem)(p))
++
++
++
++/* type to ensure maximum alignment */
++typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
++
++
++/* result of a `usual argument conversion' over lua_Number */
++typedef LUAI_UACNUMBER l_uacNumber;
++
++
++/* internal assertions for in-house debugging */
++#ifdef lua_assert
++
++#define check_exp(c,e) (lua_assert(c), (e))
++#define api_check(l,e) lua_assert(e)
++
++#else
++
++#define lua_assert(c) ((void)0)
++#define check_exp(c,e) (e)
++#define api_check luai_apicheck
++
++#endif
++
++
++#ifndef UNUSED
++#define UNUSED(x) ((void)(x)) /* to avoid warnings */
++#endif
++
++
++#ifndef cast
++#define cast(t, exp) ((t)(exp))
++#endif
++
++#define cast_byte(i) cast(lu_byte, (i))
++#define cast_num(i) cast(lua_Number, (i))
++#define cast_int(i) cast(int, (i))
++
++
++
++/*
++** type for virtual-machine instructions
++** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
++*/
++typedef lu_int32 Instruction;
++
++
++
++/* maximum stack for a Lua function */
++#define MAXSTACK 250
++
++
++
++/* minimum size for the string table (must be power of 2) */
++#ifndef MINSTRTABSIZE
++#define MINSTRTABSIZE 32
++#endif
++
++
++/* minimum size for string buffer */
++#ifndef LUA_MINBUFFER
++#define LUA_MINBUFFER 32
++#endif
++
++
++#ifndef lua_lock
++#define lua_lock(L) ((void) 0)
++#define lua_unlock(L) ((void) 0)
++#endif
++
++#ifndef luai_threadyield
++#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
++#endif
++
++
++/*
++** macro to control inclusion of some hard tests on stack reallocation
++*/
++#ifndef HARDSTACKTESTS
++#define condhardstacktests(x) ((void)0)
++#else
++#define condhardstacktests(x) x
++#endif
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lmem.c
+@@ -0,0 +1,86 @@
++/*
++** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $
++** Interface to Memory Manager
++** See Copyright Notice in lua.h
++*/
++
++
++#include <stddef.h>
++
++#define lmem_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++
++
++
++/*
++** About the realloc function:
++** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize);
++** (`osize' is the old size, `nsize' is the new size)
++**
++** Lua ensures that (ptr == NULL) iff (osize == 0).
++**
++** * frealloc(ud, NULL, 0, x) creates a new block of size `x'
++**
++** * frealloc(ud, p, x, 0) frees the block `p'
++** (in this specific case, frealloc must return NULL).
++** particularly, frealloc(ud, NULL, 0, 0) does nothing
++** (which is equivalent to free(NULL) in ANSI C)
++**
++** frealloc returns NULL if it cannot create or reallocate the area
++** (any reallocation to an equal or smaller size cannot fail!)
++*/
++
++
++
++#define MINSIZEARRAY 4
++
++
++void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
++ int limit, const char *errormsg) {
++ void *newblock;
++ int newsize;
++ if (*size >= limit/2) { /* cannot double it? */
++ if (*size >= limit) /* cannot grow even a little? */
++ luaG_runerror(L, errormsg);
++ newsize = limit; /* still have at least one free place */
++ }
++ else {
++ newsize = (*size)*2;
++ if (newsize < MINSIZEARRAY)
++ newsize = MINSIZEARRAY; /* minimum size */
++ }
++ newblock = luaM_reallocv(L, block, *size, newsize, size_elems);
++ *size = newsize; /* update only when everything else is OK */
++ return newblock;
++}
++
++
++void *luaM_toobig (lua_State *L) {
++ luaG_runerror(L, "memory allocation error: block too big");
++ return NULL; /* to avoid warnings */
++}
++
++
++
++/*
++** generic allocation routine.
++*/
++void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
++ global_State *g = G(L);
++ lua_assert((osize == 0) == (block == NULL));
++ block = (*g->frealloc)(g->ud, block, osize, nsize);
++ if (block == NULL && nsize > 0)
++ luaD_throw(L, LUA_ERRMEM);
++ lua_assert((nsize == 0) == (block == NULL));
++ g->totalbytes = (g->totalbytes - osize) + nsize;
++ return block;
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lmem.h
+@@ -0,0 +1,49 @@
++/*
++** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
++** Interface to Memory Manager
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lmem_h
++#define lmem_h
++
++
++#include <stddef.h>
++
++#include "llimits.h"
++#include "lua.h"
++
++#define MEMERRMSG "not enough memory"
++
++
++#define luaM_reallocv(L,b,on,n,e) \
++ ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \
++ luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \
++ luaM_toobig(L))
++
++#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
++#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0)
++#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t))
++
++#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t))
++#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t)))
++#define luaM_newvector(L,n,t) \
++ cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
++
++#define luaM_growvector(L,v,nelems,size,t,limit,e) \
++ if ((nelems)+1 > (size)) \
++ ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
++
++#define luaM_reallocvector(L, v,oldn,n,t) \
++ ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
++
++
++LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
++ size_t size);
++LUAI_FUNC void *luaM_toobig (lua_State *L);
++LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
++ size_t size_elem, int limit,
++ const char *errormsg);
++
++#endif
++
+--- /dev/null
++++ b/extensions/LUA/lua/lobject.c
+@@ -0,0 +1,215 @@
++/*
++** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $
++** Some generic functions over Lua objects
++** See Copyright Notice in lua.h
++*/
++
++#include <stdarg.h>
++
++#include <ctype.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#define lobject_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldo.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "lvm.h"
++
++
++
++const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL};
++
++
++/*
++** converts an integer to a "floating point byte", represented as
++** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if
++** eeeee != 0 and (xxx) otherwise.
++*/
++int luaO_int2fb (unsigned int x) {
++ int e = 0; /* expoent */
++ while (x >= 16) {
++ x = (x+1) >> 1;
++ e++;
++ }
++ if (x < 8) return x;
++ else return ((e+1) << 3) | (cast_int(x) - 8);
++}
++
++
++/* converts back */
++int luaO_fb2int (int x) {
++ int e = (x >> 3) & 31;
++ if (e == 0) return x;
++ else return ((x & 7)+8) << (e - 1);
++}
++
++
++int luaO_log2 (unsigned int x) {
++ static const lu_byte log_2[256] = {
++ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
++ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
++ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
++ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
++ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
++ };
++ int l = -1;
++ while (x >= 256) { l += 8; x >>= 8; }
++ return l + log_2[x];
++
++}
++
++
++int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
++ if (ttype(t1) != ttype(t2)) return 0;
++ else switch (ttype(t1)) {
++ case LUA_TNIL:
++ return 1;
++ case LUA_TNUMBER:
++ return luai_numeq(nvalue(t1), nvalue(t2));
++ case LUA_TBOOLEAN:
++ return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
++ case LUA_TLIGHTUSERDATA:
++ return pvalue(t1) == pvalue(t2);
++ default:
++ lua_assert(iscollectable(t1));
++ return gcvalue(t1) == gcvalue(t2);
++ }
++}
++
++
++int luaO_str2d (const char *s, lua_Number *result) {
++ char *endptr;
++ *result = lua_str2number(s, &endptr);
++ if (endptr == s) return 0; /* conversion failed */
++ if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
++ *result = cast_num(strtoul(s, &endptr, 16));
++ if (*endptr == '\0') return 1; /* most common case */
++ while (isspace(cast(unsigned char, *endptr))) endptr++;
++ if (*endptr != '\0') return 0; /* invalid trailing characters? */
++ return 1;
++}
++
++
++
++static void pushstr (lua_State *L, const char *str) {
++ setsvalue2s(L, L->top, luaS_new(L, str));
++ incr_top(L);
++}
++
++
++/* this function handles only `%d', `%c', %f, %p, and `%s' formats */
++const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
++ int n = 1;
++ pushstr(L, "");
++ for (;;) {
++ const char *e = strchr(fmt, '%');
++ if (e == NULL) break;
++ setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt));
++ incr_top(L);
++ switch (*(e+1)) {
++ case 's': {
++ const char *s = va_arg(argp, char *);
++ if (s == NULL) s = "(null)";
++ pushstr(L, s);
++ break;
++ }
++ case 'c': {
++ char buff[2];
++ buff[0] = cast(char, va_arg(argp, int));
++ buff[1] = '\0';
++ pushstr(L, buff);
++ break;
++ }
++ case 'd': {
++ setnvalue(L->top, cast_num(va_arg(argp, int)));
++ incr_top(L);
++ break;
++ }
++ case 'f': {
++ setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber)));
++ incr_top(L);
++ break;
++ }
++ case 'p': {
++ char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
++ sprintf(buff, "%p", va_arg(argp, void *));
++ pushstr(L, buff);
++ break;
++ }
++ case '%': {
++ pushstr(L, "%");
++ break;
++ }
++ default: {
++ char buff[3];
++ buff[0] = '%';
++ buff[1] = *(e+1);
++ buff[2] = '\0';
++ pushstr(L, buff);
++ break;
++ }
++ }
++ n += 2;
++ fmt = e+2;
++ }
++ pushstr(L, fmt);
++ luaV_concat(L, n+1, cast_int(L->top - L->base) - 1);
++ L->top -= n;
++ return svalue(L->top - 1);
++}
++
++
++const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
++ const char *msg;
++ va_list argp;
++ va_start(argp, fmt);
++ msg = luaO_pushvfstring(L, fmt, argp);
++ va_end(argp);
++ return msg;
++}
++
++
++void luaO_chunkid (char *out, const char *source, size_t bufflen) {
++ if (*source == '=') {
++ strncpy(out, source+1, bufflen); /* remove first char */
++ out[bufflen-1] = '\0'; /* ensures null termination */
++ }
++ else { /* out = "source", or "...source" */
++ if (*source == '@') {
++ size_t l;
++ source++; /* skip the `@' */
++ bufflen -= sizeof(" '...' ");
++ l = strlen(source);
++ strcpy(out, "");
++ if (l > bufflen) {
++ source += (l-bufflen); /* get last part of file name */
++ strcat(out, "...");
++ }
++ strcat(out, source);
++ }
++ else { /* out = [string "string"] */
++ size_t len = strcspn(source, "\n\r"); /* stop at first newline */
++ bufflen -= sizeof(" [string \"...\"] ");
++ if (len > bufflen) len = bufflen;
++ strcpy(out, "[string \"");
++ if (source[len] != '\0') { /* must truncate? */
++ strncat(out, source, len);
++ strcat(out, "...");
++ }
++ else
++ strcat(out, source);
++ strcat(out, "\"]");
++ }
++ }
++}
+--- /dev/null
++++ b/extensions/LUA/lua/lobject.h
+@@ -0,0 +1,381 @@
++/*
++** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $
++** Type definitions for Lua objects
++** See Copyright Notice in lua.h
++*/
++
++
++#ifndef lobject_h
++#define lobject_h
++
++
++#include <stdarg.h>
++
++
++#include "llimits.h"
++#include "lua.h"
++
++
++/* tags for values visible from Lua */
++#define LAST_TAG LUA_TTHREAD
++
++#define NUM_TAGS (LAST_TAG+1)
++
++
++/*
++** Extra tags for non-values
++*/
++#define LUA_TPROTO (LAST_TAG+1)
++#define LUA_TUPVAL (LAST_TAG+2)
++#define LUA_TDEADKEY (LAST_TAG+3)
++
++
++/*
++** Union of all collectable objects
++*/
++typedef union GCObject GCObject;
++
++
++/*
++** Common Header for all collectable objects (in macro form, to be
++** included in other objects)
++*/
++#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
++
++
++/*
++** Common header in struct form
++*/
++typedef struct GCheader {
++ CommonHeader;
++} GCheader;
++
++
++
++
++/*
++** Union of all Lua values
++*/
++typedef union {
++ GCObject *gc;
++ void *p;
++ lua_Number n;
++ int b;
++} Value;
++
++
++/*
++** Tagged Values
++*/
++
++#define TValuefields Value value; int tt
++
++typedef struct lua_TValue {
++ TValuefields;
++} TValue;
++
++
++/* Macros to test type */
++#define ttisnil(o) (ttype(o) == LUA_TNIL)
++#define ttisnumber(o) (ttype(o) == LUA_TNUMBER)
++#define ttisstring(o) (ttype(o) == LUA_TSTRING)
++#define ttistable(o) (ttype(o) == LUA_TTABLE)
++#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
++#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN)
++#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA)
++#define ttisthread(o) (ttype(o) == LUA_TTHREAD)
++#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA)
++
++/* Macros to access values */
++#define ttype(o) ((o)->tt)
++#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
++#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
++#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n)
++#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
++#define tsvalue(o) (&rawtsvalue(o)->tsv)
++#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
++#define uvalue(o) (&rawuvalue(o)->uv)
++#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl)
++#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h)
++#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b)
++#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th)
++
++#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
++
++/*
++** for internal debug only
++*/
++#define checkconsistency(obj) \
++ lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
++
++#define checkliveness(g,obj) \
++ lua_assert(!iscollectable(obj) || \
++ ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))
++
++
++/* Macros to set values */
++#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
++
++#define setnvalue(obj,x) \
++ { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
++
++#define setpvalue(obj,x) \
++ { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
++
++#define setbvalue(obj,x) \
++ { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
++
++#define setsvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
++ checkliveness(G(L),i_o); }
++
++#define setuvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
++ checkliveness(G(L),i_o); }
++
++#define setthvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
++ checkliveness(G(L),i_o); }
++
++#define setclvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
++ checkliveness(G(L),i_o); }
++
++#define sethvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
++ checkliveness(G(L),i_o); }
++
++#define setptvalue(L,obj,x) \
++ { TValue *i_o=(obj); \
++ i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
++ checkliveness(G(L),i_o); }
++
++
++
++
++#define setobj(L,obj1,obj2) \
++ { const TValue *o2=(obj2); TValue *o1=(obj1); \
++ o1->value = o2->value; o1->tt=o2->tt; \
++ checkliveness(G(L),o1); }
++
++
++/*
++** different types of sets, according to destination
++*/
++
++/* from stack to (same) stack */
++#define setobjs2s setobj
++/* to stack (not from same stack) */
++#define setobj2s setobj
++#define setsvalue2s setsvalue
++#define sethvalue2s sethvalue
++#define setptvalue2s setptvalue
++/* from table to same table */
++#define setobjt2t setobj
++/* to table */
++#define setobj2t setobj
++/* to new object */
++#define setobj2n setobj
++#define setsvalue2n setsvalue
++
++#define setttype(obj, tt) (ttype(obj) = (tt))
++
++
++#define iscollectable(o) (ttype(o) >= LUA_TSTRING)
++
++
++
++typedef TValue *StkId; /* index to stack elements */
++
++
++/*
++** String headers for string table
++*/
++typedef union TString {
++ L_Umaxalign dummy; /* ensures maximum alignment for strings */
++ struct {
++ CommonHeader;
++ lu_byte reserved;
++ unsigned int hash;
++ size_t len;
++ } tsv;
++} TString;
++
++
++#define getstr(ts) cast(const char *, (ts) + 1)
++#define svalue(o) getstr(rawtsvalue(o))
++
++
++
++typedef union Udata {
++ L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
++ struct {
++ CommonHeader;
++ struct Table *metatable;
++ struct Table *env;
++ size_t len;
++ } uv;
++} Udata;
++
++
++
++
++/*
++** Function Prototypes
++*/
++typedef struct Proto {
++ CommonHeader;
++ TValue *k; /* constants used by the function */
++ Instruction *code;
++ struct Proto **p; /* functions defined inside the function */
++ int *lineinfo; /* map from opcodes to source lines */
++ struct LocVar *locvars; /* information about local variables */
++ TString **upvalues; /* upvalue names */
++ TString *source;
++ int sizeupvalues;
++ int sizek; /* size of `k' */
++ int sizecode;
++ int sizelineinfo;
++ int sizep; /* size of `p' */
++ int sizelocvars;
++ int linedefined;
++ int lastlinedefined;
++ GCObject *gclist;
++ lu_byte nups; /* number of upvalues */
++ lu_byte numparams;
++ lu_byte is_vararg;
++ lu_byte maxstacksize;
++} Proto;
++
++
++/* masks for new-style vararg */
++#define VARARG_HASARG 1
++#define VARARG_ISVARARG 2
++#define VARARG_NEEDSARG 4
++
++
++typedef struct LocVar {
++ TString *varname;
++ int startpc; /* first point where variable is active */
++ int endpc; /* first point where variable is dead */
++} LocVar;
++
++
++
++/*
++** Upvalues
++*/
++
++typedef struct UpVal {
++ CommonHeader;
++ TValue *v; /* points to stack or to its own value */
++ union {
++ TValue value; /* the value (when closed) */
++ struct { /* double linked list (when open) */
++ struct UpVal *prev;
++ struct UpVal *next;
++ } l;
++ } u;
++} UpVal;
++
++
++/*
++** Closures
++*/
++
++#define ClosureHeader \
++ CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \
++ struct Table *env
++
++typedef struct CClosure {
++ ClosureHeader;
++ lua_CFunction f;
++ TValue upvalue[1];
++} CClosure;
++
++
++typedef struct LClosure {
++ ClosureHeader;
++ struct Proto *p;
++ UpVal *upvals[1];
++} LClosure;
++
++
++typedef union Closure {
++ CClosure c;
++ LClosure l;
++} Closure;
++
++
++#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)
++#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
++
++
++/*
++** Tables
++*/
++
++typedef union TKey {
++ struct {
++ TValuefields;
++ struct Node *next; /* for chaining */
++ } nk;
++ TValue tvk;
++} TKey;
++
++
++typedef struct Node {
++ TValue i_val;
++ TKey i_key;
++} Node;
++
++
++typedef struct Table {
++ CommonHeader;
++ lu_byte flags; /* 1<<p means tagmethod(p) is not present */
++ lu_byte lsizenode; /* log2 of size of `node' array */
++ struct Table *metatable;
++ TValue *array; /* array part */
++ Node *node;
++ Node *lastfree; /* any free position is before this position */
++ GCObject *gclist;
++ int sizearray; /* size of `array' array */
++} Table;
++
++
++
++/*
++** `module' operation for hashing (size is always a power of 2)
++*/
++#define lmod(s,size) \
++ (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
++
++
++#define twoto(x) (1<<(x))
++#define sizenode(t) (twoto((t)->lsizenode))
++
++
++#define luaO_nilobject (&luaO_nilobject_)
++
++LUAI_DATA const TValue luaO_nilobject_;
++
++#define ceillog2(x) (luaO_log2((x)-1) + 1)
++
++LUAI_FUNC int luaO_log2 (unsigned int x);
++LUAI_FUNC int luaO_int2fb (unsigned int x);
++LUAI_FUNC int luaO_fb2int (int x);
++LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
++LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
++LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
++ va_list argp);
++LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
++LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
++
++
++#endif
++
+--- /dev/null
++++ b/extensions/LUA/lua/lopcodes.c
+@@ -0,0 +1,102 @@
++/*
++** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
++** See Copyright Notice in lua.h
++*/
++
++
++#define lopcodes_c
++#define LUA_CORE
++
++
++#include "lopcodes.h"
++
++
++/* ORDER OP */
++
++const char *const luaP_opnames[NUM_OPCODES+1] = {
++ "MOVE",
++ "LOADK",
++ "LOADBOOL",
++ "LOADNIL",
++ "GETUPVAL",
++ "GETGLOBAL",
++ "GETTABLE",
++ "SETGLOBAL",
++ "SETUPVAL",
++ "SETTABLE",
++ "NEWTABLE",
++ "SELF",
++ "ADD",
++ "SUB",
++ "MUL",
++ "DIV",
++ "MOD",
++ "POW",
++ "UNM",
++ "NOT",
++ "LEN",
++ "CONCAT",
++ "JMP",
++ "EQ",
++ "LT",
++ "LE",
++ "TEST",
++ "TESTSET",
++ "CALL",
++ "TAILCALL",
++ "RETURN",
++ "FORLOOP",
++ "FORPREP",
++ "TFORLOOP",
++ "SETLIST",
++ "CLOSE",
++ "CLOSURE",
++ "VARARG",
++ NULL
++};
++
++
++#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
++
++const lu_byte luaP_opmodes[NUM_OPCODES] = {
++/* T A B C mode opcode */
++ opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
++ ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
++ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */
++ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */
++ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */
++ ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */
++ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */
++ ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */
++ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */
++ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */
++ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */
++ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */
++ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
++ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
++ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
++ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */
++ ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */
++ ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */
++ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */
++ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */
++ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */
++ ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */
++ ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */
++ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */
++ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */
++ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */
++ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */
++ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */
++ ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */
++ ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
++ ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */
++ ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
++ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
++};
++
+--- /dev/null
++++ b/extensions/LUA/lua/lopcodes.h
+@@ -0,0 +1,268 @@
++/*
++** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $
++** Opcodes for Lua virtual machine
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lopcodes_h
++#define lopcodes_h
++
++#include "llimits.h"
++
++
++/*===========================================================================
++ We assume that instructions are unsigned numbers.
++ All instructions have an opcode in the first 6 bits.
++ Instructions can have the following fields:
++ `A' : 8 bits
++ `B' : 9 bits
++ `C' : 9 bits
++ `Bx' : 18 bits (`B' and `C' together)
++ `sBx' : signed Bx
++
++ A signed argument is represented in excess K; that is, the number
++ value is the unsigned value minus K. K is exactly the maximum value
++ for that argument (so that -max is represented by 0, and +max is
++ represented by 2*max), which is half the maximum for the corresponding
++ unsigned argument.
++===========================================================================*/
++
++
++enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
++
++
++/*
++** size and position of opcode arguments.
++*/
++#define SIZE_C 9
++#define SIZE_B 9
++#define SIZE_Bx (SIZE_C + SIZE_B)
++#define SIZE_A 8
++
++#define SIZE_OP 6
++
++#define POS_OP 0
++#define POS_A (POS_OP + SIZE_OP)
++#define POS_C (POS_A + SIZE_A)
++#define POS_B (POS_C + SIZE_C)
++#define POS_Bx POS_C
++
++
++/*
++** limits for opcode arguments.
++** we use (signed) int to manipulate most arguments,
++** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
++*/
++#if SIZE_Bx < LUAI_BITSINT-1
++#define MAXARG_Bx ((1<<SIZE_Bx)-1)
++#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
++#else
++#define MAXARG_Bx MAX_INT
++#define MAXARG_sBx MAX_INT
++#endif
++
++
++#define MAXARG_A ((1<<SIZE_A)-1)
++#define MAXARG_B ((1<<SIZE_B)-1)
++#define MAXARG_C ((1<<SIZE_C)-1)
++
++
++/* creates a mask with `n' 1 bits at position `p' */
++#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
++
++/* creates a mask with `n' 0 bits at position `p' */
++#define MASK0(n,p) (~MASK1(n,p))
++
++/*
++** the following macros help to manipulate instructions
++*/
++
++#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
++#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
++ ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
++
++#define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0)))
++#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
++ ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
++
++#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
++#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
++ ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
++
++#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
++#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
++ ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
++
++#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
++#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
++ ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
++
++#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
++#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
++
++
++#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \
++ | (cast(Instruction, a)<<POS_A) \
++ | (cast(Instruction, b)<<POS_B) \
++ | (cast(Instruction, c)<<POS_C))
++
++#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
++ | (cast(Instruction, a)<<POS_A) \
++ | (cast(Instruction, bc)<<POS_Bx))
++
++
++/*
++** Macros to operate RK indices
++*/
++
++/* this bit 1 means constant (0 means register) */
++#define BITRK (1 << (SIZE_B - 1))
++
++/* test whether value is a constant */
++#define ISK(x) ((x) & BITRK)
++
++/* gets the index of the constant */
++#define INDEXK(r) ((int)(r) & ~BITRK)
++
++#define MAXINDEXRK (BITRK - 1)
++
++/* code a constant index as a RK value */
++#define RKASK(x) ((x) | BITRK)
++
++
++/*
++** invalid register that fits in 8 bits
++*/
++#define NO_REG MAXARG_A
++
++
++/*
++** R(x) - register
++** Kst(x) - constant (in constant table)
++** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
++*/
++
++
++/*
++** grep "ORDER OP" if you change these enums
++*/
++
++typedef enum {
++/*----------------------------------------------------------------------
++name args description
++------------------------------------------------------------------------*/
++OP_MOVE,/* A B R(A) := R(B) */
++OP_LOADK,/* A Bx R(A) := Kst(Bx) */
++OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */
++OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
++OP_GETUPVAL,/* A B R(A) := UpValue[B] */
++
++OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
++OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
++
++OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
++OP_SETUPVAL,/* A B UpValue[B] := R(A) */
++OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
++
++OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
++
++OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
++
++OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
++OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
++OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
++OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
++OP_MOD,/* A B C R(A) := RK(B) % RK(C) */
++OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
++OP_UNM,/* A B R(A) := -R(B) */
++OP_NOT,/* A B R(A) := not R(B) */
++OP_LEN,/* A B R(A) := length of R(B) */
++
++OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
++
++OP_JMP,/* sBx pc+=sBx */
++
++OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
++OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
++OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
++
++OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
++OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
++
++OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
++OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
++OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
++
++OP_FORLOOP,/* A sBx R(A)+=R(A+2);
++ if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
++OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
++
++OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
++ if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
++OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
++
++OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
++OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
++
++OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */
++} OpCode;
++
++
++#define NUM_OPCODES (cast(int, OP_VARARG) + 1)
++
++
++
++/*===========================================================================
++ Notes:
++ (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
++ and can be 0: OP_CALL then sets `top' to last_result+1, so
++ next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
++
++ (*) In OP_VARARG, if (B == 0) then use actual number of varargs and
++ set top (like in OP_CALL with C == 0).
++
++ (*) In OP_RETURN, if (B == 0) then return up to `top'
++
++ (*) In OP_SETLIST, if (B == 0) then B = `top';
++ if (C == 0) then next `instruction' is real C
++
++ (*) For comparisons, A specifies what condition the test should accept
++ (true or false).
++
++ (*) All `skips' (pc++) assume that next instruction is a jump
++===========================================================================*/
++
++
++/*
++** masks for instruction properties. The format is:
++** bits 0-1: op mode
++** bits 2-3: C arg mode
++** bits 4-5: B arg mode
++** bit 6: instruction set register A
++** bit 7: operator is a test
++*/
++
++enum OpArgMask {
++ OpArgN, /* argument is not used */
++ OpArgU, /* argument is used */
++ OpArgR, /* argument is a register or a jump offset */
++ OpArgK /* argument is a constant or register/constant */
++};
++
++LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES];
++
++#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
++#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
++#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
++#define testAMode(m) (luaP_opmodes[m] & (1 << 6))
++#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
++
++
++LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
++
++
++/* number of list items to accumulate before a SETLIST instruction */
++#define LFIELDS_PER_FLUSH 50
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lparser.c
+@@ -0,0 +1,1339 @@
++/*
++** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $
++** Lua Parser
++** See Copyright Notice in lua.h
++*/
++
++
++#include <string.h>
++
++#define lparser_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lcode.h"
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "llex.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lparser.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++
++
++
++#define hasmultret(k) ((k) == VCALL || (k) == VVARARG)
++
++#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]])
++
++#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m)
++
++
++/*
++** nodes for block list (list of active blocks)
++*/
++typedef struct BlockCnt {
++ struct BlockCnt *previous; /* chain */
++ int breaklist; /* list of jumps out of this loop */
++ lu_byte nactvar; /* # active locals outside the breakable structure */
++ lu_byte upval; /* true if some variable in the block is an upvalue */
++ lu_byte isbreakable; /* true if `block' is a loop */
++} BlockCnt;
++
++
++
++/*
++** prototypes for recursive non-terminal functions
++*/
++static void chunk (LexState *ls);
++static void expr (LexState *ls, expdesc *v);
++
++
++static void anchor_token (LexState *ls) {
++ if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
++ TString *ts = ls->t.seminfo.ts;
++ luaX_newstring(ls, getstr(ts), ts->tsv.len);
++ }
++}
++
++
++static void error_expected (LexState *ls, int token) {
++ luaX_syntaxerror(ls,
++ luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token)));
++}
++
++
++static void errorlimit (FuncState *fs, int limit, const char *what) {
++ const char *msg = (fs->f->linedefined == 0) ?
++ luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) :
++ luaO_pushfstring(fs->L, "function at line %d has more than %d %s",
++ fs->f->linedefined, limit, what);
++ luaX_lexerror(fs->ls, msg, 0);
++}
++
++
++static int testnext (LexState *ls, int c) {
++ if (ls->t.token == c) {
++ luaX_next(ls);
++ return 1;
++ }
++ else return 0;
++}
++
++
++static void check (LexState *ls, int c) {
++ if (ls->t.token != c)
++ error_expected(ls, c);
++}
++
++static void checknext (LexState *ls, int c) {
++ check(ls, c);
++ luaX_next(ls);
++}
++
++
++#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); }
++
++
++
++static void check_match (LexState *ls, int what, int who, int where) {
++ if (!testnext(ls, what)) {
++ if (where == ls->linenumber)
++ error_expected(ls, what);
++ else {
++ luaX_syntaxerror(ls, luaO_pushfstring(ls->L,
++ LUA_QS " expected (to close " LUA_QS " at line %d)",
++ luaX_token2str(ls, what), luaX_token2str(ls, who), where));
++ }
++ }
++}
++
++
++static TString *str_checkname (LexState *ls) {
++ TString *ts;
++ check(ls, TK_NAME);
++ ts = ls->t.seminfo.ts;
++ luaX_next(ls);
++ return ts;
++}
++
++
++static void init_exp (expdesc *e, expkind k, int i) {
++ e->f = e->t = NO_JUMP;
++ e->k = k;
++ e->u.s.info = i;
++}
++
++
++static void codestring (LexState *ls, expdesc *e, TString *s) {
++ init_exp(e, VK, luaK_stringK(ls->fs, s));
++}
++
++
++static void checkname(LexState *ls, expdesc *e) {
++ codestring(ls, e, str_checkname(ls));
++}
++
++
++static int registerlocalvar (LexState *ls, TString *varname) {
++ FuncState *fs = ls->fs;
++ Proto *f = fs->f;
++ int oldsize = f->sizelocvars;
++ luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
++ LocVar, SHRT_MAX, "too many local variables");
++ while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
++ f->locvars[fs->nlocvars].varname = varname;
++ luaC_objbarrier(ls->L, f, varname);
++ return fs->nlocvars++;
++}
++
++
++#define new_localvarliteral(ls,v,n) \
++ new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n)
++
++
++static void new_localvar (LexState *ls, TString *name, int n) {
++ FuncState *fs = ls->fs;
++ luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables");
++ fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name));
++}
++
++
++static void adjustlocalvars (LexState *ls, int nvars) {
++ FuncState *fs = ls->fs;
++ fs->nactvar = cast_byte(fs->nactvar + nvars);
++ for (; nvars; nvars--) {
++ getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc;
++ }
++}
++
++
++static void removevars (LexState *ls, int tolevel) {
++ FuncState *fs = ls->fs;
++ while (fs->nactvar > tolevel)
++ getlocvar(fs, --fs->nactvar).endpc = fs->pc;
++}
++
++
++static int indexupvalue (FuncState *fs, TString *name, expdesc *v) {
++ int i;
++ Proto *f = fs->f;
++ int oldsize = f->sizeupvalues;
++ for (i=0; i<f->nups; i++) {
++ if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) {
++ lua_assert(f->upvalues[i] == name);
++ return i;
++ }
++ }
++ /* new one */
++ luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues");
++ luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues,
++ TString *, MAX_INT, "");
++ while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL;
++ f->upvalues[f->nups] = name;
++ luaC_objbarrier(fs->L, f, name);
++ lua_assert(v->k == VLOCAL || v->k == VUPVAL);
++ fs->upvalues[f->nups].k = cast_byte(v->k);
++ fs->upvalues[f->nups].info = cast_byte(v->u.s.info);
++ return f->nups++;
++}
++
++
++static int searchvar (FuncState *fs, TString *n) {
++ int i;
++ for (i=fs->nactvar-1; i >= 0; i--) {
++ if (n == getlocvar(fs, i).varname)
++ return i;
++ }
++ return -1; /* not found */
++}
++
++
++static void markupval (FuncState *fs, int level) {
++ BlockCnt *bl = fs->bl;
++ while (bl && bl->nactvar > level) bl = bl->previous;
++ if (bl) bl->upval = 1;
++}
++
++
++static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
++ if (fs == NULL) { /* no more levels? */
++ init_exp(var, VGLOBAL, NO_REG); /* default is global variable */
++ return VGLOBAL;
++ }
++ else {
++ int v = searchvar(fs, n); /* look up at current level */
++ if (v >= 0) {
++ init_exp(var, VLOCAL, v);
++ if (!base)
++ markupval(fs, v); /* local will be used as an upval */
++ return VLOCAL;
++ }
++ else { /* not found at current level; try upper one */
++ if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL)
++ return VGLOBAL;
++ var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */
++ var->k = VUPVAL; /* upvalue in this level */
++ return VUPVAL;
++ }
++ }
++}
++
++
++static void singlevar (LexState *ls, expdesc *var) {
++ TString *varname = str_checkname(ls);
++ FuncState *fs = ls->fs;
++ if (singlevaraux(fs, varname, var, 1) == VGLOBAL)
++ var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */
++}
++
++
++static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
++ FuncState *fs = ls->fs;
++ int extra = nvars - nexps;
++ if (hasmultret(e->k)) {
++ extra++; /* includes call itself */
++ if (extra < 0) extra = 0;
++ luaK_setreturns(fs, e, extra); /* last exp. provides the difference */
++ if (extra > 1) luaK_reserveregs(fs, extra-1);
++ }
++ else {
++ if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */
++ if (extra > 0) {
++ int reg = fs->freereg;
++ luaK_reserveregs(fs, extra);
++ luaK_nil(fs, reg, extra);
++ }
++ }
++}
++
++
++static void enterlevel (LexState *ls) {
++ if (++ls->L->nCcalls > LUAI_MAXCCALLS)
++ luaX_lexerror(ls, "chunk has too many syntax levels", 0);
++}
++
++
++#define leavelevel(ls) ((ls)->L->nCcalls--)
++
++
++static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
++ bl->breaklist = NO_JUMP;
++ bl->isbreakable = isbreakable;
++ bl->nactvar = fs->nactvar;
++ bl->upval = 0;
++ bl->previous = fs->bl;
++ fs->bl = bl;
++ lua_assert(fs->freereg == fs->nactvar);
++}
++
++
++static void leaveblock (FuncState *fs) {
++ BlockCnt *bl = fs->bl;
++ fs->bl = bl->previous;
++ removevars(fs->ls, bl->nactvar);
++ if (bl->upval)
++ luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
++ /* a block either controls scope or breaks (never both) */
++ lua_assert(!bl->isbreakable || !bl->upval);
++ lua_assert(bl->nactvar == fs->nactvar);
++ fs->freereg = fs->nactvar; /* free registers */
++ luaK_patchtohere(fs, bl->breaklist);
++}
++
++
++static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
++ FuncState *fs = ls->fs;
++ Proto *f = fs->f;
++ int oldsize = f->sizep;
++ int i;
++ luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,
++ MAXARG_Bx, "constant table overflow");
++ while (oldsize < f->sizep) f->p[oldsize++] = NULL;
++ f->p[fs->np++] = func->f;
++ luaC_objbarrier(ls->L, f, func->f);
++ init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1));
++ for (i=0; i<func->f->nups; i++) {
++ OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;
++ luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0);
++ }
++}
++
++
++static void open_func (LexState *ls, FuncState *fs) {
++ lua_State *L = ls->L;
++ Proto *f = luaF_newproto(L);
++ fs->f = f;
++ fs->prev = ls->fs; /* linked list of funcstates */
++ fs->ls = ls;
++ fs->L = L;
++ ls->fs = fs;
++ fs->pc = 0;
++ fs->lasttarget = -1;
++ fs->jpc = NO_JUMP;
++ fs->freereg = 0;
++ fs->nk = 0;
++ fs->np = 0;
++ fs->nlocvars = 0;
++ fs->nactvar = 0;
++ fs->bl = NULL;
++ f->source = ls->source;
++ f->maxstacksize = 2; /* registers 0/1 are always valid */
++ fs->h = luaH_new(L, 0, 0);
++ /* anchor table of constants and prototype (to avoid being collected) */
++ sethvalue2s(L, L->top, fs->h);
++ incr_top(L);
++ setptvalue2s(L, L->top, f);
++ incr_top(L);
++}
++
++
++static void close_func (LexState *ls) {
++ lua_State *L = ls->L;
++ FuncState *fs = ls->fs;
++ Proto *f = fs->f;
++ removevars(ls, 0);
++ luaK_ret(fs, 0, 0); /* final return */
++ luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
++ f->sizecode = fs->pc;
++ luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
++ f->sizelineinfo = fs->pc;
++ luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);
++ f->sizek = fs->nk;
++ luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
++ f->sizep = fs->np;
++ luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
++ f->sizelocvars = fs->nlocvars;
++ luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *);
++ f->sizeupvalues = f->nups;
++ lua_assert(luaG_checkcode(f));
++ lua_assert(fs->bl == NULL);
++ ls->fs = fs->prev;
++ L->top -= 2; /* remove table and prototype from the stack */
++ /* last token read was anchored in defunct function; must reanchor it */
++ if (fs) anchor_token(ls);
++}
++
++
++Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) {
++ struct LexState lexstate;
++ struct FuncState funcstate;
++ lexstate.buff = buff;
++ luaX_setinput(L, &lexstate, z, luaS_new(L, name));
++ open_func(&lexstate, &funcstate);
++ funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */
++ luaX_next(&lexstate); /* read first token */
++ chunk(&lexstate);
++ check(&lexstate, TK_EOS);
++ close_func(&lexstate);
++ lua_assert(funcstate.prev == NULL);
++ lua_assert(funcstate.f->nups == 0);
++ lua_assert(lexstate.fs == NULL);
++ return funcstate.f;
++}
++
++
++
++/*============================================================*/
++/* GRAMMAR RULES */
++/*============================================================*/
++
++
++static void field (LexState *ls, expdesc *v) {
++ /* field -> ['.' | ':'] NAME */
++ FuncState *fs = ls->fs;
++ expdesc key;
++ luaK_exp2anyreg(fs, v);
++ luaX_next(ls); /* skip the dot or colon */
++ checkname(ls, &key);
++ luaK_indexed(fs, v, &key);
++}
++
++
++static void yindex (LexState *ls, expdesc *v) {
++ /* index -> '[' expr ']' */
++ luaX_next(ls); /* skip the '[' */
++ expr(ls, v);
++ luaK_exp2val(ls->fs, v);
++ checknext(ls, ']');
++}
++
++
++/*
++** {======================================================================
++** Rules for Constructors
++** =======================================================================
++*/
++
++
++struct ConsControl {
++ expdesc v; /* last list item read */
++ expdesc *t; /* table descriptor */
++ int nh; /* total number of `record' elements */
++ int na; /* total number of array elements */
++ int tostore; /* number of array elements pending to be stored */
++};
++
++
++static void recfield (LexState *ls, struct ConsControl *cc) {
++ /* recfield -> (NAME | `['exp1`]') = exp1 */
++ FuncState *fs = ls->fs;
++ int reg = ls->fs->freereg;
++ expdesc key, val;
++ int rkkey;
++ if (ls->t.token == TK_NAME) {
++ luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
++ checkname(ls, &key);
++ }
++ else /* ls->t.token == '[' */
++ yindex(ls, &key);
++ cc->nh++;
++ checknext(ls, '=');
++ rkkey = luaK_exp2RK(fs, &key);
++ expr(ls, &val);
++ luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));
++ fs->freereg = reg; /* free registers */
++}
++
++
++static void closelistfield (FuncState *fs, struct ConsControl *cc) {
++ if (cc->v.k == VVOID) return; /* there is no list item */
++ luaK_exp2nextreg(fs, &cc->v);
++ cc->v.k = VVOID;
++ if (cc->tostore == LFIELDS_PER_FLUSH) {
++ luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */
++ cc->tostore = 0; /* no more items pending */
++ }
++}
++
++
++static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
++ if (cc->tostore == 0) return;
++ if (hasmultret(cc->v.k)) {
++ luaK_setmultret(fs, &cc->v);
++ luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET);
++ cc->na--; /* do not count last expression (unknown number of elements) */
++ }
++ else {
++ if (cc->v.k != VVOID)
++ luaK_exp2nextreg(fs, &cc->v);
++ luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore);
++ }
++}
++
++
++static void listfield (LexState *ls, struct ConsControl *cc) {
++ expr(ls, &cc->v);
++ luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
++ cc->na++;
++ cc->tostore++;
++}
++
++
++static void constructor (LexState *ls, expdesc *t) {
++ /* constructor -> ?? */
++ FuncState *fs = ls->fs;
++ int line = ls->linenumber;
++ int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
++ struct ConsControl cc;
++ cc.na = cc.nh = cc.tostore = 0;
++ cc.t = t;
++ init_exp(t, VRELOCABLE, pc);
++ init_exp(&cc.v, VVOID, 0); /* no value (yet) */
++ luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */
++ checknext(ls, '{');
++ do {
++ lua_assert(cc.v.k == VVOID || cc.tostore > 0);
++ if (ls->t.token == '}') break;
++ closelistfield(fs, &cc);
++ switch(ls->t.token) {
++ case TK_NAME: { /* may be listfields or recfields */
++ luaX_lookahead(ls);
++ if (ls->lookahead.token != '=') /* expression? */
++ listfield(ls, &cc);
++ else
++ recfield(ls, &cc);
++ break;
++ }
++ case '[': { /* constructor_item -> recfield */
++ recfield(ls, &cc);
++ break;
++ }
++ default: { /* constructor_part -> listfield */
++ listfield(ls, &cc);
++ break;
++ }
++ }
++ } while (testnext(ls, ',') || testnext(ls, ';'));
++ check_match(ls, '}', '{', line);
++ lastlistfield(fs, &cc);
++ SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */
++ SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */
++}
++
++/* }====================================================================== */
++
++
++
++static void parlist (LexState *ls) {
++ /* parlist -> [ param { `,' param } ] */
++ FuncState *fs = ls->fs;
++ Proto *f = fs->f;
++ int nparams = 0;
++ f->is_vararg = 0;
++ if (ls->t.token != ')') { /* is `parlist' not empty? */
++ do {
++ switch (ls->t.token) {
++ case TK_NAME: { /* param -> NAME */
++ new_localvar(ls, str_checkname(ls), nparams++);
++ break;
++ }
++ case TK_DOTS: { /* param -> `...' */
++ luaX_next(ls);
++#if defined(LUA_COMPAT_VARARG)
++ /* use `arg' as default name */
++ new_localvarliteral(ls, "arg", nparams++);
++ f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG;
++#endif
++ f->is_vararg |= VARARG_ISVARARG;
++ break;
++ }
++ default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected");
++ }
++ } while (!f->is_vararg && testnext(ls, ','));
++ }
++ adjustlocalvars(ls, nparams);
++ f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
++ luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
++}
++
++
++static void body (LexState *ls, expdesc *e, int needself, int line) {
++ /* body -> `(' parlist `)' chunk END */
++ FuncState new_fs;
++ open_func(ls, &new_fs);
++ new_fs.f->linedefined = line;
++ checknext(ls, '(');
++ if (needself) {
++ new_localvarliteral(ls, "self", 0);
++ adjustlocalvars(ls, 1);
++ }
++ parlist(ls);
++ checknext(ls, ')');
++ chunk(ls);
++ new_fs.f->lastlinedefined = ls->linenumber;
++ check_match(ls, TK_END, TK_FUNCTION, line);
++ close_func(ls);
++ pushclosure(ls, &new_fs, e);
++}
++
++
++static int explist1 (LexState *ls, expdesc *v) {
++ /* explist1 -> expr { `,' expr } */
++ int n = 1; /* at least one expression */
++ expr(ls, v);
++ while (testnext(ls, ',')) {
++ luaK_exp2nextreg(ls->fs, v);
++ expr(ls, v);
++ n++;
++ }
++ return n;
++}
++
++
++static void funcargs (LexState *ls, expdesc *f) {
++ FuncState *fs = ls->fs;
++ expdesc args;
++ int base, nparams;
++ int line = ls->linenumber;
++ switch (ls->t.token) {
++ case '(': { /* funcargs -> `(' [ explist1 ] `)' */
++ if (line != ls->lastline)
++ luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
++ luaX_next(ls);
++ if (ls->t.token == ')') /* arg list is empty? */
++ args.k = VVOID;
++ else {
++ explist1(ls, &args);
++ luaK_setmultret(fs, &args);
++ }
++ check_match(ls, ')', '(', line);
++ break;
++ }
++ case '{': { /* funcargs -> constructor */
++ constructor(ls, &args);
++ break;
++ }
++ case TK_STRING: { /* funcargs -> STRING */
++ codestring(ls, &args, ls->t.seminfo.ts);
++ luaX_next(ls); /* must use `seminfo' before `next' */
++ break;
++ }
++ default: {
++ luaX_syntaxerror(ls, "function arguments expected");
++ return;
++ }
++ }
++ lua_assert(f->k == VNONRELOC);
++ base = f->u.s.info; /* base register for call */
++ if (hasmultret(args.k))
++ nparams = LUA_MULTRET; /* open call */
++ else {
++ if (args.k != VVOID)
++ luaK_exp2nextreg(fs, &args); /* close last argument */
++ nparams = fs->freereg - (base+1);
++ }
++ init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));
++ luaK_fixline(fs, line);
++ fs->freereg = base+1; /* call remove function and arguments and leaves
++ (unless changed) one result */
++}
++
++
++
++
++/*
++** {======================================================================
++** Expression parsing
++** =======================================================================
++*/
++
++
++static void prefixexp (LexState *ls, expdesc *v) {
++ /* prefixexp -> NAME | '(' expr ')' */
++ switch (ls->t.token) {
++ case '(': {
++ int line = ls->linenumber;
++ luaX_next(ls);
++ expr(ls, v);
++ check_match(ls, ')', '(', line);
++ luaK_dischargevars(ls->fs, v);
++ return;
++ }
++ case TK_NAME: {
++ singlevar(ls, v);
++ return;
++ }
++ default: {
++ luaX_syntaxerror(ls, "unexpected symbol");
++ return;
++ }
++ }
++}
++
++
++static void primaryexp (LexState *ls, expdesc *v) {
++ /* primaryexp ->
++ prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */
++ FuncState *fs = ls->fs;
++ prefixexp(ls, v);
++ for (;;) {
++ switch (ls->t.token) {
++ case '.': { /* field */
++ field(ls, v);
++ break;
++ }
++ case '[': { /* `[' exp1 `]' */
++ expdesc key;
++ luaK_exp2anyreg(fs, v);
++ yindex(ls, &key);
++ luaK_indexed(fs, v, &key);
++ break;
++ }
++ case ':': { /* `:' NAME funcargs */
++ expdesc key;
++ luaX_next(ls);
++ checkname(ls, &key);
++ luaK_self(fs, v, &key);
++ funcargs(ls, v);
++ break;
++ }
++ case '(': case TK_STRING: case '{': { /* funcargs */
++ luaK_exp2nextreg(fs, v);
++ funcargs(ls, v);
++ break;
++ }
++ default: return;
++ }
++ }
++}
++
++
++static void simpleexp (LexState *ls, expdesc *v) {
++ /* simpleexp -> NUMBER | STRING | NIL | true | false | ... |
++ constructor | FUNCTION body | primaryexp */
++ switch (ls->t.token) {
++ case TK_NUMBER: {
++ init_exp(v, VKNUM, 0);
++ v->u.nval = ls->t.seminfo.r;
++ break;
++ }
++ case TK_STRING: {
++ codestring(ls, v, ls->t.seminfo.ts);
++ break;
++ }
++ case TK_NIL: {
++ init_exp(v, VNIL, 0);
++ break;
++ }
++ case TK_TRUE: {
++ init_exp(v, VTRUE, 0);
++ break;
++ }
++ case TK_FALSE: {
++ init_exp(v, VFALSE, 0);
++ break;
++ }
++ case TK_DOTS: { /* vararg */
++ FuncState *fs = ls->fs;
++ check_condition(ls, fs->f->is_vararg,
++ "cannot use " LUA_QL("...") " outside a vararg function");
++ fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */
++ init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
++ break;
++ }
++ case '{': { /* constructor */
++ constructor(ls, v);
++ return;
++ }
++ case TK_FUNCTION: {
++ luaX_next(ls);
++ body(ls, v, 0, ls->linenumber);
++ return;
++ }
++ default: {
++ primaryexp(ls, v);
++ return;
++ }
++ }
++ luaX_next(ls);
++}
++
++
++static UnOpr getunopr (int op) {
++ switch (op) {
++ case TK_NOT: return OPR_NOT;
++ case '-': return OPR_MINUS;
++ case '#': return OPR_LEN;
++ default: return OPR_NOUNOPR;
++ }
++}
++
++
++static BinOpr getbinopr (int op) {
++ switch (op) {
++ case '+': return OPR_ADD;
++ case '-': return OPR_SUB;
++ case '*': return OPR_MUL;
++ case '/': return OPR_DIV;
++ case '%': return OPR_MOD;
++ case '^': return OPR_POW;
++ case TK_CONCAT: return OPR_CONCAT;
++ case TK_NE: return OPR_NE;
++ case TK_EQ: return OPR_EQ;
++ case '<': return OPR_LT;
++ case TK_LE: return OPR_LE;
++ case '>': return OPR_GT;
++ case TK_GE: return OPR_GE;
++ case TK_AND: return OPR_AND;
++ case TK_OR: return OPR_OR;
++ default: return OPR_NOBINOPR;
++ }
++}
++
++
++static const struct {
++ lu_byte left; /* left priority for each binary operator */
++ lu_byte right; /* right priority */
++} priority[] = { /* ORDER OPR */
++ {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */
++ {10, 9}, {5, 4}, /* power and concat (right associative) */
++ {3, 3}, {3, 3}, /* equality and inequality */
++ {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */
++ {2, 2}, {1, 1} /* logical (and/or) */
++};
++
++#define UNARY_PRIORITY 8 /* priority for unary operators */
++
++
++/*
++** subexpr -> (simpleexp | unop subexpr) { binop subexpr }
++** where `binop' is any binary operator with a priority higher than `limit'
++*/
++static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
++ BinOpr op;
++ UnOpr uop;
++ enterlevel(ls);
++ uop = getunopr(ls->t.token);
++ if (uop != OPR_NOUNOPR) {
++ luaX_next(ls);
++ subexpr(ls, v, UNARY_PRIORITY);
++ luaK_prefix(ls->fs, uop, v);
++ }
++ else simpleexp(ls, v);
++ /* expand while operators have priorities higher than `limit' */
++ op = getbinopr(ls->t.token);
++ while (op != OPR_NOBINOPR && priority[op].left > limit) {
++ expdesc v2;
++ BinOpr nextop;
++ luaX_next(ls);
++ luaK_infix(ls->fs, op, v);
++ /* read sub-expression with higher priority */
++ nextop = subexpr(ls, &v2, priority[op].right);
++ luaK_posfix(ls->fs, op, v, &v2);
++ op = nextop;
++ }
++ leavelevel(ls);
++ return op; /* return first untreated operator */
++}
++
++
++static void expr (LexState *ls, expdesc *v) {
++ subexpr(ls, v, 0);
++}
++
++/* }==================================================================== */
++
++
++
++/*
++** {======================================================================
++** Rules for Statements
++** =======================================================================
++*/
++
++
++static int block_follow (int token) {
++ switch (token) {
++ case TK_ELSE: case TK_ELSEIF: case TK_END:
++ case TK_UNTIL: case TK_EOS:
++ return 1;
++ default: return 0;
++ }
++}
++
++
++static void block (LexState *ls) {
++ /* block -> chunk */
++ FuncState *fs = ls->fs;
++ BlockCnt bl;
++ enterblock(fs, &bl, 0);
++ chunk(ls);
++ lua_assert(bl.breaklist == NO_JUMP);
++ leaveblock(fs);
++}
++
++
++/*
++** structure to chain all variables in the left-hand side of an
++** assignment
++*/
++struct LHS_assign {
++ struct LHS_assign *prev;
++ expdesc v; /* variable (global, local, upvalue, or indexed) */
++};
++
++
++/*
++** check whether, in an assignment to a local variable, the local variable
++** is needed in a previous assignment (to a table). If so, save original
++** local value in a safe place and use this safe copy in the previous
++** assignment.
++*/
++static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {
++ FuncState *fs = ls->fs;
++ int extra = fs->freereg; /* eventual position to save local variable */
++ int conflict = 0;
++ for (; lh; lh = lh->prev) {
++ if (lh->v.k == VINDEXED) {
++ if (lh->v.u.s.info == v->u.s.info) { /* conflict? */
++ conflict = 1;
++ lh->v.u.s.info = extra; /* previous assignment will use safe copy */
++ }
++ if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */
++ conflict = 1;
++ lh->v.u.s.aux = extra; /* previous assignment will use safe copy */
++ }
++ }
++ }
++ if (conflict) {
++ luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */
++ luaK_reserveregs(fs, 1);
++ }
++}
++
++
++static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
++ expdesc e;
++ check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED,
++ "syntax error");
++ if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */
++ struct LHS_assign nv;
++ nv.prev = lh;
++ primaryexp(ls, &nv.v);
++ if (nv.v.k == VLOCAL)
++ check_conflict(ls, lh, &nv.v);
++ luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls,
++ "variables in assignment");
++ assignment(ls, &nv, nvars+1);
++ }
++ else { /* assignment -> `=' explist1 */
++ int nexps;
++ checknext(ls, '=');
++ nexps = explist1(ls, &e);
++ if (nexps != nvars) {
++ adjust_assign(ls, nvars, nexps, &e);
++ if (nexps > nvars)
++ ls->fs->freereg -= nexps - nvars; /* remove extra values */
++ }
++ else {
++ luaK_setoneret(ls->fs, &e); /* close last expression */
++ luaK_storevar(ls->fs, &lh->v, &e);
++ return; /* avoid default */
++ }
++ }
++ init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */
++ luaK_storevar(ls->fs, &lh->v, &e);
++}
++
++
++static int cond (LexState *ls) {
++ /* cond -> exp */
++ expdesc v;
++ expr(ls, &v); /* read condition */
++ if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */
++ luaK_goiftrue(ls->fs, &v);
++ return v.f;
++}
++
++
++static void breakstat (LexState *ls) {
++ FuncState *fs = ls->fs;
++ BlockCnt *bl = fs->bl;
++ int upval = 0;
++ while (bl && !bl->isbreakable) {
++ upval |= bl->upval;
++ bl = bl->previous;
++ }
++ if (!bl)
++ luaX_syntaxerror(ls, "no loop to break");
++ if (upval)
++ luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
++ luaK_concat(fs, &bl->breaklist, luaK_jump(fs));
++}
++
++
++static void whilestat (LexState *ls, int line) {
++ /* whilestat -> WHILE cond DO block END */
++ FuncState *fs = ls->fs;
++ int whileinit;
++ int condexit;
++ BlockCnt bl;
++ luaX_next(ls); /* skip WHILE */
++ whileinit = luaK_getlabel(fs);
++ condexit = cond(ls);
++ enterblock(fs, &bl, 1);
++ checknext(ls, TK_DO);
++ block(ls);
++ luaK_patchlist(fs, luaK_jump(fs), whileinit);
++ check_match(ls, TK_END, TK_WHILE, line);
++ leaveblock(fs);
++ luaK_patchtohere(fs, condexit); /* false conditions finish the loop */
++}
++
++
++static void repeatstat (LexState *ls, int line) {
++ /* repeatstat -> REPEAT block UNTIL cond */
++ int condexit;
++ FuncState *fs = ls->fs;
++ int repeat_init = luaK_getlabel(fs);
++ BlockCnt bl1, bl2;
++ enterblock(fs, &bl1, 1); /* loop block */
++ enterblock(fs, &bl2, 0); /* scope block */
++ luaX_next(ls); /* skip REPEAT */
++ chunk(ls);
++ check_match(ls, TK_UNTIL, TK_REPEAT, line);
++ condexit = cond(ls); /* read condition (inside scope block) */
++ if (!bl2.upval) { /* no upvalues? */
++ leaveblock(fs); /* finish scope */
++ luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */
++ }
++ else { /* complete semantics when there are upvalues */
++ breakstat(ls); /* if condition then break */
++ luaK_patchtohere(ls->fs, condexit); /* else... */
++ leaveblock(fs); /* finish scope... */
++ luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */
++ }
++ leaveblock(fs); /* finish loop */
++}
++
++
++static int exp1 (LexState *ls) {
++ expdesc e;
++ int k;
++ expr(ls, &e);
++ k = e.k;
++ luaK_exp2nextreg(ls->fs, &e);
++ return k;
++}
++
++
++static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
++ /* forbody -> DO block */
++ BlockCnt bl;
++ FuncState *fs = ls->fs;
++ int prep, endfor;
++ adjustlocalvars(ls, 3); /* control variables */
++ checknext(ls, TK_DO);
++ prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
++ enterblock(fs, &bl, 0); /* scope for declared variables */
++ adjustlocalvars(ls, nvars);
++ luaK_reserveregs(fs, nvars);
++ block(ls);
++ leaveblock(fs); /* end of scope for declared variables */
++ luaK_patchtohere(fs, prep);
++ endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) :
++ luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars);
++ luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */
++ luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1);
++}
++
++
++static void fornum (LexState *ls, TString *varname, int line) {
++ /* fornum -> NAME = exp1,exp1[,exp1] forbody */
++ FuncState *fs = ls->fs;
++ int base = fs->freereg;
++ new_localvarliteral(ls, "(for index)", 0);
++ new_localvarliteral(ls, "(for limit)", 1);
++ new_localvarliteral(ls, "(for step)", 2);
++ new_localvar(ls, varname, 3);
++ checknext(ls, '=');
++ exp1(ls); /* initial value */
++ checknext(ls, ',');
++ exp1(ls); /* limit */
++ if (testnext(ls, ','))
++ exp1(ls); /* optional step */
++ else { /* default step = 1 */
++ luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1));
++ luaK_reserveregs(fs, 1);
++ }
++ forbody(ls, base, line, 1, 1);
++}
++
++
++static void forlist (LexState *ls, TString *indexname) {
++ /* forlist -> NAME {,NAME} IN explist1 forbody */
++ FuncState *fs = ls->fs;
++ expdesc e;
++ int nvars = 0;
++ int line;
++ int base = fs->freereg;
++ /* create control variables */
++ new_localvarliteral(ls, "(for generator)", nvars++);
++ new_localvarliteral(ls, "(for state)", nvars++);
++ new_localvarliteral(ls, "(for control)", nvars++);
++ /* create declared variables */
++ new_localvar(ls, indexname, nvars++);
++ while (testnext(ls, ','))
++ new_localvar(ls, str_checkname(ls), nvars++);
++ checknext(ls, TK_IN);
++ line = ls->linenumber;
++ adjust_assign(ls, 3, explist1(ls, &e), &e);
++ luaK_checkstack(fs, 3); /* extra space to call generator */
++ forbody(ls, base, line, nvars - 3, 0);
++}
++
++
++static void forstat (LexState *ls, int line) {
++ /* forstat -> FOR (fornum | forlist) END */
++ FuncState *fs = ls->fs;
++ TString *varname;
++ BlockCnt bl;
++ enterblock(fs, &bl, 1); /* scope for loop and control variables */
++ luaX_next(ls); /* skip `for' */
++ varname = str_checkname(ls); /* first variable name */
++ switch (ls->t.token) {
++ case '=': fornum(ls, varname, line); break;
++ case ',': case TK_IN: forlist(ls, varname); break;
++ default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected");
++ }
++ check_match(ls, TK_END, TK_FOR, line);
++ leaveblock(fs); /* loop scope (`break' jumps to this point) */
++}
++
++
++static int test_then_block (LexState *ls) {
++ /* test_then_block -> [IF | ELSEIF] cond THEN block */
++ int condexit;
++ luaX_next(ls); /* skip IF or ELSEIF */
++ condexit = cond(ls);
++ checknext(ls, TK_THEN);
++ block(ls); /* `then' part */
++ return condexit;
++}
++
++
++static void ifstat (LexState *ls, int line) {
++ /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
++ FuncState *fs = ls->fs;
++ int flist;
++ int escapelist = NO_JUMP;
++ flist = test_then_block(ls); /* IF cond THEN block */
++ while (ls->t.token == TK_ELSEIF) {
++ luaK_concat(fs, &escapelist, luaK_jump(fs));
++ luaK_patchtohere(fs, flist);
++ flist = test_then_block(ls); /* ELSEIF cond THEN block */
++ }
++ if (ls->t.token == TK_ELSE) {
++ luaK_concat(fs, &escapelist, luaK_jump(fs));
++ luaK_patchtohere(fs, flist);
++ luaX_next(ls); /* skip ELSE (after patch, for correct line info) */
++ block(ls); /* `else' part */
++ }
++ else
++ luaK_concat(fs, &escapelist, flist);
++ luaK_patchtohere(fs, escapelist);
++ check_match(ls, TK_END, TK_IF, line);
++}
++
++
++static void localfunc (LexState *ls) {
++ expdesc v, b;
++ FuncState *fs = ls->fs;
++ new_localvar(ls, str_checkname(ls), 0);
++ init_exp(&v, VLOCAL, fs->freereg);
++ luaK_reserveregs(fs, 1);
++ adjustlocalvars(ls, 1);
++ body(ls, &b, 0, ls->linenumber);
++ luaK_storevar(fs, &v, &b);
++ /* debug information will only see the variable after this point! */
++ getlocvar(fs, fs->nactvar - 1).startpc = fs->pc;
++}
++
++
++static void localstat (LexState *ls) {
++ /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */
++ int nvars = 0;
++ int nexps;
++ expdesc e;
++ do {
++ new_localvar(ls, str_checkname(ls), nvars++);
++ } while (testnext(ls, ','));
++ if (testnext(ls, '='))
++ nexps = explist1(ls, &e);
++ else {
++ e.k = VVOID;
++ nexps = 0;
++ }
++ adjust_assign(ls, nvars, nexps, &e);
++ adjustlocalvars(ls, nvars);
++}
++
++
++static int funcname (LexState *ls, expdesc *v) {
++ /* funcname -> NAME {field} [`:' NAME] */
++ int needself = 0;
++ singlevar(ls, v);
++ while (ls->t.token == '.')
++ field(ls, v);
++ if (ls->t.token == ':') {
++ needself = 1;
++ field(ls, v);
++ }
++ return needself;
++}
++
++
++static void funcstat (LexState *ls, int line) {
++ /* funcstat -> FUNCTION funcname body */
++ int needself;
++ expdesc v, b;
++ luaX_next(ls); /* skip FUNCTION */
++ needself = funcname(ls, &v);
++ body(ls, &b, needself, line);
++ luaK_storevar(ls->fs, &v, &b);
++ luaK_fixline(ls->fs, line); /* definition `happens' in the first line */
++}
++
++
++static void exprstat (LexState *ls) {
++ /* stat -> func | assignment */
++ FuncState *fs = ls->fs;
++ struct LHS_assign v;
++ primaryexp(ls, &v.v);
++ if (v.v.k == VCALL) /* stat -> func */
++ SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */
++ else { /* stat -> assignment */
++ v.prev = NULL;
++ assignment(ls, &v, 1);
++ }
++}
++
++
++static void retstat (LexState *ls) {
++ /* stat -> RETURN explist */
++ FuncState *fs = ls->fs;
++ expdesc e;
++ int first, nret; /* registers with returned values */
++ luaX_next(ls); /* skip RETURN */
++ if (block_follow(ls->t.token) || ls->t.token == ';')
++ first = nret = 0; /* return no values */
++ else {
++ nret = explist1(ls, &e); /* optional return values */
++ if (hasmultret(e.k)) {
++ luaK_setmultret(fs, &e);
++ if (e.k == VCALL && nret == 1) { /* tail call? */
++ SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
++ lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
++ }
++ first = fs->nactvar;
++ nret = LUA_MULTRET; /* return all values */
++ }
++ else {
++ if (nret == 1) /* only one single value? */
++ first = luaK_exp2anyreg(fs, &e);
++ else {
++ luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */
++ first = fs->nactvar; /* return all `active' values */
++ lua_assert(nret == fs->freereg - first);
++ }
++ }
++ }
++ luaK_ret(fs, first, nret);
++}
++
++
++static int statement (LexState *ls) {
++ int line = ls->linenumber; /* may be needed for error messages */
++ switch (ls->t.token) {
++ case TK_IF: { /* stat -> ifstat */
++ ifstat(ls, line);
++ return 0;
++ }
++ case TK_WHILE: { /* stat -> whilestat */
++ whilestat(ls, line);
++ return 0;
++ }
++ case TK_DO: { /* stat -> DO block END */
++ luaX_next(ls); /* skip DO */
++ block(ls);
++ check_match(ls, TK_END, TK_DO, line);
++ return 0;
++ }
++ case TK_FOR: { /* stat -> forstat */
++ forstat(ls, line);
++ return 0;
++ }
++ case TK_REPEAT: { /* stat -> repeatstat */
++ repeatstat(ls, line);
++ return 0;
++ }
++ case TK_FUNCTION: {
++ funcstat(ls, line); /* stat -> funcstat */
++ return 0;
++ }
++ case TK_LOCAL: { /* stat -> localstat */
++ luaX_next(ls); /* skip LOCAL */
++ if (testnext(ls, TK_FUNCTION)) /* local function? */
++ localfunc(ls);
++ else
++ localstat(ls);
++ return 0;
++ }
++ case TK_RETURN: { /* stat -> retstat */
++ retstat(ls);
++ return 1; /* must be last statement */
++ }
++ case TK_BREAK: { /* stat -> breakstat */
++ luaX_next(ls); /* skip BREAK */
++ breakstat(ls);
++ return 1; /* must be last statement */
++ }
++ default: {
++ exprstat(ls);
++ return 0; /* to avoid warnings */
++ }
++ }
++}
++
++
++static void chunk (LexState *ls) {
++ /* chunk -> { stat [`;'] } */
++ int islast = 0;
++ enterlevel(ls);
++ while (!islast && !block_follow(ls->t.token)) {
++ islast = statement(ls);
++ testnext(ls, ';');
++ lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&
++ ls->fs->freereg >= ls->fs->nactvar);
++ ls->fs->freereg = ls->fs->nactvar; /* free registers */
++ }
++ leavelevel(ls);
++}
++
++/* }====================================================================== */
+--- /dev/null
++++ b/extensions/LUA/lua/lparser.h
+@@ -0,0 +1,82 @@
++/*
++** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lua Parser
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lparser_h
++#define lparser_h
++
++#include "llimits.h"
++#include "lobject.h"
++#include "lzio.h"
++
++
++/*
++** Expression descriptor
++*/
++
++typedef enum {
++ VVOID, /* no value */
++ VNIL,
++ VTRUE,
++ VFALSE,
++ VK, /* info = index of constant in `k' */
++ VKNUM, /* nval = numerical value */
++ VLOCAL, /* info = local register */
++ VUPVAL, /* info = index of upvalue in `upvalues' */
++ VGLOBAL, /* info = index of table; aux = index of global name in `k' */
++ VINDEXED, /* info = table register; aux = index register (or `k') */
++ VJMP, /* info = instruction pc */
++ VRELOCABLE, /* info = instruction pc */
++ VNONRELOC, /* info = result register */
++ VCALL, /* info = instruction pc */
++ VVARARG /* info = instruction pc */
++} expkind;
++
++typedef struct expdesc {
++ expkind k;
++ union {
++ struct { int info, aux; } s;
++ lua_Number nval;
++ } u;
++ int t; /* patch list of `exit when true' */
++ int f; /* patch list of `exit when false' */
++} expdesc;
++
++
++typedef struct upvaldesc {
++ lu_byte k;
++ lu_byte info;
++} upvaldesc;
++
++
++struct BlockCnt; /* defined in lparser.c */
++
++
++/* state needed to generate code for a given function */
++typedef struct FuncState {
++ Proto *f; /* current function header */
++ Table *h; /* table to find (and reuse) elements in `k' */
++ struct FuncState *prev; /* enclosing function */
++ struct LexState *ls; /* lexical state */
++ struct lua_State *L; /* copy of the Lua state */
++ struct BlockCnt *bl; /* chain of current blocks */
++ int pc; /* next position to code (equivalent to `ncode') */
++ int lasttarget; /* `pc' of last `jump target' */
++ int jpc; /* list of pending jumps to `pc' */
++ int freereg; /* first free register */
++ int nk; /* number of elements in `k' */
++ int np; /* number of elements in `p' */
++ short nlocvars; /* number of elements in `locvars' */
++ lu_byte nactvar; /* number of active local variables */
++ upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */
++ unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */
++} FuncState;
++
++
++LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
++ const char *name);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lstate.c
+@@ -0,0 +1,214 @@
++/*
++** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $
++** Global State
++** See Copyright Notice in lua.h
++*/
++
++
++#include <stddef.h>
++
++#define lstate_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lgc.h"
++#include "llex.h"
++#include "lmem.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++
++
++#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE)
++#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE)
++#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE))
++
++
++/*
++** Main thread combines a thread state and the global state
++*/
++typedef struct LG {
++ lua_State l;
++ global_State g;
++} LG;
++
++
++
++static void stack_init (lua_State *L1, lua_State *L) {
++ /* initialize CallInfo array */
++ L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo);
++ L1->ci = L1->base_ci;
++ L1->size_ci = BASIC_CI_SIZE;
++ L1->end_ci = L1->base_ci + L1->size_ci - 1;
++ /* initialize stack array */
++ L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue);
++ L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK;
++ L1->top = L1->stack;
++ L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1;
++ /* initialize first ci */
++ L1->ci->func = L1->top;
++ setnilvalue(L1->top++); /* `function' entry for this `ci' */
++ L1->base = L1->ci->base = L1->top;
++ L1->ci->top = L1->top + LUA_MINSTACK;
++}
++
++
++static void freestack (lua_State *L, lua_State *L1) {
++ luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo);
++ luaM_freearray(L, L1->stack, L1->stacksize, TValue);
++}
++
++
++/*
++** open parts that may cause memory-allocation errors
++*/
++static void f_luaopen (lua_State *L, void *ud) {
++ global_State *g = G(L);
++ UNUSED(ud);
++ stack_init(L, L); /* init stack */
++ sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */
++ sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */
++ luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
++ luaT_init(L);
++ luaX_init(L);
++ luaS_fix(luaS_newliteral(L, MEMERRMSG));
++ g->GCthreshold = 4*g->totalbytes;
++}
++
++
++static void preinit_state (lua_State *L, global_State *g) {
++ G(L) = g;
++ L->stack = NULL;
++ L->stacksize = 0;
++ L->errorJmp = NULL;
++ L->hook = NULL;
++ L->hookmask = 0;
++ L->basehookcount = 0;
++ L->allowhook = 1;
++ resethookcount(L);
++ L->openupval = NULL;
++ L->size_ci = 0;
++ L->nCcalls = L->baseCcalls = 0;
++ L->status = 0;
++ L->base_ci = L->ci = NULL;
++ L->savedpc = NULL;
++ L->errfunc = 0;
++ setnilvalue(gt(L));
++}
++
++
++static void close_state (lua_State *L) {
++ global_State *g = G(L);
++ luaF_close(L, L->stack); /* close all upvalues for this thread */
++ luaC_freeall(L); /* collect all objects */
++ lua_assert(g->rootgc == obj2gco(L));
++ lua_assert(g->strt.nuse == 0);
++ luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *);
++ luaZ_freebuffer(L, &g->buff);
++ freestack(L, L);
++ lua_assert(g->totalbytes == sizeof(LG));
++ (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0);
++}
++
++
++lua_State *luaE_newthread (lua_State *L) {
++ lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State)));
++ luaC_link(L, obj2gco(L1), LUA_TTHREAD);
++ preinit_state(L1, G(L));
++ stack_init(L1, L); /* init stack */
++ setobj2n(L, gt(L1), gt(L)); /* share table of globals */
++ L1->hookmask = L->hookmask;
++ L1->basehookcount = L->basehookcount;
++ L1->hook = L->hook;
++ resethookcount(L1);
++ lua_assert(iswhite(obj2gco(L1)));
++ return L1;
++}
++
++
++void luaE_freethread (lua_State *L, lua_State *L1) {
++ luaF_close(L1, L1->stack); /* close all upvalues for this thread */
++ lua_assert(L1->openupval == NULL);
++ luai_userstatefree(L1);
++ freestack(L, L1);
++ luaM_freemem(L, fromstate(L1), state_size(lua_State));
++}
++
++
++LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
++ int i;
++ lua_State *L;
++ global_State *g;
++ void *l = (*f)(ud, NULL, 0, state_size(LG));
++ if (l == NULL) return NULL;
++ L = tostate(l);
++ g = &((LG *)L)->g;
++ L->next = NULL;
++ L->tt = LUA_TTHREAD;
++ g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);
++ L->marked = luaC_white(g);
++ set2bits(L->marked, FIXEDBIT, SFIXEDBIT);
++ preinit_state(L, g);
++ g->frealloc = f;
++ g->ud = ud;
++ g->mainthread = L;
++ g->uvhead.u.l.prev = &g->uvhead;
++ g->uvhead.u.l.next = &g->uvhead;
++ g->GCthreshold = 0; /* mark it as unfinished state */
++ g->strt.size = 0;
++ g->strt.nuse = 0;
++ g->strt.hash = NULL;
++ setnilvalue(registry(L));
++ luaZ_initbuffer(L, &g->buff);
++ g->panic = NULL;
++ g->gcstate = GCSpause;
++ g->rootgc = obj2gco(L);
++ g->sweepstrgc = 0;
++ g->sweepgc = &g->rootgc;
++ g->gray = NULL;
++ g->grayagain = NULL;
++ g->weak = NULL;
++ g->tmudata = NULL;
++ g->totalbytes = sizeof(LG);
++ g->gcpause = LUAI_GCPAUSE;
++ g->gcstepmul = LUAI_GCMUL;
++ g->gcdept = 0;
++ for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
++ if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
++ /* memory allocation error: free partial state */
++ close_state(L);
++ L = NULL;
++ }
++ else
++ luai_userstateopen(L);
++ return L;
++}
++
++
++static void callallgcTM (lua_State *L, void *ud) {
++ UNUSED(ud);
++ luaC_callGCTM(L); /* call GC metamethods for all udata */
++}
++
++
++LUA_API void lua_close (lua_State *L) {
++ L = G(L)->mainthread; /* only the main thread can be closed */
++ lua_lock(L);
++ luaF_close(L, L->stack); /* close all upvalues for this thread */
++ luaC_separateudata(L, 1); /* separate udata that have GC metamethods */
++ L->errfunc = 0; /* no error function during GC metamethods */
++ do { /* repeat until no more errors */
++ L->ci = L->base_ci;
++ L->base = L->top = L->ci->base;
++ L->nCcalls = L->baseCcalls = 0;
++ } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
++ lua_assert(G(L)->tmudata == NULL);
++ luai_userstateclose(L);
++ close_state(L);
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lstate.h
+@@ -0,0 +1,169 @@
++/*
++** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $
++** Global State
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lstate_h
++#define lstate_h
++
++#include "lua.h"
++
++#include "lobject.h"
++#include "ltm.h"
++#include "lzio.h"
++
++
++
++struct lua_longjmp; /* defined in ldo.c */
++
++
++/* table of globals */
++#define gt(L) (&L->l_gt)
++
++/* registry */
++#define registry(L) (&G(L)->l_registry)
++
++
++/* extra stack space to handle TM calls and some other extras */
++#define EXTRA_STACK 5
++
++
++#define BASIC_CI_SIZE 8
++
++#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
++
++
++
++typedef struct stringtable {
++ GCObject **hash;
++ lu_int32 nuse; /* number of elements */
++ int size;
++} stringtable;
++
++
++/*
++** informations about a call
++*/
++typedef struct CallInfo {
++ StkId base; /* base for this function */
++ StkId func; /* function index in the stack */
++ StkId top; /* top for this function */
++ const Instruction *savedpc;
++ int nresults; /* expected number of results from this function */
++ int tailcalls; /* number of tail calls lost under this entry */
++} CallInfo;
++
++
++
++#define curr_func(L) (clvalue(L->ci->func))
++#define ci_func(ci) (clvalue((ci)->func))
++#define f_isLua(ci) (!ci_func(ci)->c.isC)
++#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci))
++
++
++/*
++** `global state', shared by all threads of this state
++*/
++typedef struct global_State {
++ stringtable strt; /* hash table for strings */
++ lua_Alloc frealloc; /* function to reallocate memory */
++ void *ud; /* auxiliary data to `frealloc' */
++ lu_byte currentwhite;
++ lu_byte gcstate; /* state of garbage collector */
++ int sweepstrgc; /* position of sweep in `strt' */
++ GCObject *rootgc; /* list of all collectable objects */
++ GCObject **sweepgc; /* position of sweep in `rootgc' */
++ GCObject *gray; /* list of gray objects */
++ GCObject *grayagain; /* list of objects to be traversed atomically */
++ GCObject *weak; /* list of weak tables (to be cleared) */
++ GCObject *tmudata; /* last element of list of userdata to be GC */
++ Mbuffer buff; /* temporary buffer for string concatentation */
++ lu_mem GCthreshold;
++ lu_mem totalbytes; /* number of bytes currently allocated */
++ lu_mem estimate; /* an estimate of number of bytes actually in use */
++ lu_mem gcdept; /* how much GC is `behind schedule' */
++ int gcpause; /* size of pause between successive GCs */
++ int gcstepmul; /* GC `granularity' */
++ lua_CFunction panic; /* to be called in unprotected errors */
++ TValue l_registry;
++ struct lua_State *mainthread;
++ UpVal uvhead; /* head of double-linked list of all open upvalues */
++ struct Table *mt[NUM_TAGS]; /* metatables for basic types */
++ TString *tmname[TM_N]; /* array with tag-method names */
++} global_State;
++
++
++/*
++** `per thread' state
++*/
++struct lua_State {
++ CommonHeader;
++ lu_byte status;
++ StkId top; /* first free slot in the stack */
++ StkId base; /* base of current function */
++ global_State *l_G;
++ CallInfo *ci; /* call info for current function */
++ const Instruction *savedpc; /* `savedpc' of current function */
++ StkId stack_last; /* last free slot in the stack */
++ StkId stack; /* stack base */
++ CallInfo *end_ci; /* points after end of ci array*/
++ CallInfo *base_ci; /* array of CallInfo's */
++ int stacksize;
++ int size_ci; /* size of array `base_ci' */
++ unsigned short nCcalls; /* number of nested C calls */
++ unsigned short baseCcalls; /* nested C calls when resuming coroutine */
++ lu_byte hookmask;
++ lu_byte allowhook;
++ int basehookcount;
++ int hookcount;
++ lua_Hook hook;
++ TValue l_gt; /* table of globals */
++ TValue env; /* temporary place for environments */
++ GCObject *openupval; /* list of open upvalues in this stack */
++ GCObject *gclist;
++ struct lua_longjmp *errorJmp; /* current error recover point */
++ ptrdiff_t errfunc; /* current error handling function (stack index) */
++};
++
++
++#define G(L) (L->l_G)
++
++
++/*
++** Union of all collectable objects
++*/
++union GCObject {
++ GCheader gch;
++ union TString ts;
++ union Udata u;
++ union Closure cl;
++ struct Table h;
++ struct Proto p;
++ struct UpVal uv;
++ struct lua_State th; /* thread */
++};
++
++
++/* macros to convert a GCObject into a specific value */
++#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
++#define gco2ts(o) (&rawgco2ts(o)->tsv)
++#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
++#define gco2u(o) (&rawgco2u(o)->uv)
++#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
++#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
++#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
++#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
++#define ngcotouv(o) \
++ check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
++#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
++
++/* macro to convert any Lua object into a GCObject */
++#define obj2gco(v) (cast(GCObject *, (v)))
++
++
++LUAI_FUNC lua_State *luaE_newthread (lua_State *L);
++LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
++
++#endif
++
+--- /dev/null
++++ b/extensions/LUA/lua/lstring.c
+@@ -0,0 +1,110 @@
++/*
++** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
++** String table (keeps all strings handled by Lua)
++** See Copyright Notice in lua.h
++*/
++
++#include <string.h>
++
++#define lstring_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++#include "lstring.h"
++
++
++
++void luaS_resize (lua_State *L, int newsize) {
++ GCObject **newhash;
++ stringtable *tb;
++ int i;
++ if (G(L)->gcstate == GCSsweepstring)
++ return; /* cannot resize during GC traverse */
++ newhash = luaM_newvector(L, newsize, GCObject *);
++ tb = &G(L)->strt;
++ for (i=0; i<newsize; i++) newhash[i] = NULL;
++ /* rehash */
++ for (i=0; i<tb->size; i++) {
++ GCObject *p = tb->hash[i];
++ while (p) { /* for each node in the list */
++ GCObject *next = p->gch.next; /* save next */
++ unsigned int h = gco2ts(p)->hash;
++ int h1 = lmod(h, newsize); /* new position */
++ lua_assert(cast_int(h%newsize) == lmod(h, newsize));
++ p->gch.next = newhash[h1]; /* chain it */
++ newhash[h1] = p;
++ p = next;
++ }
++ }
++ luaM_freearray(L, tb->hash, tb->size, TString *);
++ tb->size = newsize;
++ tb->hash = newhash;
++}
++
++
++static TString *newlstr (lua_State *L, const char *str, size_t l,
++ unsigned int h) {
++ TString *ts;
++ stringtable *tb;
++ if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char))
++ luaM_toobig(L);
++ ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString)));
++ ts->tsv.len = l;
++ ts->tsv.hash = h;
++ ts->tsv.marked = luaC_white(G(L));
++ ts->tsv.tt = LUA_TSTRING;
++ ts->tsv.reserved = 0;
++ memcpy(ts+1, str, l*sizeof(char));
++ ((char *)(ts+1))[l] = '\0'; /* ending 0 */
++ tb = &G(L)->strt;
++ h = lmod(h, tb->size);
++ ts->tsv.next = tb->hash[h]; /* chain new entry */
++ tb->hash[h] = obj2gco(ts);
++ tb->nuse++;
++ if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)
++ luaS_resize(L, tb->size*2); /* too crowded */
++ return ts;
++}
++
++
++TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
++ GCObject *o;
++ unsigned int h = cast(unsigned int, l); /* seed */
++ size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */
++ size_t l1;
++ for (l1=l; l1>=step; l1-=step) /* compute hash */
++ h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
++ for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)];
++ o != NULL;
++ o = o->gch.next) {
++ TString *ts = rawgco2ts(o);
++ if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
++ /* string may be dead */
++ if (isdead(G(L), o)) changewhite(o);
++ return ts;
++ }
++ }
++ return newlstr(L, str, l, h); /* not found */
++}
++
++
++Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
++ Udata *u;
++ if (s > MAX_SIZET - sizeof(Udata))
++ luaM_toobig(L);
++ u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
++ u->uv.marked = luaC_white(G(L)); /* is not finalized */
++ u->uv.tt = LUA_TUSERDATA;
++ u->uv.len = s;
++ u->uv.metatable = NULL;
++ u->uv.env = e;
++ /* chain it on udata list (after main thread) */
++ u->uv.next = G(L)->mainthread->next;
++ G(L)->mainthread->next = obj2gco(u);
++ return u;
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lstring.h
+@@ -0,0 +1,31 @@
++/*
++** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $
++** String table (keep all strings handled by Lua)
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lstring_h
++#define lstring_h
++
++
++#include "lgc.h"
++#include "lobject.h"
++#include "lstate.h"
++
++
++#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
++
++#define sizeudata(u) (sizeof(union Udata)+(u)->len)
++
++#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
++#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
++ (sizeof(s)/sizeof(char))-1))
++
++#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
++
++LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
++LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
++LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lstrlib.c
+@@ -0,0 +1,883 @@
++/*
++** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
++** Standard library for string operations and pattern-matching
++** See Copyright Notice in lua.h
++*/
++
++
++#include <ctype.h>
++#include <stddef.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#define lstrlib_c
++#define LUA_LIB
++
++#include "lua.h"
++
++#include "lauxlib.h"
++#include "lualib.h"
++
++
++/* macro to `unsign' a character */
++#define uchar(c) ((unsigned char)(c))
++
++
++
++static int str_len (lua_State *L) {
++ size_t l;
++ luaL_checklstring(L, 1, &l);
++ lua_pushinteger(L, l);
++ return 1;
++}
++
++
++static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {
++ /* relative string position: negative means back from end */
++ if (pos < 0) pos += (ptrdiff_t)len + 1;
++ return (pos >= 0) ? pos : 0;
++}
++
++
++static int str_sub (lua_State *L) {
++ size_t l;
++ const char *s = luaL_checklstring(L, 1, &l);
++ ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l);
++ ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l);
++ if (start < 1) start = 1;
++ if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;
++ if (start <= end)
++ lua_pushlstring(L, s+start-1, end-start+1);
++ else lua_pushliteral(L, "");
++ return 1;
++}
++
++
++static int str_reverse (lua_State *L) {
++ size_t l;
++ const char *s = luaL_checklstring(L, 1, &l);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_reverse: cannot allocate memory");
++ luaL_buffinit(L, b);
++ while (l--) luaL_addchar(b, s[l]);
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++static int str_lower (lua_State *L) {
++ size_t l;
++ size_t i;
++ const char *s = luaL_checklstring(L, 1, &l);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_lower: cannot allocate memory");
++ luaL_buffinit(L, b);
++ for (i=0; i<l; i++)
++ luaL_addchar(b, tolower(uchar(s[i])));
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++static int str_upper (lua_State *L) {
++ size_t l;
++ size_t i;
++ const char *s = luaL_checklstring(L, 1, &l);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_upper: cannot allocate memory");
++ luaL_buffinit(L, b);
++ for (i=0; i<l; i++)
++ luaL_addchar(b, toupper(uchar(s[i])));
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++static int str_rep (lua_State *L) {
++ size_t l;
++ const char *s = luaL_checklstring(L, 1, &l);
++ int n = luaL_checkint(L, 2);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_rep: cannot allocate memory");
++ luaL_buffinit(L, b);
++ while (n-- > 0)
++ luaL_addlstring(b, s, l);
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++static int str_byte (lua_State *L) {
++ size_t l;
++ const char *s = luaL_checklstring(L, 1, &l);
++ ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l);
++ ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l);
++ int n, i;
++ if (posi <= 0) posi = 1;
++ if ((size_t)pose > l) pose = l;
++ if (posi > pose) return 0; /* empty interval; return no values */
++ n = (int)(pose - posi + 1);
++ if (posi + n <= pose) /* overflow? */
++ luaL_error(L, "string slice too long");
++ luaL_checkstack(L, n, "string slice too long");
++ for (i=0; i<n; i++)
++ lua_pushinteger(L, uchar(s[posi+i-1]));
++ return n;
++}
++
++
++static int str_char (lua_State *L) {
++ int n = lua_gettop(L); /* number of arguments */
++ int i;
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_char: cannot allocate memory");
++ luaL_buffinit(L, b);
++ for (i=1; i<=n; i++) {
++ int c = luaL_checkint(L, i);
++ luaL_argcheck(L, uchar(c) == c, i, "invalid value");
++ luaL_addchar(b, uchar(c));
++ }
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++static int writer (lua_State *L, const void* b, size_t size, void* B) {
++ (void)L;
++ luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
++ return 0;
++}
++
++
++static int str_dump (lua_State *L) {
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_dump: cannot allocate memory");
++ luaL_checktype(L, 1, LUA_TFUNCTION);
++ lua_settop(L, 1);
++ luaL_buffinit(L,b);
++ if (lua_dump(L, writer, b) != 0){
++ kfree(b);
++ luaL_error(L, "unable to dump given function");
++ }
++
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++
++/*
++** {======================================================
++** PATTERN MATCHING
++** =======================================================
++*/
++
++
++#define CAP_UNFINISHED (-1)
++#define CAP_POSITION (-2)
++
++typedef struct MatchState {
++ const char *src_init; /* init of source string */
++ const char *src_end; /* end (`\0') of source string */
++ lua_State *L;
++ int level; /* total number of captures (finished or unfinished) */
++ struct {
++ const char *init;
++ ptrdiff_t len;
++ } capture[LUA_MAXCAPTURES];
++} MatchState;
++
++
++#define L_ESC '%'
++#define SPECIALS "^$*+?.([%-"
++
++
++static int check_capture (MatchState *ms, int l) {
++ l -= '1';
++ if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
++ return luaL_error(ms->L, "invalid capture index");
++ return l;
++}
++
++
++static int capture_to_close (MatchState *ms) {
++ int level = ms->level;
++ for (level--; level>=0; level--)
++ if (ms->capture[level].len == CAP_UNFINISHED) return level;
++ return luaL_error(ms->L, "invalid pattern capture");
++}
++
++
++static const char *classend (MatchState *ms, const char *p) {
++ switch (*p++) {
++ case L_ESC: {
++ if (*p == '\0')
++ luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
++ return p+1;
++ }
++ case '[': {
++ if (*p == '^') p++;
++ do { /* look for a `]' */
++ if (*p == '\0')
++ luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
++ if (*(p++) == L_ESC && *p != '\0')
++ p++; /* skip escapes (e.g. `%]') */
++ } while (*p != ']');
++ return p+1;
++ }
++ default: {
++ return p;
++ }
++ }
++}
++
++
++static int match_class (int c, int cl) {
++ int res;
++ switch (tolower(cl)) {
++ case 'a' : res = isalpha(c); break;
++ case 'c' : res = iscntrl(c); break;
++ case 'd' : res = isdigit(c); break;
++ case 'l' : res = islower(c); break;
++ case 'p' : res = ispunct(c); break;
++ case 's' : res = isspace(c); break;
++ case 'u' : res = isupper(c); break;
++ case 'w' : res = isalnum(c); break;
++ case 'x' : res = isxdigit(c); break;
++ case 'z' : res = (c == 0); break;
++ default: return (cl == c);
++ }
++ return (islower(cl) ? res : !res);
++}
++
++
++static int matchbracketclass (int c, const char *p, const char *ec) {
++ int sig = 1;
++ if (*(p+1) == '^') {
++ sig = 0;
++ p++; /* skip the `^' */
++ }
++ while (++p < ec) {
++ if (*p == L_ESC) {
++ p++;
++ if (match_class(c, uchar(*p)))
++ return sig;
++ }
++ else if ((*(p+1) == '-') && (p+2 < ec)) {
++ p+=2;
++ if (uchar(*(p-2)) <= c && c <= uchar(*p))
++ return sig;
++ }
++ else if (uchar(*p) == c) return sig;
++ }
++ return !sig;
++}
++
++
++static int singlematch (int c, const char *p, const char *ep) {
++ switch (*p) {
++ case '.': return 1; /* matches any char */
++ case L_ESC: return match_class(c, uchar(*(p+1)));
++ case '[': return matchbracketclass(c, p, ep-1);
++ default: return (uchar(*p) == c);
++ }
++}
++
++
++static const char *match (MatchState *ms, const char *s, const char *p);
++
++
++static const char *matchbalance (MatchState *ms, const char *s,
++ const char *p) {
++ if (*p == 0 || *(p+1) == 0)
++ luaL_error(ms->L, "unbalanced pattern");
++ if (*s != *p) return NULL;
++ else {
++ int b = *p;
++ int e = *(p+1);
++ int cont = 1;
++ while (++s < ms->src_end) {
++ if (*s == e) {
++ if (--cont == 0) return s+1;
++ }
++ else if (*s == b) cont++;
++ }
++ }
++ return NULL; /* string ends out of balance */
++}
++
++
++static const char *max_expand (MatchState *ms, const char *s,
++ const char *p, const char *ep) {
++ ptrdiff_t i = 0; /* counts maximum expand for item */
++ while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))
++ i++;
++ /* keeps trying to match with the maximum repetitions */
++ while (i>=0) {
++ const char *res = match(ms, (s+i), ep+1);
++ if (res) return res;
++ i--; /* else didn't match; reduce 1 repetition to try again */
++ }
++ return NULL;
++}
++
++
++static const char *min_expand (MatchState *ms, const char *s,
++ const char *p, const char *ep) {
++ for (;;) {
++ const char *res = match(ms, s, ep+1);
++ if (res != NULL)
++ return res;
++ else if (s<ms->src_end && singlematch(uchar(*s), p, ep))
++ s++; /* try with one more repetition */
++ else return NULL;
++ }
++}
++
++
++static const char *start_capture (MatchState *ms, const char *s,
++ const char *p, int what) {
++ const char *res;
++ int level = ms->level;
++ if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
++ ms->capture[level].init = s;
++ ms->capture[level].len = what;
++ ms->level = level+1;
++ if ((res=match(ms, s, p)) == NULL) /* match failed? */
++ ms->level--; /* undo capture */
++ return res;
++}
++
++
++static const char *end_capture (MatchState *ms, const char *s,
++ const char *p) {
++ int l = capture_to_close(ms);
++ const char *res;
++ ms->capture[l].len = s - ms->capture[l].init; /* close capture */
++ if ((res = match(ms, s, p)) == NULL) /* match failed? */
++ ms->capture[l].len = CAP_UNFINISHED; /* undo capture */
++ return res;
++}
++
++
++static const char *match_capture (MatchState *ms, const char *s, int l) {
++ size_t len;
++ l = check_capture(ms, l);
++ len = ms->capture[l].len;
++ if ((size_t)(ms->src_end-s) >= len &&
++ memcmp(ms->capture[l].init, s, len) == 0)
++ return s+len;
++ else return NULL;
++}
++
++
++static const char *match (MatchState *ms, const char *s, const char *p) {
++ init: /* using goto's to optimize tail recursion */
++ switch (*p) {
++ case '(': { /* start capture */
++ if (*(p+1) == ')') /* position capture? */
++ return start_capture(ms, s, p+2, CAP_POSITION);
++ else
++ return start_capture(ms, s, p+1, CAP_UNFINISHED);
++ }
++ case ')': { /* end capture */
++ return end_capture(ms, s, p+1);
++ }
++ case L_ESC: {
++ switch (*(p+1)) {
++ case 'b': { /* balanced string? */
++ s = matchbalance(ms, s, p+2);
++ if (s == NULL) return NULL;
++ p+=4; goto init; /* else return match(ms, s, p+4); */
++ }
++ case 'f': { /* frontier? */
++ const char *ep; char previous;
++ p += 2;
++ if (*p != '[')
++ luaL_error(ms->L, "missing " LUA_QL("[") " after "
++ LUA_QL("%%f") " in pattern");
++ ep = classend(ms, p); /* points to what is next */
++ previous = (s == ms->src_init) ? '\0' : *(s-1);
++ if (matchbracketclass(uchar(previous), p, ep-1) ||
++ !matchbracketclass(uchar(*s), p, ep-1)) return NULL;
++ p=ep; goto init; /* else return match(ms, s, ep); */
++ }
++ default: {
++ if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */
++ s = match_capture(ms, s, uchar(*(p+1)));
++ if (s == NULL) return NULL;
++ p+=2; goto init; /* else return match(ms, s, p+2) */
++ }
++ goto dflt; /* case default */
++ }
++ }
++ }
++ case '\0': { /* end of pattern */
++ return s; /* match succeeded */
++ }
++ case '$': {
++ if (*(p+1) == '\0') /* is the `$' the last char in pattern? */
++ return (s == ms->src_end) ? s : NULL; /* check end of string */
++ else goto dflt;
++ }
++ default: dflt: { /* it is a pattern item */
++ const char *ep = classend(ms, p); /* points to what is next */
++ int m = s<ms->src_end && singlematch(uchar(*s), p, ep);
++ switch (*ep) {
++ case '?': { /* optional */
++ const char *res;
++ if (m && ((res=match(ms, s+1, ep+1)) != NULL))
++ return res;
++ p=ep+1; goto init; /* else return match(ms, s, ep+1); */
++ }
++ case '*': { /* 0 or more repetitions */
++ return max_expand(ms, s, p, ep);
++ }
++ case '+': { /* 1 or more repetitions */
++ return (m ? max_expand(ms, s+1, p, ep) : NULL);
++ }
++ case '-': { /* 0 or more repetitions (minimum) */
++ return min_expand(ms, s, p, ep);
++ }
++ default: {
++ if (!m) return NULL;
++ s++; p=ep; goto init; /* else return match(ms, s+1, ep); */
++ }
++ }
++ }
++ }
++}
++
++
++
++static const char *lmemfind (const char *s1, size_t l1,
++ const char *s2, size_t l2) {
++ if (l2 == 0) return s1; /* empty strings are everywhere */
++ else if (l2 > l1) return NULL; /* avoids a negative `l1' */
++ else {
++ const char *init; /* to search for a `*s2' inside `s1' */
++ l2--; /* 1st char will be checked by `memchr' */
++ l1 = l1-l2; /* `s2' cannot be found after that */
++ while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
++ init++; /* 1st char is already checked */
++ if (memcmp(init, s2+1, l2) == 0)
++ return init-1;
++ else { /* correct `l1' and `s1' to try again */
++ l1 -= init-s1;
++ s1 = init;
++ }
++ }
++ return NULL; /* not found */
++ }
++}
++
++
++static void push_onecapture (MatchState *ms, int i, const char *s,
++ const char *e) {
++ if (i >= ms->level) {
++ if (i == 0) /* ms->level == 0, too */
++ lua_pushlstring(ms->L, s, e - s); /* add whole match */
++ else
++ luaL_error(ms->L, "invalid capture index");
++ }
++ else {
++ ptrdiff_t l = ms->capture[i].len;
++ if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
++ if (l == CAP_POSITION)
++ lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
++ else
++ lua_pushlstring(ms->L, ms->capture[i].init, l);
++ }
++}
++
++
++static int push_captures (MatchState *ms, const char *s, const char *e) {
++ int i;
++ int nlevels = (ms->level == 0 && s) ? 1 : ms->level;
++ luaL_checkstack(ms->L, nlevels, "too many captures");
++ for (i = 0; i < nlevels; i++)
++ push_onecapture(ms, i, s, e);
++ return nlevels; /* number of strings pushed */
++}
++
++
++static int str_find_aux (lua_State *L, int find) {
++ size_t l1, l2;
++ const char *s = luaL_checklstring(L, 1, &l1);
++ const char *p = luaL_checklstring(L, 2, &l2);
++ ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1;
++ if (init < 0) init = 0;
++ else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;
++ if (find && (lua_toboolean(L, 4) || /* explicit request? */
++ strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */
++ /* do a plain search */
++ const char *s2 = lmemfind(s+init, l1-init, p, l2);
++ if (s2) {
++ lua_pushinteger(L, s2-s+1);
++ lua_pushinteger(L, s2-s+l2);
++ return 2;
++ }
++ }
++ else {
++ MatchState ms;
++ int anchor = (*p == '^') ? (p++, 1) : 0;
++ const char *s1=s+init;
++ ms.L = L;
++ ms.src_init = s;
++ ms.src_end = s+l1;
++ do {
++ const char *res;
++ ms.level = 0;
++ if ((res=match(&ms, s1, p)) != NULL) {
++ if (find) {
++ lua_pushinteger(L, s1-s+1); /* start */
++ lua_pushinteger(L, res-s); /* end */
++ return push_captures(&ms, NULL, 0) + 2;
++ }
++ else
++ return push_captures(&ms, s1, res);
++ }
++ } while (s1++ < ms.src_end && !anchor);
++ }
++ lua_pushnil(L); /* not found */
++ return 1;
++}
++
++
++static int str_find (lua_State *L) {
++ return str_find_aux(L, 1);
++}
++
++
++static int str_match (lua_State *L) {
++ return str_find_aux(L, 0);
++}
++
++
++static int gmatch_aux (lua_State *L) {
++ MatchState ms;
++ size_t ls;
++ const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);
++ const char *p = lua_tostring(L, lua_upvalueindex(2));
++ const char *src;
++ ms.L = L;
++ ms.src_init = s;
++ ms.src_end = s+ls;
++ for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));
++ src <= ms.src_end;
++ src++) {
++ const char *e;
++ ms.level = 0;
++ if ((e = match(&ms, src, p)) != NULL) {
++ lua_Integer newstart = e-s;
++ if (e == src) newstart++; /* empty match? go at least one position */
++ lua_pushinteger(L, newstart);
++ lua_replace(L, lua_upvalueindex(3));
++ return push_captures(&ms, src, e);
++ }
++ }
++ return 0; /* not found */
++}
++
++
++static int gmatch (lua_State *L) {
++ luaL_checkstring(L, 1);
++ luaL_checkstring(L, 2);
++ lua_settop(L, 2);
++ lua_pushinteger(L, 0);
++ lua_pushcclosure(L, gmatch_aux, 3);
++ return 1;
++}
++
++
++static int gfind_nodef (lua_State *L) {
++ return luaL_error(L, LUA_QL("string.gfind") " was renamed to "
++ LUA_QL("string.gmatch"));
++}
++
++
++static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
++ const char *e) {
++ size_t l, i;
++ const char *news = lua_tolstring(ms->L, 3, &l);
++ for (i = 0; i < l; i++) {
++ if (news[i] != L_ESC)
++ luaL_addchar(b, news[i]);
++ else {
++ i++; /* skip ESC */
++ if (!isdigit(uchar(news[i])))
++ luaL_addchar(b, news[i]);
++ else if (news[i] == '0')
++ luaL_addlstring(b, s, e - s);
++ else {
++ push_onecapture(ms, news[i] - '1', s, e);
++ luaL_addvalue(b); /* add capture to accumulated result */
++ }
++ }
++ }
++}
++
++
++static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
++ const char *e) {
++ lua_State *L = ms->L;
++ switch (lua_type(L, 3)) {
++ case LUA_TNUMBER:
++ case LUA_TSTRING: {
++ add_s(ms, b, s, e);
++ return;
++ }
++ case LUA_TFUNCTION: {
++ int n;
++ lua_pushvalue(L, 3);
++ n = push_captures(ms, s, e);
++ lua_call(L, n, 1);
++ break;
++ }
++ case LUA_TTABLE: {
++ push_onecapture(ms, 0, s, e);
++ lua_gettable(L, 3);
++ break;
++ }
++ }
++ if (!lua_toboolean(L, -1)) { /* nil or false? */
++ lua_pop(L, 1);
++ lua_pushlstring(L, s, e - s); /* keep original text */
++ }
++ else if (!lua_isstring(L, -1))
++ luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
++ luaL_addvalue(b); /* add result to accumulator */
++}
++
++
++static int str_gsub (lua_State *L) {
++ size_t srcl;
++ const char *src = luaL_checklstring(L, 1, &srcl);
++ const char *p = luaL_checkstring(L, 2);
++ int tr = lua_type(L, 3);
++ int max_s = luaL_optint(L, 4, srcl+1);
++ int anchor = (*p == '^') ? (p++, 1) : 0;
++ int n = 0;
++ MatchState ms;
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_gsub: cannot allocate memory");
++ luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
++ tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
++ "string/function/table expected");
++ luaL_buffinit(L, b);
++ ms.L = L;
++ ms.src_init = src;
++ ms.src_end = src+srcl;
++ while (n < max_s) {
++ const char *e;
++ ms.level = 0;
++ e = match(&ms, src, p);
++ if (e) {
++ n++;
++ add_value(&ms, b, src, e);
++ }
++ if (e && e>src) /* non empty match? */
++ src = e; /* skip it */
++ else if (src < ms.src_end)
++ luaL_addchar(b, *src++);
++ else break;
++ if (anchor) break;
++ }
++ luaL_addlstring(b, src, ms.src_end-src);
++ luaL_pushresult(b);
++ lua_pushinteger(L, n); /* number of substitutions */
++ kfree(b);
++ return 2;
++}
++
++/* }====================================================== */
++
++
++/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */
++#define MAX_ITEM 512
++/* valid flags in a format specification */
++#define FLAGS "-+ #0"
++/*
++** maximum size of each format specification (such as '%-099.99d')
++** (+10 accounts for %99.99x plus margin of error)
++*/
++#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)
++
++
++static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
++ size_t l;
++ const char *s = luaL_checklstring(L, arg, &l);
++ luaL_addchar(b, '"');
++ while (l--) {
++ switch (*s) {
++ case '"': case '\\': case '\n': {
++ luaL_addchar(b, '\\');
++ luaL_addchar(b, *s);
++ break;
++ }
++ case '\r': {
++ luaL_addlstring(b, "\\r", 2);
++ break;
++ }
++ case '\0': {
++ luaL_addlstring(b, "\\000", 4);
++ break;
++ }
++ default: {
++ luaL_addchar(b, *s);
++ break;
++ }
++ }
++ s++;
++ }
++ luaL_addchar(b, '"');
++}
++
++static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
++ const char *p = strfrmt;
++ while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */
++ if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
++ luaL_error(L, "invalid format (repeated flags)");
++ if (isdigit(uchar(*p))) p++; /* skip width */
++ if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
++ if (*p == '.') {
++ p++;
++ if (isdigit(uchar(*p))) p++; /* skip precision */
++ if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
++ }
++ if (isdigit(uchar(*p)))
++ luaL_error(L, "invalid format (width or precision too long)");
++ *(form++) = '%';
++ strncpy(form, strfrmt, p - strfrmt + 1);
++ form += p - strfrmt + 1;
++ *form = '\0';
++ return p;
++}
++
++
++static void addintlen (char *form) {
++ size_t l = strlen(form);
++ char spec = form[l - 1];
++ strcpy(form + l - 1, LUA_INTFRMLEN);
++ form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;
++ form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0';
++}
++
++
++static int str_format (lua_State *L) {
++ int arg = 1;
++ size_t sfl;
++ const char *strfrmt = luaL_checklstring(L, arg, &sfl);
++ const char *strfrmt_end = strfrmt+sfl;
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "str_format: cannot allocate memory");
++ luaL_buffinit(L, b);
++ while (strfrmt < strfrmt_end) {
++ if (*strfrmt != L_ESC)
++ luaL_addchar(b, *strfrmt++);
++ else if (*++strfrmt == L_ESC)
++ luaL_addchar(b, *strfrmt++); /* %% */
++ else { /* format item */
++ char form[MAX_FORMAT]; /* to store the format (`%...') */
++ char buff[MAX_ITEM]; /* to store the formatted item */
++ arg++;
++ strfrmt = scanformat(L, strfrmt, form);
++ switch (*strfrmt++) {
++ case 'c': {
++ sprintf(buff, form, (int)luaL_checknumber(L, arg));
++ break;
++ }
++ case 'd': case 'i': {
++ addintlen(form);
++ sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg));
++ break;
++ }
++ case 'o': case 'u': case 'x': case 'X': {
++ addintlen(form);
++ sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
++ break;
++ }
++ case 'q': {
++ addquoted(L, b, arg);
++ continue; /* skip the 'addsize' at the end */
++ }
++ case 's': {
++ size_t l;
++ const char *s = luaL_checklstring(L, arg, &l);
++ if (!strchr(form, '.') && l >= 100) {
++ /* no precision and string is too long to be formatted;
++ keep original string */
++ lua_pushvalue(L, arg);
++ luaL_addvalue(b);
++ continue; /* skip the `addsize' at the end */
++ }
++ else {
++ sprintf(buff, form, s);
++ break;
++ }
++ }
++ default: { /* also treat cases `pnLlh' */
++ kfree(b);
++ return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
++ LUA_QL("format"), *(strfrmt - 1));
++ }
++ }
++ luaL_addlstring(b, buff, strlen(buff));
++ }
++ }
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++static const luaL_Reg strlib[] = {
++ {"byte", str_byte},
++ {"char", str_char},
++ {"dump", str_dump},
++ {"find", str_find},
++ {"format", str_format},
++ {"gfind", gfind_nodef},
++ {"gmatch", gmatch},
++ {"gsub", str_gsub},
++ {"len", str_len},
++ {"lower", str_lower},
++ {"match", str_match},
++ {"rep", str_rep},
++ {"reverse", str_reverse},
++ {"sub", str_sub},
++ {"upper", str_upper},
++ {NULL, NULL}
++};
++
++
++static void createmetatable (lua_State *L) {
++ lua_createtable(L, 0, 1); /* create metatable for strings */
++ lua_pushliteral(L, ""); /* dummy string */
++ lua_pushvalue(L, -2);
++ lua_setmetatable(L, -2); /* set string metatable */
++ lua_pop(L, 1); /* pop dummy string */
++ lua_pushvalue(L, -2); /* string library... */
++ lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */
++ lua_pop(L, 1); /* pop metatable */
++}
++
++
++/*
++** Open string library
++*/
++LUALIB_API int luaopen_string (lua_State *L) {
++ luaL_register(L, LUA_STRLIBNAME, strlib);
++#if defined(LUA_COMPAT_GFIND)
++ lua_getfield(L, -1, "gmatch");
++ lua_setfield(L, -2, "gfind");
++#endif
++ createmetatable(L);
++ return 1;
++}
+--- /dev/null
++++ b/extensions/LUA/lua/ltable.c
+@@ -0,0 +1,588 @@
++/*
++** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $
++** Lua tables (hash)
++** See Copyright Notice in lua.h
++*/
++
++
++/*
++** Implementation of tables (aka arrays, objects, or hash tables).
++** Tables keep its elements in two parts: an array part and a hash part.
++** Non-negative integer keys are all candidates to be kept in the array
++** part. The actual size of the array is the largest `n' such that at
++** least half the slots between 0 and n are in use.
++** Hash uses a mix of chained scatter table with Brent's variation.
++** A main invariant of these tables is that, if an element is not
++** in its main position (i.e. the `original' position that its hash gives
++** to it), then the colliding element is in its own main position.
++** Hence even when the load factor reaches 100%, performance remains good.
++*/
++
++#include <math.h>
++#include <string.h>
++
++#define ltable_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lgc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstate.h"
++#include "ltable.h"
++
++
++/*
++** max size of array part is 2^MAXBITS
++*/
++#if LUAI_BITSINT > 26
++#define MAXBITS 26
++#else
++#define MAXBITS (LUAI_BITSINT-2)
++#endif
++
++#define MAXASIZE (1 << MAXBITS)
++
++
++#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
++
++#define hashstr(t,str) hashpow2(t, (str)->tsv.hash)
++#define hashboolean(t,p) hashpow2(t, p)
++
++
++/*
++** for some types, it is better to avoid modulus by power of 2, as
++** they tend to have many 2 factors.
++*/
++#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
++
++
++#define hashpointer(t,p) hashmod(t, IntPoint(p))
++
++
++/*
++** number of ints inside a lua_Number
++*/
++#define numints cast_int(sizeof(lua_Number)/sizeof(int))
++
++
++
++#define dummynode (&dummynode_)
++
++static const Node dummynode_ = {
++ {{NULL}, LUA_TNIL}, /* value */
++ {{{NULL}, LUA_TNIL, NULL}} /* key */
++};
++
++
++/*
++** hash for lua_Numbers
++*/
++static Node *hashnum (const Table *t, lua_Number n) {
++ unsigned int a[numints];
++ int i;
++ if (luai_numeq(n, 0)) /* avoid problems with -0 */
++ return gnode(t, 0);
++ memcpy(a, &n, sizeof(a));
++ for (i = 1; i < numints; i++) a[0] += a[i];
++ return hashmod(t, a[0]);
++}
++
++
++
++/*
++** returns the `main' position of an element in a table (that is, the index
++** of its hash value)
++*/
++static Node *mainposition (const Table *t, const TValue *key) {
++ switch (ttype(key)) {
++ case LUA_TNUMBER:
++ return hashnum(t, nvalue(key));
++ case LUA_TSTRING:
++ return hashstr(t, rawtsvalue(key));
++ case LUA_TBOOLEAN:
++ return hashboolean(t, bvalue(key));
++ case LUA_TLIGHTUSERDATA:
++ return hashpointer(t, pvalue(key));
++ default:
++ return hashpointer(t, gcvalue(key));
++ }
++}
++
++
++/*
++** returns the index for `key' if `key' is an appropriate key to live in
++** the array part of the table, -1 otherwise.
++*/
++static int arrayindex (const TValue *key) {
++ if (ttisnumber(key)) {
++ lua_Number n = nvalue(key);
++ int k;
++ lua_number2int(k, n);
++ if (luai_numeq(cast_num(k), n))
++ return k;
++ }
++ return -1; /* `key' did not match some condition */
++}
++
++
++/*
++** returns the index of a `key' for table traversals. First goes all
++** elements in the array part, then elements in the hash part. The
++** beginning of a traversal is signalled by -1.
++*/
++static int findindex (lua_State *L, Table *t, StkId key) {
++ int i;
++ if (ttisnil(key)) return -1; /* first iteration */
++ i = arrayindex(key);
++ if (0 < i && i <= t->sizearray) /* is `key' inside array part? */
++ return i-1; /* yes; that's the index (corrected to C) */
++ else {
++ Node *n = mainposition(t, key);
++ do { /* check whether `key' is somewhere in the chain */
++ /* key may be dead already, but it is ok to use it in `next' */
++ if (luaO_rawequalObj(key2tval(n), key) ||
++ (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) &&
++ gcvalue(gkey(n)) == gcvalue(key))) {
++ i = cast_int(n - gnode(t, 0)); /* key index in hash table */
++ /* hash elements are numbered after array ones */
++ return i + t->sizearray;
++ }
++ else n = gnext(n);
++ } while (n);
++ luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */
++ return 0; /* to avoid warnings */
++ }
++}
++
++
++int luaH_next (lua_State *L, Table *t, StkId key) {
++ int i = findindex(L, t, key); /* find original element */
++ for (i++; i < t->sizearray; i++) { /* try first array part */
++ if (!ttisnil(&t->array[i])) { /* a non-nil value? */
++ setnvalue(key, cast_num(i+1));
++ setobj2s(L, key+1, &t->array[i]);
++ return 1;
++ }
++ }
++ for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
++ if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
++ setobj2s(L, key, key2tval(gnode(t, i)));
++ setobj2s(L, key+1, gval(gnode(t, i)));
++ return 1;
++ }
++ }
++ return 0; /* no more elements */
++}
++
++
++/*
++** {=============================================================
++** Rehash
++** ==============================================================
++*/
++
++
++static int computesizes (int nums[], int *narray) {
++ int i;
++ int twotoi; /* 2^i */
++ int a = 0; /* number of elements smaller than 2^i */
++ int na = 0; /* number of elements to go to array part */
++ int n = 0; /* optimal size for array part */
++ for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {
++ if (nums[i] > 0) {
++ a += nums[i];
++ if (a > twotoi/2) { /* more than half elements present? */
++ n = twotoi; /* optimal size (till now) */
++ na = a; /* all elements smaller than n will go to array part */
++ }
++ }
++ if (a == *narray) break; /* all elements already counted */
++ }
++ *narray = n;
++ lua_assert(*narray/2 <= na && na <= *narray);
++ return na;
++}
++
++
++static int countint (const TValue *key, int *nums) {
++ int k = arrayindex(key);
++ if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */
++ nums[ceillog2(k)]++; /* count as such */
++ return 1;
++ }
++ else
++ return 0;
++}
++
++
++static int numusearray (const Table *t, int *nums) {
++ int lg;
++ int ttlg; /* 2^lg */
++ int ause = 0; /* summation of `nums' */
++ int i = 1; /* count to traverse all array keys */
++ for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */
++ int lc = 0; /* counter */
++ int lim = ttlg;
++ if (lim > t->sizearray) {
++ lim = t->sizearray; /* adjust upper limit */
++ if (i > lim)
++ break; /* no more elements to count */
++ }
++ /* count elements in range (2^(lg-1), 2^lg] */
++ for (; i <= lim; i++) {
++ if (!ttisnil(&t->array[i-1]))
++ lc++;
++ }
++ nums[lg] += lc;
++ ause += lc;
++ }
++ return ause;
++}
++
++
++static int numusehash (const Table *t, int *nums, int *pnasize) {
++ int totaluse = 0; /* total number of elements */
++ int ause = 0; /* summation of `nums' */
++ int i = sizenode(t);
++ while (i--) {
++ Node *n = &t->node[i];
++ if (!ttisnil(gval(n))) {
++ ause += countint(key2tval(n), nums);
++ totaluse++;
++ }
++ }
++ *pnasize += ause;
++ return totaluse;
++}
++
++
++static void setarrayvector (lua_State *L, Table *t, int size) {
++ int i;
++ luaM_reallocvector(L, t->array, t->sizearray, size, TValue);
++ for (i=t->sizearray; i<size; i++)
++ setnilvalue(&t->array[i]);
++ t->sizearray = size;
++}
++
++
++static void setnodevector (lua_State *L, Table *t, int size) {
++ int lsize;
++ if (size == 0) { /* no elements to hash part? */
++ t->node = cast(Node *, dummynode); /* use common `dummynode' */
++ lsize = 0;
++ }
++ else {
++ int i;
++ lsize = ceillog2(size);
++ if (lsize > MAXBITS)
++ luaG_runerror(L, "table overflow");
++ size = twoto(lsize);
++ t->node = luaM_newvector(L, size, Node);
++ for (i=0; i<size; i++) {
++ Node *n = gnode(t, i);
++ gnext(n) = NULL;
++ setnilvalue(gkey(n));
++ setnilvalue(gval(n));
++ }
++ }
++ t->lsizenode = cast_byte(lsize);
++ t->lastfree = gnode(t, size); /* all positions are free */
++}
++
++
++static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
++ int i;
++ int oldasize = t->sizearray;
++ int oldhsize = t->lsizenode;
++ Node *nold = t->node; /* save old hash ... */
++ if (nasize > oldasize) /* array part must grow? */
++ setarrayvector(L, t, nasize);
++ /* create new hash part with appropriate size */
++ setnodevector(L, t, nhsize);
++ if (nasize < oldasize) { /* array part must shrink? */
++ t->sizearray = nasize;
++ /* re-insert elements from vanishing slice */
++ for (i=nasize; i<oldasize; i++) {
++ if (!ttisnil(&t->array[i]))
++ setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]);
++ }
++ /* shrink array */
++ luaM_reallocvector(L, t->array, oldasize, nasize, TValue);
++ }
++ /* re-insert elements from hash part */
++ for (i = twoto(oldhsize) - 1; i >= 0; i--) {
++ Node *old = nold+i;
++ if (!ttisnil(gval(old)))
++ setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old));
++ }
++ if (nold != dummynode)
++ luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */
++}
++
++
++void luaH_resizearray (lua_State *L, Table *t, int nasize) {
++ int nsize = (t->node == dummynode) ? 0 : sizenode(t);
++ resize(L, t, nasize, nsize);
++}
++
++
++static void rehash (lua_State *L, Table *t, const TValue *ek) {
++ int nasize, na;
++ int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */
++ int i;
++ int totaluse;
++ for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */
++ nasize = numusearray(t, nums); /* count keys in array part */
++ totaluse = nasize; /* all those keys are integer keys */
++ totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */
++ /* count extra key */
++ nasize += countint(ek, nums);
++ totaluse++;
++ /* compute new size for array part */
++ na = computesizes(nums, &nasize);
++ /* resize the table to new computed sizes */
++ resize(L, t, nasize, totaluse - na);
++}
++
++
++
++/*
++** }=============================================================
++*/
++
++
++Table *luaH_new (lua_State *L, int narray, int nhash) {
++ Table *t = luaM_new(L, Table);
++ luaC_link(L, obj2gco(t), LUA_TTABLE);
++ t->metatable = NULL;
++ t->flags = cast_byte(~0);
++ /* temporary values (kept only if some malloc fails) */
++ t->array = NULL;
++ t->sizearray = 0;
++ t->lsizenode = 0;
++ t->node = cast(Node *, dummynode);
++ setarrayvector(L, t, narray);
++ setnodevector(L, t, nhash);
++ return t;
++}
++
++
++void luaH_free (lua_State *L, Table *t) {
++ if (t->node != dummynode)
++ luaM_freearray(L, t->node, sizenode(t), Node);
++ luaM_freearray(L, t->array, t->sizearray, TValue);
++ luaM_free(L, t);
++}
++
++
++static Node *getfreepos (Table *t) {
++ while (t->lastfree-- > t->node) {
++ if (ttisnil(gkey(t->lastfree)))
++ return t->lastfree;
++ }
++ return NULL; /* could not find a free place */
++}
++
++
++
++/*
++** inserts a new key into a hash table; first, check whether key's main
++** position is free. If not, check whether colliding node is in its main
++** position or not: if it is not, move colliding node to an empty place and
++** put new key in its main position; otherwise (colliding node is in its main
++** position), new key goes to an empty position.
++*/
++static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
++ Node *mp = mainposition(t, key);
++ if (!ttisnil(gval(mp)) || mp == dummynode) {
++ Node *othern;
++ Node *n = getfreepos(t); /* get a free place */
++ if (n == NULL) { /* cannot find a free place? */
++ rehash(L, t, key); /* grow table */
++ return luaH_set(L, t, key); /* re-insert key into grown table */
++ }
++ lua_assert(n != dummynode);
++ othern = mainposition(t, key2tval(mp));
++ if (othern != mp) { /* is colliding node out of its main position? */
++ /* yes; move colliding node into free position */
++ while (gnext(othern) != mp) othern = gnext(othern); /* find previous */
++ gnext(othern) = n; /* redo the chain with `n' in place of `mp' */
++ *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */
++ gnext(mp) = NULL; /* now `mp' is free */
++ setnilvalue(gval(mp));
++ }
++ else { /* colliding node is in its own main position */
++ /* new node will go into free position */
++ gnext(n) = gnext(mp); /* chain new position */
++ gnext(mp) = n;
++ mp = n;
++ }
++ }
++ gkey(mp)->value = key->value; gkey(mp)->tt = key->tt;
++ luaC_barriert(L, t, key);
++ lua_assert(ttisnil(gval(mp)));
++ return gval(mp);
++}
++
++
++/*
++** search function for integers
++*/
++const TValue *luaH_getnum (Table *t, int key) {
++ /* (1 <= key && key <= t->sizearray) */
++ if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
++ return &t->array[key-1];
++ else {
++ lua_Number nk = cast_num(key);
++ Node *n = hashnum(t, nk);
++ do { /* check whether `key' is somewhere in the chain */
++ if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))
++ return gval(n); /* that's it */
++ else n = gnext(n);
++ } while (n);
++ return luaO_nilobject;
++ }
++}
++
++
++/*
++** search function for strings
++*/
++const TValue *luaH_getstr (Table *t, TString *key) {
++ Node *n = hashstr(t, key);
++ do { /* check whether `key' is somewhere in the chain */
++ if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key)
++ return gval(n); /* that's it */
++ else n = gnext(n);
++ } while (n);
++ return luaO_nilobject;
++}
++
++
++/*
++** main search function
++*/
++const TValue *luaH_get (Table *t, const TValue *key) {
++ switch (ttype(key)) {
++ case LUA_TNIL: return luaO_nilobject;
++ case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
++ case LUA_TNUMBER: {
++ int k;
++ lua_Number n = nvalue(key);
++ lua_number2int(k, n);
++ if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */
++ return luaH_getnum(t, k); /* use specialized version */
++ /* else go through */
++ }
++ default: {
++ Node *n = mainposition(t, key);
++ do { /* check whether `key' is somewhere in the chain */
++ if (luaO_rawequalObj(key2tval(n), key))
++ return gval(n); /* that's it */
++ else n = gnext(n);
++ } while (n);
++ return luaO_nilobject;
++ }
++ }
++}
++
++
++TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
++ const TValue *p = luaH_get(t, key);
++ t->flags = 0;
++ if (p != luaO_nilobject)
++ return cast(TValue *, p);
++ else {
++ if (ttisnil(key)) luaG_runerror(L, "table index is nil");
++ else if (ttisnumber(key) && luai_numisnan(nvalue(key)))
++ luaG_runerror(L, "table index is NaN");
++ return newkey(L, t, key);
++ }
++}
++
++
++TValue *luaH_setnum (lua_State *L, Table *t, int key) {
++ const TValue *p = luaH_getnum(t, key);
++ if (p != luaO_nilobject)
++ return cast(TValue *, p);
++ else {
++ TValue k;
++ setnvalue(&k, cast_num(key));
++ return newkey(L, t, &k);
++ }
++}
++
++
++TValue *luaH_setstr (lua_State *L, Table *t, TString *key) {
++ const TValue *p = luaH_getstr(t, key);
++ if (p != luaO_nilobject)
++ return cast(TValue *, p);
++ else {
++ TValue k;
++ setsvalue(L, &k, key);
++ return newkey(L, t, &k);
++ }
++}
++
++
++static int unbound_search (Table *t, unsigned int j) {
++ unsigned int i = j; /* i is zero or a present index */
++ j++;
++ /* find `i' and `j' such that i is present and j is not */
++ while (!ttisnil(luaH_getnum(t, j))) {
++ i = j;
++ j *= 2;
++ if (j > cast(unsigned int, MAX_INT)) { /* overflow? */
++ /* table was built with bad purposes: resort to linear search */
++ i = 1;
++ while (!ttisnil(luaH_getnum(t, i))) i++;
++ return i - 1;
++ }
++ }
++ /* now do a binary search between them */
++ while (j - i > 1) {
++ unsigned int m = (i+j)/2;
++ if (ttisnil(luaH_getnum(t, m))) j = m;
++ else i = m;
++ }
++ return i;
++}
++
++
++/*
++** Try to find a boundary in table `t'. A `boundary' is an integer index
++** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).
++*/
++int luaH_getn (Table *t) {
++ unsigned int j = t->sizearray;
++ if (j > 0 && ttisnil(&t->array[j - 1])) {
++ /* there is a boundary in the array part: (binary) search for it */
++ unsigned int i = 0;
++ while (j - i > 1) {
++ unsigned int m = (i+j)/2;
++ if (ttisnil(&t->array[m - 1])) j = m;
++ else i = m;
++ }
++ return i;
++ }
++ /* else must find a boundary in hash part */
++ else if (t->node == dummynode) /* hash part is empty? */
++ return j; /* that is easy... */
++ else return unbound_search(t, j);
++}
++
++
++
++#if defined(LUA_DEBUG)
++
++Node *luaH_mainposition (const Table *t, const TValue *key) {
++ return mainposition(t, key);
++}
++
++int luaH_isdummy (Node *n) { return n == dummynode; }
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/ltable.h
+@@ -0,0 +1,40 @@
++/*
++** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lua tables (hash)
++** See Copyright Notice in lua.h
++*/
++
++#ifndef ltable_h
++#define ltable_h
++
++#include "lobject.h"
++
++
++#define gnode(t,i) (&(t)->node[i])
++#define gkey(n) (&(n)->i_key.nk)
++#define gval(n) (&(n)->i_val)
++#define gnext(n) ((n)->i_key.nk.next)
++
++#define key2tval(n) (&(n)->i_key.tvk)
++
++
++LUAI_FUNC const TValue *luaH_getnum (Table *t, int key);
++LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key);
++LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
++LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);
++LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
++LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
++LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash);
++LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);
++LUAI_FUNC void luaH_free (lua_State *L, Table *t);
++LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
++LUAI_FUNC int luaH_getn (Table *t);
++
++
++#if defined(LUA_DEBUG)
++LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
++LUAI_FUNC int luaH_isdummy (Node *n);
++#endif
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/ltablib.c
+@@ -0,0 +1,288 @@
++/*
++** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $
++** Library for Table Manipulation
++** See Copyright Notice in lua.h
++*/
++
++
++#include <stddef.h>
++
++#define ltablib_c
++#define LUA_LIB
++
++#include "lua.h"
++
++#include "lauxlib.h"
++#include "lualib.h"
++
++
++#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))
++
++
++static int foreachi (lua_State *L) {
++ int i;
++ int n = aux_getn(L, 1);
++ luaL_checktype(L, 2, LUA_TFUNCTION);
++ for (i=1; i <= n; i++) {
++ lua_pushvalue(L, 2); /* function */
++ lua_pushinteger(L, i); /* 1st argument */
++ lua_rawgeti(L, 1, i); /* 2nd argument */
++ lua_call(L, 2, 1);
++ if (!lua_isnil(L, -1))
++ return 1;
++ lua_pop(L, 1); /* remove nil result */
++ }
++ return 0;
++}
++
++
++static int foreach (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++ luaL_checktype(L, 2, LUA_TFUNCTION);
++ lua_pushnil(L); /* first key */
++ while (lua_next(L, 1)) {
++ lua_pushvalue(L, 2); /* function */
++ lua_pushvalue(L, -3); /* key */
++ lua_pushvalue(L, -3); /* value */
++ lua_call(L, 2, 1);
++ if (!lua_isnil(L, -1))
++ return 1;
++ lua_pop(L, 2); /* remove value and result */
++ }
++ return 0;
++}
++
++
++static int maxn (lua_State *L) {
++ lua_Number max = 0;
++ luaL_checktype(L, 1, LUA_TTABLE);
++ lua_pushnil(L); /* first key */
++ while (lua_next(L, 1)) {
++ lua_pop(L, 1); /* remove value */
++ if (lua_type(L, -1) == LUA_TNUMBER) {
++ lua_Number v = lua_tonumber(L, -1);
++ if (v > max) max = v;
++ }
++ }
++ lua_pushnumber(L, max);
++ return 1;
++}
++
++
++static int getn (lua_State *L) {
++ lua_pushinteger(L, aux_getn(L, 1));
++ return 1;
++}
++
++
++static int setn (lua_State *L) {
++ luaL_checktype(L, 1, LUA_TTABLE);
++#ifndef luaL_setn
++ luaL_setn(L, 1, luaL_checkint(L, 2));
++#else
++ luaL_error(L, LUA_QL("setn") " is obsolete");
++#endif
++ lua_pushvalue(L, 1);
++ return 1;
++}
++
++
++static int tinsert (lua_State *L) {
++ int e = aux_getn(L, 1) + 1; /* first empty element */
++ int pos; /* where to insert new element */
++ switch (lua_gettop(L)) {
++ case 2: { /* called with only 2 arguments */
++ pos = e; /* insert new element at the end */
++ break;
++ }
++ case 3: {
++ int i;
++ pos = luaL_checkint(L, 2); /* 2nd argument is the position */
++ if (pos > e) e = pos; /* `grow' array if necessary */
++ for (i = e; i > pos; i--) { /* move up elements */
++ lua_rawgeti(L, 1, i-1);
++ lua_rawseti(L, 1, i); /* t[i] = t[i-1] */
++ }
++ break;
++ }
++ default: {
++ return luaL_error(L, "wrong number of arguments to " LUA_QL("insert"));
++ }
++ }
++ luaL_setn(L, 1, e); /* new size */
++ lua_rawseti(L, 1, pos); /* t[pos] = v */
++ return 0;
++}
++
++
++static int tremove (lua_State *L) {
++ int e = aux_getn(L, 1);
++ int pos = luaL_optint(L, 2, e);
++ if (!(1 <= pos && pos <= e)) /* position is outside bounds? */
++ return 0; /* nothing to remove */
++ luaL_setn(L, 1, e - 1); /* t.n = n-1 */
++ lua_rawgeti(L, 1, pos); /* result = t[pos] */
++ for ( ;pos<e; pos++) {
++ lua_rawgeti(L, 1, pos+1);
++ lua_rawseti(L, 1, pos); /* t[pos] = t[pos+1] */
++ }
++ lua_pushnil(L);
++ lua_rawseti(L, 1, e); /* t[e] = nil */
++ return 1;
++}
++
++
++static void addfield (lua_State *L, luaL_Buffer *b, int i) {
++ lua_rawgeti(L, 1, i);
++ if (!lua_isstring(L, -1))
++ luaL_error(L, "invalid value (%s) at index %d in table for "
++ LUA_QL("concat"), luaL_typename(L, -1), i);
++ luaL_addvalue(b);
++}
++
++
++static int tconcat (lua_State *L) {
++ size_t lsep;
++ int i, last;
++ const char *sep = luaL_optlstring(L, 2, "", &lsep);
++ luaL_Buffer *b = (luaL_Buffer *)kmalloc(sizeof(luaL_Buffer) + BUFSIZ, GFP_ATOMIC);
++ if(!b) luaL_error(L, "tconcat: cannot allocate memory");
++ luaL_checktype(L, 1, LUA_TTABLE);
++ i = luaL_optint(L, 3, 1);
++ last = luaL_opt(L, luaL_checkint, 4, luaL_getn(L, 1));
++ luaL_buffinit(L, b);
++ for (; i < last; i++) {
++ addfield(L, b, i);
++ luaL_addlstring(b, sep, lsep);
++ }
++ if (i == last) /* add last value (if interval was not empty) */
++ addfield(L, b, i);
++ luaL_pushresult(b);
++ kfree(b);
++ return 1;
++}
++
++
++
++/*
++** {======================================================
++** Quicksort
++** (based on `Algorithms in MODULA-3', Robert Sedgewick;
++** Addison-Wesley, 1993.)
++*/
++
++
++static void set2 (lua_State *L, int i, int j) {
++ lua_rawseti(L, 1, i);
++ lua_rawseti(L, 1, j);
++}
++
++static int sort_comp (lua_State *L, int a, int b) {
++ if (!lua_isnil(L, 2)) { /* function? */
++ int res;
++ lua_pushvalue(L, 2);
++ lua_pushvalue(L, a-1); /* -1 to compensate function */
++ lua_pushvalue(L, b-2); /* -2 to compensate function and `a' */
++ lua_call(L, 2, 1);
++ res = lua_toboolean(L, -1);
++ lua_pop(L, 1);
++ return res;
++ }
++ else /* a < b? */
++ return lua_lessthan(L, a, b);
++}
++
++static void auxsort (lua_State *L, int l, int u) {
++ while (l < u) { /* for tail recursion */
++ int i, j;
++ /* sort elements a[l], a[(l+u)/2] and a[u] */
++ lua_rawgeti(L, 1, l);
++ lua_rawgeti(L, 1, u);
++ if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */
++ set2(L, l, u); /* swap a[l] - a[u] */
++ else
++ lua_pop(L, 2);
++ if (u-l == 1) break; /* only 2 elements */
++ i = (l+u)/2;
++ lua_rawgeti(L, 1, i);
++ lua_rawgeti(L, 1, l);
++ if (sort_comp(L, -2, -1)) /* a[i]<a[l]? */
++ set2(L, i, l);
++ else {
++ lua_pop(L, 1); /* remove a[l] */
++ lua_rawgeti(L, 1, u);
++ if (sort_comp(L, -1, -2)) /* a[u]<a[i]? */
++ set2(L, i, u);
++ else
++ lua_pop(L, 2);
++ }
++ if (u-l == 2) break; /* only 3 elements */
++ lua_rawgeti(L, 1, i); /* Pivot */
++ lua_pushvalue(L, -1);
++ lua_rawgeti(L, 1, u-1);
++ set2(L, i, u-1);
++ /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
++ i = l; j = u-1;
++ for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
++ /* repeat ++i until a[i] >= P */
++ while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
++ if (i>u) luaL_error(L, "invalid order function for sorting");
++ lua_pop(L, 1); /* remove a[i] */
++ }
++ /* repeat --j until a[j] <= P */
++ while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
++ if (j<l) luaL_error(L, "invalid order function for sorting");
++ lua_pop(L, 1); /* remove a[j] */
++ }
++ if (j<i) {
++ lua_pop(L, 3); /* pop pivot, a[i], a[j] */
++ break;
++ }
++ set2(L, i, j);
++ }
++ lua_rawgeti(L, 1, u-1);
++ lua_rawgeti(L, 1, i);
++ set2(L, u-1, i); /* swap pivot (a[u-1]) with a[i] */
++ /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
++ /* adjust so that smaller half is in [j..i] and larger one in [l..u] */
++ if (i-l < u-i) {
++ j=l; i=i-1; l=i+2;
++ }
++ else {
++ j=i+1; i=u; u=j-2;
++ }
++ auxsort(L, j, i); /* call recursively the smaller one */
++ } /* repeat the routine for the larger one */
++}
++
++static int sort (lua_State *L) {
++ int n = aux_getn(L, 1);
++ luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */
++ if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
++ luaL_checktype(L, 2, LUA_TFUNCTION);
++ lua_settop(L, 2); /* make sure there is two arguments */
++ auxsort(L, 1, n);
++ return 0;
++}
++
++/* }====================================================== */
++
++
++static const luaL_Reg tab_funcs[] = {
++ {"concat", tconcat},
++ {"foreach", foreach},
++ {"foreachi", foreachi},
++ {"getn", getn},
++ {"maxn", maxn},
++ {"insert", tinsert},
++ {"remove", tremove},
++ {"setn", setn},
++ {"sort", sort},
++ {NULL, NULL}
++};
++
++
++LUALIB_API int luaopen_table (lua_State *L) {
++ luaL_register(L, LUA_TABLIBNAME, tab_funcs);
++ return 1;
++}
+--- /dev/null
++++ b/extensions/LUA/lua/ltm.c
+@@ -0,0 +1,74 @@
++/*
++** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $
++** Tag methods
++** See Copyright Notice in lua.h
++*/
++
++#include <string.h>
++
++#define ltm_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "lobject.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++
++
++
++const char *const luaT_typenames[] = {
++ "nil", "boolean", "userdata", "number",
++ "string", "table", "function", "userdata", "thread",
++ "proto", "upval"
++};
++
++
++void luaT_init (lua_State *L) {
++ static const char *const luaT_eventname[] = { /* ORDER TM */
++ "__index", "__newindex",
++ "__gc", "__mode", "__eq",
++ "__add", "__sub", "__mul", "__div", "__mod",
++ "__pow", "__unm", "__len", "__lt", "__le",
++ "__concat", "__call"
++ };
++ int i;
++ for (i=0; i<TM_N; i++) {
++ G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
++ luaS_fix(G(L)->tmname[i]); /* never collect these names */
++ }
++}
++
++
++/*
++** function to be used with macro "fasttm": optimized for absence of
++** tag methods
++*/
++const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
++ const TValue *tm = luaH_getstr(events, ename);
++ lua_assert(event <= TM_EQ);
++ if (ttisnil(tm)) { /* no tag method? */
++ events->flags |= cast_byte(1u<<event); /* cache this fact */
++ return NULL;
++ }
++ else return tm;
++}
++
++
++const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
++ Table *mt;
++ switch (ttype(o)) {
++ case LUA_TTABLE:
++ mt = hvalue(o)->metatable;
++ break;
++ case LUA_TUSERDATA:
++ mt = uvalue(o)->metatable;
++ break;
++ default:
++ mt = G(L)->mt[ttype(o)];
++ }
++ return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/ltm.h
+@@ -0,0 +1,54 @@
++/*
++** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $
++** Tag methods
++** See Copyright Notice in lua.h
++*/
++
++#ifndef ltm_h
++#define ltm_h
++
++
++#include "lobject.h"
++
++
++/*
++* WARNING: if you change the order of this enumeration,
++* grep "ORDER TM"
++*/
++typedef enum {
++ TM_INDEX,
++ TM_NEWINDEX,
++ TM_GC,
++ TM_MODE,
++ TM_EQ, /* last tag method with `fast' access */
++ TM_ADD,
++ TM_SUB,
++ TM_MUL,
++ TM_DIV,
++ TM_MOD,
++ TM_POW,
++ TM_UNM,
++ TM_LEN,
++ TM_LT,
++ TM_LE,
++ TM_CONCAT,
++ TM_CALL,
++ TM_N /* number of elements in the enum */
++} TMS;
++
++
++
++#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
++ ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
++
++#define fasttm(l,et,e) gfasttm(G(l), et, e)
++
++LUAI_DATA const char *const luaT_typenames[];
++
++
++LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
++LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
++ TMS event);
++LUAI_FUNC void luaT_init (lua_State *L);
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/luaconf.h
+@@ -0,0 +1,797 @@
++/*
++** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
++** Configuration file for Lua
++** See Copyright Notice in lua.h
++*/
++
++
++#ifndef lconfig_h
++#define lconfig_h
++
++#include <stddef.h>
++
++#if !defined(__KERNEL__)
++#include <limits.h>
++#else
++#define UCHAR_MAX 255
++#define SHRT_MAX 32767
++#define BUFSIZ 8192
++#define NO_FPU
++#endif
++
++/*
++** ==================================================================
++** Search for "@@" to find all configurable definitions.
++** ===================================================================
++*/
++
++
++/*
++@@ LUA_ANSI controls the use of non-ansi features.
++** CHANGE it (define it) if you want Lua to avoid the use of any
++** non-ansi feature or library.
++*/
++#if defined(__STRICT_ANSI__)
++#define LUA_ANSI
++#endif
++
++
++#if !defined(LUA_ANSI) && defined(_WIN32)
++#define LUA_WIN
++#endif
++
++#if defined(LUA_USE_LINUX)
++#define LUA_USE_POSIX
++#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
++#define LUA_USE_READLINE /* needs some extra libraries */
++#endif
++
++#if defined(LUA_USE_MACOSX)
++#define LUA_USE_POSIX
++#define LUA_DL_DYLD /* does not need extra library */
++#endif
++
++
++
++/*
++@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
++@* Interfaces Extension (XSI).
++** CHANGE it (define it) if your system is XSI compatible.
++*/
++#if defined(LUA_USE_POSIX)
++#define LUA_USE_MKSTEMP
++#define LUA_USE_ISATTY
++#define LUA_USE_POPEN
++#define LUA_USE_ULONGJMP
++#endif
++
++
++/*
++@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
++@* Lua check to set its paths.
++@@ LUA_INIT is the name of the environment variable that Lua
++@* checks for initialization code.
++** CHANGE them if you want different names.
++*/
++#define LUA_PATH "LUA_PATH"
++#define LUA_CPATH "LUA_CPATH"
++#define LUA_INIT "LUA_INIT"
++
++
++/*
++@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
++@* Lua libraries.
++@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
++@* C libraries.
++** CHANGE them if your machine has a non-conventional directory
++** hierarchy or if you want to install your libraries in
++** non-conventional directories.
++*/
++#if defined(_WIN32)
++/*
++** In Windows, any exclamation mark ('!') in the path is replaced by the
++** path of the directory of the executable file of the current process.
++*/
++#define LUA_LDIR "!\\lua\\"
++#define LUA_CDIR "!\\"
++#define LUA_PATH_DEFAULT \
++ ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
++ LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
++#define LUA_CPATH_DEFAULT \
++ ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
++
++#else
++#define LUA_ROOT "/usr/local/"
++#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
++#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
++#define LUA_PATH_DEFAULT \
++ "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
++ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
++#define LUA_CPATH_DEFAULT \
++ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
++#endif
++
++
++/*
++@@ LUA_DIRSEP is the directory separator (for submodules).
++** CHANGE it if your machine does not use "/" as the directory separator
++** and is not Windows. (On Windows Lua automatically uses "\".)
++*/
++#if defined(_WIN32)
++#define LUA_DIRSEP "\\"
++#else
++#define LUA_DIRSEP "/"
++#endif
++
++
++/*
++@@ LUA_PATHSEP is the character that separates templates in a path.
++@@ LUA_PATH_MARK is the string that marks the substitution points in a
++@* template.
++@@ LUA_EXECDIR in a Windows path is replaced by the executable's
++@* directory.
++@@ LUA_IGMARK is a mark to ignore all before it when bulding the
++@* luaopen_ function name.
++** CHANGE them if for some reason your system cannot use those
++** characters. (E.g., if one of those characters is a common character
++** in file/directory names.) Probably you do not need to change them.
++*/
++#define LUA_PATHSEP ";"
++#define LUA_PATH_MARK "?"
++#define LUA_EXECDIR "!"
++#define LUA_IGMARK "-"
++
++
++/*
++@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
++** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
++** machines, ptrdiff_t gives a good choice between int or long.)
++*/
++#define LUA_INTEGER ptrdiff_t
++
++
++/*
++@@ LUA_API is a mark for all core API functions.
++@@ LUALIB_API is a mark for all standard library functions.
++** CHANGE them if you need to define those functions in some special way.
++** For instance, if you want to create one Windows DLL with the core and
++** the libraries, you may want to use the following definition (define
++** LUA_BUILD_AS_DLL to get it).
++*/
++#if defined(LUA_BUILD_AS_DLL)
++
++#if defined(LUA_CORE) || defined(LUA_LIB)
++#define LUA_API __declspec(dllexport)
++#else
++#define LUA_API __declspec(dllimport)
++#endif
++
++#else
++
++#define LUA_API extern
++
++#endif
++
++/* more often than not the libs go together with the core */
++#define LUALIB_API LUA_API
++
++
++/*
++@@ LUAI_FUNC is a mark for all extern functions that are not to be
++@* exported to outside modules.
++@@ LUAI_DATA is a mark for all extern (const) variables that are not to
++@* be exported to outside modules.
++** CHANGE them if you need to mark them in some special way. Elf/gcc
++** (versions 3.2 and later) mark them as "hidden" to optimize access
++** when Lua is compiled as a shared library.
++*/
++#if defined(luaall_c)
++#define LUAI_FUNC static
++#define LUAI_DATA /* empty */
++
++#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
++ defined(__ELF__)
++#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
++#define LUAI_DATA LUAI_FUNC
++
++#else
++#define LUAI_FUNC extern
++#define LUAI_DATA extern
++#endif
++
++
++
++/*
++@@ LUA_QL describes how error messages quote program elements.
++** CHANGE it if you want a different appearance.
++*/
++#define LUA_QL(x) "'" x "'"
++#define LUA_QS LUA_QL("%s")
++
++
++/*
++@@ LUA_IDSIZE gives the maximum size for the description of the source
++@* of a function in debug information.
++** CHANGE it if you want a different size.
++*/
++#define LUA_IDSIZE 60
++
++
++/*
++** {==================================================================
++** Stand-alone configuration
++** ===================================================================
++*/
++
++#if defined(lua_c) || defined(luaall_c)
++
++/*
++@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
++@* is, whether we're running lua interactively).
++** CHANGE it if you have a better definition for non-POSIX/non-Windows
++** systems.
++*/
++#if defined(LUA_USE_ISATTY)
++#include <unistd.h>
++#define lua_stdin_is_tty() isatty(0)
++#elif defined(LUA_WIN)
++#include <io.h>
++#include <stdio.h>
++#define lua_stdin_is_tty() _isatty(_fileno(stdin))
++#else
++#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
++#endif
++
++
++/*
++@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
++@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
++** CHANGE them if you want different prompts. (You can also change the
++** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
++*/
++#define LUA_PROMPT "> "
++#define LUA_PROMPT2 ">> "
++
++
++/*
++@@ LUA_PROGNAME is the default name for the stand-alone Lua program.
++** CHANGE it if your stand-alone interpreter has a different name and
++** your system is not able to detect that name automatically.
++*/
++#define LUA_PROGNAME "lua"
++
++
++/*
++@@ LUA_MAXINPUT is the maximum length for an input line in the
++@* stand-alone interpreter.
++** CHANGE it if you need longer lines.
++*/
++#define LUA_MAXINPUT 512
++
++
++/*
++@@ lua_readline defines how to show a prompt and then read a line from
++@* the standard input.
++@@ lua_saveline defines how to "save" a read line in a "history".
++@@ lua_freeline defines how to free a line read by lua_readline.
++** CHANGE them if you want to improve this functionality (e.g., by using
++** GNU readline and history facilities).
++*/
++#if defined(LUA_USE_READLINE)
++#include <stdio.h>
++#include <readline/readline.h>
++#include <readline/history.h>
++#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
++#define lua_saveline(L,idx) \
++ if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
++ add_history(lua_tostring(L, idx)); /* add it to history */
++#define lua_freeline(L,b) ((void)L, free(b))
++#else
++#define lua_readline(L,b,p) \
++ ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
++ fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
++#define lua_saveline(L,idx) { (void)L; (void)idx; }
++#define lua_freeline(L,b) { (void)L; (void)b; }
++#endif
++
++#endif
++
++/* }================================================================== */
++
++
++/*
++@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
++@* as a percentage.
++** CHANGE it if you want the GC to run faster or slower (higher values
++** mean larger pauses which mean slower collection.) You can also change
++** this value dynamically.
++*/
++#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
++
++
++/*
++@@ LUAI_GCMUL defines the default speed of garbage collection relative to
++@* memory allocation as a percentage.
++** CHANGE it if you want to change the granularity of the garbage
++** collection. (Higher values mean coarser collections. 0 represents
++** infinity, where each step performs a full collection.) You can also
++** change this value dynamically.
++*/
++#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
++
++
++
++/*
++@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
++** CHANGE it (define it) if you want exact compatibility with the
++** behavior of setn/getn in Lua 5.0.
++*/
++#undef LUA_COMPAT_GETN
++
++/*
++@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
++** CHANGE it to undefined as soon as you do not need a global 'loadlib'
++** function (the function is still available as 'package.loadlib').
++*/
++#undef LUA_COMPAT_LOADLIB
++
++/*
++@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
++** CHANGE it to undefined as soon as your programs use only '...' to
++** access vararg parameters (instead of the old 'arg' table).
++*/
++#define LUA_COMPAT_VARARG
++
++/*
++@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
++** CHANGE it to undefined as soon as your programs use 'math.fmod' or
++** the new '%' operator instead of 'math.mod'.
++*/
++#define LUA_COMPAT_MOD
++
++/*
++@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
++@* facility.
++** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
++** off the advisory error when nesting [[...]].
++*/
++#define LUA_COMPAT_LSTR 1
++
++/*
++@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
++** CHANGE it to undefined as soon as you rename 'string.gfind' to
++** 'string.gmatch'.
++*/
++#define LUA_COMPAT_GFIND
++
++/*
++@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
++@* behavior.
++** CHANGE it to undefined as soon as you replace to 'luaL_register'
++** your uses of 'luaL_openlib'
++*/
++#define LUA_COMPAT_OPENLIB
++
++
++
++/*
++@@ luai_apicheck is the assert macro used by the Lua-C API.
++** CHANGE luai_apicheck if you want Lua to perform some checks in the
++** parameters it gets from API calls. This may slow down the interpreter
++** a bit, but may be quite useful when debugging C code that interfaces
++** with Lua. A useful redefinition is to use assert.h.
++*/
++#if defined(LUA_USE_APICHECK)
++#include <assert.h>
++#define luai_apicheck(L,o) { (void)L; assert(o); }
++#else
++#define luai_apicheck(L,o) { (void)L; }
++#endif
++
++
++/*
++@@ LUAI_BITSINT defines the number of bits in an int.
++** CHANGE here if Lua cannot automatically detect the number of bits of
++** your machine. Probably you do not need to change this.
++*/
++/* avoid overflows in comparison */
++#if !defined(__KERNEL__)
++#include <limits.h>
++#define LUA_INT_MAX INT_MAX
++#else
++#define LUA_INT_MAX (~0U>>1)
++#endif
++
++#if LUA_INT_MAX-20 < 32760
++#define LUAI_BITSINT 16
++#elif LUA_INT_MAX > 2147483640L
++/* int has at least 32 bits */
++#define LUAI_BITSINT 32
++#else
++#error "you must define LUA_BITSINT with number of bits in an integer"
++#endif
++
++
++/*
++@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
++@@ LUAI_INT32 is an signed integer with at least 32 bits.
++@@ LUAI_UMEM is an unsigned integer big enough to count the total
++@* memory used by Lua.
++@@ LUAI_MEM is a signed integer big enough to count the total memory
++@* used by Lua.
++** CHANGE here if for some weird reason the default definitions are not
++** good enough for your machine. (The definitions in the 'else'
++** part always works, but may waste space on machines with 64-bit
++** longs.) Probably you do not need to change this.
++*/
++#if LUAI_BITSINT >= 32
++#define LUAI_UINT32 unsigned int
++#define LUAI_INT32 int
++#define LUAI_MAXINT32 INT_MAX
++#define LUAI_UMEM size_t
++#define LUAI_MEM ptrdiff_t
++#else
++/* 16-bit ints */
++#define LUAI_UINT32 unsigned long
++#define LUAI_INT32 long
++#define LUAI_MAXINT32 LONG_MAX
++#define LUAI_UMEM unsigned long
++#define LUAI_MEM long
++#endif
++
++
++/*
++@@ LUAI_MAXCALLS limits the number of nested calls.
++** CHANGE it if you need really deep recursive calls. This limit is
++** arbitrary; its only purpose is to stop infinite recursion before
++** exhausting memory.
++*/
++#define LUAI_MAXCALLS 20000
++
++
++/*
++@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
++@* can use.
++** CHANGE it if you need lots of (Lua) stack space for your C
++** functions. This limit is arbitrary; its only purpose is to stop C
++** functions to consume unlimited stack space. (must be smaller than
++** -LUA_REGISTRYINDEX)
++*/
++#define LUAI_MAXCSTACK 8000
++
++
++
++/*
++** {==================================================================
++** CHANGE (to smaller values) the following definitions if your system
++** has a small C stack. (Or you may want to change them to larger
++** values if your system has a large C stack and these limits are
++** too rigid for you.) Some of these constants control the size of
++** stack-allocated arrays used by the compiler or the interpreter, while
++** others limit the maximum number of recursive calls that the compiler
++** or the interpreter can perform. Values too large may cause a C stack
++** overflow for some forms of deep constructs.
++** ===================================================================
++*/
++
++
++/*
++@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
++@* syntactical nested non-terminals in a program.
++*/
++#define LUAI_MAXCCALLS 200
++
++
++/*
++@@ LUAI_MAXVARS is the maximum number of local variables per function
++@* (must be smaller than 250).
++*/
++#define LUAI_MAXVARS 200
++
++
++/*
++@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
++@* (must be smaller than 250).
++*/
++#define LUAI_MAXUPVALUES 60
++
++
++/*
++@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
++*/
++#define LUAL_BUFFERSIZE BUFSIZ
++
++/* }================================================================== */
++
++
++
++
++/*
++** {==================================================================
++@@ LUA_NUMBER is the type of numbers in Lua.
++** CHANGE the following definitions only if you want to build Lua
++** with a number type different from double. You may also need to
++** change lua_number2int & lua_number2integer.
++** ===================================================================
++*/
++#if !defined(NO_FPU)
++#define LUA_NUMBER_DOUBLE
++#define LUA_NUMBER double
++#else
++#define LUA_NUMBER long
++#endif
++
++/*
++@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
++@* over a number.
++*/
++#define LUAI_UACNUMBER LUA_NUMBER
++
++
++/*
++@@ LUA_NUMBER_SCAN is the format for reading numbers.
++@@ LUA_NUMBER_FMT is the format for writing numbers.
++@@ lua_number2str converts a number to a string.
++@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
++@@ lua_str2number converts a string to a number.
++*/
++#if !defined(NO_FPU)
++#define LUA_NUMBER_SCAN "%lf"
++#define LUA_NUMBER_FMT "%.14g"
++#define lua_str2number(s,p) strtod((s), (p))
++#else
++#define LUA_NUMBER_SCAN "%ld"
++#define LUA_NUMBER_FMT "%ld"
++#if !defined(__KERNEL__)
++#define lua_str2number(s,p) strtol((s), (p), 10)
++#else
++#define lua_str2number(s,p) simple_strtol((s), (p), 10)
++#endif
++#endif
++
++#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
++#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
++
++/*
++@@ The luai_num* macros define the primitive operations over numbers.
++*/
++#if defined(LUA_CORE)
++#define luai_numadd(a,b) ((a)+(b))
++#define luai_numsub(a,b) ((a)-(b))
++#define luai_nummul(a,b) ((a)*(b))
++#define luai_numdiv(a,b) ((a)/(b))
++#define luai_numunm(a) (-(a))
++#define luai_numeq(a,b) ((a)==(b))
++#define luai_numlt(a,b) ((a)<(b))
++#define luai_numle(a,b) ((a)<=(b))
++#define luai_numisnan(a) (!luai_numeq((a), (a)))
++#if !defined(NO_FPU)
++#include <math.h>
++#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
++#define luai_numpow(a,b) (pow(a,b))
++#else
++#define luai_nummod(a,b) ((a)%(b))
++#define luai_numpow(a,b) luai_nummul(a,b)
++#endif
++#endif
++
++
++/*
++@@ lua_number2int is a macro to convert lua_Number to int.
++@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
++** CHANGE them if you know a faster way to convert a lua_Number to
++** int (with any rounding method and without throwing errors) in your
++** system. In Pentium machines, a naive typecast from double to int
++** in C is extremely slow, so any alternative is worth trying.
++*/
++
++/* On a Pentium, resort to a trick */
++#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
++ (defined(__i386) || defined (_M_IX86) || defined(__i386__))
++
++/* On a Microsoft compiler, use assembler */
++#if defined(_MSC_VER)
++
++#define lua_number2int(i,d) __asm fld d __asm fistp i
++#define lua_number2integer(i,n) lua_number2int(i, n)
++
++/* the next trick should work on any Pentium, but sometimes clashes
++ with a DirectX idiosyncrasy */
++#else
++
++union luai_Cast { double l_d; long l_l; };
++#define lua_number2int(i,d) \
++ { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
++#define lua_number2integer(i,n) lua_number2int(i, n)
++
++#endif
++
++
++/* this option always works, but may be slow */
++#else
++#define lua_number2int(i,d) ((i)=(int)(d))
++#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
++
++#endif
++
++/* }================================================================== */
++
++
++/*
++@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
++** CHANGE it if your system requires alignments larger than double. (For
++** instance, if your system supports long doubles and they must be
++** aligned in 16-byte boundaries, then you should add long double in the
++** union.) Probably you do not need to change this.
++*/
++#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
++
++
++/*
++@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
++** CHANGE them if you prefer to use longjmp/setjmp even with C++
++** or if want/don't to use _longjmp/_setjmp instead of regular
++** longjmp/setjmp. By default, Lua handles errors with exceptions when
++** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
++** and with longjmp/setjmp otherwise.
++*/
++#if defined(__KERNEL__)
++#undef LUA_USE_ULONGJMP
++#endif
++
++#if defined(__cplusplus)
++/* C++ exceptions */
++#define LUAI_THROW(L,c) throw(c)
++#define LUAI_TRY(L,c,a) try { a } catch(...) \
++ { if ((c)->status == 0) (c)->status = -1; }
++#define luai_jmpbuf int /* dummy variable */
++
++#elif defined(LUA_USE_ULONGJMP)
++/* in Unix, try _longjmp/_setjmp (more efficient) */
++#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
++#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
++#define luai_jmpbuf jmp_buf
++
++#else
++/* default handling with long jumps */
++#define LUAI_THROW(L,c) longjmp((c)->b, 1)
++#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
++#define luai_jmpbuf jmp_buf
++
++#endif
++
++
++/*
++@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
++@* can do during pattern-matching.
++** CHANGE it if you need more captures. This limit is arbitrary.
++*/
++#define LUA_MAXCAPTURES 32
++
++
++/*
++@@ lua_tmpnam is the function that the OS library uses to create a
++@* temporary name.
++@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
++** CHANGE them if you have an alternative to tmpnam (which is considered
++** insecure) or if you want the original tmpnam anyway. By default, Lua
++** uses tmpnam except when POSIX is available, where it uses mkstemp.
++*/
++#if defined(loslib_c) || defined(luaall_c)
++
++#if defined(LUA_USE_MKSTEMP)
++#include <unistd.h>
++#define LUA_TMPNAMBUFSIZE 32
++#define lua_tmpnam(b,e) { \
++ strcpy(b, "/tmp/lua_XXXXXX"); \
++ e = mkstemp(b); \
++ if (e != -1) close(e); \
++ e = (e == -1); }
++
++#else
++#define LUA_TMPNAMBUFSIZE L_tmpnam
++#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
++#endif
++
++#endif
++
++
++/*
++@@ lua_popen spawns a new process connected to the current one through
++@* the file streams.
++** CHANGE it if you have a way to implement it in your system.
++*/
++#if defined(LUA_USE_POPEN)
++
++#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
++#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
++
++#elif defined(LUA_WIN)
++
++#define lua_popen(L,c,m) ((void)L, _popen(c,m))
++#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
++
++#else
++
++#define lua_popen(L,c,m) ((void)((void)c, m), \
++ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
++#define lua_pclose(L,file) ((void)((void)L, file), 0)
++
++#endif
++
++/*
++@@ LUA_DL_* define which dynamic-library system Lua should use.
++** CHANGE here if Lua has problems choosing the appropriate
++** dynamic-library system for your platform (either Windows' DLL, Mac's
++** dyld, or Unix's dlopen). If your system is some kind of Unix, there
++** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
++** it. To use dlopen you also need to adapt the src/Makefile (probably
++** adding -ldl to the linker options), so Lua does not select it
++** automatically. (When you change the makefile to add -ldl, you must
++** also add -DLUA_USE_DLOPEN.)
++** If you do not want any kind of dynamic library, undefine all these
++** options.
++** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
++*/
++#if defined(LUA_USE_DLOPEN)
++#define LUA_DL_DLOPEN
++#endif
++
++#if defined(LUA_WIN)
++#define LUA_DL_DLL
++#endif
++
++
++/*
++@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
++@* (the data goes just *before* the lua_State pointer).
++** CHANGE (define) this if you really need that. This value must be
++** a multiple of the maximum alignment required for your machine.
++*/
++#define LUAI_EXTRASPACE 0
++
++
++/*
++@@ luai_userstate* allow user-specific actions on threads.
++** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
++** extra when a thread is created/deleted/resumed/yielded.
++*/
++#define luai_userstateopen(L) ((void)L)
++#define luai_userstateclose(L) ((void)L)
++#define luai_userstatethread(L,L1) ((void)L)
++#define luai_userstatefree(L) ((void)L)
++#define luai_userstateresume(L,n) ((void)L)
++#define luai_userstateyield(L,n) ((void)L)
++
++
++/*
++@@ LUA_INTFRMLEN is the length modifier for integer conversions
++@* in 'string.format'.
++@@ LUA_INTFRM_T is the integer type correspoding to the previous length
++@* modifier.
++** CHANGE them if your system supports long long or does not support long.
++*/
++
++#if defined(LUA_USELONGLONG)
++
++#define LUA_INTFRMLEN "ll"
++#define LUA_INTFRM_T long long
++
++#else
++
++#define LUA_INTFRMLEN "l"
++#define LUA_INTFRM_T long
++
++#endif
++
++/* =================================================================== */
++
++/*
++** Local configuration. You can use this space to add your redefinitions
++** without modifying the main part of the file.
++*/
++
++
++
++#endif
++
+--- /dev/null
++++ b/extensions/LUA/lua/lua.h
+@@ -0,0 +1,387 @@
++/*
++** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
++** Lua - An Extensible Extension Language
++** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
++** See Copyright Notice at the end of this file
++*/
++
++
++#ifndef lua_h
++#define lua_h
++
++#include <stdarg.h>
++#include <stddef.h>
++
++#include "luaconf.h"
++
++
++#define LUA_VERSION "Lua 5.1"
++#define LUA_RELEASE "Lua 5.1.4"
++#define LUA_VERSION_NUM 501
++#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
++#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
++
++
++/* mark for precompiled code (`<esc>Lua') */
++#define LUA_SIGNATURE "\033Lua"
++
++/* option for multiple returns in `lua_pcall' and `lua_call' */
++#define LUA_MULTRET (-1)
++
++
++/*
++** pseudo-indices
++*/
++#define LUA_REGISTRYINDEX (-10000)
++#define LUA_ENVIRONINDEX (-10001)
++#define LUA_GLOBALSINDEX (-10002)
++#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
++
++
++/* thread status; 0 is OK */
++#define LUA_YIELD 1
++#define LUA_ERRRUN 2
++#define LUA_ERRSYNTAX 3
++#define LUA_ERRMEM 4
++#define LUA_ERRERR 5
++
++
++typedef struct lua_State lua_State;
++
++typedef int (*lua_CFunction) (lua_State *L);
++
++
++/*
++** functions that read/write blocks when loading/dumping Lua chunks
++*/
++typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
++
++typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
++
++
++/*
++** prototype for memory-allocation functions
++*/
++typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
++
++
++/*
++** basic types
++*/
++#define LUA_TNONE (-1)
++
++#define LUA_TNIL 0
++#define LUA_TBOOLEAN 1
++#define LUA_TLIGHTUSERDATA 2
++#define LUA_TNUMBER 3
++#define LUA_TSTRING 4
++#define LUA_TTABLE 5
++#define LUA_TFUNCTION 6
++#define LUA_TUSERDATA 7
++#define LUA_TTHREAD 8
++
++
++
++/* minimum Lua stack available to a C function */
++#define LUA_MINSTACK 20
++
++
++/*
++** generic extra include file
++*/
++#if defined(LUA_USER_H)
++#include LUA_USER_H
++#endif
++
++
++/* type of numbers in Lua */
++typedef LUA_NUMBER lua_Number;
++
++
++/* type for integer functions */
++typedef LUA_INTEGER lua_Integer;
++
++
++
++/*
++** state manipulation
++*/
++LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
++LUA_API void (lua_close) (lua_State *L);
++LUA_API lua_State *(lua_newthread) (lua_State *L);
++
++LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
++
++
++/*
++** basic stack manipulation
++*/
++LUA_API int (lua_gettop) (lua_State *L);
++LUA_API void (lua_settop) (lua_State *L, int idx);
++LUA_API void (lua_pushvalue) (lua_State *L, int idx);
++LUA_API void (lua_remove) (lua_State *L, int idx);
++LUA_API void (lua_insert) (lua_State *L, int idx);
++LUA_API void (lua_replace) (lua_State *L, int idx);
++LUA_API int (lua_checkstack) (lua_State *L, int sz);
++
++LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
++
++
++/*
++** access functions (stack -> C)
++*/
++
++LUA_API int (lua_isnumber) (lua_State *L, int idx);
++LUA_API int (lua_isstring) (lua_State *L, int idx);
++LUA_API int (lua_iscfunction) (lua_State *L, int idx);
++LUA_API int (lua_isuserdata) (lua_State *L, int idx);
++LUA_API int (lua_type) (lua_State *L, int idx);
++LUA_API const char *(lua_typename) (lua_State *L, int tp);
++
++LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
++LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
++LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
++
++LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
++LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
++LUA_API int (lua_toboolean) (lua_State *L, int idx);
++LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
++LUA_API size_t (lua_objlen) (lua_State *L, int idx);
++LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
++LUA_API void *(lua_touserdata) (lua_State *L, int idx);
++LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
++LUA_API const void *(lua_topointer) (lua_State *L, int idx);
++
++
++/*
++** push functions (C -> stack)
++*/
++LUA_API void (lua_pushnil) (lua_State *L);
++LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
++LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
++LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
++LUA_API void (lua_pushstring) (lua_State *L, const char *s);
++LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
++ va_list argp);
++LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
++LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
++LUA_API void (lua_pushboolean) (lua_State *L, int b);
++LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
++LUA_API int (lua_pushthread) (lua_State *L);
++
++
++/*
++** get functions (Lua -> stack)
++*/
++LUA_API void (lua_gettable) (lua_State *L, int idx);
++LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
++LUA_API void (lua_rawget) (lua_State *L, int idx);
++LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
++LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
++LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
++LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
++LUA_API void (lua_getfenv) (lua_State *L, int idx);
++
++
++/*
++** set functions (stack -> Lua)
++*/
++LUA_API void (lua_settable) (lua_State *L, int idx);
++LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
++LUA_API void (lua_rawset) (lua_State *L, int idx);
++LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
++LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
++LUA_API int (lua_setfenv) (lua_State *L, int idx);
++
++
++/*
++** `load' and `call' functions (load and run Lua code)
++*/
++LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
++LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
++LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
++LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
++ const char *chunkname);
++
++LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
++
++
++/*
++** coroutine functions
++*/
++LUA_API int (lua_yield) (lua_State *L, int nresults);
++LUA_API int (lua_resume) (lua_State *L, int narg);
++LUA_API int (lua_status) (lua_State *L);
++
++/*
++** garbage-collection function and options
++*/
++
++#define LUA_GCSTOP 0
++#define LUA_GCRESTART 1
++#define LUA_GCCOLLECT 2
++#define LUA_GCCOUNT 3
++#define LUA_GCCOUNTB 4
++#define LUA_GCSTEP 5
++#define LUA_GCSETPAUSE 6
++#define LUA_GCSETSTEPMUL 7
++
++LUA_API int (lua_gc) (lua_State *L, int what, int data);
++
++
++/*
++** miscellaneous functions
++*/
++
++LUA_API int (lua_error) (lua_State *L);
++
++LUA_API int (lua_next) (lua_State *L, int idx);
++
++LUA_API void (lua_concat) (lua_State *L, int n);
++
++LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
++LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
++
++
++
++/*
++** ===============================================================
++** some useful macros
++** ===============================================================
++*/
++
++#define lua_pop(L,n) lua_settop(L, -(n)-1)
++
++#define lua_newtable(L) lua_createtable(L, 0, 0)
++
++#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
++
++#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
++
++#define lua_strlen(L,i) lua_objlen(L, (i))
++
++#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
++#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
++#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
++#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
++#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
++#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
++#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
++#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
++
++#define lua_pushliteral(L, s) \
++ lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
++
++#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
++#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
++
++#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
++
++
++
++/*
++** compatibility macros and functions
++*/
++
++#define lua_open() luaL_newstate()
++
++#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
++
++#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
++
++#define lua_Chunkreader lua_Reader
++#define lua_Chunkwriter lua_Writer
++
++
++/* hack */
++LUA_API void lua_setlevel (lua_State *from, lua_State *to);
++
++
++/*
++** {======================================================================
++** Debug API
++** =======================================================================
++*/
++
++
++/*
++** Event codes
++*/
++#define LUA_HOOKCALL 0
++#define LUA_HOOKRET 1
++#define LUA_HOOKLINE 2
++#define LUA_HOOKCOUNT 3
++#define LUA_HOOKTAILRET 4
++
++
++/*
++** Event masks
++*/
++#define LUA_MASKCALL (1 << LUA_HOOKCALL)
++#define LUA_MASKRET (1 << LUA_HOOKRET)
++#define LUA_MASKLINE (1 << LUA_HOOKLINE)
++#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
++
++typedef struct lua_Debug lua_Debug; /* activation record */
++
++
++/* Functions to be called by the debuger in specific events */
++typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
++
++
++LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
++LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
++LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
++LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
++LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
++LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
++
++LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
++LUA_API lua_Hook lua_gethook (lua_State *L);
++LUA_API int lua_gethookmask (lua_State *L);
++LUA_API int lua_gethookcount (lua_State *L);
++
++
++struct lua_Debug {
++ int event;
++ const char *name; /* (n) */
++ const char *namewhat; /* (n) `global', `local', `field', `method' */
++ const char *what; /* (S) `Lua', `C', `main', `tail' */
++ const char *source; /* (S) */
++ int currentline; /* (l) */
++ int nups; /* (u) number of upvalues */
++ int linedefined; /* (S) */
++ int lastlinedefined; /* (S) */
++ char short_src[LUA_IDSIZE]; /* (S) */
++ /* private part */
++ int i_ci; /* active function */
++};
++
++/* }====================================================================== */
++
++
++/******************************************************************************
++* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
++*
++* Permission is hereby granted, free of charge, to any person obtaining
++* a copy of this software and associated documentation files (the
++* "Software"), to deal in the Software without restriction, including
++* without limitation the rights to use, copy, modify, merge, publish,
++* distribute, sublicense, and/or sell copies of the Software, and to
++* permit persons to whom the Software is furnished to do so, subject to
++* the following conditions:
++*
++* The above copyright notice and this permission notice shall be
++* included in all copies or substantial portions of the Software.
++*
++* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
++* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
++* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
++* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++******************************************************************************/
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lualib.h
+@@ -0,0 +1,55 @@
++/*
++** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lua standard libraries
++** See Copyright Notice in lua.h
++*/
++
++
++#ifndef lualib_h
++#define lualib_h
++
++#include "lua.h"
++
++
++/* Key to file-handle type */
++#define LUA_FILEHANDLE "FILE*"
++
++
++#define LUA_COLIBNAME "coroutine"
++LUALIB_API int (luaopen_base) (lua_State *L);
++
++#define LUA_TABLIBNAME "table"
++LUALIB_API int (luaopen_table) (lua_State *L);
++/*
++#define LUA_IOLIBNAME "io"
++LUALIB_API int (luaopen_io) (lua_State *L);
++
++#define LUA_OSLIBNAME "os"
++LUALIB_API int (luaopen_os) (lua_State *L);
++*/
++
++#define LUA_STRLIBNAME "string"
++LUALIB_API int (luaopen_string) (lua_State *L);
++
++/*
++#define LUA_MATHLIBNAME "math"
++LUALIB_API int (luaopen_math) (lua_State *L);
++
++#define LUA_DBLIBNAME "debug"
++LUALIB_API int (luaopen_debug) (lua_State *L);
++
++#define LUA_LOADLIBNAME "package"
++LUALIB_API int (luaopen_package) (lua_State *L);
++*/
++
++/* open all previous libraries */
++LUALIB_API void (luaL_openlibs) (lua_State *L);
++
++
++
++#ifndef lua_assert
++#define lua_assert(x) ((void)0)
++#endif
++
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lundump.c
+@@ -0,0 +1,227 @@
++/*
++** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $
++** load precompiled Lua chunks
++** See Copyright Notice in lua.h
++*/
++
++#include <string.h>
++
++#define lundump_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lmem.h"
++#include "lobject.h"
++#include "lstring.h"
++#include "lundump.h"
++#include "lzio.h"
++
++typedef struct {
++ lua_State* L;
++ ZIO* Z;
++ Mbuffer* b;
++ const char* name;
++} LoadState;
++
++#ifdef LUAC_TRUST_BINARIES
++#define IF(c,s)
++#define error(S,s)
++#else
++#define IF(c,s) if (c) error(S,s)
++
++static void error(LoadState* S, const char* why)
++{
++ luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why);
++ luaD_throw(S->L,LUA_ERRSYNTAX);
++}
++#endif
++
++#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
++#define LoadByte(S) (lu_byte)LoadChar(S)
++#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
++#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
++
++static void LoadBlock(LoadState* S, void* b, size_t size)
++{
++ size_t r=luaZ_read(S->Z,b,size);
++ IF (r!=0, "unexpected end");
++}
++
++static int LoadChar(LoadState* S)
++{
++ char x;
++ LoadVar(S,x);
++ return x;
++}
++
++static int LoadInt(LoadState* S)
++{
++ int x;
++ LoadVar(S,x);
++ IF (x<0, "bad integer");
++ return x;
++}
++
++static lua_Number LoadNumber(LoadState* S)
++{
++ lua_Number x;
++ LoadVar(S,x);
++ return x;
++}
++
++static TString* LoadString(LoadState* S)
++{
++ size_t size;
++ LoadVar(S,size);
++ if (size==0)
++ return NULL;
++ else
++ {
++ char* s=luaZ_openspace(S->L,S->b,size);
++ LoadBlock(S,s,size);
++ return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */
++ }
++}
++
++static void LoadCode(LoadState* S, Proto* f)
++{
++ int n=LoadInt(S);
++ f->code=luaM_newvector(S->L,n,Instruction);
++ f->sizecode=n;
++ LoadVector(S,f->code,n,sizeof(Instruction));
++}
++
++static Proto* LoadFunction(LoadState* S, TString* p);
++
++static void LoadConstants(LoadState* S, Proto* f)
++{
++ int i,n;
++ n=LoadInt(S);
++ f->k=luaM_newvector(S->L,n,TValue);
++ f->sizek=n;
++ for (i=0; i<n; i++) setnilvalue(&f->k[i]);
++ for (i=0; i<n; i++)
++ {
++ TValue* o=&f->k[i];
++ int t=LoadChar(S);
++ switch (t)
++ {
++ case LUA_TNIL:
++ setnilvalue(o);
++ break;
++ case LUA_TBOOLEAN:
++ setbvalue(o,LoadChar(S)!=0);
++ break;
++ case LUA_TNUMBER:
++ setnvalue(o,LoadNumber(S));
++ break;
++ case LUA_TSTRING:
++ setsvalue2n(S->L,o,LoadString(S));
++ break;
++ default:
++ error(S,"bad constant");
++ break;
++ }
++ }
++ n=LoadInt(S);
++ f->p=luaM_newvector(S->L,n,Proto*);
++ f->sizep=n;
++ for (i=0; i<n; i++) f->p[i]=NULL;
++ for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);
++}
++
++static void LoadDebug(LoadState* S, Proto* f)
++{
++ int i,n;
++ n=LoadInt(S);
++ f->lineinfo=luaM_newvector(S->L,n,int);
++ f->sizelineinfo=n;
++ LoadVector(S,f->lineinfo,n,sizeof(int));
++ n=LoadInt(S);
++ f->locvars=luaM_newvector(S->L,n,LocVar);
++ f->sizelocvars=n;
++ for (i=0; i<n; i++) f->locvars[i].varname=NULL;
++ for (i=0; i<n; i++)
++ {
++ f->locvars[i].varname=LoadString(S);
++ f->locvars[i].startpc=LoadInt(S);
++ f->locvars[i].endpc=LoadInt(S);
++ }
++ n=LoadInt(S);
++ f->upvalues=luaM_newvector(S->L,n,TString*);
++ f->sizeupvalues=n;
++ for (i=0; i<n; i++) f->upvalues[i]=NULL;
++ for (i=0; i<n; i++) f->upvalues[i]=LoadString(S);
++}
++
++static Proto* LoadFunction(LoadState* S, TString* p)
++{
++ Proto* f;
++ if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
++ f=luaF_newproto(S->L);
++ setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
++ f->source=LoadString(S); if (f->source==NULL) f->source=p;
++ f->linedefined=LoadInt(S);
++ f->lastlinedefined=LoadInt(S);
++ f->nups=LoadByte(S);
++ f->numparams=LoadByte(S);
++ f->is_vararg=LoadByte(S);
++ f->maxstacksize=LoadByte(S);
++ LoadCode(S,f);
++ LoadConstants(S,f);
++ LoadDebug(S,f);
++ IF (!luaG_checkcode(f), "bad code");
++ S->L->top--;
++ S->L->nCcalls--;
++ return f;
++}
++
++static void LoadHeader(LoadState* S)
++{
++ char h[LUAC_HEADERSIZE];
++ char s[LUAC_HEADERSIZE];
++ luaU_header(h);
++ LoadBlock(S,s,LUAC_HEADERSIZE);
++ IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
++}
++
++/*
++** load precompiled chunk
++*/
++Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
++{
++ LoadState S;
++ if (*name=='@' || *name=='=')
++ S.name=name+1;
++ else if (*name==LUA_SIGNATURE[0])
++ S.name="binary string";
++ else
++ S.name=name;
++ S.L=L;
++ S.Z=Z;
++ S.b=buff;
++ LoadHeader(&S);
++ return LoadFunction(&S,luaS_newliteral(L,"=?"));
++}
++
++/*
++* make header
++*/
++void luaU_header (char* h)
++{
++ int x=1;
++ memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);
++ h+=sizeof(LUA_SIGNATURE)-1;
++ *h++=(char)LUAC_VERSION;
++ *h++=(char)LUAC_FORMAT;
++ *h++=(char)*(char*)&x; /* endianness */
++ *h++=(char)sizeof(int);
++ *h++=(char)sizeof(size_t);
++ *h++=(char)sizeof(Instruction);
++ *h++=(char)sizeof(lua_Number);
++ *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */
++}
+--- /dev/null
++++ b/extensions/LUA/lua/lundump.h
+@@ -0,0 +1,36 @@
++/*
++** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
++** load precompiled Lua chunks
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lundump_h
++#define lundump_h
++
++#include "lobject.h"
++#include "lzio.h"
++
++/* load one chunk; from lundump.c */
++LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);
++
++/* make header; from lundump.c */
++LUAI_FUNC void luaU_header (char* h);
++
++/* dump one chunk; from ldump.c */
++LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
++
++#ifdef luac_c
++/* print one chunk; from print.c */
++LUAI_FUNC void luaU_print (const Proto* f, int full);
++#endif
++
++/* for header of binary files -- this is Lua 5.1 */
++#define LUAC_VERSION 0x51
++
++/* for header of binary files -- this is the official format */
++#define LUAC_FORMAT 0
++
++/* size of header of binary files */
++#define LUAC_HEADERSIZE 12
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lvm.c
+@@ -0,0 +1,762 @@
++/*
++** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
++** Lua virtual machine
++** See Copyright Notice in lua.h
++*/
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#define lvm_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "ldebug.h"
++#include "ldo.h"
++#include "lfunc.h"
++#include "lgc.h"
++#include "lobject.h"
++#include "lopcodes.h"
++#include "lstate.h"
++#include "lstring.h"
++#include "ltable.h"
++#include "ltm.h"
++#include "lvm.h"
++
++
++
++/* limit for table tag-method chains (to avoid loops) */
++#define MAXTAGLOOP 100
++
++
++const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
++ lua_Number num;
++ if (ttisnumber(obj)) return obj;
++ if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) {
++ setnvalue(n, num);
++ return n;
++ }
++ else
++ return NULL;
++}
++
++
++int luaV_tostring (lua_State *L, StkId obj) {
++ if (!ttisnumber(obj))
++ return 0;
++ else {
++ char s[LUAI_MAXNUMBER2STR];
++ lua_Number n = nvalue(obj);
++ lua_number2str(s, n);
++ setsvalue2s(L, obj, luaS_new(L, s));
++ return 1;
++ }
++}
++
++
++static void traceexec (lua_State *L, const Instruction *pc) {
++ lu_byte mask = L->hookmask;
++ const Instruction *oldpc = L->savedpc;
++ L->savedpc = pc;
++ if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) {
++ resethookcount(L);
++ luaD_callhook(L, LUA_HOOKCOUNT, -1);
++ }
++ if (mask & LUA_MASKLINE) {
++ Proto *p = ci_func(L->ci)->l.p;
++ int npc = pcRel(pc, p);
++ int newline = getline(p, npc);
++ /* call linehook when enter a new function, when jump back (loop),
++ or when enter a new line */
++ if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p)))
++ luaD_callhook(L, LUA_HOOKLINE, newline);
++ }
++}
++
++
++static void callTMres (lua_State *L, StkId res, const TValue *f,
++ const TValue *p1, const TValue *p2) {
++ ptrdiff_t result = savestack(L, res);
++ setobj2s(L, L->top, f); /* push function */
++ setobj2s(L, L->top+1, p1); /* 1st argument */
++ setobj2s(L, L->top+2, p2); /* 2nd argument */
++ luaD_checkstack(L, 3);
++ L->top += 3;
++ luaD_call(L, L->top - 3, 1);
++ res = restorestack(L, result);
++ L->top--;
++ setobjs2s(L, res, L->top);
++}
++
++
++
++static void callTM (lua_State *L, const TValue *f, const TValue *p1,
++ const TValue *p2, const TValue *p3) {
++ setobj2s(L, L->top, f); /* push function */
++ setobj2s(L, L->top+1, p1); /* 1st argument */
++ setobj2s(L, L->top+2, p2); /* 2nd argument */
++ setobj2s(L, L->top+3, p3); /* 3th argument */
++ luaD_checkstack(L, 4);
++ L->top += 4;
++ luaD_call(L, L->top - 4, 0);
++}
++
++
++void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
++ int loop;
++ for (loop = 0; loop < MAXTAGLOOP; loop++) {
++ const TValue *tm;
++ if (ttistable(t)) { /* `t' is a table? */
++ Table *h = hvalue(t);
++ const TValue *res = luaH_get(h, key); /* do a primitive get */
++ if (!ttisnil(res) || /* result is no nil? */
++ (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */
++ setobj2s(L, val, res);
++ return;
++ }
++ /* else will try the tag method */
++ }
++ else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
++ luaG_typeerror(L, t, "index");
++ if (ttisfunction(tm)) {
++ callTMres(L, val, tm, t, key);
++ return;
++ }
++ t = tm; /* else repeat with `tm' */
++ }
++ luaG_runerror(L, "loop in gettable");
++}
++
++
++void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
++ int loop;
++ for (loop = 0; loop < MAXTAGLOOP; loop++) {
++ const TValue *tm;
++ if (ttistable(t)) { /* `t' is a table? */
++ Table *h = hvalue(t);
++ TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
++ if (!ttisnil(oldval) || /* result is no nil? */
++ (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
++ setobj2t(L, oldval, val);
++ luaC_barriert(L, h, val);
++ return;
++ }
++ /* else will try the tag method */
++ }
++ else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
++ luaG_typeerror(L, t, "index");
++ if (ttisfunction(tm)) {
++ callTM(L, tm, t, key, val);
++ return;
++ }
++ t = tm; /* else repeat with `tm' */
++ }
++ luaG_runerror(L, "loop in settable");
++}
++
++
++static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
++ StkId res, TMS event) {
++ const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */
++ if (ttisnil(tm))
++ tm = luaT_gettmbyobj(L, p2, event); /* try second operand */
++ if (ttisnil(tm)) return 0;
++ callTMres(L, res, tm, p1, p2);
++ return 1;
++}
++
++
++static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
++ TMS event) {
++ const TValue *tm1 = fasttm(L, mt1, event);
++ const TValue *tm2;
++ if (tm1 == NULL) return NULL; /* no metamethod */
++ if (mt1 == mt2) return tm1; /* same metatables => same metamethods */
++ tm2 = fasttm(L, mt2, event);
++ if (tm2 == NULL) return NULL; /* no metamethod */
++ if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */
++ return tm1;
++ return NULL;
++}
++
++
++static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
++ TMS event) {
++ const TValue *tm1 = luaT_gettmbyobj(L, p1, event);
++ const TValue *tm2;
++ if (ttisnil(tm1)) return -1; /* no metamethod? */
++ tm2 = luaT_gettmbyobj(L, p2, event);
++ if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */
++ return -1;
++ callTMres(L, L->top, tm1, p1, p2);
++ return !l_isfalse(L->top);
++}
++
++
++static int l_strcmp (const TString *ls, const TString *rs) {
++ const char *l = getstr(ls);
++ size_t ll = ls->tsv.len;
++ const char *r = getstr(rs);
++ size_t lr = rs->tsv.len;
++ for (;;) {
++ int temp = strcoll(l, r);
++ if (temp != 0) return temp;
++ else { /* strings are equal up to a `\0' */
++ size_t len = strlen(l); /* index of first `\0' in both strings */
++ if (len == lr) /* r is finished? */
++ return (len == ll) ? 0 : 1;
++ else if (len == ll) /* l is finished? */
++ return -1; /* l is smaller than r (because r is not finished) */
++ /* both strings longer than `len'; go on comparing (after the `\0') */
++ len++;
++ l += len; ll -= len; r += len; lr -= len;
++ }
++ }
++}
++
++
++int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
++ int res;
++ if (ttype(l) != ttype(r))
++ return luaG_ordererror(L, l, r);
++ else if (ttisnumber(l))
++ return luai_numlt(nvalue(l), nvalue(r));
++ else if (ttisstring(l))
++ return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;
++ else if ((res = call_orderTM(L, l, r, TM_LT)) != -1)
++ return res;
++ return luaG_ordererror(L, l, r);
++}
++
++
++static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
++ int res;
++ if (ttype(l) != ttype(r))
++ return luaG_ordererror(L, l, r);
++ else if (ttisnumber(l))
++ return luai_numle(nvalue(l), nvalue(r));
++ else if (ttisstring(l))
++ return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
++ else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */
++ return res;
++ else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */
++ return !res;
++ return luaG_ordererror(L, l, r);
++}
++
++
++int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
++ const TValue *tm;
++ lua_assert(ttype(t1) == ttype(t2));
++ switch (ttype(t1)) {
++ case LUA_TNIL: return 1;
++ case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
++ case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
++ case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
++ case LUA_TUSERDATA: {
++ if (uvalue(t1) == uvalue(t2)) return 1;
++ tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable,
++ TM_EQ);
++ break; /* will try TM */
++ }
++ case LUA_TTABLE: {
++ if (hvalue(t1) == hvalue(t2)) return 1;
++ tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
++ break; /* will try TM */
++ }
++ default: return gcvalue(t1) == gcvalue(t2);
++ }
++ if (tm == NULL) return 0; /* no TM? */
++ callTMres(L, L->top, tm, t1, t2); /* call TM */
++ return !l_isfalse(L->top);
++}
++
++
++void luaV_concat (lua_State *L, int total, int last) {
++ do {
++ StkId top = L->base + last + 1;
++ int n = 2; /* number of elements handled in this pass (at least 2) */
++ if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
++ if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
++ luaG_concaterror(L, top-2, top-1);
++ } else if (tsvalue(top-1)->len == 0) /* second op is empty? */
++ (void)tostring(L, top - 2); /* result is first op (as string) */
++ else {
++ /* at least two string values; get as many as possible */
++ size_t tl = tsvalue(top-1)->len;
++ char *buffer;
++ int i;
++ /* collect total length */
++ for (n = 1; n < total && tostring(L, top-n-1); n++) {
++ size_t l = tsvalue(top-n-1)->len;
++ if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
++ tl += l;
++ }
++ buffer = luaZ_openspace(L, &G(L)->buff, tl);
++ tl = 0;
++ for (i=n; i>0; i--) { /* concat all strings */
++ size_t l = tsvalue(top-i)->len;
++ memcpy(buffer+tl, svalue(top-i), l);
++ tl += l;
++ }
++ setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
++ }
++ total -= n-1; /* got `n' strings to create 1 new */
++ last -= n-1;
++ } while (total > 1); /* repeat until only 1 result left */
++}
++
++
++static void Arith (lua_State *L, StkId ra, const TValue *rb,
++ const TValue *rc, TMS op) {
++ TValue tempb, tempc;
++ const TValue *b, *c;
++ if ((b = luaV_tonumber(rb, &tempb)) != NULL &&
++ (c = luaV_tonumber(rc, &tempc)) != NULL) {
++ lua_Number nb = nvalue(b), nc = nvalue(c);
++ switch (op) {
++ case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
++ case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
++ case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
++ case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break;
++ case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
++ case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
++ case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
++ default: lua_assert(0); break;
++ }
++ }
++ else if (!call_binTM(L, rb, rc, ra, op))
++ luaG_aritherror(L, rb, rc);
++}
++
++
++
++/*
++** some macros for common tasks in `luaV_execute'
++*/
++
++#define runtime_check(L, c) { if (!(c)) break; }
++
++#define RA(i) (base+GETARG_A(i))
++/* to be used after possible stack reallocation */
++#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
++#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
++#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
++ ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))
++#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
++ ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))
++#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))
++
++
++#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);}
++
++
++#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; }
++
++
++#define arith_op(op,tm) { \
++ TValue *rb = RKB(i); \
++ TValue *rc = RKC(i); \
++ if (ttisnumber(rb) && ttisnumber(rc)) { \
++ lua_Number nb = nvalue(rb), nc = nvalue(rc); \
++ setnvalue(ra, op(nb, nc)); \
++ } \
++ else \
++ Protect(Arith(L, ra, rb, rc, tm)); \
++ }
++
++
++
++void luaV_execute (lua_State *L, int nexeccalls) {
++ LClosure *cl;
++ StkId base;
++ TValue *k;
++ const Instruction *pc;
++ reentry: /* entry point */
++ lua_assert(isLua(L->ci));
++ pc = L->savedpc;
++ cl = &clvalue(L->ci->func)->l;
++ base = L->base;
++ k = cl->p->k;
++ /* main loop of interpreter */
++ for (;;) {
++ const Instruction i = *pc++;
++ StkId ra;
++ if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
++ (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
++ traceexec(L, pc);
++ if (L->status == LUA_YIELD) { /* did hook yield? */
++ L->savedpc = pc - 1;
++ return;
++ }
++ base = L->base;
++ }
++ /* warning!! several calls may realloc the stack and invalidate `ra' */
++ ra = RA(i);
++ lua_assert(base == L->base && L->base == L->ci->base);
++ lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
++ lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
++ switch (GET_OPCODE(i)) {
++ case OP_MOVE: {
++ setobjs2s(L, ra, RB(i));
++ continue;
++ }
++ case OP_LOADK: {
++ setobj2s(L, ra, KBx(i));
++ continue;
++ }
++ case OP_LOADBOOL: {
++ setbvalue(ra, GETARG_B(i));
++ if (GETARG_C(i)) pc++; /* skip next instruction (if C) */
++ continue;
++ }
++ case OP_LOADNIL: {
++ TValue *rb = RB(i);
++ do {
++ setnilvalue(rb--);
++ } while (rb >= ra);
++ continue;
++ }
++ case OP_GETUPVAL: {
++ int b = GETARG_B(i);
++ setobj2s(L, ra, cl->upvals[b]->v);
++ continue;
++ }
++ case OP_GETGLOBAL: {
++ TValue g;
++ TValue *rb = KBx(i);
++ sethvalue(L, &g, cl->env);
++ lua_assert(ttisstring(rb));
++ Protect(luaV_gettable(L, &g, rb, ra));
++ continue;
++ }
++ case OP_GETTABLE: {
++ Protect(luaV_gettable(L, RB(i), RKC(i), ra));
++ continue;
++ }
++ case OP_SETGLOBAL: {
++ TValue g;
++ sethvalue(L, &g, cl->env);
++ lua_assert(ttisstring(KBx(i)));
++ Protect(luaV_settable(L, &g, KBx(i), ra));
++ continue;
++ }
++ case OP_SETUPVAL: {
++ UpVal *uv = cl->upvals[GETARG_B(i)];
++ setobj(L, uv->v, ra);
++ luaC_barrier(L, uv, ra);
++ continue;
++ }
++ case OP_SETTABLE: {
++ Protect(luaV_settable(L, ra, RKB(i), RKC(i)));
++ continue;
++ }
++ case OP_NEWTABLE: {
++ int b = GETARG_B(i);
++ int c = GETARG_C(i);
++ sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c)));
++ Protect(luaC_checkGC(L));
++ continue;
++ }
++ case OP_SELF: {
++ StkId rb = RB(i);
++ setobjs2s(L, ra+1, rb);
++ Protect(luaV_gettable(L, rb, RKC(i), ra));
++ continue;
++ }
++ case OP_ADD: {
++ arith_op(luai_numadd, TM_ADD);
++ continue;
++ }
++ case OP_SUB: {
++ arith_op(luai_numsub, TM_SUB);
++ continue;
++ }
++ case OP_MUL: {
++ arith_op(luai_nummul, TM_MUL);
++ continue;
++ }
++ case OP_DIV: {
++ arith_op(luai_numdiv, TM_DIV);
++ continue;
++ }
++ case OP_MOD: {
++ arith_op(luai_nummod, TM_MOD);
++ continue;
++ }
++ case OP_POW: {
++ arith_op(luai_numpow, TM_POW);
++ continue;
++ }
++ case OP_UNM: {
++ TValue *rb = RB(i);
++ if (ttisnumber(rb)) {
++ lua_Number nb = nvalue(rb);
++ setnvalue(ra, luai_numunm(nb));
++ }
++ else {
++ Protect(Arith(L, ra, rb, rb, TM_UNM));
++ }
++ continue;
++ }
++ case OP_NOT: {
++ int res = l_isfalse(RB(i)); /* next assignment may change this value */
++ setbvalue(ra, res);
++ continue;
++ }
++ case OP_LEN: {
++ const TValue *rb = RB(i);
++ switch (ttype(rb)) {
++ case LUA_TTABLE: {
++ setnvalue(ra, cast_num(luaH_getn(hvalue(rb))));
++ break;
++ }
++ case LUA_TSTRING: {
++ setnvalue(ra, cast_num(tsvalue(rb)->len));
++ break;
++ }
++ default: { /* try metamethod */
++ Protect(
++ if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))
++ luaG_typeerror(L, rb, "get length of");
++ )
++ }
++ }
++ continue;
++ }
++ case OP_CONCAT: {
++ int b = GETARG_B(i);
++ int c = GETARG_C(i);
++ Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L));
++ setobjs2s(L, RA(i), base+b);
++ continue;
++ }
++ case OP_JMP: {
++ dojump(L, pc, GETARG_sBx(i));
++ continue;
++ }
++ case OP_EQ: {
++ TValue *rb = RKB(i);
++ TValue *rc = RKC(i);
++ Protect(
++ if (equalobj(L, rb, rc) == GETARG_A(i))
++ dojump(L, pc, GETARG_sBx(*pc));
++ )
++ pc++;
++ continue;
++ }
++ case OP_LT: {
++ Protect(
++ if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i))
++ dojump(L, pc, GETARG_sBx(*pc));
++ )
++ pc++;
++ continue;
++ }
++ case OP_LE: {
++ Protect(
++ if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i))
++ dojump(L, pc, GETARG_sBx(*pc));
++ )
++ pc++;
++ continue;
++ }
++ case OP_TEST: {
++ if (l_isfalse(ra) != GETARG_C(i))
++ dojump(L, pc, GETARG_sBx(*pc));
++ pc++;
++ continue;
++ }
++ case OP_TESTSET: {
++ TValue *rb = RB(i);
++ if (l_isfalse(rb) != GETARG_C(i)) {
++ setobjs2s(L, ra, rb);
++ dojump(L, pc, GETARG_sBx(*pc));
++ }
++ pc++;
++ continue;
++ }
++ case OP_CALL: {
++ int b = GETARG_B(i);
++ int nresults = GETARG_C(i) - 1;
++ if (b != 0) L->top = ra+b; /* else previous instruction set top */
++ L->savedpc = pc;
++ switch (luaD_precall(L, ra, nresults)) {
++ case PCRLUA: {
++ nexeccalls++;
++ goto reentry; /* restart luaV_execute over new Lua function */
++ }
++ case PCRC: {
++ /* it was a C function (`precall' called it); adjust results */
++ if (nresults >= 0) L->top = L->ci->top;
++ base = L->base;
++ continue;
++ }
++ default: {
++ return; /* yield */
++ }
++ }
++ }
++ case OP_TAILCALL: {
++ int b = GETARG_B(i);
++ if (b != 0) L->top = ra+b; /* else previous instruction set top */
++ L->savedpc = pc;
++ lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
++ switch (luaD_precall(L, ra, LUA_MULTRET)) {
++ case PCRLUA: {
++ /* tail call: put new frame in place of previous one */
++ CallInfo *ci = L->ci - 1; /* previous frame */
++ int aux;
++ StkId func = ci->func;
++ StkId pfunc = (ci+1)->func; /* previous function index */
++ if (L->openupval) luaF_close(L, ci->base);
++ L->base = ci->base = ci->func + ((ci+1)->base - pfunc);
++ for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */
++ setobjs2s(L, func+aux, pfunc+aux);
++ ci->top = L->top = func+aux; /* correct top */
++ lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize);
++ ci->savedpc = L->savedpc;
++ ci->tailcalls++; /* one more call lost */
++ L->ci--; /* remove new frame */
++ goto reentry;
++ }
++ case PCRC: { /* it was a C function (`precall' called it) */
++ base = L->base;
++ continue;
++ }
++ default: {
++ return; /* yield */
++ }
++ }
++ }
++ case OP_RETURN: {
++ int b = GETARG_B(i);
++ if (b != 0) L->top = ra+b-1;
++ if (L->openupval) luaF_close(L, base);
++ L->savedpc = pc;
++ b = luaD_poscall(L, ra);
++ if (--nexeccalls == 0) /* was previous function running `here'? */
++ return; /* no: return */
++ else { /* yes: continue its execution */
++ if (b) L->top = L->ci->top;
++ lua_assert(isLua(L->ci));
++ lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL);
++ goto reentry;
++ }
++ }
++ case OP_FORLOOP: {
++ lua_Number step = nvalue(ra+2);
++ lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */
++ lua_Number limit = nvalue(ra+1);
++ if (luai_numlt(0, step) ? luai_numle(idx, limit)
++ : luai_numle(limit, idx)) {
++ dojump(L, pc, GETARG_sBx(i)); /* jump back */
++ setnvalue(ra, idx); /* update internal index... */
++ setnvalue(ra+3, idx); /* ...and external index */
++ }
++ continue;
++ }
++ case OP_FORPREP: {
++ const TValue *init = ra;
++ const TValue *plimit = ra+1;
++ const TValue *pstep = ra+2;
++ L->savedpc = pc; /* next steps may throw errors */
++ if (!tonumber(init, ra))
++ luaG_runerror(L, LUA_QL("for") " initial value must be a number");
++ else if (!tonumber(plimit, ra+1))
++ luaG_runerror(L, LUA_QL("for") " limit must be a number");
++ else if (!tonumber(pstep, ra+2))
++ luaG_runerror(L, LUA_QL("for") " step must be a number");
++ setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
++ dojump(L, pc, GETARG_sBx(i));
++ continue;
++ }
++ case OP_TFORLOOP: {
++ StkId cb = ra + 3; /* call base */
++ setobjs2s(L, cb+2, ra+2);
++ setobjs2s(L, cb+1, ra+1);
++ setobjs2s(L, cb, ra);
++ L->top = cb+3; /* func. + 2 args (state and index) */
++ Protect(luaD_call(L, cb, GETARG_C(i)));
++ L->top = L->ci->top;
++ cb = RA(i) + 3; /* previous call may change the stack */
++ if (!ttisnil(cb)) { /* continue loop? */
++ setobjs2s(L, cb-1, cb); /* save control variable */
++ dojump(L, pc, GETARG_sBx(*pc)); /* jump back */
++ }
++ pc++;
++ continue;
++ }
++ case OP_SETLIST: {
++ int n = GETARG_B(i);
++ int c = GETARG_C(i);
++ int last;
++ Table *h;
++ if (n == 0) {
++ n = cast_int(L->top - ra) - 1;
++ L->top = L->ci->top;
++ }
++ if (c == 0) c = cast_int(*pc++);
++ runtime_check(L, ttistable(ra));
++ h = hvalue(ra);
++ last = ((c-1)*LFIELDS_PER_FLUSH) + n;
++ if (last > h->sizearray) /* needs more space? */
++ luaH_resizearray(L, h, last); /* pre-alloc it at once */
++ for (; n > 0; n--) {
++ TValue *val = ra+n;
++ setobj2t(L, luaH_setnum(L, h, last--), val);
++ luaC_barriert(L, h, val);
++ }
++ continue;
++ }
++ case OP_CLOSE: {
++ luaF_close(L, ra);
++ continue;
++ }
++ case OP_CLOSURE: {
++ Proto *p;
++ Closure *ncl;
++ int nup, j;
++ p = cl->p->p[GETARG_Bx(i)];
++ nup = p->nups;
++ ncl = luaF_newLclosure(L, nup, cl->env);
++ ncl->l.p = p;
++ for (j=0; j<nup; j++, pc++) {
++ if (GET_OPCODE(*pc) == OP_GETUPVAL)
++ ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)];
++ else {
++ lua_assert(GET_OPCODE(*pc) == OP_MOVE);
++ ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc));
++ }
++ }
++ setclvalue(L, ra, ncl);
++ Protect(luaC_checkGC(L));
++ continue;
++ }
++ case OP_VARARG: {
++ int b = GETARG_B(i) - 1;
++ int j;
++ CallInfo *ci = L->ci;
++ int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1;
++ if (b == LUA_MULTRET) {
++ Protect(luaD_checkstack(L, n));
++ ra = RA(i); /* previous call may change the stack */
++ b = n;
++ L->top = ra + n;
++ }
++ for (j = 0; j < b; j++) {
++ if (j < n) {
++ setobjs2s(L, ra + j, ci->base - n + j);
++ }
++ else {
++ setnilvalue(ra + j);
++ }
++ }
++ continue;
++ }
++ }
++ }
++}
++
+--- /dev/null
++++ b/extensions/LUA/lua/lvm.h
+@@ -0,0 +1,36 @@
++/*
++** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $
++** Lua virtual machine
++** See Copyright Notice in lua.h
++*/
++
++#ifndef lvm_h
++#define lvm_h
++
++
++#include "ldo.h"
++#include "lobject.h"
++#include "ltm.h"
++
++
++#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
++
++#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \
++ (((o) = luaV_tonumber(o,n)) != NULL))
++
++#define equalobj(L,o1,o2) \
++ (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))
++
++
++LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);
++LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2);
++LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n);
++LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj);
++LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key,
++ StkId val);
++LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key,
++ StkId val);
++LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls);
++LUAI_FUNC void luaV_concat (lua_State *L, int total, int last);
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/lua/lzio.c
+@@ -0,0 +1,81 @@
++/*
++** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
++** a generic input stream interface
++** See Copyright Notice in lua.h
++*/
++
++#include <string.h>
++
++#define lzio_c
++#define LUA_CORE
++
++#include "lua.h"
++
++#include "llimits.h"
++#include "lmem.h"
++#include "lstate.h"
++#include "lzio.h"
++
++
++int luaZ_fill (ZIO *z) {
++ size_t size;
++ lua_State *L = z->L;
++ const char *buff;
++ lua_unlock(L);
++ buff = z->reader(L, z->data, &size);
++ lua_lock(L);
++ if (buff == NULL || size == 0) return EOZ;
++ z->n = size - 1;
++ z->p = buff;
++ return char2int(*(z->p++));
++}
++
++
++int luaZ_lookahead (ZIO *z) {
++ if (z->n == 0) {
++ if (luaZ_fill(z) == EOZ)
++ return EOZ;
++ else {
++ z->n++; /* luaZ_fill removed first byte; put back it */
++ z->p--;
++ }
++ }
++ return char2int(*z->p);
++}
++
++
++void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
++ z->L = L;
++ z->reader = reader;
++ z->data = data;
++ z->n = 0;
++ z->p = NULL;
++}
++
++
++/* --------------------------------------------------------------- read --- */
++size_t luaZ_read (ZIO *z, void *b, size_t n) {
++ while (n) {
++ size_t m;
++ if (luaZ_lookahead(z) == EOZ)
++ return n; /* return number of missing bytes */
++ m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
++ memcpy(b, z->p, m);
++ z->n -= m;
++ z->p += m;
++ b = (char *)b + m;
++ n -= m;
++ }
++ return 0;
++}
++
++/* ------------------------------------------------------------------------ */
++char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
++ if (n > buff->buffsize) {
++ if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;
++ luaZ_resizebuffer(L, buff, n);
++ }
++ return buff->buffer;
++}
++
++
+--- /dev/null
++++ b/extensions/LUA/lua/lzio.h
+@@ -0,0 +1,67 @@
++/*
++** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $
++** Buffered streams
++** See Copyright Notice in lua.h
++*/
++
++
++#ifndef lzio_h
++#define lzio_h
++
++#include "lua.h"
++
++#include "lmem.h"
++
++
++#define EOZ (-1) /* end of stream */
++
++typedef struct Zio ZIO;
++
++#define char2int(c) cast(int, cast(unsigned char, (c)))
++
++#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z))
++
++typedef struct Mbuffer {
++ char *buffer;
++ size_t n;
++ size_t buffsize;
++} Mbuffer;
++
++#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
++
++#define luaZ_buffer(buff) ((buff)->buffer)
++#define luaZ_sizebuffer(buff) ((buff)->buffsize)
++#define luaZ_bufflen(buff) ((buff)->n)
++
++#define luaZ_resetbuffer(buff) ((buff)->n = 0)
++
++
++#define luaZ_resizebuffer(L, buff, size) \
++ (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
++ (buff)->buffsize = size)
++
++#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
++
++
++LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
++LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
++ void *data);
++LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
++LUAI_FUNC int luaZ_lookahead (ZIO *z);
++
++
++
++/* --------- Private Part ------------------ */
++
++struct Zio {
++ size_t n; /* bytes still unread */
++ const char *p; /* current position in buffer */
++ lua_Reader reader;
++ void* data; /* additional data */
++ lua_State *L; /* Lua state (for reader) */
++};
++
++
++LUAI_FUNC int luaZ_fill (ZIO *z);
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/Makefile
+@@ -0,0 +1,389 @@
++# Makefile.in generated by automake 1.11.1 from Makefile.am.
++# extensions/LUA/Makefile. Generated from Makefile.in by configure.
++
++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
++# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
++# Inc.
++# This Makefile.in is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++# PARTICULAR PURPOSE.
++
++
++
++# -*- Makefile -*-
++# AUTOMAKE
++
++pkgdatadir = $(datadir)/xtables-addons
++pkgincludedir = $(includedir)/xtables-addons
++pkglibdir = $(libdir)/xtables-addons
++pkglibexecdir = $(libexecdir)/xtables-addons
++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
++install_sh_DATA = $(install_sh) -c -m 644
++install_sh_PROGRAM = $(install_sh) -c
++install_sh_SCRIPT = $(install_sh) -c
++INSTALL_HEADER = $(INSTALL_DATA)
++transform = $(program_transform_name)
++NORMAL_INSTALL = :
++PRE_INSTALL = :
++POST_INSTALL = :
++NORMAL_UNINSTALL = :
++PRE_UNINSTALL = :
++POST_UNINSTALL = :
++build_triplet = i686-pc-linux-gnu
++host_triplet = i686-pc-linux-gnu
++DIST_COMMON = $(srcdir)/../../Makefile.extra $(srcdir)/Makefile.am \
++ $(srcdir)/Makefile.in
++subdir = extensions/LUA
++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
++am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
++ $(top_srcdir)/configure.ac
++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
++ $(ACLOCAL_M4)
++mkinstalldirs = $(install_sh) -d
++CONFIG_HEADER = $(top_builddir)/config.h
++CONFIG_CLEAN_FILES =
++CONFIG_CLEAN_VPATH_FILES =
++SOURCES =
++DIST_SOURCES =
++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
++ACLOCAL = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run aclocal-1.11
++AMTAR = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run tar
++AR = ar
++AUTOCONF = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run autoconf
++AUTOHEADER = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run autoheader
++AUTOMAKE = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run automake-1.11
++AWK = mawk
++CC = gcc
++CCDEPMODE = depmode=gcc3
++CFLAGS = -g -O2
++CPP = gcc -E
++CPPFLAGS =
++CYGPATH_W = echo
++DEFS = -DHAVE_CONFIG_H
++DEPDIR = .deps
++DSYMUTIL =
++DUMPBIN =
++ECHO_C =
++ECHO_N = -n
++ECHO_T =
++EGREP = /bin/grep -E
++EXEEXT =
++FGREP = /bin/grep -F
++GREP = /bin/grep
++INSTALL = /usr/bin/install -c
++INSTALL_DATA = ${INSTALL} -m 644
++INSTALL_PROGRAM = ${INSTALL}
++INSTALL_SCRIPT = ${INSTALL}
++INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
++LD = /usr/bin/ld
++LDFLAGS =
++LIBOBJS =
++LIBS =
++LIBTOOL = $(SHELL) $(top_builddir)/libtool
++LIPO =
++LN_S = ln -s
++LTLIBOBJS =
++MAKEINFO = ${SHELL} /home/andre/Dropbox/xtables-addons/missing --run makeinfo
++MKDIR_P = /bin/mkdir -p
++NM = /usr/bin/nm -B
++NMEDIT =
++OBJDUMP = objdump
++OBJEXT = o
++OTOOL =
++OTOOL64 =
++PACKAGE = xtables-addons
++PACKAGE_BUGREPORT =
++PACKAGE_NAME = xtables-addons
++PACKAGE_STRING = xtables-addons 1.21
++PACKAGE_TARNAME = xtables-addons
++PACKAGE_URL =
++PACKAGE_VERSION = 1.21
++PATH_SEPARATOR = :
++PKG_CONFIG = /usr/bin/pkg-config
++RANLIB = ranlib
++SED = /bin/sed
++SET_MAKE =
++SHELL = /bin/bash
++STRIP = strip
++VERSION = 1.21
++abs_builddir = /home/andre/Dropbox/xtables-addons/extensions/LUA
++abs_srcdir = /home/andre/Dropbox/xtables-addons/extensions/LUA
++abs_top_builddir = /home/andre/Dropbox/xtables-addons
++abs_top_srcdir = /home/andre/Dropbox/xtables-addons
++ac_ct_CC = gcc
++ac_ct_DUMPBIN =
++am__include = include
++am__leading_dot = .
++am__quote =
++am__tar = ${AMTAR} chof - "$$tardir"
++am__untar = ${AMTAR} xf -
++bindir = ${exec_prefix}/bin
++build = i686-pc-linux-gnu
++build_alias =
++build_cpu = i686
++build_os = linux-gnu
++build_vendor = pc
++builddir = .
++datadir = ${datarootdir}
++datarootdir = ${prefix}/share
++docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
++dvidir = ${docdir}
++exec_prefix = ${prefix}
++host = i686-pc-linux-gnu
++host_alias =
++host_cpu = i686
++host_os = linux-gnu
++host_vendor = pc
++htmldir = ${docdir}
++includedir = ${prefix}/include
++infodir = ${datarootdir}/info
++install_sh = ${SHELL} /home/andre/Dropbox/xtables-addons/install-sh
++kbuilddir = /lib/modules/2.6.33-020633-generic/build
++kinclude_CFLAGS = -I /lib/modules/2.6.33-020633-generic/build/include
++ksourcedir =
++libdir = ${exec_prefix}/lib
++libexecdir = ${exec_prefix}/libexec
++libxtables_CFLAGS =
++libxtables_LIBS = -L/lib -lxtables
++localedir = ${datarootdir}/locale
++localstatedir = ${prefix}/var
++lt_ECHO = echo
++mandir = ${datarootdir}/man
++mkdir_p = /bin/mkdir -p
++oldincludedir = /usr/include
++pdfdir = ${docdir}
++prefix = /usr/local
++program_transform_name = s,x,x,
++psdir = ${docdir}
++regular_CFLAGS = -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -Wall -Waggregate-return -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Winline -pipe -DXTABLES_LIBDIR=\"${xtlibdir}\"
++sbindir = ${exec_prefix}/sbin
++sharedstatedir = ${prefix}/com
++srcdir = .
++sysconfdir = ${prefix}/etc
++target_alias =
++top_build_prefix = ../../
++top_builddir = ../..
++top_srcdir = ../..
++xtlibdir = ${libexecdir}/xtables
++XA_SRCDIR = ${srcdir}
++XA_TOPSRCDIR = ${top_srcdir}
++XA_ABSTOPSRCDIR = ${abs_top_srcdir}
++_mcall = -f ${top_builddir}/Makefile.iptrules
++all: all-am
++
++.SUFFIXES:
++$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../../Makefile.extra $(am__configure_deps)
++ @for dep in $?; do \
++ case '$(am__configure_deps)' in \
++ *$$dep*) \
++ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++ && { if test -f $@; then exit 0; else break; fi; }; \
++ exit 1;; \
++ esac; \
++ done; \
++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign extensions/LUA/Makefile'; \
++ $(am__cd) $(top_srcdir) && \
++ $(AUTOMAKE) --foreign extensions/LUA/Makefile
++.PRECIOUS: Makefile
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++ @case '$?' in \
++ *config.status*) \
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
++ *) \
++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
++ esac;
++
++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++$(top_srcdir)/configure: $(am__configure_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(ACLOCAL_M4): $(am__aclocal_m4_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(am__aclocal_m4_deps):
++
++mostlyclean-libtool:
++ -rm -f *.lo
++
++clean-libtool:
++ -rm -rf .libs _libs
++tags: TAGS
++TAGS:
++
++ctags: CTAGS
++CTAGS:
++
++
++distdir: $(DISTFILES)
++ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ list='$(DISTFILES)'; \
++ dist_files=`for file in $$list; do echo $$file; done | \
++ sed -e "s|^$$srcdirstrip/||;t" \
++ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
++ case $$dist_files in \
++ */*) $(MKDIR_P) `echo "$$dist_files" | \
++ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
++ sort -u` ;; \
++ esac; \
++ for file in $$dist_files; do \
++ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
++ if test -d $$d/$$file; then \
++ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
++ if test -d "$(distdir)/$$file"; then \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
++ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
++ else \
++ test -f "$(distdir)/$$file" \
++ || cp -p $$d/$$file "$(distdir)/$$file" \
++ || exit 1; \
++ fi; \
++ done
++check-am: all-am
++check: check-am
++all-am: Makefile all-local
++installdirs:
++install: install-am
++install-exec: install-exec-am
++install-data: install-data-am
++uninstall: uninstall-am
++
++install-am: all-am
++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
++
++installcheck: installcheck-am
++install-strip:
++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++ `test -z '$(STRIP)' || \
++ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
++mostlyclean-generic:
++
++clean-generic:
++
++distclean-generic:
++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
++ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
++
++maintainer-clean-generic:
++ @echo "This command is intended for maintainers to use"
++ @echo "it deletes files that may require special tools to rebuild."
++clean: clean-am
++
++clean-am: clean-generic clean-libtool clean-local mostlyclean-am
++
++distclean: distclean-am
++ -rm -f Makefile
++distclean-am: clean-am distclean-generic
++
++dvi: dvi-am
++
++dvi-am:
++
++html: html-am
++
++html-am:
++
++info: info-am
++
++info-am:
++
++install-data-am:
++
++install-dvi: install-dvi-am
++
++install-dvi-am:
++
++install-exec-am: install-exec-local
++
++install-html: install-html-am
++
++install-html-am:
++
++install-info: install-info-am
++
++install-info-am:
++
++install-man:
++
++install-pdf: install-pdf-am
++
++install-pdf-am:
++
++install-ps: install-ps-am
++
++install-ps-am:
++
++installcheck-am:
++
++maintainer-clean: maintainer-clean-am
++ -rm -f Makefile
++maintainer-clean-am: distclean-am maintainer-clean-generic
++
++mostlyclean: mostlyclean-am
++
++mostlyclean-am: mostlyclean-generic mostlyclean-libtool
++
++pdf: pdf-am
++
++pdf-am:
++
++ps: ps-am
++
++ps-am:
++
++uninstall-am:
++
++.MAKE: install-am install-strip
++
++.PHONY: all all-am all-local check check-am clean clean-generic \
++ clean-libtool clean-local distclean distclean-generic \
++ distclean-libtool distdir dvi dvi-am html html-am info info-am \
++ install install-am install-data install-data-am install-dvi \
++ install-dvi-am install-exec install-exec-am install-exec-local \
++ install-html install-html-am install-info install-info-am \
++ install-man install-pdf install-pdf-am install-ps \
++ install-ps-am install-strip installcheck installcheck-am \
++ installdirs maintainer-clean maintainer-clean-generic \
++ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
++ ps ps-am uninstall uninstall-am
++
++export XA_SRCDIR
++export XA_TOPSRCDIR
++export XA_ABSTOPSRCDIR
++
++all-local: user-all-local
++
++install-exec-local: user-install-local
++
++clean-local: user-clean-local
++
++user-all-local:
++ ${MAKE} ${_mcall} all;
++
++# Have no user-install-data-local ATM
++user-install-local: user-install-exec-local
++
++user-install-exec-local:
++ ${MAKE} ${_mcall} install;
++
++user-clean-local:
++ ${MAKE} ${_mcall} clean;
++
++# Tell versions [3.59,3.63) of GNU make to not export all variables.
++# Otherwise a system limit (for SysV at least) may be exceeded.
++.NOEXPORT:
++
+--- /dev/null
++++ b/extensions/LUA/Makefile.am
+@@ -0,0 +1 @@
++include ../../Makefile.extra
+--- /dev/null
++++ b/extensions/LUA/Makefile.in
+@@ -0,0 +1,389 @@
++# Makefile.in generated by automake 1.11.1 from Makefile.am.
++# @configure_input@
++
++# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
++# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
++# Inc.
++# This Makefile.in is free software; the Free Software Foundation
++# gives unlimited permission to copy and/or distribute it,
++# with or without modifications, as long as this notice is preserved.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
++# PARTICULAR PURPOSE.
++
++@SET_MAKE@
++
++# -*- Makefile -*-
++# AUTOMAKE
++VPATH = @srcdir@
++pkgdatadir = $(datadir)/@PACKAGE@
++pkgincludedir = $(includedir)/@PACKAGE@
++pkglibdir = $(libdir)/@PACKAGE@
++pkglibexecdir = $(libexecdir)/@PACKAGE@
++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
++install_sh_DATA = $(install_sh) -c -m 644
++install_sh_PROGRAM = $(install_sh) -c
++install_sh_SCRIPT = $(install_sh) -c
++INSTALL_HEADER = $(INSTALL_DATA)
++transform = $(program_transform_name)
++NORMAL_INSTALL = :
++PRE_INSTALL = :
++POST_INSTALL = :
++NORMAL_UNINSTALL = :
++PRE_UNINSTALL = :
++POST_UNINSTALL = :
++build_triplet = @build@
++host_triplet = @host@
++DIST_COMMON = $(srcdir)/../../Makefile.extra $(srcdir)/Makefile.am \
++ $(srcdir)/Makefile.in
++subdir = extensions/LUA
++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
++am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
++ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
++ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
++ $(top_srcdir)/configure.ac
++am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
++ $(ACLOCAL_M4)
++mkinstalldirs = $(install_sh) -d
++CONFIG_HEADER = $(top_builddir)/config.h
++CONFIG_CLEAN_FILES =
++CONFIG_CLEAN_VPATH_FILES =
++SOURCES =
++DIST_SOURCES =
++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
++ACLOCAL = @ACLOCAL@
++AMTAR = @AMTAR@
++AR = @AR@
++AUTOCONF = @AUTOCONF@
++AUTOHEADER = @AUTOHEADER@
++AUTOMAKE = @AUTOMAKE@
++AWK = @AWK@
++CC = @CC@
++CCDEPMODE = @CCDEPMODE@
++CFLAGS = @CFLAGS@
++CPP = @CPP@
++CPPFLAGS = @CPPFLAGS@
++CYGPATH_W = @CYGPATH_W@
++DEFS = @DEFS@
++DEPDIR = @DEPDIR@
++DSYMUTIL = @DSYMUTIL@
++DUMPBIN = @DUMPBIN@
++ECHO_C = @ECHO_C@
++ECHO_N = @ECHO_N@
++ECHO_T = @ECHO_T@
++EGREP = @EGREP@
++EXEEXT = @EXEEXT@
++FGREP = @FGREP@
++GREP = @GREP@
++INSTALL = @INSTALL@
++INSTALL_DATA = @INSTALL_DATA@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
++INSTALL_SCRIPT = @INSTALL_SCRIPT@
++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
++LD = @LD@
++LDFLAGS = @LDFLAGS@
++LIBOBJS = @LIBOBJS@
++LIBS = @LIBS@
++LIBTOOL = @LIBTOOL@
++LIPO = @LIPO@
++LN_S = @LN_S@
++LTLIBOBJS = @LTLIBOBJS@
++MAKEINFO = @MAKEINFO@
++MKDIR_P = @MKDIR_P@
++NM = @NM@
++NMEDIT = @NMEDIT@
++OBJDUMP = @OBJDUMP@
++OBJEXT = @OBJEXT@
++OTOOL = @OTOOL@
++OTOOL64 = @OTOOL64@
++PACKAGE = @PACKAGE@
++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
++PACKAGE_NAME = @PACKAGE_NAME@
++PACKAGE_STRING = @PACKAGE_STRING@
++PACKAGE_TARNAME = @PACKAGE_TARNAME@
++PACKAGE_URL = @PACKAGE_URL@
++PACKAGE_VERSION = @PACKAGE_VERSION@
++PATH_SEPARATOR = @PATH_SEPARATOR@
++PKG_CONFIG = @PKG_CONFIG@
++RANLIB = @RANLIB@
++SED = @SED@
++SET_MAKE = @SET_MAKE@
++SHELL = @SHELL@
++STRIP = @STRIP@
++VERSION = @VERSION@
++abs_builddir = @abs_builddir@
++abs_srcdir = @abs_srcdir@
++abs_top_builddir = @abs_top_builddir@
++abs_top_srcdir = @abs_top_srcdir@
++ac_ct_CC = @ac_ct_CC@
++ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
++am__include = @am__include@
++am__leading_dot = @am__leading_dot@
++am__quote = @am__quote@
++am__tar = @am__tar@
++am__untar = @am__untar@
++bindir = @bindir@
++build = @build@
++build_alias = @build_alias@
++build_cpu = @build_cpu@
++build_os = @build_os@
++build_vendor = @build_vendor@
++builddir = @builddir@
++datadir = @datadir@
++datarootdir = @datarootdir@
++docdir = @docdir@
++dvidir = @dvidir@
++exec_prefix = @exec_prefix@
++host = @host@
++host_alias = @host_alias@
++host_cpu = @host_cpu@
++host_os = @host_os@
++host_vendor = @host_vendor@
++htmldir = @htmldir@
++includedir = @includedir@
++infodir = @infodir@
++install_sh = @install_sh@
++kbuilddir = @kbuilddir@
++kinclude_CFLAGS = @kinclude_CFLAGS@
++ksourcedir = @ksourcedir@
++libdir = @libdir@
++libexecdir = @libexecdir@
++libxtables_CFLAGS = @libxtables_CFLAGS@
++libxtables_LIBS = @libxtables_LIBS@
++localedir = @localedir@
++localstatedir = @localstatedir@
++lt_ECHO = @lt_ECHO@
++mandir = @mandir@
++mkdir_p = @mkdir_p@
++oldincludedir = @oldincludedir@
++pdfdir = @pdfdir@
++prefix = @prefix@
++program_transform_name = @program_transform_name@
++psdir = @psdir@
++regular_CFLAGS = @regular_CFLAGS@
++sbindir = @sbindir@
++sharedstatedir = @sharedstatedir@
++srcdir = @srcdir@
++sysconfdir = @sysconfdir@
++target_alias = @target_alias@
++top_build_prefix = @top_build_prefix@
++top_builddir = @top_builddir@
++top_srcdir = @top_srcdir@
++xtlibdir = @xtlibdir@
++XA_SRCDIR = ${srcdir}
++XA_TOPSRCDIR = ${top_srcdir}
++XA_ABSTOPSRCDIR = ${abs_top_srcdir}
++_mcall = -f ${top_builddir}/Makefile.iptrules
++all: all-am
++
++.SUFFIXES:
++$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/../../Makefile.extra $(am__configure_deps)
++ @for dep in $?; do \
++ case '$(am__configure_deps)' in \
++ *$$dep*) \
++ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
++ && { if test -f $@; then exit 0; else break; fi; }; \
++ exit 1;; \
++ esac; \
++ done; \
++ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign extensions/LUA/Makefile'; \
++ $(am__cd) $(top_srcdir) && \
++ $(AUTOMAKE) --foreign extensions/LUA/Makefile
++.PRECIOUS: Makefile
++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
++ @case '$?' in \
++ *config.status*) \
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
++ *) \
++ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
++ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
++ esac;
++
++$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++
++$(top_srcdir)/configure: $(am__configure_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(ACLOCAL_M4): $(am__aclocal_m4_deps)
++ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
++$(am__aclocal_m4_deps):
++
++mostlyclean-libtool:
++ -rm -f *.lo
++
++clean-libtool:
++ -rm -rf .libs _libs
++tags: TAGS
++TAGS:
++
++ctags: CTAGS
++CTAGS:
++
++
++distdir: $(DISTFILES)
++ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
++ list='$(DISTFILES)'; \
++ dist_files=`for file in $$list; do echo $$file; done | \
++ sed -e "s|^$$srcdirstrip/||;t" \
++ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
++ case $$dist_files in \
++ */*) $(MKDIR_P) `echo "$$dist_files" | \
++ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
++ sort -u` ;; \
++ esac; \
++ for file in $$dist_files; do \
++ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
++ if test -d $$d/$$file; then \
++ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
++ if test -d "$(distdir)/$$file"; then \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
++ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
++ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
++ fi; \
++ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
++ else \
++ test -f "$(distdir)/$$file" \
++ || cp -p $$d/$$file "$(distdir)/$$file" \
++ || exit 1; \
++ fi; \
++ done
++check-am: all-am
++check: check-am
++all-am: Makefile all-local
++installdirs:
++install: install-am
++install-exec: install-exec-am
++install-data: install-data-am
++uninstall: uninstall-am
++
++install-am: all-am
++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
++
++installcheck: installcheck-am
++install-strip:
++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
++ `test -z '$(STRIP)' || \
++ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
++mostlyclean-generic:
++
++clean-generic:
++
++distclean-generic:
++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
++ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
++
++maintainer-clean-generic:
++ @echo "This command is intended for maintainers to use"
++ @echo "it deletes files that may require special tools to rebuild."
++clean: clean-am
++
++clean-am: clean-generic clean-libtool clean-local mostlyclean-am
++
++distclean: distclean-am
++ -rm -f Makefile
++distclean-am: clean-am distclean-generic
++
++dvi: dvi-am
++
++dvi-am:
++
++html: html-am
++
++html-am:
++
++info: info-am
++
++info-am:
++
++install-data-am:
++
++install-dvi: install-dvi-am
++
++install-dvi-am:
++
++install-exec-am: install-exec-local
++
++install-html: install-html-am
++
++install-html-am:
++
++install-info: install-info-am
++
++install-info-am:
++
++install-man:
++
++install-pdf: install-pdf-am
++
++install-pdf-am:
++
++install-ps: install-ps-am
++
++install-ps-am:
++
++installcheck-am:
++
++maintainer-clean: maintainer-clean-am
++ -rm -f Makefile
++maintainer-clean-am: distclean-am maintainer-clean-generic
++
++mostlyclean: mostlyclean-am
++
++mostlyclean-am: mostlyclean-generic mostlyclean-libtool
++
++pdf: pdf-am
++
++pdf-am:
++
++ps: ps-am
++
++ps-am:
++
++uninstall-am:
++
++.MAKE: install-am install-strip
++
++.PHONY: all all-am all-local check check-am clean clean-generic \
++ clean-libtool clean-local distclean distclean-generic \
++ distclean-libtool distdir dvi dvi-am html html-am info info-am \
++ install install-am install-data install-data-am install-dvi \
++ install-dvi-am install-exec install-exec-am install-exec-local \
++ install-html install-html-am install-info install-info-am \
++ install-man install-pdf install-pdf-am install-ps \
++ install-ps-am install-strip installcheck installcheck-am \
++ installdirs maintainer-clean maintainer-clean-generic \
++ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
++ ps ps-am uninstall uninstall-am
++
++export XA_SRCDIR
++export XA_TOPSRCDIR
++export XA_ABSTOPSRCDIR
++
++all-local: user-all-local
++
++install-exec-local: user-install-local
++
++clean-local: user-clean-local
++
++user-all-local:
++ ${MAKE} ${_mcall} all;
++
++# Have no user-install-data-local ATM
++user-install-local: user-install-exec-local
++
++user-install-exec-local:
++ ${MAKE} ${_mcall} install;
++
++user-clean-local:
++ ${MAKE} ${_mcall} clean;
++
++# Tell versions [3.59,3.63) of GNU make to not export all variables.
++# Otherwise a system limit (for SysV at least) may be exceeded.
++.NOEXPORT:
++
+--- /dev/null
++++ b/extensions/LUA/Mbuild
+@@ -0,0 +1,3 @@
++# -*- Makefile -*-
++
++obj-${build_LUA} += libxt_LUA.so
+--- /dev/null
++++ b/extensions/LUA/nf_lua.c
+@@ -0,0 +1,64 @@
++#if defined(__KERNEL__)
++
++#include <linux/kernel.h>
++#include <linux/slab.h>
++#include <linux/string.h>
++#include <linux/timer.h>
++#include <linux/random.h>
++#include <linux/netfilter/x_tables.h>
++
++#endif
++
++#include "lua.h"
++#include "lobject.h" /*sizeof(udata) */
++#include "lauxlib.h"
++#include "controller.h"
++
++#if defined(__KERNEL__) /* reachs until luaopen_nflib */
++
++
++static int32_t nf_get_random(lua_State *L)
++{
++ uint32_t rand = 0;
++
++ get_random_bytes(&rand, sizeof(uint32_t ));
++ lua_pushnumber(L, rand);
++ return 1;
++}
++
++static int32_t nf_get_time(lua_State *L)
++{
++ lua_pushnumber(L, jiffies_to_msecs(jiffies_64));
++ return 1;
++}
++
++static const struct luaL_Reg nf_lua_lib_f [] = {
++ { "get_random", nf_get_random },
++ { "get_time", nf_get_time },
++ { NULL, NULL }
++};
++
++void luaopen_nflib(lua_State *L)
++{
++ int32_t top;
++
++ luaL_register(L, NETFILTER_LIB, nf_lua_lib_f);
++ lua_pop(L, 1);
++
++ /* registering verdicts inside the _G */
++ lua_getglobal(L, "_G");
++ top = lua_gettop(L);
++
++ lua_pushinteger(L, XT_CONTINUE);
++ lua_setfield(L, top, "XT_CONTINUE"); /* continiue with next rule */
++
++ lua_pushinteger(L, NF_DROP);
++ lua_setfield(L, top, "NF_DROP"); /* stop traversal in the current table hook and drop packet */
++
++ lua_pushinteger(L, NF_ACCEPT);
++ lua_setfield(L, top, "NF_ACCEPT"); /* stop traversal in the current table hook and accept packet */
++
++ lua_pop(L, 1); /* pop _G */
++}
++
++#endif
+--- /dev/null
++++ b/extensions/LUA/prot_buf_dynamic.c
+@@ -0,0 +1,486 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "controller.h"
++
++
++
++struct protocol_buf * dyn_prot_buf_array[MAX_NR_OF_DYN_PROT_BUFS] = { NULL };
++
++
++/* LUA_API: the function 'field_dynamic_setter' acts as a wrapper around
++ * a given Lua field setter function of a dynamic protocol buffer. The
++ * string containing the lua function name was piggybacked in the 'set'
++ * member of the protocol_field. We call this function passing the actual
++ * segment as byte array and the set value.
++ *
++ * Paramters:
++ * 1. lua_packet_segment (implicit)
++ * 2. some lua value
++ *
++ * Upvalues:
++ * 1. pointer to the protocol buffer
++ * 2. field index
++ *
++ * Returns:
++ * 1. true or false if the 'set' was successful
++ */
++int32_t field_dynamic_setter(lua_State *L)
++{
++ size_t nbytes;
++ lua_packet_segment * array;
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ int32_t field_index = lua_tointeger(L, lua_upvalueindex(2));
++
++ /* the function name is piggybacked as a string */
++ lua_getglobal(L, (char *)prot_buf->protocol_fields[field_index].set);
++ if (!lua_isfunction(L, -1)) {
++ lua_pushboolean(L, 0);
++ return 1;
++ }
++
++ nbytes = sizeof(lua_packet_segment) + seg->length * sizeof(uint8_t);
++ array = (lua_packet_segment *)lua_newuserdata(L, nbytes);
++ array->length = seg->length;
++ array->start = seg->start + seg->offset;
++ array->changes = NULL;
++
++ luaL_getmetatable(L, LUA_BYTE_ARRAY);
++ lua_setmetatable(L, -2);
++ lua_pushvalue(L, 2); /* push value to set */
++ if (lua_pcall(L, 2, 1, 0) != 0) {
++ pr_debug("Error: %s \n", lua_tostring(L, -1));
++ lua_pop(L, 1);
++ lua_pushboolean(L, 0);
++ }
++ return 1;
++}
++
++/* LUA_API: the function 'field_dynamic_getter' acts as a wrapper around
++ * a given Lua field getter function of a dynamic protocol buffer. The
++ * string containing the lua function name was piggybacked in the 'get'
++ * member of the protocol_field. We call this function passing the actual
++ * segment as byte array.
++ *
++ * Paramters:
++ * 1. lua_packet_segment (implicit)
++ *
++ * Upvalues:
++ * 1. pointer to the protocol buffer
++ * 2. field index
++ *
++ * Returns:
++ * 1. true or false if the 'get' was successful
++ */
++int32_t field_dynamic_getter(lua_State *L)
++{
++ size_t nbytes;
++ lua_packet_segment * array;
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ int32_t field_index = lua_tointeger(L, lua_upvalueindex(2));
++
++ /* the function name is piggybacked as a string */
++ lua_getglobal(L, (char *)prot_buf->protocol_fields[field_index].get);
++ if (!lua_isfunction(L, -1)) {
++ lua_pushboolean(L, 0);
++ return 1;
++ }
++
++ nbytes = sizeof(lua_packet_segment) + seg->length * sizeof(uint8_t);
++ array = (lua_packet_segment *)lua_newuserdata(L, nbytes);
++ array->length = seg->length;
++ array->start = seg->start + seg->offset;
++ array->changes = NULL;
++
++ luaL_getmetatable(L, LUA_BYTE_ARRAY);
++ lua_setmetatable(L, -2);
++ if (lua_pcall(L, 1, 1, 0) != 0) {
++ pr_debug("Error: %s \n", luaL_checkstring(L, -1));
++ lua_pop(L, 1);
++ lua_pushboolean(L, 0);
++ }
++ return 1;
++}
++
++/* LUA_API: the function 'has_protocol_dynamic' acts as a wrapper around
++ * a given lua has_protocol function of a dynamic protocol buffer. The
++ * string containing the lua function name was piggybacked in the 'has_protocol'
++ * member of the protocol_buffer. We call this function passing the actual
++ * segment.
++ *
++ * Paramters:
++ * 1. lua_packet_segment
++ * 2. protocol type
++ *
++ * Returns:
++ * 1. true or false if the payload field contains the given protocol
++ */
++int32_t has_protocol_dynamic(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t type)
++{
++ lua_packet_segment *seg_new;
++ int32_t res = 0;
++
++ /* the function name is piggybacked as a string */
++ lua_getglobal(L, (char *)prot_buf->has_protocol);
++ seg_new = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
++ seg_new->start = seg->start;
++ seg_new->offset = seg->offset;
++ seg_new->length = seg->length;
++ seg_new->changes = NULL;
++ luaL_getmetatable(L, prot_buf->name);
++ lua_setmetatable(L, -2);
++ lua_pushinteger(L, type); /* push the protocol type */
++ if (lua_pcall(L, 2, 1, 0) != 0) {
++ pr_debug("Error: %s \n", luaL_checkstring(L, -1));
++ lua_pop(L, 1);
++ return 0;
++ }
++ res = lua_toboolean(L, -1);
++ lua_pop(L, 1);
++
++ return res;
++}
++
++/* LUA_API: the function 'get_field_changes_dynamic' acts as a wrapper around
++ * a given lua get_field_changes function of a dynamic protocol buffer. The
++ * string containing the lua function name was piggybacked in the 'get_field_changes'
++ * member of the protocol_buffer. We call this function passing the actual
++ * segment. The lua function must return two lua table containing the offset
++ * and length changes (in bits).
++ *
++ * Paramters:
++ * 1. lua_packet_segment
++ *
++ * Returns:
++ * 1. new allocated field_changes struct
++ */
++struct field_changes * get_field_changes_dynamic(lua_State *L, struct protocol_buf *prot_buf, lua_packet_segment * seg)
++{
++ lua_packet_segment *seg_new;
++ struct field_changes * changes;
++ int32_t nr_of_changes, i;
++
++ lua_getglobal(L, (char *)prot_buf->get_field_changes);
++
++ seg_new = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
++ seg_new->start = seg->start;
++ seg_new->offset = seg->offset;
++ seg_new->length = seg->length;
++ seg_new->changes = NULL;
++ luaL_getmetatable(L, prot_buf->name);
++ lua_setmetatable(L, -2);
++
++ if (lua_pcall(L, 1, 2, 0) != 0)
++ luaL_error(L, "inside get_field_changes_dynamic. %s\n", lua_tostring(L, -1));
++
++ /* the function call must return a table containing length changes */
++ luaL_checktype(L, -1, LUA_TTABLE);
++ /* the function call must return a table containing offset changes */
++ luaL_checktype(L, -2, LUA_TTABLE);
++ /* both tables have to be of same size */
++ if (lua_objlen(L, -1) != lua_objlen(L, -2))
++ luaL_error(L, "the provided tables are not of equal size");
++
++ nr_of_changes = lua_objlen(L, -1);
++ changes = get_allocated_field_changes(L, nr_of_changes);
++
++ /* loop over the tables */
++ for (i = 1; i < nr_of_changes; i++) {
++ lua_rawgeti(L, -1, i); /* push length value of field at index i */
++ changes->field_length_changes[i - 1] = luaL_checkinteger(L, -1);
++ lua_pop(L, 1); /* pop offset value */
++
++ lua_rawgeti(L, -2, i); /* push offset value of field at index i */
++ changes->field_offset_changes[i - 1] = luaL_checkinteger(L, -1);
++ lua_pop(L, 1); /* pop length value */
++ }
++
++ /* pop both tables */
++ lua_pop(L, 2);
++
++ return changes;
++}
++
++/* C_INT: 'get_free_protocol_index' is only used internally. This function
++ * gets a free slot inside the array holding all the protocol buffers.
++ * There are several ways to get to this information. In this case I take
++ * the way over the reflected array SUPPORTED_PROTOCOL_TABLE inside the
++ * Lua state. Since this function is called at laodtime, we do not have
++ * to care about performance.
++ */
++static int32_t get_free_protocol_index(lua_State *L)
++{
++ int32_t protocol_index;
++
++ lua_getglobal(L, SUPPORTED_PROTOCOL_TABLE);
++ protocol_index = lua_objlen(L, -1) + 1;
++ lua_pop(L, 1);
++ return protocol_index;
++}
++
++/* C_API: 'free_dynamic_prot_buf' frees the allocated memory of a given
++ * dynamic protocol buffer. this function is normally called inside a
++ * cleanup routine. Be aware, before running this function you must be
++ * sure that no references to the dynamic protocol buffers were available.
++ * It's recomended to close the Lua state before calling the function. */
++void free_dynamic_prot_buf(struct protocol_buf * prot_buf)
++{
++ struct protocol_field * field = prot_buf->protocol_fields;
++
++ for (; field->name != NULL; field++) {
++ if (field->get) kfree(field->get);
++ if (field->set) kfree(field->set);
++ if (field->name) kfree((char *)field->name);
++ }
++
++ if (prot_buf->payload_field) kfree(prot_buf->payload_field);
++ if (prot_buf->has_protocol) kfree(prot_buf->has_protocol);
++
++ if (prot_buf->get_field_changes) kfree(prot_buf->get_field_changes);
++ kfree((char *)prot_buf->name);
++ kfree(prot_buf);
++ return;
++}
++
++void cleanup_dynamic_prot_bufs(void)
++{
++ int32_t i;
++
++ for (i = 0; i < MAX_NR_OF_DYN_PROT_BUFS; i++) {
++ if (dyn_prot_buf_array[i]) {
++ free_dynamic_prot_buf(dyn_prot_buf_array[i]);
++ dyn_prot_buf_array[i] = NULL;
++ }
++ }
++ return;
++}
++
++
++/* C_INT: 'free_protocol_fields' is used internally as a helper function for
++ * 'register_dynamic_protbuf'. It is used when durin registration an error
++ * occurs and the afore allocated fields needed to be freed. */
++static inline void free_protocol_fields(struct protocol_field * prot_fields, int32_t i)
++{
++ struct protocol_field * f;
++
++ while (i >= 0) {
++ f = &prot_fields[i];
++ if (f->name) kfree((void *)f->name);
++ if (f->get) kfree((void *)f->get);
++ if (f->set) kfree((void *)f->set);
++ kfree((void *)f);
++ i--;
++ }
++}
++
++/* LUA_API: 'register_dynamic_protbuf' is called from within the Lua script.
++ * it takes a Lua table representing the dynamic protocol buffer as parameter.
++ * e.g.:
++ * eth_prot_buf = {
++ * name = "packet_eth_dyn",
++ * payload_field = "data",
++ * protocol_fields = {
++ * {"dmac", 0, 48, nil, nil },
++ * {"smac", 48, 48, nil, nil },
++ * {"type", 96, 16, nil, nil },
++ * {"data", 112, 0, nil, nil },
++ * },
++ * has_protocol = "eth_dyn_has_protocol",
++ * get_field_changes = "eth_dyn_get_field_changes"
++ * }
++ * register_dynamic_protbuf(eth_prot_buf)
++ *
++ * the table gets parsed and a new protocol_buf struct is allocated and
++ * initialized using 'register_protbuf', which is also used for the static
++ * protocol buffers. This enables an identical behavior like the static
++ * protocol buffers. The dynamic protocol buffers are not garbage collected,
++ * use 'free_dynamic_protbuf' to free them after closing the Lua state.
++ */
++static int32_t register_dynamic_protbuf(lua_State *L)
++{
++ struct protocol_buf *prot_buf;
++ struct protocol_field *field, sentinel = PROT_FIELD_SENTINEL;
++ int32_t nr_of_fields, i;
++
++ prot_buf = (struct protocol_buf *)kmalloc(sizeof(struct protocol_buf), GFP_KERNEL);
++ prot_buf->is_dynamic = 1;
++
++ /* check if parameter is a table */
++ luaL_checktype(L, 1, LUA_TTABLE);
++
++ /* initialize prot_buf.name */
++ lua_getfield(L, 1, "name");
++ prot_buf->name = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char *)prot_buf->name, luaL_checkstring(L, -1));
++ lua_pop(L, 1); /* pop res from lua_getfield */
++
++ /* check if protocol buffer is already registered */
++ lua_getglobal(L, prot_buf->name);
++ if (!lua_isnil(L, -1)) {
++ lua_pop(L, 1); /* pop res from lua_getglobal */
++ pr_debug("protocol_buf '%s' already registered.\n", prot_buf->name);
++ goto free_prot_buf;
++ }
++ lua_pop(L, 1); /* pop res from lua_getglobal */
++
++ /* initialize payload field */
++ lua_getfield(L, 1, "payload_field");
++ if (lua_isstring(L, -1)) {
++ prot_buf->payload_field = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy(prot_buf->payload_field, lua_tostring(L, -1));
++ }else
++ prot_buf->payload_field = NULL;
++ lua_pop(L, 1); /* pop res from lua_getfield */
++
++ /* initialize protocol_fields field*/
++ lua_getfield(L, 1, "protocol_fields");
++ if (!lua_istable(L, -1)) {
++ pr_debug("invalid protocol_fields table.\n");
++ goto err2;
++
++ }
++
++ nr_of_fields = lua_objlen(L, -1);
++ prot_buf->protocol_fields = (struct protocol_field *)kmalloc((nr_of_fields + 1) * sizeof(struct protocol_field), GFP_KERNEL);
++
++ for (i = 1; i <= nr_of_fields; i++) {
++ field = &prot_buf->protocol_fields[i - 1];
++ /* initialize protocol field */
++ lua_rawgeti(L, -1, i); /* push field-table */
++ if (!lua_istable(L, -1)) {
++ free_protocol_fields(prot_buf->protocol_fields, i);
++ pr_debug("invalid protocol_field at %i.\n", i);
++ goto err;
++ }
++
++ /* initialize protocol field name */
++ lua_rawgeti(L, -1, 1);
++ if (!lua_isstring(L, -1)) {
++ free_protocol_fields(prot_buf->protocol_fields, i);
++ pr_debug("invalid protocol_field name at %i.\n", i);
++ goto err;
++ }
++
++ field->name = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char*)field->name, lua_tostring(L, -1));
++ lua_pop(L, 1); /* pop field name */
++
++ /* initialize protocol field offset */
++ lua_rawgeti(L, -1, 2);
++ if (!lua_isnumber(L, -1)) {
++ free_protocol_fields(prot_buf->protocol_fields, i);
++ pr_debug("invalid protocol_field offset at %i.\n", i);
++ goto err;
++ }
++ field->offset = lua_tointeger(L, -1);
++ lua_pop(L, 1); /* pop field offset */
++
++ /* initialize protocol field length */
++ lua_rawgeti(L, -1, 3);
++ if (!lua_isnumber(L, -1)) {
++ free_protocol_fields(prot_buf->protocol_fields, i);
++ pr_debug("invalid protocol_field length at %i.\n", i);
++ goto err;
++ }
++ field->length = lua_tointeger(L, -1);
++ lua_pop(L, 1); /* pop field length */
++
++ /* initialize protocol field getter */
++ lua_rawgeti(L, -1, 4);
++ if (lua_isstring(L, -1)) {
++ field->get = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char *)field->get, lua_tostring(L, -1)); /* the get-wrapper knows about the piggybacked string */
++ }else
++ field->get = NULL;
++ lua_pop(L, 1); /* pop field getter */
++
++ /* initialize protocol field setter */
++ lua_rawgeti(L, -1, 5);
++ if (lua_isstring(L, -1)) {
++ field->set = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char *)field->set, lua_tostring(L, -1)); /* the set-wrapper knows about the piggybacked string */
++ }else
++ field->set = NULL;
++ lua_pop(L, 1); /* pop field setter */
++
++ /* field initialization completed */
++ lua_pop(L, 1); /* pop field-table */
++ }
++
++ /* put sentinel at the end of protocol_fields */
++ memcpy(&prot_buf->protocol_fields[nr_of_fields], &sentinel, sizeof(sentinel));
++ lua_pop(L, 1); /* pop protocol-fields-table */
++
++ /* initialize has_protocol field */
++ lua_getfield(L, 1, "has_protocol");
++ if (lua_isstring(L, -1)) {
++ prot_buf->has_protocol = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char *)prot_buf->has_protocol, lua_tostring(L, -1)); /* the has_protocol-wrapper knows about the piggybacked string */
++ }else
++ prot_buf->has_protocol = NULL;
++ lua_pop(L, 1); /* pop has_protocol */
++
++ /* initialize get_field_changes field */
++ lua_getfield(L, 1, "get_field_changes");
++ if (lua_isstring(L, -1)) {
++ prot_buf->get_field_changes = kmalloc(lua_objlen(L, -1), GFP_KERNEL);
++ strcpy((char *)prot_buf->get_field_changes, lua_tostring(L, -1)); /* the get_field_changes-wrapper knows about the piggybacked string */
++ }else
++ prot_buf->get_field_changes = NULL;
++ lua_pop(L, 1); /* pop get_field_changes */
++
++ /* Storing the pointer to the DYNAMIC protbuf within dyn_prot_buf_array, in order to free it at cleanup */
++ for (i = 0; i < MAX_NR_OF_DYN_PROT_BUFS; i++) {
++ if (!dyn_prot_buf_array[i]) {
++ dyn_prot_buf_array[i] = prot_buf;
++ break;
++ }else
++ goto err;
++ }
++
++ /* call the "common" register_protbuf */
++ register_protbuf(L, prot_buf, get_free_protocol_index(L)); /* register prot_buf as it is done with the static ones */
++
++ return 0;
++
++err:
++ kfree(prot_buf->protocol_fields);
++err2:
++ if (prot_buf->payload_field) kfree(prot_buf->payload_field);
++free_prot_buf:
++ kfree((void *)prot_buf->name);
++ kfree(prot_buf);
++
++ luaL_error(L, "one or more error happend while registering a dynamic protocol buffer, please consult the debug log");
++
++ return 0;
++
++}
++
++void luaopen_protbuf_dynamic(lua_State *L)
++{
++ lua_getglobal(L, "_G");
++ lua_pushcclosure(L, register_dynamic_protbuf, 0);
++ lua_setfield(L, -2, "register_dynamic_protbuf");
++ lua_pop(L, 1); /* pop _G */
++ return;
++}
+--- /dev/null
++++ b/extensions/LUA/prot_buf_ethernet.c
+@@ -0,0 +1,60 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "controller.h"
++
++
++static int32_t eth_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ uint8_t *embedded_protocol = seg->start + seg->offset + 12 /*bytes*/;
++ unsigned short res = (unsigned short)((embedded_protocol[1] << CHAR_BIT) | (embedded_protocol[0] << CHAR_BIT));
++
++ switch (res) {
++ case 0x0800: /* 1: Internet Protocol (IP) */
++ if (protocol_type == PACKET_IP) return 1;
++ break;
++ default:
++ return 0;
++ }
++
++ return 0;
++}
++
++static const struct protocol_field eth_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "dmac", 0, 48, NULL, NULL },
++ { "smac", 48, 48, NULL, NULL },
++ { "type", 96, 16, NULL, NULL },
++ { "data", 112, 0, NULL, NULL },
++ PROT_FIELD_SENTINEL,
++};
++
++static const struct protocol_buf eth_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_ETH,
++ .payload_field = "data",
++ .protocol_fields = (struct protocol_field *)ð_protocol_fields,
++ .has_protocol = ð_has_protocol,
++ .get_field_changes = NULL,
++};
++
++
++void luaopen_protbuf_eth(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)ð_protocol_buf, PACKET_ETH);
++}
+--- /dev/null
++++ b/extensions/LUA/prot_buf_helpers.c
+@@ -0,0 +1,216 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#if defined(__KERNEL__)
++#include <linux/netfilter_ipv4.h>
++#include <linux/slab.h> /* kmalloc */
++#endif
++
++#include "controller.h"
++
++int32_t get_header_size(struct protocol_buf * prot_buf)
++{
++ int32_t bit_counter = 0;
++ struct protocol_field * field = prot_buf->protocol_fields;
++
++ for (; field->name; field++)
++ bit_counter += field->length;
++
++ return bit_counter >> 3;
++}
++
++
++int32_t set_32_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ *(uint32_t *)(seg->start + seg->offset) = (uint32_t )htonl(luaL_checkinteger(L, 2));
++ return 0;
++}
++int32_t get_32_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushinteger(L, ntohl(*((uint32_t *)(seg->start + seg->offset))));
++ return 1;
++}
++
++int32_t set_16_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ *(uint16_t *)(seg->start + seg->offset) = (uint16_t)htons(luaL_checkinteger(L, 2));
++ return 0;
++}
++int32_t get_16_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushinteger(L, ntohs(*((uint16_t *)(seg->start + seg->offset))));
++ return 1;
++}
++
++int32_t set_lower_4_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ uint8_t b = (uint8_t)luaL_checkinteger(L, 2) << 4;
++ uint8_t * pos = (uint8_t *)(seg->start + seg->offset);
++
++ *pos &= 0x0F; /* reset lower 4 bits*/
++ *pos |= b;
++
++ return 0;
++}
++
++int32_t get_lower_4_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushinteger(L, (*(uint8_t *)(seg->start + seg->offset)) >> 4);
++ return 1;
++}
++
++int32_t set_upper_4_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ uint8_t b = (uint8_t)luaL_checkinteger(L, 2) << 4;
++ uint8_t * pos = (uint8_t *)(seg->start + seg->offset);
++
++ *pos &= 0xF0; /* reset upper 4 bits*/
++ *pos |= (b >> 4);
++
++ return 0;
++}
++
++int32_t get_upper_4_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushinteger(L, (*(uint8_t *)(seg->start + seg->offset)) & 0x0F);
++ return 1;
++}
++
++
++int32_t set_8_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ *(uint8_t *)(seg->start + seg->offset) = (uint8_t)luaL_checkinteger(L, 2);
++ return 0;
++}
++
++int32_t get_8_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ lua_pushinteger(L, *(uint8_t *)(seg->start + seg->offset));
++ return 1;
++}
++
++int32_t set_1_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ unsigned long l = 0;
++
++ memcpy(&l, (seg->start + seg->offset), seg->length);
++ l |= (1 << ((CHAR_BIT * seg->length) - luaL_checkinteger(L, 2)));
++ memcpy((seg->start + seg->offset), &l, seg->length);
++
++ return 0;
++}
++
++int32_t get_1_bit_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ unsigned long l = 0;
++ uint32_t bit = 0;
++
++ memcpy(&l, (seg->start + seg->offset), seg->length);
++ bit = l & (1 << ((CHAR_BIT * seg->length) - luaL_checkinteger(L, 2)));
++
++ lua_pushboolean(L, bit);
++ return 1;
++}
++
++int32_t get_string_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++ /* Warning we cast from uchar to char */
++ lua_pushlstring(L, (char *)seg->start + seg->offset, seg->length);
++ return 1;
++}
++
++int32_t set_data_generic(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++ lua_packet_segment * data = checkbytearray(L, 2);
++
++ pr_debug("seg->length %u, data->length %u\n", seg->length, data->length);
++
++ if (seg->length >= data->length)
++ memcpy((seg->start + seg->offset), data->start, data->length);
++ else
++ luaL_error(L, "provided byte array too big for given packet segment");
++ return 0;
++}
++
++struct field_changes * get_allocated_field_changes(lua_State *L, int32_t nr_of_fields)
++{
++ struct field_changes * changes;
++
++ changes = kmalloc(sizeof(struct field_changes), GFP_ATOMIC);
++
++ if (!changes)
++ goto failure;
++
++ changes->field_length_changes = kmalloc(nr_of_fields * sizeof(int), GFP_ATOMIC);
++ if (!changes->field_length_changes)
++ goto free1;
++
++ changes->field_offset_changes = kmalloc(nr_of_fields * sizeof(int), GFP_ATOMIC);
++ if (!changes->field_offset_changes)
++ goto free2;
++
++ memset(changes->field_length_changes, 0, nr_of_fields * sizeof(int));
++ memset(changes->field_offset_changes, 0, nr_of_fields * sizeof(int));
++
++ changes->ref_count = 1;
++
++ return changes;
++
++free2: kfree(changes->field_length_changes);
++free1: kfree(changes);
++failure:
++ if (!changes) luaL_error(L, "couldnt allocate memory inside 'get_allocated_field_changes'");
++ return NULL; /* only to omit warnings */
++}
+\ No newline at end of file
+--- /dev/null
++++ b/extensions/LUA/prot_buf_icmp.c
+@@ -0,0 +1,49 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "controller.h"
++
++static int32_t icmp_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ return 0;
++}
++
++static const struct protocol_field icmp_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "type", 0, 8, NULL, NULL },
++ { "code", 8, 8, NULL, NULL },
++ { "checksum", 16, 16, NULL, NULL },
++ { "id", 32, 16, NULL, NULL },
++ { "sequence", 48, 16, NULL, NULL },
++ PROT_FIELD_SENTINEL,
++};
++
++static const struct protocol_buf icmp_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_ICMP,
++ .payload_field = NULL,
++ .protocol_fields = (struct protocol_field *)&icmp_protocol_fields,
++ .has_protocol = &icmp_has_protocol,
++ .get_field_changes = NULL,
++};
++
++void luaopen_protbuf_icmp(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&icmp_protocol_buf, PACKET_ICMP);
++}
++
+--- /dev/null
++++ b/extensions/LUA/prot_buf_ip.c
+@@ -0,0 +1,209 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#if defined(__KERNEL__)
++ #include <net/checksum.h>
++ #include <net/tcp.h>
++#endif
++
++#include "controller.h"
++
++
++#define IP_FMT "%u.%u.%u.%u"
++#define IP_ACC(buf) buf[0], buf[1], buf[2], buf[3]
++
++
++static int32_t ip_version_set(lua_State *L)
++{
++ uint8_t version_checked;
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *version_seg = seg->start + seg->offset;
++ int32_t version = luaL_checkinteger(L, 2);
++
++ luaL_argcheck(L, version >= 0 && version <= 15, 1, "version number invalid");
++
++ version_checked = (uint8_t)version;
++
++ version_seg[0] &= (uint8_t)0x0F; /* reset version bits */
++ version_seg[0] |= version_checked << 4;
++
++ return 0;
++}
++static int32_t ip_version_get(lua_State *L)
++{
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *version_seg = seg->start + seg->offset;
++ uint8_t v = version_seg[0] & 0xF0;
++
++ v >>= 4;
++
++ lua_pushinteger(L, v);
++ return 1;
++}
++
++static int32_t ip_ihl_set(lua_State *L)
++{
++ uint8_t ihl_checked;
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *ihl_seg = seg->start + seg->offset;
++ int32_t ihl = luaL_checkinteger(L, 2);
++
++ luaL_argcheck(L, ihl >= 5 && ihl <= 15, 1, "ip header length invalid"); // RFC 791 5x32 = 160 bits
++
++ ihl_checked = (uint8_t)ihl;
++
++ ihl_seg[0] &= (uint8_t)0xF0; /* reset ihl bits */
++ ihl_seg[0] |= ihl_checked;
++
++ return 0;
++}
++static int32_t ip_ihl_get(lua_State *L)
++{
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *ihl_seg = seg->start + seg->offset;
++ uint8_t v = ihl_seg[0] & 0x0F;
++
++ lua_pushinteger(L, v);
++ return 1;
++}
++
++static int32_t ip_addr_set(lua_State *L)
++{
++ int32_t field_id = lua_tointeger(L, lua_upvalueindex(2));
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *addr_seg = seg->start + seg->offset;
++ uint32_t old_addr;
++ char *ip = (char *)luaL_checkstring(L, 2);
++ uint32_t a, b, c, d;
++ struct sk_buff * skb = (struct sk_buff *)lua_touserdata(L, 3);
++
++ /* for tcp / udp checksumming*/
++ uint32_t prot_offset;
++ uint8_t *check, *protocol_seg;
++
++ /* end */
++
++ sscanf(ip, IP_FMT, &a, &b, &c, &d);
++
++ luaL_argcheck(L, a < 256 && b < 256 && c < 256 && d < 256, 1, "invalid ip addr");
++
++ old_addr = *((uint32_t *)addr_seg);
++ addr_seg[0] = (uint8_t)a;
++ addr_seg[1] = (uint8_t)b;
++ addr_seg[2] = (uint8_t)c;
++ addr_seg[3] = (uint8_t)d;
++
++#if defined(__KERNEL__)
++ if (old_addr != *(uint32_t *)addr_seg) {
++ int32_t offset = (field_id == 10) ? -2 : -6; /* offset from saddr or daddr */
++
++ csum_replace4((uint16_t *)(addr_seg + offset), old_addr, *(uint32_t *)addr_seg);
++
++ prot_offset = (field_id == 10) ? -3 : -7; /* offset from saddr or daddr */
++ protocol_seg = seg->start + seg->offset + prot_offset;
++
++ if (skb && (protocol_seg[0] == 0x06 || protocol_seg[0] == 0x11)) { /* is payload TCP or UDP ? */
++
++ check = seg->start + seg->offset; /* tmp res */
++ check += (field_id == 10) ? 8 : 16; /* the start of the payload, depending saddr or daddr */
++ check += (protocol_seg[0] == 0x06) ? 16 : 6; /* the start of the checksum, depending on TCP or UDP */
++
++ inet_proto_csum_replace4((__sum16 *)check, skb, old_addr, *(uint32_t *)addr_seg, 1);
++
++ lua_pop(L, 1);
++ }
++ }
++#endif
++ return 0;
++}
++
++
++
++
++
++static int32_t ip_addr_get(lua_State *L)
++{
++ lua_packet_segment * seg = checkpacketseg(L, 1, LUA_PACKET_SEG_IP);
++ uint8_t *addr_seg = seg->start + seg->offset;
++
++ char buf[16]; /*max: 255.255.255.255\0 --> 16 chars */
++
++ sprintf(buf, IP_FMT, IP_ACC(addr_seg));
++ lua_pushstring(L, buf);
++ return 1;
++}
++
++static int32_t ip_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ uint8_t * embedded_protocol = seg->start + seg->offset + 9 /*bytes*/;
++
++ switch (embedded_protocol[0]) {
++ case 0x01: /* 1: Internet Control Message Protocol (ICMP) */
++ if (protocol_type == PACKET_ICMP) return 1;
++ break;
++ case 0x02: /* 2: Internet Group Management Protocol (IGMP) */
++ break;
++ case 0x06: /* 6: Transmission Control Protocol (TCP) */
++ if (protocol_type == PACKET_TCP) return 1;
++ break;
++ case 0x11: /* 17: User Datagram Protocol (UDP) */
++ if (protocol_type == PACKET_UDP) return 1;
++ break;
++ case 0x59: /* 89: Open Shortest Path First (OSPF) */
++ break;
++ case 0x84: /* 132: Stream Control Transmission Protocol (SCTP) */
++ break;
++ default:
++ break;
++ }
++
++ return 0;
++}
++
++static const struct protocol_field ip_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "version", 0, 4, ip_version_get, ip_version_set },
++ { "ihl", 4, 4, ip_ihl_get, ip_ihl_set },
++ { "tos", 8, 8, get_8_bit_generic, set_8_bit_generic },
++ { "tot_len", 16, 16, get_16_bit_generic, set_16_bit_generic },
++ { "id", 32, 16, get_16_bit_generic, set_16_bit_generic },
++ { "flags", 48, 3, get_1_bit_generic, set_1_bit_generic },
++ { "frag_off", 51, 13, NULL, NULL },
++ { "ttl", 64, 8, get_8_bit_generic, set_8_bit_generic },
++ { "protocol", 72, 8, get_8_bit_generic, set_8_bit_generic },
++ { "check", 80, 16, get_16_bit_generic, set_16_bit_generic },
++ { "saddr", 96, 32, ip_addr_get, ip_addr_set },
++ { "daddr", 128, 32, ip_addr_get, ip_addr_set },
++ { "data", 160, 0, NULL, set_data_generic },
++ PROT_FIELD_SENTINEL,
++};
++
++static const struct protocol_buf ip_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_IP,
++ .payload_field = "data",
++ .protocol_fields = (struct protocol_field *)&ip_protocol_fields,
++ .has_protocol = &ip_has_protocol,
++ .get_field_changes = NULL,
++};
++
++void luaopen_protbuf_ip(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&ip_protocol_buf, PACKET_IP);
++}
++
+--- /dev/null
++++ b/extensions/LUA/prot_buf_raw.c
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include "controller.h"
++static int32_t raw_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ return 1;
++}
++
++static const struct protocol_field raw_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "data", 0, 0, NULL, NULL },
++ PROT_FIELD_SENTINEL,
++};
++
++static const struct protocol_buf raw_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_RAW,
++ .payload_field = "data",
++ .protocol_fields = (struct protocol_field *)&raw_protocol_fields,
++ .has_protocol = &raw_has_protocol,
++ .get_field_changes = NULL,
++};
++
++void luaopen_protbuf_raw(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&raw_protocol_buf, PACKET_RAW);
++}
+--- /dev/null
++++ b/extensions/LUA/prot_buf_tcp.c
+@@ -0,0 +1,188 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#if defined(__KERNEL__)
++ #include <net/checksum.h>
++ #include <net/tcp.h>
++#endif
++#include "controller.h"
++
++
++static int32_t tcp_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ return 1;
++}
++
++static int32_t tcp_set_checksum(lua_State *L)
++{
++ struct protocol_buf * prot_buf = (struct protocol_buf *)lua_topointer(L, lua_upvalueindex(1));
++ lua_packet_segment * seg = checkpacketseg(L, 1, prot_buf->name);
++
++#if defined(__KERNEL__)
++ uint8_t * check_seg = seg->start + seg->offset;
++ uint8_t * tcp_hdr = check_seg - 16;
++ uint8_t * saddr = tcp_hdr - 8;
++ uint8_t * daddr = saddr + 4;
++ uint32_t len = 20 + (seg->changes->field_length_changes[11] / 8) + (seg->changes->field_length_changes[10] / 8);
++ unsigned short checksum = tcp_v4_check(len, *(uint32_t *)saddr, *(uint32_t *)daddr,
++ csum_partial(tcp_hdr, len, 0));
++
++ memcpy(check_seg, &checksum, sizeof(unsigned short));
++#endif
++ return 0;
++}
++
++
++static const struct protocol_field tcp_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "sport", 0, 16, get_16_bit_generic, set_16_bit_generic },
++ { "dport", 16, 16, get_16_bit_generic, set_16_bit_generic },
++ { "seq", 32, 32, get_32_bit_generic, set_32_bit_generic },
++ { "ack", 64, 32, get_32_bit_generic, set_32_bit_generic },
++ { "data_off", 96, 4, get_lower_4_bit_generic, set_lower_4_bit_generic },
++ { "reserved", 100, 4, get_upper_4_bit_generic, set_upper_4_bit_generic },
++ { "flags", 104, 8, get_1_bit_generic, set_1_bit_generic },
++ { "window_size", 112, 16, get_16_bit_generic, set_16_bit_generic },
++ { "check", 128, 16, get_16_bit_generic, tcp_set_checksum },
++ { "urgent", 144, 16, NULL, NULL },
++ { "options", 160, 0, NULL, set_data_generic },
++ { "data", 160, 0, NULL, set_data_generic }, /* begin of data depends on options */
++ PROT_FIELD_SENTINEL,
++};
++
++
++static const struct protocol_field tcp_options_and_data[] = {
++ /* field name offset length getter setter */
++ { "MSS", 0, 16, get_16_bit_generic, set_16_bit_generic },
++ { "WS", 0, 8, get_8_bit_generic, set_8_bit_generic },
++ { "SACK", 0, 16, get_16_bit_generic, set_16_bit_generic },
++ { "TSVAL", 0, 32, get_32_bit_generic, set_32_bit_generic },
++ { "TSER", 0, 32, get_32_bit_generic, set_32_bit_generic },
++ PROT_FIELD_SENTINEL,
++};
++
++
++static struct field_changes * tcp_get_field_changes(lua_State *L, lua_packet_segment * seg);
++
++static const struct protocol_buf tcp_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_TCP,
++ .payload_field = "data",
++ .protocol_fields = (struct protocol_field *)&tcp_protocol_fields,
++ .has_protocol = &tcp_has_protocol,
++ .get_field_changes = &tcp_get_field_changes,
++};
++
++
++static struct field_changes * tcp_options_get_field_changes(lua_State *L, lua_packet_segment * seg);
++
++static const struct protocol_buf tcp_options_and_data_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_TCP_OPT,
++ .payload_field = NULL,
++ .protocol_fields = (struct protocol_field *)&tcp_options_and_data,
++ .has_protocol = NULL,
++ .get_field_changes = &tcp_options_get_field_changes,
++};
++
++struct field_changes * tcp_get_field_changes(lua_State *L, lua_packet_segment * seg)
++{
++ /* depending on the value stored inside the 'data_off'-field, the length of
++ * the 'options' field has to be changed, as well as the length and offset
++ * of the 'data' field */
++ uint8_t *tcp_hdr = seg->start + seg->offset;
++
++ /* get the pointer to the 'data_off' field */
++ uint8_t * data_off_field = tcp_hdr + 12; /* 12 bytes offset */
++ /* extract the stored header length in bits */
++ uint32_t tcp_hdr_len = ((*(uint8_t *)data_off_field) >> 4) * 32;
++
++ /* get an allocated 'field_changes' structure */
++ struct field_changes * changes = get_allocated_field_changes(L, 12);
++
++ /* depending on the tcp header length, change the length of the options*/
++ changes->field_length_changes[10] = tcp_hdr_len - 160;
++ /* depending on the options length, change the offset of the data */
++ changes->field_offset_changes[11] = changes->field_length_changes[10];
++ changes->field_length_changes[11] = (seg->length * 8) - tcp_hdr_len;
++
++ return changes;
++
++}
++
++struct field_changes * tcp_options_get_field_changes(lua_State *L, lua_packet_segment * seg)
++{
++ /* depending on the value stored inside the 'data_off'-field, the length of
++ * the 'options' field has to be changed, as well as the length and offset
++ * of the 'data' field */
++ uint8_t *tcp_opt_hdr = seg->start + seg->offset;
++
++ /* get an allocated 'field_changes' structure */
++ struct field_changes * changes = get_allocated_field_changes(L, 5);
++
++ int32_t MSS = 0, WS = 0, SACK = 0, TS = 0, i;
++
++ uint8_t b1, b2;
++
++ for (i = 0; i < seg->length; i++) {
++ b1 = tcp_opt_hdr[i];
++ b2 = tcp_opt_hdr[i + 1];
++
++ if (b1 == 0x00)
++ break;
++
++ /* test for MSS */
++ if (!MSS && (b1 == 0x02 && b2 == 0x04)) {
++ changes->field_offset_changes[0] = (i + 2) * CHAR_BIT;
++ MSS = 1;
++ }
++
++ /* test for WS --- yet buggy somehow */
++ if (!WS && (b1 == 0x03 && b2 == 0x03)) {
++ changes->field_offset_changes[1] = (i + 2) * CHAR_BIT;
++ WS = 1;
++ }
++
++ /* test for SACK*/
++ if (!SACK && (b1 == 0x04 && b2 == 0x02)) {
++ changes->field_offset_changes[2] = i * CHAR_BIT; /* has no value */
++ SACK = 1;
++ }
++
++ /* test for TS */
++ if (!TS && (b1 == 0x08 && b2 == 0x0A)) {
++ changes->field_offset_changes[3] = (i + 2) * CHAR_BIT;
++ changes->field_offset_changes[4] = (i + 2 + 4) * CHAR_BIT;
++ TS = 1;
++ }
++ }
++
++ return changes;
++
++}
++
++void luaopen_protbuf_tcp(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&tcp_protocol_buf, PACKET_TCP);
++}
++void luaopen_protbuf_tcp_options(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&tcp_options_and_data_buf, PACKET_TCP_OPTIONS);
++}
++
++
+--- /dev/null
++++ b/extensions/LUA/prot_buf_tftp.c
+@@ -0,0 +1,87 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++#include "controller.h"
++
++static const struct protocol_field tftp_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "opcode", 0, 16, get_16_bit_generic, NULL},
++ { "filename", 0, 0, get_string_generic, NULL},
++ { "mode", 0, 0, get_string_generic, NULL},
++ { "block_nr", 0, 16, get_16_bit_generic, NULL},
++ { "data", 0, 0, NULL, NULL},
++ PROT_FIELD_SENTINEL,
++};
++
++struct field_changes * tftp_get_field_changes(lua_State *L, lua_packet_segment * seg)
++{
++ /* depending on the value stored inside the 'opcode'-field we have to change
++ * offsets and lengths */
++ uint8_t *tftp_hdr = seg->start + seg->offset;
++ short opcode = ntohs(*((uint16_t *)tftp_hdr));
++ /* get an allocated 'field_changes' structure */
++ struct field_changes * changes = get_allocated_field_changes(L, 5);
++ switch (opcode) {
++ case 1: /* Read Request (RRQ) */
++ /* setting offset and length of field 'filename' */
++ changes->field_offset_changes[1] = sizeof(unsigned short) << 3;
++ changes->field_length_changes[1] = strlen((char *)tftp_hdr + sizeof(unsigned short)) << 3;
++ /* setting offset and length of field 'mode' */
++ changes->field_offset_changes[2] = changes->field_offset_changes[1] + changes->field_length_changes[1];
++ changes->field_length_changes[2] = strlen((char *)tftp_hdr + (changes->field_offset_changes[2] >> 3));
++ break;
++ case 2: /* Write Request (WRQ) */
++ /* setting offset and length of field 'filename' */
++ changes->field_offset_changes[1] = sizeof(unsigned short) << 3;
++ changes->field_length_changes[1] = strlen((char *)tftp_hdr + sizeof(unsigned short)) << 3;
++ /* setting offset and length of field 'mode' */
++ changes->field_offset_changes[2] = changes->field_offset_changes[1] + changes->field_length_changes[1];
++ changes->field_length_changes[2] = strlen((char *)tftp_hdr + (changes->field_offset_changes[2] >> 3));
++ break;
++ case 3: /* Data (DATA) */
++ /* setting offset of field 'block_nr' */
++ changes->field_offset_changes[3] = sizeof(unsigned short) << 3;
++ /* setting offset of field 'data' */
++ changes->field_offset_changes[4] = changes->field_offset_changes[3] + (sizeof(unsigned short) << 3);
++ break;
++ case 4: /* Acknowledgment (ACK) */
++ /* setting offset of field 'block_nr' */
++ changes->field_offset_changes[3] = sizeof(unsigned short) << 3;
++ break;
++ case 5: /* Error (ERROR) */
++ /* we don't care ... yet */
++ break;
++ default:
++ break;
++ }
++
++ return changes;
++}
++
++static const struct protocol_buf tftp_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_TFTP,
++ .payload_field = NULL,
++ .protocol_fields = (struct protocol_field *)&tftp_protocol_fields,
++ .has_protocol = NULL, /* we don't need it, since we don't provide a payload field */
++ .get_field_changes = tftp_get_field_changes,
++};
++
++void luaopen_protbuf_tftp(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&tftp_protocol_buf, PACKET_TFTP);
++}
+--- /dev/null
++++ b/extensions/LUA/prot_buf_udp.c
+@@ -0,0 +1,53 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#if defined(__KERNEL__)
++ #include <net/checksum.h>
++#endif
++
++#include "controller.h"
++
++
++static int32_t udp_has_protocol(lua_State *L, struct protocol_buf * prot_buf, lua_packet_segment * seg, int32_t protocol_type)
++{
++ return 1;
++}
++
++static const struct protocol_field udp_protocol_fields[] = {
++ /* field name offset length getter setter */
++ { "sport", 0, 16, get_16_bit_generic, set_16_bit_generic },
++ { "dport", 16, 16, get_16_bit_generic, set_16_bit_generic },
++ { "length", 32, 16, get_16_bit_generic, set_16_bit_generic },
++ { "check", 48, 16, get_16_bit_generic, set_16_bit_generic },
++ { "data", 64, 0, NULL, NULL },
++ PROT_FIELD_SENTINEL,
++};
++
++static const struct protocol_buf udp_protocol_buf = {
++ .is_dynamic = 0,
++ .name = LUA_PACKET_SEG_UDP,
++ .payload_field = "data",
++ .protocol_fields = (struct protocol_field *)&udp_protocol_fields,
++ .has_protocol = &udp_has_protocol,
++ .get_field_changes = NULL,
++};
++
++void luaopen_protbuf_udp(lua_State *L)
++{
++ register_protbuf(L, (struct protocol_buf *)&udp_protocol_buf, PACKET_UDP);
++}
+--- /dev/null
++++ b/extensions/LUA/xt_LUA.h
+@@ -0,0 +1,36 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre.graf@stud.unibas.ch>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef XT_LUA_H_
++#define XT_LUA_H_
++
++#define MAX_FILENAME_SIZE 256
++#define MAX_FUNCTION_SIZE 256
++#define MAX_SCRIPT_SIZE 32768
++#define LUA_STATE_ARRAY_SIZE 128
++
++/* the targetsize is stored in a u16, so max size of the xt_lua_tginfo cannot exceed 64K*/
++struct xt_lua_tginfo {
++ char buf[MAX_SCRIPT_SIZE];
++ char filename[MAX_FILENAME_SIZE];
++ char function[MAX_FUNCTION_SIZE];
++ __u64 script_size;
++ __u32 state_id;
++};
++
++#endif /* XT_LUA_H_ */
+--- /dev/null
++++ b/extensions/LUA/xt_LUA_target.c
+@@ -0,0 +1,286 @@
++/*
++ * Copyright (C) 2010 University of Basel <http://cn.cs.unibas.ch/>
++ * by Andre Graf <andre@dergraf.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <linux/kernel.h>
++#include <linux/slab.h>
++#include <linux/module.h>
++#include <asm/uaccess.h>
++#include <net/ip.h>
++#include <linux/netfilter/x_tables.h>
++#include "xt_LUA.h"
++
++#include "controller.h"
++
++/*::*
++ * lua_envs
++ * ----------
++ * This array holds a defined number of `lua_envs`_ structures.
++ * The used array index is also used as the Lua state identifier.
++ * The size of the array is defined in `LUA_STATE_ARRAY_SIZE`_.
++ */
++struct lua_env * lua_envs[LUA_STATE_ARRAY_SIZE];
++
++/*::*
++ * lua_state_refs
++ * --------------
++ * This array holds the reference counts of the several `lua_nf_state`_s
++ * which are stored inside the array `lua_states`_.
++ */
++uint32_t lua_state_refs[LUA_STATE_ARRAY_SIZE] = { 0 };
++
++/*::*
++ * lua_tg
++ * ------
++ * This function is called whenever a packet matches all matching conditions
++ * inside a rule. It is the target. It extracts the state identifier comming
++ * inside the *xt_target_param* structure and uses it to access the proper
++ * Lua state inside the `lua_states`_ array.
++ *
++ * It then constructs a new Lua userdata of type *lua_packet_segment* and
++ * initializes it with the lowest network header available. This userdata
++ * is annotated with the Lua metatable `LUA_PACKET_SEG_RAW`_ which converts
++ * the userdata to a raw lua packet having all raw functions available.
++ * This raw packet is the single parameter to the Lua function *process_packet*
++ * which must be defined inside the Lua script provided by the user. So far
++ * hardcoded, may be later configured by Lua - subject to change.
++ *
++ * The process_packet function must return an integer value, the verdict. For
++ * convenience reasons xt_LUA exports the verdicts NF_ACCEPT, NF_DROP and
++ * XT_CONTINUE inside the *register_lua_packet_lib* function.
++ */
++
++spinlock_t lock = SPIN_LOCK_UNLOCKED;
++
++static uint32_t
++lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
++{
++ uint32_t verdict;
++ lua_packet_segment *p;
++ const struct xt_lua_tginfo *info = par->targinfo;
++ lua_State * L;
++
++ /* START critical section on SMP, PacketScript is on the sequential trail at the moment TODO*/
++ spin_lock_irq(&lock);
++
++ L = lua_envs[info->state_id]->L;
++
++ if (!skb_make_writable(pskb, pskb->len))
++ return NF_DROP;
++
++ /* call the function provided by --function parameter or the default 'process_packet' defined in Lua */
++ lua_getglobal(L, info->function);
++
++ /* push the lua_packet_segment as a parameter */
++ p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
++ if (pskb->mac_header)
++ p->start = pskb->mac_header;
++ else if (pskb->network_header)
++ p->start = pskb->network_header;
++ else if (pskb->transport_header)
++ p->start = pskb->transport_header;
++ p->offset = 0;
++ p->length = (unsigned long)pskb->tail - (unsigned long)p->start;
++ p->changes = NULL;
++
++ /* marking userdata 'lua_packet_seg' with the corresponding metatable */
++ luaL_getmetatable(L, LUA_PACKET_SEG_RAW);
++ lua_setmetatable(L, -2);
++
++ /* push a reference to the skb as a parameter, needed at the moment for calculating TCP checksum, but I am not happy with it*/
++ lua_pushlightuserdata(L, (void *)skb_get(pskb));
++
++ /* do the function call (2 argument, 1 result) */
++ if (lua_pcall(L, 2, 1, 0) != 0) {
++ printk(KERN_ERR "LUA [%d]: pcall '%s' failed: %s\n", info->state_id, info->function, lua_tostring(L, -1));
++ lua_pop(L, 1);
++ return NF_DROP;
++ }
++
++ if (!lua_isnumber(L, -1)) {
++ printk(KERN_ERR "LUA [%d]: function '%s' must return a verdict\n", info->state_id, info->function);
++ lua_pop(L, 1);
++ return NF_DROP;
++ }
++
++ verdict = lua_tonumber(L, -1);
++ lua_pop(L, 1);
++
++ kfree_skb(pskb);
++
++ /* END critical section on SMP */
++ spin_unlock_irq(&lock);
++
++
++ return verdict;
++
++}
++/* Helper for checkentry */
++static bool load_script_into_state(uint32_t state_id, unsigned long script_size, char *script_buf)
++{
++ char *buf = kmalloc(script_size, GFP_KERNEL);
++ int32_t ret;
++ struct lua_env * env = kmalloc(sizeof(struct lua_env), GFP_KERNEL);
++
++ if (!script_size > 0) {
++ pr_debug("LUA [%d]: script_size %lu < 0\n", state_id, script_size);
++ return false;
++ }
++
++ env->L = lua_open();
++ luaopen_base(env->L);
++ luaopen_controller(env->L);
++
++ lua_getglobal(env->L, "_G");
++ lua_pushinteger(env->L, state_id);
++ lua_setfield(env->L, -2, "STATE_ID");
++ lua_pop(env->L, 1); /* pop _G */
++
++ strncpy(buf, script_buf, script_size);
++ ret = luaL_loadbuffer(env->L, buf, script_size, "PacketScript, loadbuffer") ||
++ lua_pcall(env->L, 0, 1, 0);
++
++ if (ret != 0) {
++ printk(KERN_ERR "LUA [%d]: failure loading script, error %s \n", state_id, lua_tostring(env->L, -1));
++ lua_pop(env->L, 1);
++ kfree(buf);
++ kfree(env);
++ return false;
++ }
++
++ lua_envs[state_id] = env;
++
++ kfree(buf);
++
++ return true;
++}
++/*::*
++ * lua_tg_checkentry
++ * -----------------
++ * This function is used as a kernel-side sanity check of the data comming
++ * from the iptables userspace program. Since this is the function which is
++ * called everytime a new rule (with -j xt_LUA) is injected, this function
++ * is used to do the bookkeeping work, such as counting the reference of
++ * several Lua states and the initialization of new states if needed. As an
++ * extra initialization step it loads the provided Lua script into the Lua
++ * state.
++ *
++ * Lua state initialization
++ * ~~~~~~~~~~~~~~~~~~~~~~~~
++ * 1. If a new rule is inserted and there is no existing state for the given
++ * state identifier (default state identifier is 0) a new Lua state is
++ * initialized using *lua_open*.
++ * 2. The Lua base library is registered inside the newly initialized state.
++ * Have a look at *lua/lbaselib.c* to see what functions of the Lua base
++ * library are available inside Lua.
++ * 3. The Lua packet library is registered inside the Lua state using the
++ * function *register_lua_packet_lib*. So far this function only registers
++ * the Netfilter verdicts NF_ACCEPT, NF_DROP and XT_CONTINUE inside the
++ * global environment of the given Lua state.
++ * 4. All the protocol Buffers, and the functions for accessing the bytes are
++ * registered using *register_protocols*.
++ *
++ * Lua state reference counting
++ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
++ * Bookkeeping of the Lua states inside the *lua_state_refs* array. The
++ * state identifier is mapped to the array index, which holds an integer
++ * counting the several initialized states.
++ *
++ * Loading the Lua script
++ * ~~~~~~~~~~~~~~~~~~~~~~
++ * Copying the buffer which was initialized by the userspace program to a
++ * buffer with the proper size. The script is then loaded by the function
++ * xt_LUA_loadcode, which wrapps the *luaL_loadbuffer* function and does
++ * some workqueue initialization. So far this is done each time this function
++ * is called, subject to change.
++ */
++static bool
++lua_tg_checkentry(const struct xt_tgchk_param *par)
++{
++ const struct xt_lua_tginfo *info = par->targinfo;
++
++ if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
++ lua_state_refs[info->state_id]++;
++ return true;
++ }
++ return false;
++}
++
++/*::*
++ * lua_tg_destroy
++ * --------------
++ * This function is the counterpart of the `lua_tg_checkentry`_ function. It is
++ * responsible to free all the resources alocated inside the checkentry process.
++ * To be more specific it frees the Lua state using *lua_close* and kfree on all
++ * the dynamically allocated pointers to the registered dynamic protocol buffers.
++ *
++ * Additionally the function cares about decrementing the reference counters
++ * inside the array `lua_states`_.
++ */
++static void
++lua_tg_destroy(const struct xt_tgdtor_param *par)
++{
++ const struct xt_lua_tginfo *info = par->targinfo;
++ struct lua_env * env = lua_envs[info->state_id];
++
++ if (lua_state_refs[info->state_id] == 1) {
++ lua_close(env->L);
++ cleanup_dynamic_prot_bufs(); /* clean memory allocated by protocols defined in Lua */
++ kfree(env);
++ pr_debug("LUA [%d]: Rule removed, close Lua state\n", info->state_id);
++ } else
++ pr_debug("LUA [%d]: Rule removed, Lua state stays open, referenced %d time(s)\n",
++ info->state_id, lua_state_refs[info->state_id] - 1);
++
++ lua_state_refs[info->state_id]--;
++}
++
++static struct xt_target lua_tg_reg __read_mostly = {
++ .name = "LUA",
++ .revision = 0,
++ .family = NFPROTO_UNSPEC,
++ .targetsize = XT_ALIGN(sizeof(struct xt_lua_tginfo)),
++ .target = lua_tg,
++ .checkentry = lua_tg_checkentry,
++ .destroy = lua_tg_destroy,
++ .me = THIS_MODULE,
++};
++
++
++static int32_t lua_tg_init(void)
++{
++ return xt_register_target(&lua_tg_reg);
++}
++
++static void lua_tg_exit(void)
++{
++ xt_unregister_target(&lua_tg_reg);
++}
++
++module_init(lua_tg_init);
++module_exit(lua_tg_exit);
++
++MODULE_AUTHOR("Andre Graf <andre@dergraf.org>");
++MODULE_DESCRIPTION("Xtables: Processing of matched packets using the Lua scripting environment");
++MODULE_ALIAS("ipt_LUA");
++MODULE_ALIAS("ipt6t_LUA");
++MODULE_ALIAS("arpt_LUA");
++MODULE_ALIAS("ebt_LUA");
++MODULE_LICENSE("GPL");
++
++
++
+--- a/extensions/Kbuild
++++ b/extensions/Kbuild
+@@ -27,6 +27,7 @@ obj-${build_pknock} += pknock/
+ obj-${build_psd} += xt_psd.o
+ obj-${build_quota2} += xt_quota2.o
+ obj-${build_rtsp} += rtsp/
++obj-${build_LUA} += LUA/
+
+ -include ${M}/*.Kbuild
+ -include ${M}/Kbuild.*
+--- a/extensions/Mbuild
++++ b/extensions/Mbuild
+@@ -22,3 +22,4 @@ obj-${build_pknock} += pknock/
+ obj-${build_psd} += libxt_psd.so
+ obj-${build_quota2} += libxt_quota2.so
+ obj-${build_gradm} += libxt_gradm.so
++obj-${build_LUA} += LUA/
+--- a/mconfig
++++ b/mconfig
+@@ -23,3 +23,4 @@ build_pknock=m
+ build_psd=m
+ build_quota2=m
+ build_rtsp=m
++build_LUA=m
--- /dev/null
+--- a/extensions/LUA/xt_LUA_target.c
++++ b/extensions/LUA/xt_LUA_target.c
+@@ -19,7 +19,7 @@
+ #include <linux/kernel.h>
+ #include <linux/slab.h>
+ #include <linux/module.h>
+-#include <asm/uaccess.h>
++#include <linux/uaccess.h>
+ #include <net/ip.h>
+ #include <linux/netfilter/x_tables.h>
+ #include "xt_LUA.h"
+@@ -64,10 +64,10 @@ uint32_t lua_state_refs[LUA_STATE_ARRAY
+ * XT_CONTINUE inside the *register_lua_packet_lib* function.
+ */
+
+-spinlock_t lock = SPIN_LOCK_UNLOCKED;
++DEFINE_SPINLOCK(lock);
+
+ static uint32_t
+-lua_tg(struct sk_buff *pskb, const struct xt_target_param *par)
++lua_tg(struct sk_buff *pskb, const struct xt_action_param *par)
+ {
+ uint32_t verdict;
+ lua_packet_segment *p;
+@@ -88,11 +88,11 @@ lua_tg(struct sk_buff *pskb, const struc
+ /* push the lua_packet_segment as a parameter */
+ p = (lua_packet_segment *)lua_newuserdata(L, sizeof(lua_packet_segment));
+ if (pskb->mac_header)
+- p->start = pskb->mac_header;
++ p->start = skb_mac_header(pskb);
+ else if (pskb->network_header)
+- p->start = pskb->network_header;
++ p->start = skb_network_header(pskb);
+ else if (pskb->transport_header)
+- p->start = pskb->transport_header;
++ p->start = skb_transport_header(pskb);
+ p->offset = 0;
+ p->length = (unsigned long)pskb->tail - (unsigned long)p->start;
+ p->changes = NULL;
+@@ -208,16 +208,16 @@ static bool load_script_into_state(uint3
+ * some workqueue initialization. So far this is done each time this function
+ * is called, subject to change.
+ */
+-static bool
++static int
+ lua_tg_checkentry(const struct xt_tgchk_param *par)
+ {
+ const struct xt_lua_tginfo *info = par->targinfo;
+
+ if (load_script_into_state(info->state_id, info->script_size, (char *)info->buf)) {
+ lua_state_refs[info->state_id]++;
+- return true;
++ return 0;
+ }
+- return false;
++ return -EINVAL;
+ }
+
+ /*::*
+--- a/extensions/LUA/lua/llimits.h
++++ b/extensions/LUA/lua/llimits.h
+@@ -8,7 +8,6 @@
+ #define llimits_h
+
+ #include <stddef.h>
+-#include <limits.h>
+
+ #include "lua.h"
+
+--- a/extensions/LUA/lua/lapi.c
++++ b/extensions/LUA/lua/lapi.c
+@@ -4,9 +4,6 @@
+ ** See Copyright Notice in lua.h
+ */
+
+-#include <stdarg.h>
+-#include <math.h>
+-#include <assert.h>
+ #include <string.h>
+
+ #define lapi_c
+--- a/extensions/LUA/lua/ltable.c
++++ b/extensions/LUA/lua/ltable.c
+@@ -18,7 +18,6 @@
+ ** Hence even when the load factor reaches 100%, performance remains good.
+ */
+
+-#include <math.h>
+ #include <string.h>
+
+ #define ltable_c
+--- a/extensions/LUA/lua/luaconf.h
++++ b/extensions/LUA/lua/luaconf.h
+@@ -13,8 +13,12 @@
+ #if !defined(__KERNEL__)
+ #include <limits.h>
+ #else
++#include <linux/kernel.h>
++
++#undef UCHAR_MAX
++#undef BUFSIZ
++#undef NO_FPU
+ #define UCHAR_MAX 255
+-#define SHRT_MAX 32767
+ #define BUFSIZ 8192
+ #define NO_FPU
+ #endif
+@@ -637,6 +641,8 @@ union luai_Cast { double l_d; long l_l;
+ */
+ #if defined(__KERNEL__)
+ #undef LUA_USE_ULONGJMP
++#define setjmp __builtin_setjmp
++#define longjmp __builtin_longjmp
+ #endif
+
+ #if defined(__cplusplus)
+--- a/extensions/LUA/lua/llex.h
++++ b/extensions/LUA/lua/llex.h
+@@ -10,6 +10,8 @@
+ #include "lobject.h"
+ #include "lzio.h"
+
++/* prevent conflict with definition from asm/current.h */
++#undef current
+
+ #define FIRST_RESERVED 257
+
--- /dev/null
+--- a/extensions/libxt_geoip.c
++++ b/extensions/libxt_geoip.c
+@@ -59,13 +59,13 @@ geoip_get_subnets(const char *code, uint
+
+ /* Use simple integer vector files */
+ if (nfproto == NFPROTO_IPV6) {
+-#if __BYTE_ORDER == _BIG_ENDIAN
++#if BYTE_ORDER == BIG_ENDIAN
+ snprintf(buf, sizeof(buf), GEOIP_DB_DIR "/BE/%s.iv6", code);
+ #else
+ snprintf(buf, sizeof(buf), GEOIP_DB_DIR "/LE/%s.iv6", code);
+ #endif
+ } else {
+-#if __BYTE_ORDER == _BIG_ENDIAN
++#if BYTE_ORDER == BIG_ENDIAN
+ snprintf(buf, sizeof(buf), GEOIP_DB_DIR "/BE/%s.iv4", code);
+ #else
+ snprintf(buf, sizeof(buf), GEOIP_DB_DIR "/LE/%s.iv4", code);
include $(TOPDIR)/rules.mk
PKG_NAME:=zerotier
-PKG_VERSION:=1.2.4
+PKG_VERSION:=1.2.8
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/zerotier/ZeroTierOne
-PKG_SOURCE_SUBDIR:=ZeroTierOne-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=fe5257df81c4ec4b5d48f707eb794de0748b7ac0
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=131436529d26f8eb975a0a8705b489cc22a1139c323755895c1776db579003bc
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
+PKG_SOURCE_URL:=https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/$(PKG_VERSION)?
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=08e2df34550d6bb68e106eaac48babb481160046818b0944ec41f1e158548a47
+PKG_BUILD_DIR:=$(BUILD_DIR)/ZeroTierOne-$(PKG_VERSION)
+
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
endif
endef
+# Make binary smaller
+TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
define Package/zerotier/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/zerotier-one $(1)/usr/bin/
config zerotier sample_config
- option enabled 1
- option interface 'wan' # restart ZT when wan status changed
+ option enabled 0
+
+ # persistent configuration folder (for ZT controller mode)
+ #option config_path '/etc/zerotier'
+
#option port '9993'
- option secret 'generate' # generate secret on first start
- list join '8056c2e21c000001' # a public network called Earth
+
+ # Generate secret on first start
+ option secret 'generate'
+
+ # Join a public network called Earth
+ list join '8056c2e21c000001'
USE_PROCD=1
-LIST_SEP="
-"
-ZT_COMMAND=/usr/bin/zerotier-one
+PROG=/usr/bin/zerotier-one
+CONFIG_PATH=/var/lib/zerotier-one
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
start_instance() {
local cfg="$1"
- local port secret interface
+ local port secret config_path
local ARGS=""
- section_enabled "$cfg" || return 1
-
- mkdir -p /var/lib/zerotier-one/networks.d/
+ if ! section_enabled "$cfg"; then
+ echo "disabled in config"
+ return 1
+ fi
+ config_get config_path $cfg 'config_path'
config_get_bool port $cfg 'port'
config_get secret $cfg 'secret'
- config_get interface $cfg 'interface'
+
+ # Remove existing link or folder
+ rm -rf $CONFIG_PATH
+
+ # Create link from CONFIG_PATH to config_path
+ if [ -n "$config_path" -a "$config_path" != $CONFIG_PATH ]; then
+ if [ ! -d "$config_path" ]; then
+ echo "ZeroTier config_path does not exist: $config_path"
+ return
+ fi
+
+ ln -s $config_path $CONFIG_PATH
+ fi
+
+ mkdir -p $CONFIG_PATH/networks.d
if [ -n "$port" ]; then
ARGS="$ARGS -p$port"
if [ "$secret" = "generate" ]; then
echo "Generate secret - please wait..."
- local tmp="/tmp/zt.$cfg.secret"
- zerotier-idtool generate "$tmp" > /dev/null
- secret="$(cat $tmp)"
- rm "$tmp"
+ local sf="/tmp/zt.$cfg.secret"
+
+ zerotier-idtool generate "$sf" > /dev/null
+ [ $? -ne 0 ] && return 1
+
+ secret="$(cat $sf)"
+ rm "$sf"
uci set zerotier.$cfg.secret="$secret"
uci commit zerotier
fi
if [ -n "$secret" ]; then
- echo "$secret" > /var/lib/zerotier-one/identity.secret
- #make sure there is not previous dentity.public
- rm -f /var/lib/zerotier-one/identity.public
+ echo "$secret" > $CONFIG_PATH/identity.secret
+ # make sure there is not previous identity.public
+ rm -f $CONFIG_PATH/identity.public
fi
add_join() {
- #an (empty) config file will cause ZT to join a network
- touch /var/lib/zerotier-one/networks.d/$1.conf
+ # an (empty) config file will cause ZT to join a network
+ touch $CONFIG_PATH/networks.d/$1.conf
}
config_list_foreach $cfg 'join' add_join
procd_open_instance
- procd_add_reload_interface_trigger "$interface"
- procd_set_param command $ZT_COMMAND $ARGS
+ procd_set_param command $PROG $ARGS $CONFIG_PATH
+ procd_set_param stderr 1
procd_close_instance
}
-service_triggers() {
- procd_add_reload_trigger zerotier
-}
-
start_service() {
config_load 'zerotier'
config_foreach start_instance 'zerotier'
}
+
+stop_instance() {
+ local cfg="$1"
+
+ # Remove existing link or folder
+ rm -rf $CONFIG_PATH
+}
+
+stop_service() {
+ config_load 'zerotier'
+ config_foreach stop_instance 'zerotier'
+}
--- /dev/null
+From c578216351a4daa3916265b39b14f7c23ef15c90 Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Mon, 23 Apr 2018 22:12:31 +0200
+Subject: [PATCH 1/4] find miniupnpc.h in staging directory
+
+---
+ make-linux.mk | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/make-linux.mk b/make-linux.mk
+index 2e6a8632..0cd955d1 100644
+--- a/make-linux.mk
++++ b/make-linux.mk
+@@ -22,8 +22,8 @@ ONE_OBJS+=osdep/LinuxEthernetTap.o
+ # otherwise build into binary as done on Mac and Windows.
+ ONE_OBJS+=osdep/PortMapper.o
+ override DEFS+=-DZT_USE_MINIUPNPC
+-MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2..*"' /usr/include/miniupnpc/miniupnpc.h && echo 1)
+-#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
++MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2..*"' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1)
++#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1)
+ ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
+ override DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
+ LDLIBS+=-lminiupnpc
+--
+2.17.0
+
+++ /dev/null
-From 61b69f74fecf3c34c0fd2003897c92790ca5a9f5 Mon Sep 17 00:00:00 2001
-From: Moritz Warning <moritzwarning@web.de>
-Date: Thu, 4 May 2017 22:13:55 +0200
-Subject: [PATCH 1/2] use external libminiupnpc and libnatpmp
-
----
- make-linux.mk | 20 ++++++++++----------
- 1 file changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/make-linux.mk b/make-linux.mk
-index 87d29af..f5b3d8d 100644
---- a/make-linux.mk
-+++ b/make-linux.mk
-@@ -22,20 +22,20 @@ OBJS+=ext/http-parser/http_parser.o
- # otherwise build into binary as done on Mac and Windows.
- OBJS+=osdep/PortMapper.o
- DEFS+=-DZT_USE_MINIUPNPC
--MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
--ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
-+#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
-+#ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
- DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
- LDLIBS+=-lminiupnpc
--else
-- DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
-- OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o
--endif
--ifeq ($(wildcard /usr/include/natpmp.h),)
-- OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
--else
-+#else
-+# DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
-+# OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o
-+#endif
-+#ifeq ($(wildcard /usr/include/natpmp.h),)
-+# OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
-+#else
- LDLIBS+=-lnatpmp
- DEFS+=-DZT_USE_SYSTEM_NATPMP
--endif
-+#endif
-
- ifeq ($(ZT_ENABLE_CLUSTER),1)
- DEFS+=-DZT_ENABLE_CLUSTER
---
-2.1.4
-
+++ /dev/null
-From b8a0598002fd08618d20cd1bbfb03559435241a8 Mon Sep 17 00:00:00 2001
-From: Moritz Warning <moritzwarning@web.de>
-Date: Thu, 4 May 2017 22:35:58 +0200
-Subject: [PATCH 2/2] pin target to linux
-
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 9511862..d5b0dfc 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,6 +1,6 @@
- # Common makefile -- loads make rules for each platform
-
--OSTYPE=$(shell uname -s)
-+OSTYPE=Linux
-
- ifeq ($(OSTYPE),Darwin)
- include make-mac.mk
---
-2.1.4
-
--- /dev/null
+From 7cfe751128d412a9b780ba5e4cb11908fc71cd3d Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Mon, 30 Apr 2018 16:14:30 +0200
+Subject: [PATCH 2/4] remove -pie
+
+fixes relocation "against `a local symbol' can not be used
+when making a shared object; recompile with -fPIC" error
+---
+ make-linux.mk | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/make-linux.mk b/make-linux.mk
+index 0cd955d1..add1d3ae 100644
+--- a/make-linux.mk
++++ b/make-linux.mk
+@@ -71,11 +71,11 @@ ifeq ($(ZT_DEBUG),1)
+ # C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
+ node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
+ else
+- CFLAGS?=-O3 -fstack-protector -fPIE
++ CFLAGS?=-O3 -fstack-protector
+ override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+- CXXFLAGS?=-O3 -fstack-protector -fPIE
++ CXXFLAGS?=-O3 -fstack-protector
+ override CXXFLAGS+=-Wall -Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+- LDFLAGS=-pie -Wl,-z,relro,-z,now
++ LDFLAGS=-Wl,-z,relro,-z,now
+ STRIP?=strip
+ STRIP+=--strip-all
+ endif
+--
+2.17.0
+
+++ /dev/null
-Index: ZeroTierOne-1.2.4/ext/json/json.hpp
-===================================================================
---- ZeroTierOne-1.2.4.orig/ext/json/json.hpp
-+++ ZeroTierOne-1.2.4/ext/json/json.hpp
-@@ -64,7 +64,7 @@ SOFTWARE.
- #endif
- #elif defined(__GNUC__)
- #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-- #if GCC_VERSION < 40900
-+ #if GCC_VERSION < 40800
- #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
- #endif
- #endif
--- /dev/null
+From bfb1a652dbf897dc065d2a1414296eb145a2224b Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Mon, 23 Apr 2018 22:31:03 +0200
+Subject: [PATCH 3/4] remove -march=armv5
+
+---
+ make-linux.mk | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/make-linux.mk b/make-linux.mk
+index add1d3ae..49e14f70 100644
+--- a/make-linux.mk
++++ b/make-linux.mk
+@@ -229,12 +229,12 @@ endif
+ # ARM32 hell -- use conservative CFLAGS
+ ifeq ($(ZT_ARCHITECTURE),3)
+ ifeq ($(shell if [ -e /usr/bin/dpkg ]; then dpkg --print-architecture; fi),armel)
+- override CFLAGS+=-march=armv5 -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
+- override CXXFLAGS+=-march=armv5 -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
++ override CFLAGS+=-mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
++ override CXXFLAGS+=-mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
+ ZT_USE_ARM32_NEON_ASM_CRYPTO=0
+ else
+- override CFLAGS+=-march=armv5 -mno-unaligned-access -marm
+- override CXXFLAGS+=-march=armv5 -mno-unaligned-access -marm
++ override CFLAGS+=-mno-unaligned-access -marm
++ override CXXFLAGS+=-mno-unaligned-access -marm
+ endif
+ endif
+
+--
+2.17.0
+
--- /dev/null
+From a2cf8bf645d25f18cbc2ed7ad4b9a25725811afd Mon Sep 17 00:00:00 2001
+From: Moritz Warning <moritzwarning@web.de>
+Date: Wed, 2 May 2018 16:06:46 +0200
+Subject: [PATCH 4/4] accept external linker flags
+
+---
+ make-linux.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/make-linux.mk b/make-linux.mk
+index 49e14f70..8e766bfb 100644
+--- a/make-linux.mk
++++ b/make-linux.mk
+@@ -75,7 +75,7 @@ else
+ override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+ CXXFLAGS?=-O3 -fstack-protector
+ override CXXFLAGS+=-Wall -Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+- LDFLAGS=-Wl,-z,relro,-z,now
++ LDFLAGS+=-Wl,-z,relro,-z,now
+ STRIP?=strip
+ STRIP+=--strip-all
+ endif
+--
+2.17.0
+
include $(TOPDIR)/rules.mk
PKG_NAME:=znc
-PKG_VERSION:=1.6.5
+PKG_VERSION:=1.6.6
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://znc.in/releases \
- http://znc.in/releases/archive
-PKG_HASH:=2f0225d49c53a01f8d94feea4619a6fe92857792bb3401a4eb1edd65f0342aca
+PKG_SOURCE_URL:=https://znc.in/releases \
+ https://znc.in/releases/archive
+PKG_HASH:=7fb841bc71dc1749b1dc081e9eaf22ceb56ebb03c6b1d8804a4f9eb8bbd59525
PKG_MAINTAINER:=Jonas Gorski <jogo@openwrt.org>
PKG_LICENSE:=Apache-2.0
PKG_USE_MIPS16:=0
PKG_BUILD_PARALLEL:=1
-PKG_CONFIG_DEPENDS := CONFIG_ZNC_ICU
+PKG_CONFIG_DEPENDS:= CONFIG_ZNC_ICU
define Package/znc/default
SUBMENU:=Instant Messaging
SECTION:=net
CATEGORY:=Network
TITLE:=ZNC
- URL:=http://en.znc.in/
+ URL:=https://znc.in/
USERID:=znc:znc
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=fdk-aac
-PKG_VERSION:=0.1.5-20171120
+PKG_VERSION:=0.1.6
PKG_RELEASE:=1
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=Fraunhofer-FDK-AAC-for-Android
PKG_LICENSE_FILES:=NOTICE
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL=https://github.com/mstorsjo/fdk-aac/
-PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=56c717e223a161b11f523de97dae51c5cccd6b52
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_MIRROR_HASH:=c0c035df410697bb753fc06f03bacc0079b4c456a571718b3fabb568c05c41ce
+
+PKG_SOURCE_URL=https://codeload.github.com/mstorsjo/fdk-aac/tar.gz/v$(PKG_VERSION)?
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=adbcd793e406e1b88b3c1c41382d49f8c27371485b823c0fdab69c9124fd2ce3
PKG_FIXUP:=autoreconf
PKG_CONFIG_DEPENDS:= CONFIG_FDK-AAC_OPTIMIZE_SPEED
ifeq ($(CONFIG_FDK-AAC_OPTIMIZE_SPEED),y)
- TARGET_CFLAGS := $(filter-out -Os,$(TARGET_CFLAGS))
+ TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
TARGET_CFLAGS += $(TARGET_CFLAGS) -O2 -flto
- TARGET_CXXFLAGS := $(filter-out -Os,$(TARGET_CXXFLAGS))
+ TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS))
TARGET_CXXFLAGS += $(TARGET_CXXFLAGS) -O2 -flto
TARGET_LDFLAGS += $(TARGET_LDFLAGS) -flto
endif
source "$(SOURCE)/Config.in"
endef
-define Package/fdk-aac/install
+define Package/fdk-aac/install
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/.libs/*.so* $(1)/usr/lib/
endef
endif
ifeq ($(CONFIG_LAME-LIB_OPTIMIZE_SPEED),y)
- TARGET_CFLAGS += $(TARGET_CFLAGS) -O3 -ffast-math
- TARGET_CFLAGS := $(filter-out -Os,$(TARGET_CFLAGS))
+ TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3 -ffast-math
endif
CONFIGURE_ARGS += --disable-gtktest --disable-static
include $(TOPDIR)/rules.mk
PKG_NAME:=mpg123
-PKG_VERSION:=1.25.7
+PKG_VERSION:=1.25.10
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/mpg123
-PKG_HASH:=31b15ebcf26111b874732e07c8e60de5053ee555eea15fb70c657a4f9f0344f3
+PKG_HASH:=6c1337aee2e4bf993299851c70b7db11faec785303cfca3a5c3eb5f329ba7023
PKG_MAINTAINER:=Zoltan HERPAI <wigyori@uid0.hu>
PKG_FIXUP:=libtool
PKG_NAME:=pulseaudio
PKG_VERSION:=11.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://freedesktop.org/software/pulseaudio/releases/
PKG_FIXUP:=autoreconf
PKG_USE_MIPS16:=0
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
PKG_INSTALL = 1
include $(INCLUDE_DIR)/package.mk
define Package/pulseaudio-daemon
$(call Package/pulseaudio/Default)
+ VARIANT:=noavahi
+endef
+
+define Package/pulseaudio-daemon-avahi
+ $(call Package/pulseaudio/Default)
+ DEPENDS+=+dbus +libavahi-client +sbc
+# DEPENDS+=+avahi-daemon
+ TITLE+= (avahi/bluez)
+ VARIANT:=avahi
endef
define Package/pulseaudio/Default/description
$(call Package/pulseaudio/Default/description)
endef
+define Package/pulseaudio-daemon-avahi/description
+ $(call Package/pulseaudio/Default/description)
+ This package enables avahi,bluez and is compiled against dbus, sbc, and avahi.
+endef
+
define Package/pulseaudio-daemon/conffiles
/etc/pulse/client.conf
/etc/pulse/daemon.conf
/etc/pulse/system.pa
endef
+define Package/pulseaudio-daemon-avahi/conffiles
+/etc/pulse/client.conf
+/etc/pulse/daemon.conf
+/etc/pulse/default.pa
+/etc/pulse/system.pa
+endef
+
define Package/pulseaudio-tools
SECTION:=sound
CATEGORY:=Sound
DEPENDS:=+libsndfile +pulseaudio
TITLE:=Tools for Pulseaudio
URL:=http://www.pulseaudio.org
+ VARIANT:=noavahi
endef
define Package/pulseaudio-profiles
endef
CONFIGURE_ARGS += \
+ $(if $(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),--enable-neon-opt,--disable-neon-opt) \
--with-system-user=pulse \
--with-system-group=pulse \
--with-access-group=audio \
--disable-jack \
--disable-asyncns \
--disable-lirc \
- --disable-bluez \
--disable-udev \
--without-fftw \
- --disable-avahi \
- --disable-dbus \
--without-soxr \
--without-speex
+# --disable-bluez
+
+ifeq ($(BUILD_VARIANT),avahi)
+CONFIGURE_ARGS += \
+ --enable-avahi \
+ --enable-dbus
+endif
+
+ifeq ($(BUILD_VARIANT),noavahi)
+CONFIGURE_ARGS += \
+ --disable-avahi \
+ --disable-dbus
+endif
CONFIGURE_VARS += \
PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig"
endef
+define Package/pulseaudio-daemon-avahi/install
+ $(INSTALL_DIR) \
+ $(1)/etc/pulse \
+ $(1)/etc/init.d \
+ $(1)/usr/bin \
+ $(1)/usr/lib \
+ $(1)/usr/lib/pulseaudio \
+ $(1)/usr/lib/pulse-$(PKG_VERSION)/modules \
+ $(1)/etc/dbus-1/system.d
+
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/pulseaudio \
+ $(1)/usr/bin/pulseaudio
+
+ $(INSTALL_BIN) \
+ ./files/pulseaudio.init \
+ $(1)/etc/init.d/pulseaudio
+
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/etc/pulse/* \
+ $(1)/etc/pulse
+
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/*.so* \
+ $(1)/usr/lib/
+
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/pulseaudio/* \
+ $(1)/usr/lib/pulseaudio/
+
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/pulse-$(PKG_VERSION)/modules/lib*.so \
+ $(1)/usr/lib/
+
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/pulse-$(PKG_VERSION)/modules/module*.so \
+ $(1)/usr/lib/pulse-$(PKG_VERSION)/modules/
+
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/pulseaudio-system.conf \
+ $(1)/etc/dbus-1/system.d/pulseaudio-system.conf
+endef
+
define Package/pulseaudio-tools/install
$(INSTALL_DIR) \
$(1)/usr/bin
endef
$(eval $(call BuildPackage,pulseaudio-daemon))
+$(eval $(call BuildPackage,pulseaudio-daemon-avahi))
$(eval $(call BuildPackage,pulseaudio-tools))
$(eval $(call BuildPackage,pulseaudio-profiles))
include $(TOPDIR)/rules.mk
PKG_NAME:=acl
-PKG_REV:=fa5f6835e00c4927cae051328642b2a5a0d8b1c1
-PKG_VERSION:=20170420
+PKG_REV:=c39f7c5475e3e00d8abeb7b30e61958670fb3ee2
+PKG_VERSION:=20180121
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MIRROR_HASH:=4ef33a249eb8715746e7ea914dfab06b5920f0b73635fad60290fe6e532bf535
+PKG_MIRROR_HASH:=0291d931bbac041f14bc12d317e505cd596e0ec6f1b8bcdfa03b9a1fad274ac2
PKG_SOURCE_URL:=https://git.savannah.gnu.org/git/acl.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
include $(TOPDIR)/rules.mk
PKG_NAME:=acpica-unix
-PKG_VERSION:=20171215
+PKG_VERSION:=20180427
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://acpica.org/sites/$(patsubst %-unix,%,$(PKG_NAME))/files/$(PKG_SOURCE_URL)
-PKG_HASH:=1287c3d75c7956680dbb7e90151caef0255797eb29e18dd55588d713ada97d14
+PKG_HASH:=ae01b2d9e06192dca8fec9ccba327f766454e10935f98f608ec7de2690fd0c16
PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
PKG_LICENSE:=GPL-2.0
include $(TOPDIR)/rules.mk
PKG_NAME:=ap51-flash
-PKG_VERSION:=2016-10-16
+PKG_VERSION:=2017-12-07
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=git://dev.cloudtrax.com/ap51-flash.git
+PKG_SOURCE_URL:=https://github.com/ap51-flash/ap51-flash.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=48b3fbac1c30c5968b2608eb09b53ea37c310a24
+PKG_SOURCE_VERSION:=f94f9c99711d14a3c0186318d822d67d9d0ce391
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
-PKG_MIRROR_HASH:=4d00a1ceb480793db95e359cb95d63630920335415c7ffdcd05f2616cf1bc034
+PKG_MIRROR_HASH:=15786a0ecae9be5ed4e8f32940624d1a1c83da924294df08003616a863947074
PKG_MAINTAINER:=Russell Senior <russell@personaltelco.net>
+PKG_LICENSE:=GPL-3.0+
+PKG_LICENSE_FILES:=LICENSES/preferred/GPL-3.0
include $(INCLUDE_DIR)/package.mk
-ifeq ($(CONFIG_BIG_ENDIAN),y)
- STAMP_BUILT:=$(STAMP_BUILT)_big
-endif
-
define Package/ap51-flash
SECTION:=utils
CATEGORY:=Utilities
URL:=http://dev.cloudtrax.com/wiki/ap51-flash-station
endef
-TARGET_EXTRA_CFLAGS:=-DFLASH_FROM_FILE -DNO_LIBPCAP -D_GNU_SOURCE
-ifeq ($(CONFIG_BIG_ENDIAN),y)
- TARGET_EXTRA_CFLAGS:=$(TARGET_EXTRA_CFLAGS) -DUIP_CONF_BYTE_ORDER=1234
-endif
-
# pass optimization flags
MAKE_FLAGS += \
- OFLAGS="$(TARGET_CFLAGS)" \
- EXTRA_CFLAGS="$(TARGET_EXTRA_CFLAGS)" \
REVISION="$(PKG_VERSION)" \
ap51-flash
+++ /dev/null
-Index: ap51-flash-2016-10-16/proto.c
-===================================================================
---- ap51-flash-2016-10-16.orig/proto.c
-+++ ap51-flash-2016-10-16/proto.c
-@@ -29,6 +29,10 @@
- #include "router_redboot.h"
- #include "router_tftp_client.h"
-
-+#ifndef IPPORT_TFTP
-+#define IPPORT_TFTP 69
-+#endif
-+
- #define TFTP_SRC_PORT 13337
- #define REDBOOT_TELNET_SPORT 13337
- #define REDBOOT_TELNET_DPORT 9000
include $(TOPDIR)/rules.mk
PKG_NAME:=auc
-PKG_VERSION:=0.0.8
-PKG_RELEASE=1
+PKG_VERSION:=0.0.9
+PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0
include $(INCLUDE_DIR)/package.mk
CLI client for attended-sysupgrade
endef
+# set to 1 to enable debugging
+DEBUG:=1
+
+EXTRA_CFLAGS += \
+ $(if $(DEBUG),-DAUC_DEBUG=ON)
+
define Package/auc/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/auc $(1)/usr/sbin/
*/
#define _GNU_SOURCE
-#define AUC_VERSION "0.0.8"
+#define AUC_VERSION "0.0.9"
#include <fcntl.h>
#include <dlfcn.h>
#define APIOBJ_CHECK "api/upgrade-check"
#define APIOBJ_REQUEST "api/upgrade-request"
+#define PUBKEY_PATH "/etc/opkg/keys"
+
+#ifdef AUC_DEBUG
+#define DPRINTF(...) if (debug) fprintf(stderr, __VA_ARGS__)
+#else
+#define DPRINTF(...)
+#endif
+
+static const char server_issues[]="https://github.com/aparcar/attendedsysupgrade-server/issues";
+
static char user_agent[80];
static char *serverurl;
static int upgrade_packages;
static int retry, imagebuilder, building, ibready;
static char *board_name = NULL;
static char *target = NULL, *subtarget = NULL;
-static char *distribution = NULL, *version = NULL, *revision = NULL;
+static char *distribution = NULL, *version = NULL;
static int uptodate;
static char *filename = NULL;
+static int rc;
+
+#ifdef AUC_DEBUG
static int debug = 0;
+#endif
/*
* policy for ubus call system board
* see procd/system.c
*/
enum {
- BOARD_KERNEL,
- BOARD_HOSTNAME,
- BOARD_SYSTEM,
- BOARD_MODEL,
BOARD_BOARD_NAME,
BOARD_RELEASE,
__BOARD_MAX,
};
static const struct blobmsg_policy board_policy[__BOARD_MAX] = {
- [BOARD_KERNEL] = { .name = "kernel", .type = BLOBMSG_TYPE_STRING },
- [BOARD_HOSTNAME] = { .name = "hostname", .type = BLOBMSG_TYPE_STRING },
- [BOARD_SYSTEM] = { .name = "system", .type = BLOBMSG_TYPE_STRING },
- [BOARD_MODEL] = { .name = "model", .type = BLOBMSG_TYPE_STRING },
[BOARD_BOARD_NAME] = { .name = "board_name", .type = BLOBMSG_TYPE_STRING },
[BOARD_RELEASE] = { .name = "release", .type = BLOBMSG_TYPE_TABLE },
};
enum {
RELEASE_DISTRIBUTION,
RELEASE_VERSION,
- RELEASE_REVISION,
- RELEASE_CODENAME,
RELEASE_TARGET,
- RELEASE_DESCRIPTION,
__RELEASE_MAX,
};
static const struct blobmsg_policy release_policy[__RELEASE_MAX] = {
[RELEASE_DISTRIBUTION] = { .name = "distribution", .type = BLOBMSG_TYPE_STRING },
[RELEASE_VERSION] = { .name = "version", .type = BLOBMSG_TYPE_STRING },
- [RELEASE_REVISION] = { .name = "revision", .type = BLOBMSG_TYPE_STRING },
- [RELEASE_CODENAME] = { .name = "codename", .type = BLOBMSG_TYPE_STRING },
[RELEASE_TARGET] = { .name = "target", .type = BLOBMSG_TYPE_STRING },
- [RELEASE_DESCRIPTION] = { .name = "description", .type = BLOBMSG_TYPE_STRING },
};
/*
[CHECK_UPGRADES] = { .name = "upgrades", .type = BLOBMSG_TYPE_TABLE },
};
+static const struct blobmsg_policy pkg_upgrades_policy[2] = {
+ { .type = BLOBMSG_TYPE_STRING },
+ { .type = BLOBMSG_TYPE_STRING },
+};
+
/*
* policy for upgrade-request response
* parse download information for the ready image.
static const struct blobmsg_policy image_policy[__IMAGE_MAX] = {
[IMAGE_REQHASH] = { .name = "request_hash", .type = BLOBMSG_TYPE_STRING },
- [IMAGE_FILESIZE] = { .name = "filesize", .type = BLOBMSG_TYPE_INT32 },
[IMAGE_URL] = { .name = "url", .type = BLOBMSG_TYPE_STRING },
- [IMAGE_CHECKSUM] = { .name = "checksum", .type = BLOBMSG_TYPE_STRING },
[IMAGE_FILES] = { .name = "files", .type = BLOBMSG_TYPE_STRING },
[IMAGE_SYSUPGRADE] = { .name = "sysupgrade", .type = BLOBMSG_TYPE_STRING },
};
+/*
+ * policy for HTTP headers received from server
+ */
+enum {
+ H_RANGE,
+ H_LEN,
+ H_IBSTATUS,
+ H_IBQUEUEPOS,
+ H_UNKNOWN_PACKAGE,
+ __H_MAX
+};
+
+static const struct blobmsg_policy policy[__H_MAX] = {
+ [H_RANGE] = { .name = "content-range", .type = BLOBMSG_TYPE_STRING },
+ [H_LEN] = { .name = "content-length", .type = BLOBMSG_TYPE_STRING },
+ [H_IBSTATUS] = { .name = "x-imagebuilder-status", .type = BLOBMSG_TYPE_STRING },
+ [H_IBQUEUEPOS] = { .name = "x-build-queue-position", .type = BLOBMSG_TYPE_STRING },
+ [H_UNKNOWN_PACKAGE] = { .name = "x-unknown-package", .type = BLOBMSG_TYPE_STRING },
+};
+
/*
* load serverurl from UCI
*/
static int load_config() {
- static struct uci_context *uci_ctx;
- static struct uci_package *uci_attendedsysupgrade;
+ struct uci_context *uci_ctx;
+ struct uci_package *uci_attendedsysupgrade;
struct uci_section *uci_s;
uci_ctx = uci_alloc_context();
* rpc-sys packagelist
* append packagelist response to blobbuf given in req->priv
*/
-static void pkglist_cb(struct ubus_request *req, int type, struct blob_attr *msg) {
+static void pkglist_check_cb(struct ubus_request *req, int type, struct blob_attr *msg) {
struct blob_buf *buf = (struct blob_buf *)req->priv;
struct blob_attr *tb[__PACKAGELIST_MAX];
if (!tb[PACKAGELIST_PACKAGES]) {
fprintf(stderr, "No packagelist received\n");
+ rc=-1;
return;
}
blobmsg_add_field(buf, BLOBMSG_TYPE_TABLE, "packages", blobmsg_data(tb[PACKAGELIST_PACKAGES]), blobmsg_data_len(tb[PACKAGELIST_PACKAGES]));
};
+/*
+ * rpc-sys packagelist
+ * append array of package names to blobbuf given in req->priv
+ */
+static void pkglist_req_cb(struct ubus_request *req, int type, struct blob_attr *msg) {
+ struct blob_buf *buf = (struct blob_buf *)req->priv;
+ struct blob_attr *tb[__PACKAGELIST_MAX];
+ struct blob_attr *cur;
+ int rem;
+ void *array;
+
+ blobmsg_parse(packagelist_policy, __PACKAGELIST_MAX, tb, blob_data(msg), blob_len(msg));
+
+ if (!tb[PACKAGELIST_PACKAGES]) {
+ fprintf(stderr, "No packagelist received\n");
+ return;
+ }
+
+ array = blobmsg_open_array(buf, "packages");
+ blobmsg_for_each_attr(cur, tb[PACKAGELIST_PACKAGES], rem)
+ blobmsg_add_string(buf, NULL, blobmsg_name(cur));
+
+ blobmsg_close_array(buf, array);
+};
+
+
/*
* system board
* append append board information to blobbuf given in req->priv
if (!tb[BOARD_BOARD_NAME]) {
fprintf(stderr, "No board name received\n");
+ rc=-1;
return;
}
board_name = strdup(blobmsg_get_string(tb[BOARD_BOARD_NAME]));
if (!tb[BOARD_RELEASE]) {
fprintf(stderr, "No release received\n");
+ rc=-1;
return;
}
if (!rel[RELEASE_TARGET]) {
fprintf(stderr, "No target received\n");
+ rc=-1;
return;
}
distribution = strdup(blobmsg_get_string(rel[RELEASE_DISTRIBUTION]));
version = strdup(blobmsg_get_string(rel[RELEASE_VERSION]));
- revision = strdup(blobmsg_get_string(rel[RELEASE_REVISION]));
blobmsg_add_string(buf, "distro", distribution);
blobmsg_add_string(buf, "target", target);
static void header_done_cb(struct uclient *cl)
{
- enum {
- H_RANGE,
- H_LEN,
- H_IBSTATUS,
- H_IBQUEUEPOS,
- __H_MAX
- };
- static const struct blobmsg_policy policy[__H_MAX] = {
- [H_RANGE] = { .name = "content-range", .type = BLOBMSG_TYPE_STRING },
- [H_LEN] = { .name = "content-length", .type = BLOBMSG_TYPE_STRING },
- [H_IBSTATUS] = { .name = "x-imagebuilder-status", .type = BLOBMSG_TYPE_STRING },
- [H_IBQUEUEPOS] = { .name = "x-build-queue-position", .type = BLOBMSG_TYPE_STRING },
- };
struct blob_attr *tb[__H_MAX];
uint64_t resume_offset = 0, resume_end, resume_size;
char *ibstatus;
return;
}
- if (debug)
- fprintf(stderr, "headers:\n%s\n", blobmsg_format_json_indent(cl->meta, true, 0));
+ DPRINTF("headers:\n%s\n", blobmsg_format_json_indent(cl->meta, true, 0));
blobmsg_parse(policy, __H_MAX, tb, blob_data(cl->meta), blob_len(cl->meta));
switch (cl->status_code) {
case 400:
request_done(cl);
+ rc=-1;
break;
case 412:
- fprintf(stderr, "target not found.\n");
+ fprintf(stderr, "%s target %s/%s (%s) not found. Please report this at %s\n",
+ distribution, target, subtarget, board_name, server_issues);
request_done(cl);
+ rc=-2;
break;
case 413:
fprintf(stderr, "image too big.\n");
+ rc=-1;
request_done(cl);
break;
case 416:
request_done(cl);
break;
case 422:
- fprintf(stderr, "unknown package requested.\n");
+ fprintf(stderr, "unknown package '%s' requested.\n",
+ blobmsg_get_string(tb[H_UNKNOWN_PACKAGE]));
+ rc=-1;
request_done(cl);
break;
case 501:
fprintf(stderr, "ImageBuilder didn't produce sysupgrade file.\n");
+ rc=-2;
request_done(cl);
break;
case 204:
- fprintf(stderr, "system is up to date.\n");
+ fprintf(stdout, "system is up to date.\n");
uptodate=1;
+ request_done(cl);
break;
case 206:
if (!cur_resume) {
retry=1;
} else {
fprintf(stderr, "unrecognized remote imagebuilder status '%s'\n", ibstatus);
+ rc=-2;
}
// fall through
case 200:
}
/**
- * use busybox md5sum (from jow's luci-ng)
+ * use busybox sha256sum to verify sha256sums file
*/
-static char *md5sum(const char *file) {
+static int sha256sum_v(const char *sha256file, const char *msgfile) {
pid_t pid;
int fds[2];
- static char md5[33];
+ int status;
+ FILE *f = fopen(sha256file, "r");
+ char sumline[512] = {};
+ char *fname;
+ unsigned int fnlen;
+ unsigned int cnt = 0;
if (pipe(fds))
- return NULL;
+ return -1;
- switch ((pid = fork()))
- {
+ if (!f)
+ return -1;
+
+
+ pid = fork();
+ switch (pid) {
case -1:
- return NULL;
+ return -1;
case 0:
uloop_done();
- dup2(fds[1], 1);
-
- close(0);
+ dup2(fds[0], 0);
+ close(1);
close(2);
close(fds[0]);
close(fds[1]);
-
- if (execl("/bin/busybox", "/bin/busybox", "md5sum", file, NULL));
- return NULL;
+ if (execl("/bin/busybox", "/bin/busybox", "sha256sum", "-s", "-c", NULL));
+ return -1;
break;
default:
- memset(md5, 0, sizeof(md5));
- read(fds[0], md5, 32);
- waitpid(pid, NULL, 0);
- close(fds[0]);
+ while (fgets(sumline, sizeof(sumline), f)) {
+ fname = &sumline[66];
+ fnlen = strlen(fname);
+ fname[fnlen-1] = '\0';
+ if (!strcmp(fname, msgfile)) {
+ fname[fnlen-1] = '\n';
+ write(fds[1], sumline, strlen(sumline));
+ cnt++;
+ }
+ }
+ fclose(f);
close(fds[1]);
+ waitpid(pid, &status, 0);
+ close(fds[0]);
+
+ if (cnt == 1)
+ return WEXITSTATUS(status);
+ else
+ return -1;
}
- return md5;
+ return -1;
+}
+
+/**
+ * use usign to verify sha256sums.sig
+ */
+static int usign_v(const char *file) {
+ pid_t pid;
+ int status;
+
+ pid = fork();
+ switch (pid) {
+ case -1:
+ return -1;
+
+ case 0:
+ uloop_done();
+
+ if (execl("/usr/bin/usign", "/usr/bin/usign",
+ "-V", "-q", "-P", PUBKEY_PATH, "-m", file, NULL));
+ return -1;
+
+ break;
+
+ default:
+ waitpid(pid, &status, 0);
+ return WEXITSTATUS(status);
+ }
+
+ return -1;
}
static int ask_user(void)
struct blob_attr *tb[2];
int rem;
- static struct blobmsg_policy policy[2] = {
- { .type = BLOBMSG_TYPE_STRING },
- { .type = BLOBMSG_TYPE_STRING },
- };
-
blobmsg_for_each_attr(cur, upgrades, rem) {
- blobmsg_parse_array(policy, ARRAY_SIZE(policy), tb, blobmsg_data(cur), blobmsg_data_len(cur));
+ blobmsg_parse_array(pkg_upgrades_policy, ARRAY_SIZE(policy), tb, blobmsg_data(cur), blobmsg_data_len(cur));
if (!tb[0] || !tb[1])
continue;
/* this main function is too big... todo: split */
int main(int args, char *argv[]) {
- unsigned char argc=1;
- static struct blob_buf checkbuf, reqbuf, imgbuf, upgbuf;
+ static struct blob_buf allpkg, checkbuf, infobuf, reqbuf, imgbuf, upgbuf;
struct ubus_context *ctx = ubus_connect(NULL);
uint32_t id;
- int rc;
- int queuepos, valid, use_get;
+ int valid, use_get;
char url[256];
char *newversion = NULL;
struct blob_attr *tb[__IMAGE_MAX];
struct blob_attr *tbc[__CHECK_MAX];
- unsigned int filesize;
- char *checksum = NULL;
+ char *tmp;
struct stat imgstat;
+ int check_only = 0;
+ int ignore_sig = 0;
+ unsigned char argc = 1;
snprintf(user_agent, sizeof(user_agent), "%s (%s)", argv[0], AUC_VERSION);
fprintf(stdout, "%s\n", user_agent);
!strncmp(argv[argc], "--help", 7)) {
fprintf(stdout, "%s: Attended sysUpgrade CLI client\n", argv[0]);
fprintf(stdout, "Usage: auc [-d] [-h]\n");
+ fprintf(stdout, " -c\tonly check if system is up-to-date\n");
+ fprintf(stdout, " -F\tignore result of signature verification\n");
+#ifdef AUC_DEBUG
fprintf(stdout, " -d\tenable debugging output\n");
+#endif
fprintf(stdout, " -h\toutput help\n");
return 0;
}
+
+#ifdef AUC_DEBUG
if (!strncmp(argv[argc], "-d", 3))
debug = 1;
+#endif
+ if (!strncmp(argv[argc], "-c", 3))
+ check_only = 1;
+
+ if (!strncmp(argv[argc], "-F", 3))
+ ignore_sig = 1;
+
argc++;
};
}
blobmsg_buf_init(&checkbuf);
+ blobmsg_buf_init(&infobuf);
blobmsg_buf_init(&reqbuf);
blobmsg_buf_init(&imgbuf);
- blobmsg_buf_init(&upgbuf);
+ /* ubus requires BLOBMSG_TYPE_UNSPEC */
+ blob_buf_init(&allpkg, 0);
+ blob_buf_init(&upgbuf, 0);
if (ubus_lookup_id(ctx, "system", &id) ||
ubus_invoke(ctx, id, "board", NULL, board_cb, &checkbuf, 3000)) {
goto freebufs;
}
+ if (rc)
+ goto freebufs;
+
+ blobmsg_add_u8(&allpkg, "all", 1);
+ blobmsg_add_string(&allpkg, "dummy", "foo");
if (ubus_lookup_id(ctx, "rpc-sys", &id) ||
- ubus_invoke(ctx, id, "packagelist", NULL, pkglist_cb, &checkbuf, 3000)) {
+ ubus_invoke(ctx, id, "packagelist", allpkg.head, pkglist_check_cb, &checkbuf, 3000)) {
fprintf(stderr, "cannot request packagelist from rpcd\n");
rc=-1;
goto freeboard;
}
+ if (rc)
+ goto freeboard;
+
blobmsg_add_u32(&checkbuf, "upgrade_packages", upgrade_packages);
- fprintf(stdout, "running %s %s %s on %s/%s (%s)\n", distribution,
- version, revision, target, subtarget, board_name);
+ fprintf(stdout, "running %s %s on %s/%s (%s)\n", distribution,
+ version, target, subtarget, board_name);
fprintf(stdout, "checking %s for release upgrade%s\n", serverurl,
upgrade_packages?" or updated packages":"");
- blobmsg_add_string(&reqbuf, "distro", distribution);
- blobmsg_add_string(&reqbuf, "target", target);
- blobmsg_add_string(&reqbuf, "subtarget", subtarget);
- blobmsg_add_string(&reqbuf, "board", board_name);
snprintf(url, sizeof(url), "%s/%s", serverurl, APIOBJ_CHECK);
uptodate=0;
do {
retry=0;
- if (debug)
- fprintf(stderr, "requesting:\n%s\n", blobmsg_format_json_indent(checkbuf.head, true, 0));
- if (server_request(url, &checkbuf, &reqbuf)) {
+ DPRINTF("requesting:\n%s\n", blobmsg_format_json_indent(checkbuf.head, true, 0));
+ if (server_request(url, &checkbuf, &infobuf)) {
fprintf(stderr, "failed to connect to server\n");
rc=-1;
goto freeboard;
sleep(3);
} while(retry);
- if (debug)
- fprintf(stderr, "reply:\n%s\n", blobmsg_format_json_indent(reqbuf.head, true, 0));
+ DPRINTF("reply:\n%s\n", blobmsg_format_json_indent(infobuf.head, true, 0));
- blobmsg_parse(check_policy, __CHECK_MAX, tbc, blob_data(reqbuf.head), blob_len(reqbuf.head));
+ blobmsg_parse(check_policy, __CHECK_MAX, tbc, blob_data(infobuf.head), blob_len(infobuf.head));
if (!tbc[CHECK_VERSION] && !tbc[CHECK_UPGRADES]) {
- if (!uptodate) {
+ if (uptodate) {
+ rc=0;
+ } else if (!rc) {
fprintf(stderr, "server reply invalid.\n");
- rc=-1;
- goto freeboard;
+ rc=-2;
}
- rc=0;
goto freeboard;
}
+
if (tbc[CHECK_VERSION]) {
newversion = blobmsg_get_string(tbc[CHECK_VERSION]);
fprintf(stdout, "new %s release %s found.\n", distribution, newversion);
} else {
+ newversion = version;
fprintf(stdout, "staying on %s release version %s\n", distribution, version);
- blobmsg_add_string(&reqbuf, "version", version);
};
+ blobmsg_add_string(&reqbuf, "version", newversion);
+
if (tbc[CHECK_UPGRADES]) {
fprintf(stdout, "package updates:\n");
print_package_updates(tbc[CHECK_UPGRADES]);
}
+ if (check_only) {
+ rc=1;
+ goto freeboard;
+ };
+
rc = ask_user();
if (rc)
goto freeboard;
+ blobmsg_add_string(&reqbuf, "distro", distribution);
+ blobmsg_add_string(&reqbuf, "target", target);
+ blobmsg_add_string(&reqbuf, "subtarget", subtarget);
+ blobmsg_add_string(&reqbuf, "board", board_name);
+
+ blob_buf_init(&allpkg, 0);
+ blobmsg_add_u8(&allpkg, "all", 0);
+ blobmsg_add_string(&allpkg, "dummy", "foo");
+ if (ubus_invoke(ctx, id, "packagelist", allpkg.head, pkglist_req_cb, &reqbuf, 3000)) {
+ fprintf(stderr, "cannot request packagelist from rpcd\n");
+ rc=-1;
+ goto freeboard;
+ }
+
snprintf(url, sizeof(url), "%s/%s", serverurl, APIOBJ_REQUEST);
imagebuilder = 0;
do {
retry = 0;
- if (debug && !use_get)
- fprintf(stderr, "requesting:\n%s\n", blobmsg_format_json_indent(reqbuf.head, true, 0));
+ DPRINTF("requesting:\n%s\n", use_get?"":blobmsg_format_json_indent(reqbuf.head, true, 0));
server_request(url, use_get?NULL:&reqbuf, &imgbuf);
blobmsg_parse(image_policy, __IMAGE_MAX, tb, blob_data(imgbuf.head), blob_len(imgbuf.head));
snprintf(url, sizeof(url), "%s/%s/%s", serverurl,
APIOBJ_REQUEST,
blobmsg_get_string(tb[IMAGE_REQHASH]));
- if (debug)
- fprintf(stderr, "polling via GET %s\n", url);
-
+ DPRINTF("polling via GET %s\n", url);
retry=1;
use_get=1;
}
blobmsg_buf_init(&imgbuf);
sleep(3);
}
- } while(retry || queuepos);
+ } while(retry);
- if (debug)
- fprintf(stderr, "reply:\n%s\n", blobmsg_format_json_indent(imgbuf.head, true, 0));
+ DPRINTF("reply:\n%s\n", blobmsg_format_json_indent(imgbuf.head, true, 0));
if (!tb[IMAGE_SYSUPGRADE]) {
- fprintf(stderr, "no sysupgrade image returned\n");
- rc=-1;
+ if (!rc) {
+ fprintf(stderr, "no sysupgrade image returned\n");
+ rc=-1;
+ }
goto freeboard;
}
+
strncpy(url, blobmsg_get_string(tb[IMAGE_SYSUPGRADE]), sizeof(url));
- if (!tb[IMAGE_FILESIZE]) {
- fprintf(stderr, "no image size returned\n");
+ server_request(url, NULL, NULL);
+
+ filename = uclient_get_url_filename(url, "firmware.bin");
+
+ if (stat(filename, &imgstat)) {
+ fprintf(stderr, "image download failed\n");
rc=-1;
goto freeboard;
}
- filesize = blobmsg_get_u32(tb[IMAGE_FILESIZE]);
- if (!tb[IMAGE_CHECKSUM]) {
- fprintf(stderr, "no image checksum returned\n");
+ if ((intmax_t)imgstat.st_size != out_len) {
+ fprintf(stderr, "file size mismatch\n");
+ unlink(filename);
rc=-1;
goto freeboard;
}
- checksum = blobmsg_get_string(tb[IMAGE_CHECKSUM]);
+
+ tmp=strrchr(url, '/');
+
+ strcpy(tmp, "/sha256sums");
server_request(url, NULL, NULL);
-/* usign signature is not yet implemented! */
-// strncat(url, ".sig", sizeof(url));
-// server_request(url, NULL, NULL);
- filename = uclient_get_url_filename(url, "firmware.bin");
- if (stat(filename, &imgstat)) {
- fprintf(stderr, "image download failed\n");
+ if (stat("sha256sums", &imgstat)) {
+ fprintf(stderr, "sha256sums download failed\n");
rc=-1;
goto freeboard;
}
- if ((intmax_t)imgstat.st_size != filesize) {
- fprintf(stderr, "file size mismatch\n");
- unlink(filename);
+ if ((intmax_t)imgstat.st_size != out_len) {
+ fprintf(stderr, "sha256sums download incomplete\n");
+ unlink("sha256sums");
rc=-1;
goto freeboard;
}
- if (strncmp(checksum, md5sum(filename), 33)) {
- fprintf(stderr, "image checksum mismatch\n");
+ if (out_len < 68) {
+ fprintf(stderr, "sha256sums size mismatch\n");
+ unlink("sha256sums");
+ rc=-1;
+ goto freeboard;
+ }
+
+ if (sha256sum_v("sha256sums", filename)) {
+ fprintf(stderr, "checksum verification failed\n");
unlink(filename);
+ unlink("sha256sums");
rc=-1;
goto freeboard;
+ }
+
+ strcpy(tmp, "/sha256sums.sig");
+ server_request(url, NULL, NULL);
+
+ if (stat("sha256sums.sig", &imgstat)) {
+ fprintf(stderr, "sha256sums.sig download failed\n");
+ rc=-1;
+ goto freeboard;
+ }
+
+ if ((intmax_t)imgstat.st_size != out_len) {
+ fprintf(stderr, "sha256sums.sig download incomplete\n");
+ unlink("sha256sums.sig");
+ rc=-1;
+ goto freeboard;
+ }
+
+ if (out_len < 16) {
+ fprintf(stderr, "sha256sums.sig size mismatch\n");
+ unlink("sha256sums.sig");
+ rc=-1;
+ goto freeboard;
+ }
+
+ if (usign_v("sha256sums")) {
+ fprintf(stderr, "signature verification failed\n");
+ if (!ignore_sig) {
+ unlink(filename);
+ unlink("sha256sums");
+ unlink("sha256sums.sig");
+ rc=-1;
+ goto freeboard;
+ }
};
if (strcmp(filename, "firmware.bin")) {
/* subtarget is a pointer within target, don't free */
free(distribution);
free(version);
- free(revision);
freebufs:
blob_buf_free(&checkbuf);
+ blob_buf_free(&infobuf);
blob_buf_free(&reqbuf);
blob_buf_free(&imgbuf);
blob_buf_free(&upgbuf);
--- /dev/null
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bmx7-dnsupdate
+PKG_VERSION:=0.1
+PKG_RELEASE:=2
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bmx7-dnsupdate
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=bmx7-dnsupdate
+ MAINTAINER:=Paul Spooren <spooren@informatik.uni-leipzig.de>
+ DEPENDS:=+bmx7 +bmx7-json inotifywait jshn
+endef
+
+define Build/Compile
+endef
+
+define Build/Configure
+endef
+
+define Package/bmx7-dnsupdate/install
+ $(CP) files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,bmx7-dnsupdate))
--- /dev/null
+#!/bin/sh /etc/rc.common
+START=92
+USE_PROCD=1
+
+BIN=/usr/bin/bmx7-dnsupdate
+
+start_service() {
+ procd_open_instance "bmx7-dnsupdate"
+ procd_set_param command "$BIN"
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_set_param respawn
+ procd_close_instance
+}
--- /dev/null
+#!/bin/sh
+
+. /usr/share/libubox/jshn.sh
+
+while true; do
+ json_load "$(bmx7 -c jshow=originators)"
+ json_select "originators"
+ idx="1"
+
+ # clean all bmx7 dns entries
+ > /tmp/hosts/bmx7
+
+ while json_get_type Type "$idx" && [ "$Type" == object ]; do
+ json_select "$idx"
+ json_get_var shortId shortId
+ json_get_var name name
+ json_get_var primaryIp primaryIp
+ printf "$primaryIp $name\n$primaryIp $shortId\n" >> /tmp/hosts/bmx7
+ json_select ..
+ $((idx++)) 2> /dev/null
+ done
+
+ # reload dnsmasq to apply changes
+ logger -t bmx7-dnsupdate "dnsmasq updated due to new hosts"
+ killall -HUP dnsmasq
+
+ # block until originators changes
+ inotifywait -e create -e delete -q /var/run/bmx7/json/originators/ || sleep 10
+done
include $(TOPDIR)/rules.mk
PKG_NAME:=btrfs-progs
-PKG_VERSION:=4.14
+PKG_VERSION:=4.15.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/kernel/people/kdave/btrfs-progs/
-PKG_HASH:=09095cbc3bc2b6aa9d09c93146fb4d7437c51d2572f6918b74fe990fcdcb91af
+PKG_HASH:=67102ac0d6795f368acc94efaca29b6626d972638790a4a0c9f89a27cd543f96
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION)
EXTRA_CFLAGS=$(TARGET_CPPFLAGS)
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/include/* \
+ $(1)/usr/include/
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/libbtrfs.{a,so*} \
+ $(1)/usr/lib/
+endef
+
define Package/btrfs-progs/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libbtrfs.so* $(1)/usr/lib
include $(TOPDIR)/rules.mk
PKG_NAME:=ccid
-PKG_VERSION:=1.4.28
+PKG_VERSION:=1.4.29
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=https://alioth.debian.org/frs/download.php/file/4230
-PKG_HASH:=875836ac5d9d952b40dc1a253a726e74361671864d81337285a3260268f8ade0
+PKG_SOURCE_URL:=https://ccid.apdu.fr/files/
+PKG_HASH:=a5432ae845730493c04e59304b5c0c6103cd0e2c8827df57d69469a3eaaab84d
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=LGPL-2.1+
PKG_LICENSE_FILES:=COPYING
CATEGORY:=Libraries
DEPENDS:=+libusb-1.0 +libpcsclite
TITLE:=Generic USB CCID smart card reader driver
- URL:=http://pcsclite.alioth.debian.org/ccid.html
+ URL:=https://ccid.apdu.fr/
endef
define Package/ccid/description
PKG_NAME:=collectd
PKG_VERSION:=5.8.0
-PKG_RELEASE:=1
+PKG_RELEASE:=5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://collectd.org/files/ \
memcached \
mic \
monitorus \
- mqtt \
multimeter \
netapp \
nfs \
match_value \
memory \
modbus \
+ mqtt \
mysql \
netlink \
network \
and provides mechanismns to store the values in a variety of ways.
endef
+define Package/collectd/config
+ config PACKAGE_COLLECTD_ENCRYPTED_NETWORK
+ bool "Enable ability to use encrypted networking"
+ default n
+ depends on PACKAGE_collectd
+ select PACKAGE_collectd-mod-network
+endef
+
ifneq ($(CONFIG_avr32),)
TARGET_CFLAGS += -fsigned-char
endif
--enable-daemon \
--with-nan-emulation \
--with-libyajl=no \
- --without-libgcrypt \
--without-perl-bindings \
--without-libudev
LDFLAGS="$$$$LDFLAGS -lm -lz" \
KERNEL_DIR="$(LINUX_DIR)" \
+ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
+CONFIGURE_ARGS+= \
+ --with-libgcrypt=$(STAGING_DIR)/usr
+CONFIGURE_VARS+= \
+ GCRYPT_LIBS="-lgcrypt"
+else
+CONFIGURE_ARGS+= \
+ --without-libgcrypt
+endif
+
CONFIGURE_PLUGIN= \
$(foreach m, $(1), \
$(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
$(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
$(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
$(eval $(call BuildPlugin,match-value,value match,match_value,))
-#$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
+$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
$(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
$(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
+$(eval $(call BuildPlugin,mqtt,transmit data with MQTT,mqtt,+PACKAGE_collectd-mod-mqtt:libmosquitto))
$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
-$(eval $(call BuildPlugin,network,network input/output,network,))
+$(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt))
$(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
$(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
$(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
--- /dev/null
+From 6028f89df95b12219d735b277863f83e9f5ee9e9 Mon Sep 17 00:00:00 2001
+From: PJ Bostley <pbostley@gmail.com>
+Date: Sat, 20 Jan 2018 16:39:36 -0700
+Subject: [PATCH 1/2] Adding support for CDAB endian 32-bit modbus polls
+
+---
+ src/modbus.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 56 insertions(+), 5 deletions(-)
+
+diff --git a/src/modbus.c b/src/modbus.c
+index 31f0c2da81..daa3c028f5 100644
+--- a/src/modbus.c
++++ b/src/modbus.c
+@@ -76,9 +76,13 @@
+ enum mb_register_type_e /* {{{ */
+ { REG_TYPE_INT16,
+ REG_TYPE_INT32,
++ REG_TYPE_INT32_CDAB,
+ REG_TYPE_UINT16,
+ REG_TYPE_UINT32,
+- REG_TYPE_FLOAT }; /* }}} */
++ REG_TYPE_UINT32_CDAB,
++ REG_TYPE_FLOAT,
++ REG_TYPE_FLOAT_CDAB }; /* }}} */
++
+ enum mb_mreg_type_e /* {{{ */
+ { MREG_HOLDING,
+ MREG_INPUT }; /* }}} */
+@@ -425,7 +429,9 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+
+ if ((ds->ds[0].type != DS_TYPE_GAUGE) &&
+ (data->register_type != REG_TYPE_INT32) &&
+- (data->register_type != REG_TYPE_UINT32)) {
++ (data->register_type != REG_TYPE_INT32_CDAB) &&
++ (data->register_type != REG_TYPE_UINT32) &&
++ (data->register_type != REG_TYPE_UINT32_CDAB)) {
+ NOTICE(
+ "Modbus plugin: The data source of type \"%s\" is %s, not gauge. "
+ "This will most likely result in problems, because the register type "
+@@ -434,8 +440,11 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+ }
+
+ if ((data->register_type == REG_TYPE_INT32) ||
++ (data->register_type == REG_TYPE_INT32_CDAB) ||
+ (data->register_type == REG_TYPE_UINT32) ||
+- (data->register_type == REG_TYPE_FLOAT))
++ (data->register_type == REG_TYPE_UINT32_CDAB) ||
++ (data->register_type == REG_TYPE_FLOAT) ||
++ (data->register_type == REG_TYPE_FLOAT_CDAB))
+ values_num = 2;
+ else
+ values_num = 1;
+@@ -496,8 +505,8 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+ }
+ if (status != values_num) {
+ ERROR("Modbus plugin: modbus read function (%s/%s) failed. "
+- " status = %i, values_num = %i. Giving up.",
+- host->host, host->node, status, values_num);
++ " status = %i, start_addr = %i, values_num = %i. Giving up.",
++ host->host, host->node, status, data->register_base, values_num);
+ #if LEGACY_LIBMODBUS
+ modbus_close(&host->connection);
+ #else
+@@ -521,6 +530,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+ "Returned float value is %g",
+ (double)float_value);
+
++ CAST_TO_VALUE_T(ds, vt, float_value);
++ mb_submit(host, slave, data, vt);
++ } else if (data->register_type == REG_TYPE_FLOAT_CDAB) {
++ float float_value;
++ value_t vt;
++
++ float_value = mb_register_to_float(values[1], values[0]);
++ DEBUG("Modbus plugin: mb_read_data: "
++ "Returned float value is %g",
++ (double)float_value);
++
+ CAST_TO_VALUE_T(ds, vt, float_value);
+ mb_submit(host, slave, data, vt);
+ } else if (data->register_type == REG_TYPE_INT32) {
+@@ -535,6 +555,20 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+ "Returned int32 value is %" PRIi32,
+ v.i32);
+
++ CAST_TO_VALUE_T(ds, vt, v.i32);
++ mb_submit(host, slave, data, vt);
++ } else if (data->register_type == REG_TYPE_INT32_CDAB) {
++ union {
++ uint32_t u32;
++ int32_t i32;
++ } v;
++ value_t vt;
++
++ v.u32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]);
++ DEBUG("Modbus plugin: mb_read_data: "
++ "Returned int32 value is %" PRIi32,
++ v.i32);
++
+ CAST_TO_VALUE_T(ds, vt, v.i32);
+ mb_submit(host, slave, data, vt);
+ } else if (data->register_type == REG_TYPE_INT16) {
+@@ -561,6 +595,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
+ "Returned uint32 value is %" PRIu32,
+ v32);
+
++ CAST_TO_VALUE_T(ds, vt, v32);
++ mb_submit(host, slave, data, vt);
++ } else if (data->register_type == REG_TYPE_UINT32_CDAB) {
++ uint32_t v32;
++ value_t vt;
++
++ v32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]);
++ DEBUG("Modbus plugin: mb_read_data: "
++ "Returned uint32 value is %" PRIu32,
++ v32);
++
+ CAST_TO_VALUE_T(ds, vt, v32);
+ mb_submit(host, slave, data, vt);
+ } else /* if (data->register_type == REG_TYPE_UINT16) */
+@@ -702,12 +747,18 @@ static int mb_config_add_data(oconfig_item_t *ci) /* {{{ */
+ data.register_type = REG_TYPE_INT16;
+ else if (strcasecmp("Int32", tmp) == 0)
+ data.register_type = REG_TYPE_INT32;
++ else if (strcasecmp("Int32LE", tmp) == 0)
++ data.register_type = REG_TYPE_INT32_CDAB;
+ else if (strcasecmp("Uint16", tmp) == 0)
+ data.register_type = REG_TYPE_UINT16;
+ else if (strcasecmp("Uint32", tmp) == 0)
+ data.register_type = REG_TYPE_UINT32;
++ else if (strcasecmp("Uint32LE", tmp) == 0)
++ data.register_type = REG_TYPE_UINT32_CDAB;
+ else if (strcasecmp("Float", tmp) == 0)
+ data.register_type = REG_TYPE_FLOAT;
++ else if (strcasecmp("FloatLE", tmp) == 0)
++ data.register_type = REG_TYPE_FLOAT_CDAB;
+ else {
+ ERROR("Modbus plugin: The register type \"%s\" is unknown.", tmp);
+ status = -1;
+
+From 67afd2685892e69ababb489f48b9033ab5908f4d Mon Sep 17 00:00:00 2001
+From: PJ Bostley <pbostley@gmail.com>
+Date: Tue, 23 Jan 2018 15:33:23 -0700
+Subject: [PATCH 2/2] Adding documentation for the Modbus little endian modes
+ where 32 bit values have thier registers swapped
+
+---
+ src/collectd.conf.pod | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
+index dfd785a2c8..e9715126e6 100644
+--- a/src/collectd.conf.pod
++++ b/src/collectd.conf.pod
+@@ -4128,11 +4128,19 @@ Configures the base register to read from the device. If the option
+ B<RegisterType> has been set to B<Uint32> or B<Float>, this and the next
+ register will be read (the register number is increased by one).
+
+-=item B<RegisterType> B<Int16>|B<Int32>|B<Uint16>|B<Uint32>|B<Float>
+-
+-Specifies what kind of data is returned by the device. If the type is B<Int32>,
+-B<Uint32> or B<Float>, two 16E<nbsp>bit registers will be read and the data is
+-combined into one value. Defaults to B<Uint16>.
++=item B<RegisterType> B<Int16>|B<Int32>|B<Uint16>|B<Uint32>|B<Float>|B<Int32LE>|B<Uint32LE>|B<FloatLE>
++
++Specifies what kind of data is returned by the device. This defaults to
++B<Uint16>. If the type is B<Int32>, B<Int32LE>, B<Uint32>, B<Uint32LE>,
++B<Float> or B<FloatLE>, two 16E<nbsp>bit registers at B<RegisterBase>
++and B<RegisterBase+1> will be read and the data is combined into one
++32E<nbsp>value. For B<Int32>, B<Uint32> and B<Float> the most significant
++16E<nbsp>bits are in the register at B<RegisterBase> and the least
++significant 16E<nbsp>bits are in the register at B<RegisterBase+1>.
++For B<Int32LE>, B<Uint32LE>, or B<Float32LE>, the high and low order
++registers are swapped with the most significant 16E<nbsp>bits in
++the B<RegisterBase+1> and the least significant 16E<nbsp>bits in
++B<RegisterBase>.
+
+ =item B<RegisterCmd> B<ReadHolding>|B<ReadInput>
+
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=cryptodev-linux
-PKG_VERSION:=1.9.git-2017-05-29
+PKG_VERSION:=1.9.git-2017-10-04
PKG_RELEASE:=1
PKG_SOURCE_URL:=https://github.com/cryptodev-linux/cryptodev-linux
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=a705360197260d28535746ae98c461ba2cfb7a9e
-PKG_MIRROR_HASH:=334a8f4df18e36e97459b4c6669c9873c13c4f5dae25243cf41ff70c2ce661d8
+PKG_SOURCE_VERSION:=0a54e38b264d9a3bed74c642a61b88191660d0f8
+PKG_MIRROR_HASH:=af3c303afe7ff995b120add6101261a652a6478a2a69018dd740f49a8b14ed09
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/$(PKG_VERSION)/
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_VERSION)
PKG_HASH:=1db4d36b1aedab2adc976e8faa5495df3cf82dc4bf883633dc6ba71f7c4af995
PKG_MAINTAINER:=Stefan Hellermann <stefan@the2masters.de>
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=@SF/$(PKG_NAME)/files/
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MAINTAINER:=Bruno Randolf <br1@einfach.org>
PKG_HASH:=36428c6a6cb3088cad5a3592933385253da5f29f2effa61518ee5991ea38f833
PKG_LICENSE:=GPL-2.0+
PKG_NAME:=gammu
PKG_VERSION:=1.38.4
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE_URL:=http://dl.cihar.com/gammu/releases/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
URL:=http://dl.cihar.com/gammu/releases/
DEPENDS:=+libpthread +libcurl +glib2 $(ICONV_DEPENDS) $(INTL_DEPENDS)
DEPENDS+=+PACKAGE_python:python +PACKAGE_bluez-libs:bluez-libs
- DEPENDS+=+PACKAGE_libmysqlclient:libmysqlclient +PACKAGE_unixodbc:unixodbc +PACKAGE_libpq:libpq
+ DEPENDS+=+PACKAGE_libmariadbclient:libmariadbclient +PACKAGE_unixodbc:unixodbc +PACKAGE_libpq:libpq
DEPENDS+=+PACKAGE_libusb-1.0:libusb-1.0
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=gpsd
-PKG_VERSION:=3.16
+PKG_VERSION:=3.17
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME)
-PKG_HASH:=03579af13a4d3fe0c5b79fa44b5f75c9f3cac6749357f1d99ce5d38c09bc2029
+PKG_HASH:=68e0dbecfb5831997f8b3d6ba48aed812eb465d8c0089420ab68f9ce4d85e77a
PKG_MAINTAINER:=Pushpal Sidhu <psidhu.devel@gmail.com>
PKG_LICENSE:=BSD-3-Clause
===================================================================
--- gpsd-3.16.orig/SConstruct
+++ gpsd-3.16/SConstruct
-@@ -543,6 +543,10 @@ else:
- ncurseslibs = pkg_config('ncurses')
- if config.CheckPKG('tinfo'):
- ncurseslibs += pkg_config('tinfo')
+@@ -672,6 +672,10 @@ else:
+ ncurseslibs += pkg_config('tinfo', rpath_hack=True)
+ # It's not yet known whether rpath_hack is appropriate for
+ # ncurses5-config.
+ elif WhereIs('ncurses6-config'):
+ ncurseslibs = ['!ncurses6-config --libs --cflags']
+ elif WhereIs('ncursesw6-config'):
PKG_NAME:=haveged
PKG_VERSION:=1.9.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/haveged \
PKG_MAINTAINER:=Hannu Nyman <hannu.nyman@iki.fi>
PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-$(call include_mk, python3-package.mk)
+include ../../lang/python/python-package.mk
+include ../../lang/python/python3-package.mk
define Package/i2c/Default
URL:=http://lm-sensors.org/wiki/I2CTools
--- /dev/null
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=inotify-tools
+PKG_VERSION:=3.14
+PKG_HASH:=222bcca8893d7bf8a1ce207fb39ceead5233b5015623d099392e95197676c92f
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://github.com/downloads/rvoicilas/inotify-tools/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/inotify-tools/Default
+ URL:=https://github.com/rvoicilas/inotify-tools/wiki
+endef
+
+define Package/libinotifytools
+ $(call Package/inotify-tools/Default)
+ SECTION:=libs
+ CATEGORY:=Libraries
+ TITLE=libinotifytools
+endef
+
+define Package/inotifywait
+ $(call Package/inotify-tools/Default)
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=+libinotifytools
+ TITLE=inotifywait tool
+endef
+
+define Package/inotifywatch
+ $(call Package/inotify-tools/Default)
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=+libinotifytools
+ TITLE=inotifywatch tool
+endef
+
+define Package/inotify-tools/description
+inotify-tools is a C library and a set of command-line programs for
+Linux providing a simple interface to inotify. These programs can be
+used to monitor and act upon filesystem events. A more detailed
+description of the programs is further down the page. The programs are
+written in C and have no dependencies other than a Linux kernel
+supporting inotify.
+endef
+
+define Package/inotifywait/description
+ $(call Package/inotify-tools/description)
+
+ This package provides the inotifywait tool.
+endef
+
+define Package/inotifywatch/description
+ $(call Package/inotify-tools/description)
+
+ This package provides the inotifywatch tool.
+endef
+
+define Package/libinotifytools/description
+ $(call Package/inotify-tools/description)
+
+ This package provides the libinotifytools shared library.
+endef
+
+define Package/inotifywait/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywait $(1)/usr/bin/
+endef
+
+define Package/inotifywatch/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywatch $(1)/usr/bin/
+endef
+
+define Package/libinotifytools/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+endef
+
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/include/inotifytools
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/inotifytools/* $(1)/usr/include/inotifytools/
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a,la} $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libinotifytools))
+$(eval $(call BuildPackage,inotifywait))
+$(eval $(call BuildPackage,inotifywatch))
PKG_NAME:=lm-sensors
PKG_VERSION:=3.3.5
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/groeck/lm-sensors.git
define Package/lm-sensors/conffiles
/etc/sensors.conf
+/etc/sensors3.conf
endef
define Build/Compile
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) ./files/sensors.conf $(1)/etc/sensors.conf
endif
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/lm-sensors.init $(1)/etc/init.d/lm-sensors
endef
define Package/lm-sensors-detect/install
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2017 Philip Prindeville, Redfish Solutions LLC
+
+START=28
+STOP=
+
+PROG=/usr/sbin/sensors
+
+start() {
+ [ -f /etc/sensors.conf -o -f /etc/sensors3.conf ] || return
+
+ $PROG -s
+}
+
--- /dev/null
+#
+# Copyright (C) 2018 Sebastian Kemper <sebastian_ml@gmx.net>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=mariadb
+PKG_VERSION:=10.1.32
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://downloads.mariadb.org/interstitial/$(PKG_NAME)-$(PKG_VERSION)/source
+
+PKG_HASH:=0e2aae6a6a190d07c8e36e87dd43377057fa82651ca3c583462563f3e9369096
+PKG_MAINTAINER:=Sebastian Kemper <sebastian_ml@gmx.net>
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+HOST_BUILD_PARALLEL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+HOST_BUILD_DEPENDS:=libxml2/host
+# Without libevent2 tests/async_queries sporadically fails on the bots
+PKG_BUILD_DEPENDS:=libevent2 mariadb/host
+
+CMAKE_INSTALL:=1
+
+PLUGIN_DIR:=/usr/lib/mysql/plugin
+
+MARIADB_COMMON_DEPENDS := \
+ +libatomic \
+ +libopenssl \
+ +libstdcpp \
+ +zlib
+
+MARIADB_SERVER_PLUGINS := \
+ adt_null \
+ auth_0x0100 \
+ auth_ed25519 \
+ auth_socket \
+ auth_test_plugin \
+ client_ed25519 \
+ debug_key_management \
+ dialog_examples \
+ disks \
+ example_key_management \
+ feedback \
+ file_key_management \
+ ha_archive \
+ ha_blackhole \
+ ha_connect \
+ ha_example \
+ ha_federated \
+ ha_federatedx \
+ ha_innodb \
+ ha_spider \
+ ha_test_sql_discovery \
+ handlersocket \
+ libdaemon_example \
+ locales \
+ metadata_lock_info \
+ mypluglib \
+ qa_auth_client \
+ qa_auth_interface \
+ qa_auth_server \
+ query_cache_info \
+ query_response_time \
+ semisync_master \
+ semisync_slave \
+ server_audit \
+ simple_password_check \
+ sql_errlog \
+ wsrep_info
+
+PKG_CONFIG_DEPENDS := \
+ $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-%,$(subst _,-,$(MARIADB_SERVER_PLUGINS))) \
+ CONFIG_PACKAGE_mariadb-server
+
+plugin-adt_null := PLUGIN_AUDIT_NULL
+plugin-auth_0x0100 := PLUGIN_AUTH_0X0100
+plugin-auth_ed25519 := PLUGIN_AUTH_ED25519
+plugin-auth_socket := PLUGIN_AUTH_SOCKET
+plugin-auth_test_plugin := PLUGIN_AUTH_TEST_PLUGIN
+plugin-client_ed25519 := PLUGIN_CLIENT_ED25519
+plugin-debug_key_management := PLUGIN_DEBUG_KEY_MANAGEMENT
+plugin-dialog_examples := PLUGIN_DIALOG_EXAMPLES
+plugin-disks := PLUGIN_DISKS
+plugin-example_key_management := PLUGIN_EXAMPLE_KEY_MANAGEMENT
+plugin-feedback := PLUGIN_FEEDBACK
+plugin-file_key_management := PLUGIN_FILE_KEY_MANAGEMENT
+plugin-ha_archive := PLUGIN_ARCHIVE
+plugin-ha_blackhole := PLUGIN_BLACKHOLE
+plugin-ha_connect := PLUGIN_CONNECT
+plugin-ha_example := PLUGIN_EXAMPLE
+plugin-ha_federated := PLUGIN_FEDERATED
+plugin-ha_federatedx := PLUGIN_FEDERATEDX
+plugin-ha_innodb := PLUGIN_INNOBASE
+plugin-ha_spider := PLUGIN_SPIDER
+plugin-ha_test_sql_discovery := PLUGIN_TEST_SQL_DISCOVERY
+plugin-handlersocket := PLUGIN_HANDLERSOCKET
+plugin-libdaemon_example := PLUGIN_DAEMON_EXAMPLE
+plugin-locales := PLUGIN_LOCALES
+plugin-metadata_lock_info := PLUGIN_METADATA_LOCK_INFO
+plugin-mypluglib := PLUGIN_FTEXAMPLE
+plugin-qa_auth_client := PLUGIN_QA_AUTH_CLIENT
+plugin-qa_auth_interface := PLUGIN_QA_AUTH_INTERFACE
+plugin-qa_auth_server := PLUGIN_QA_AUTH_SERVER
+plugin-query_cache_info := PLUGIN_QUERY_CACHE_INFO
+plugin-query_response_time := PLUGIN_QUERY_RESPONSE_TIME
+plugin-semisync_master := PLUGIN_SEMISYNC_MASTER
+plugin-semisync_slave := PLUGIN_SEMISYNC_SLAVE
+plugin-server_audit := PLUGIN_SERVER_AUDIT
+plugin-simple_password_check := PLUGIN_SIMPLE_PASSWORD_CHECK
+plugin-sql_errlog := PLUGIN_SQL_ERRLOG
+plugin-wsrep_info := PLUGIN_WSREP_INFO
+
+MARIADB_CLIENT := \
+ mysql \
+ mysqlcheck
+
+MARIADB_CLIENT_EXTRA := \
+ mysql_find_rows \
+ mysql_waitpid \
+ mysqlaccess \
+ mysqladmin \
+ mysqldump \
+ mysqlimport \
+ mysqlshow \
+ mysqlslap \
+ mytop
+
+MARIADB_SERVER := \
+ innochecksum \
+ my_print_defaults \
+ mysql_install_db \
+ mysql_upgrade \
+ mysqld
+
+MARIADB_SERVER_EXTRA := \
+ aria* \
+ mariabackup \
+ msql2mysql \
+ myisam_ftdump \
+ myisamchk \
+ myisamlog \
+ myisampack \
+ mysql_convert_table_format \
+ mysql_fix_extensions \
+ mysql_plugin \
+ mysql_secure_installation \
+ mysql_setpermission \
+ mysql_tzinfo_to_sql \
+ mysqlbinlog \
+ mysqld_multi \
+ mysqld_safe \
+ mysqld_safe_helper \
+ mysqldumpslow \
+ mysqlhotcopy \
+ perror \
+ replace \
+ resolve_stack_dump
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/mariadb/install/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin
+endef
+
+define Package/mariadb/description/Default
+MariaDB is a fast, stable and true multi-user, multi-threaded SQL
+database server. SQL (Structured Query Language) is the most popular
+database query language in the world. The main goals of MariaDB are
+speed, robustness and ease of use.
+endef
+
+define Package/libmariadbclient
+ SECTION:=libs
+ CATEGORY:=Libraries
+ DEPENDS:=$(MARIADB_COMMON_DEPENDS)
+ TITLE:=MariaDB database client library
+ URL:=https://mariadb.org/
+ PROVIDES:=libmysqlclient libmysqlclient-r
+endef
+
+define Package/libmariadbclient/description
+$(call Package/mariadb/description/Default)
+
+This package includes the client library.
+
+endef
+
+define Package/mariadb/Default
+ SECTION:=utils
+ CATEGORY:=Utilities
+ URL:=https://mariadb.org/
+ SUBMENU:=database
+endef
+
+define Package/mariadb-client
+ $(call Package/mariadb/Default)
+ TITLE:=MariaDB database core client binaries
+ DEPENDS:= \
+ $(MARIADB_COMMON_DEPENDS) \
+ +libncursesw
+endef
+
+define Package/mariadb-client/description
+$(call Package/mariadb/description/Default)
+
+This package includes the following core client binaries:
+
+$(subst $(space),$(newline),$(MARIADB_CLIENT))
+
+endef
+
+define Package/mariadb-client-extra
+ $(call Package/mariadb/Default)
+ TITLE:=MariaDB database extra client binaries
+ DEPENDS:=mariadb-client
+endef
+
+define Package/mariadb-client-extra/description
+$(call Package/mariadb/description/Default)
+
+This package includes the following extra client binaries:
+
+$(subst $(space),$(newline),$(MARIADB_CLIENT_EXTRA))
+
+endef
+
+define Package/mariadb-extra-charsets
+ $(call Package/mariadb/Default)
+ TITLE:=MariaDB database extra character sets
+ DEPENDS:=mariadb-server
+endef
+
+define Package/mariadb-extra-charsets/description
+$(call Package/mariadb/description/Default)
+
+The MariaDB server packaged by OpenWrt only provides support for UTF-8.
+This package contains single Byte character sets and collations that can
+be added at run time.
+
+endef
+
+define Package/mariadb-server
+ $(call Package/mariadb/Default)
+ DEPENDS:= \
+ $(MARIADB_COMMON_DEPENDS) \
+ +!arc:libaio \
+ +liblzma \
+ +libpcre \
+ +resolveip
+ TITLE:=MariaDB database core server binaries
+ MENU:=1
+ PROVIDES:=mysql-server
+endef
+
+define Package/mariadb-server/description
+$(call Package/mariadb/description/Default)
+
+This package includes the following core server binaries:
+
+$(subst $(space),$(newline),$(MARIADB_SERVER))
+
+endef
+
+define Package/mariadb-server-extra
+ $(call Package/mariadb/Default)
+ TITLE:=MariaDB database extra server binaries
+ DEPENDS:=mariadb-server
+endef
+
+define Package/mariadb-server-extra/description
+$(call Package/mariadb/description/Default)
+
+This package includes the following extra server binaries:
+
+$(subst $(space),$(newline),$(MARIADB_SERVER_EXTRA))
+
+endef
+
+# We won't need unit tests
+CMAKE_OPTIONS += -DWITH_UNIT_TESTS=0
+
+# This value is determined automatically during straight compile by compiling
+# and running a test code. You cannot do that during cross-compile. However the
+# stack grows downward in most if not all modern systems. The only exception
+# according to buildroot is PA-RISC which is not supported by OpenWrt as far as
+# I know. Therefore it makes sense to hardcode the value. If an arch is added
+# the stack of which grows up one should expect unpredictable behavior at run
+# time.
+CMAKE_OPTIONS += -DSTACK_DIRECTION=-1
+
+# Jemalloc was added for TokuDB. Since its configure script seems somewhat broken
+# when it comes to cross-compilation we shall disable it and also disable TokuDB.
+CMAKE_OPTIONS += -DWITH_JEMALLOC=no -DWITHOUT_TOKUDB=1
+
+# Make it explicit that we are cross-compiling
+CMAKE_OPTIONS += -DCMAKE_CROSSCOMPILING=1
+
+# Explicitly disable dtrace to avoid detection of a host version
+CMAKE_OPTIONS += -DENABLE_DTRACE=0
+
+# Prevent mariadb from messing with OpenWrt's C(XX)FLAGS
+CMAKE_OPTIONS += -DSECURITY_HARDENED=OFF
+
+ifeq ($(CONFIG_PACKAGE_mariadb-server),)
+CMAKE_OPTIONS += -DWITHOUT_SERVER=ON
+else
+CMAKE_OPTIONS += -DWITHOUT_SERVER=OFF
+endif
+
+CMAKE_OPTIONS += \
+ -DCONNECT_WITH_JDBC=NO \
+ -DCONNECT_WITH_LIBXML2=system \
+ -DCONNECT_WITH_ODBC=NO \
+ -DDEFAULT_CHARSET=utf8 \
+ -DDEFAULT_COLLATION=utf8_general_ci \
+ -DDISABLE_SHARED=NO \
+ -DENABLED_PROFILING=OFF \
+ -DENABLE_STATIC_LIBS=OFF \
+ -DINSTALL_DOCDIR=share/doc/mariadb \
+ -DINSTALL_DOCREADMEDIR=share/doc/mariadb \
+ -DINSTALL_MANDIR=share/man \
+ -DINSTALL_MYSQLSHAREDIR=share/mysql \
+ -DINSTALL_MYSQLTESTDIR="" \
+ -DINSTALL_PLUGINDIR=lib/mysql/plugin \
+ -DINSTALL_SBINDIR=bin \
+ -DINSTALL_SCRIPTDIR=bin \
+ -DINSTALL_SQLBENCHDIR="" \
+ -DINSTALL_SUPPORTFILESDIR=share/mysql \
+ -DMYSQLD_USER=root \
+ -DMYSQL_DATADIR=/var/lib/mysql \
+ -DMYSQL_UNIX_ADDR=/var/run/mysqld.sock \
+ -DSKIP_TESTS=ON \
+ -DWITH_ASAN=OFF \
+ -DWITH_EMBEDDED_SERVER=OFF \
+ -DWITH_EXTRA_CHARSETS=none \
+ -DWITH_INNODB_BZIP2=OFF \
+ -DWITH_INNODB_LZ4=OFF \
+ -DWITH_INNODB_LZMA=ON \
+ -DWITH_INNODB_LZO=OFF \
+ -DWITH_INNODB_SNAPPY=OFF \
+ -DWITH_LIBEDIT=OFF \
+ -DWITH_LIBNUMA=NO \
+ -DWITH_LIBWRAP=OFF \
+ -DWITH_LIBWSEP=OFF \
+ -DWITH_MARIABACKUP=ON \
+ -DWITH_PCRE=system \
+ -DWITH_READLINE=OFF \
+ -DWITH_SAFEMALLOC=OFF \
+ -DWITH_SSL=system \
+ -DWITH_SYSTEMD=no \
+ -DWITH_VALGRIND=OFF \
+ -DWITH_ZLIB=system
+
+# Default-disable some modules
+CMAKE_OPTIONS += \
+ -DPLUGIN_CASSANDRA=NO \
+ -DPLUGIN_MROONGA=NO \
+ -DPLUGIN_OQGRAPH=NO \
+ -DPLUGIN_ROCKSDB=NO \
+ -DPLUGIN_SPHINX=NO \
+ -DPLUGIN_TOKUDB=NO \
+ -DPLUGIN_AUTH_PAM=NO \
+ -DPLUGIN_AUTH_GSSAPI=NO \
+ -DPLUGIN_AUTH_GSSAPI_CLIENT=NO \
+ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=NO
+
+CMAKE_OPTIONS += \
+ $(foreach p,$(MARIADB_SERVER_PLUGINS),-D$(plugin-$(p))=$(if $(CONFIG_PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(p))),DYNAMIC,NO))
+
+# Set CMAKE_FIND_ROOT_PATH_MODE_INCLUDE and CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
+# to BOTH as otherwise the host build will not find some required dependencies
+# installed on the host machine, like ncurses.
+#
+# Add "$(STAGING_DIR_HOSTPKG)/lib" to the RPATH of the host helpers,
+# otherwise they might not find the location of a library at run time.
+CMAKE_HOST_OPTIONS += \
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE \
+ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
+ -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOSTPKG)/lib" \
+ -DCMAKE_SKIP_RPATH=FALSE \
+ -DWITHOUT_SERVER=OFF \
+ -DWITHOUT_TOKUDB=1
+
+# Some helpers must be compiled for host in order to crosscompile mariadb for
+# the target. They are then included by import_executables.cmake which is
+# generated during the build of the host helpers. It is not necessary to build
+# the whole host package, only the "import_executables" target.
+# -DIMPORT_EXECUTABLES=$(HOST_BUILD_DIR)/import_executables.cmake
+# must then be passed to cmake during target build.
+# see also https://mariadb.com/kb/en/mariadb/cross-compiling-mariadb/
+
+CMAKE_OPTIONS += -DIMPORT_EXECUTABLES=$(STAGING_DIR_HOSTPKG)/share/mariadb/import_executables.cmake
+
+define Host/Compile
+ $(call Host/Compile/Default,import_executables)
+endef
+
+define Host/Install
+ $(SED) 's|$(HOST_BUILD_DIR)|$(STAGING_DIR_HOSTPKG)/share/mariadb|' $(HOST_BUILD_DIR)/import_executables.cmake
+ $(INSTALL_DIR) $(1)/share/mariadb/{dbug,extra,scripts,sql}
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/dbug/factorial $(1)/share/mariadb/dbug
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/extra/comp_err $(1)/share/mariadb/extra
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/scripts/comp_sql $(1)/share/mariadb/scripts
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/sql/{gen_lex_hash,gen_lex_token} $(1)/share/mariadb/sql
+ $(INSTALL_DATA) $(HOST_BUILD_DIR)/import_executables.cmake $(1)/share/mariadb
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib/pkgconfig $(1)/usr/share/aclocal
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
+ $(LN) $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
+ $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmysqlclient*.so* $(1)/usr/lib/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/mariadb.pc $(1)/usr/lib/pkgconfig
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/mysql.m4 $(1)/usr/share/aclocal
+endef
+
+define Package/libmariadbclient/install
+ $(INSTALL_DIR) $(1)$(PLUGIN_DIR)
+ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmysqlclient*.so* $(1)/usr/lib/
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/dialog.so $(1)$(PLUGIN_DIR)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/mysql_clear_password.so $(1)$(PLUGIN_DIR)
+endef
+
+define Package/mariadb-client/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(foreach b,$(MARIADB_CLIENT),$(call Package/mariadb/install/bin,$(1),$(b));)
+endef
+
+define Package/mariadb-client-extra/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(foreach b,$(MARIADB_CLIENT_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
+endef
+
+define Package/mariadb-extra-charsets/install
+ $(INSTALL_DIR) $(1)/usr/share/mysql/charsets
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/charsets/* $(1)/usr/share/mysql/charsets
+endef
+
+define Package/mariadb-server/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(foreach b,$(MARIADB_SERVER),$(call Package/mariadb/install/bin,$(1),$(b));)
+ $(INSTALL_DIR) $(1)/etc/init.d/
+ $(INSTALL_DIR) $(1)/etc/mysql
+ $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
+ $(INSTALL_CONF) conf/my.cnf $(1)/etc/mysql
+ $(INSTALL_DIR) $(1)$(PLUGIN_DIR)
+ $(INSTALL_CONF) $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/daemon_example.ini $(1)$(PLUGIN_DIR)
+ $(INSTALL_DIR) $(1)/usr/share/mysql/english
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/maria_add_gis_sp_bootstrap.sql $(1)/usr/share/mysql/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_performance_tables.sql $(1)/usr/share/mysql/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
+ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
+endef
+
+define Package/mariadb-server-extra/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(foreach b,$(MARIADB_SERVER_EXTRA),$(call Package/mariadb/install/bin,$(1),$(b));)
+endef
+
+define Package/mariadb-server/conffiles
+/etc/mysql/my.cnf
+/usr/lib/mysql/plugin/daemon_example.ini
+endef
+
+define BuildPlugin
+ define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1))
+ $$(call Package/mariadb/Default)
+ TITLE:=MariaDB database plugin
+ DEPENDS:=mariadb-server $(patsubst +%,+PACKAGE_$(PKG_NAME)-server-plugin-$(subst _,-,$(1)):%,$(2))
+ endef
+ define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1))/description
+ $$(call Package/mariadb/description/Default)
+
+This package provides the $(1) plugin.
+
+ endef
+ define Package/$(PKG_NAME)-server-plugin-$(subst _,-,$(1))/install
+ $(INSTALL_DIR) $$(1)$(PLUGIN_DIR)
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)$(PLUGIN_DIR)/$(1).so \
+ $$(1)$(PLUGIN_DIR)
+ endef
+ $$(eval $$(call BuildPackage,$(PKG_NAME)-server-plugin-$(subst _,-,$(1))))
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libmariadbclient))
+$(eval $(call BuildPackage,mariadb-client))
+$(eval $(call BuildPackage,mariadb-client-extra))
+$(eval $(call BuildPackage,mariadb-extra-charsets))
+$(eval $(call BuildPackage,mariadb-server))
+$(eval $(call BuildPackage,mariadb-server-extra))
+
+$(eval $(call BuildPlugin,adt_null,))
+$(eval $(call BuildPlugin,auth_0x0100,))
+$(eval $(call BuildPlugin,auth_ed25519,))
+$(eval $(call BuildPlugin,auth_socket,))
+$(eval $(call BuildPlugin,auth_test_plugin,))
+$(eval $(call BuildPlugin,client_ed25519,))
+$(eval $(call BuildPlugin,debug_key_management,))
+$(eval $(call BuildPlugin,dialog_examples,))
+$(eval $(call BuildPlugin,disks,))
+$(eval $(call BuildPlugin,example_key_management,))
+$(eval $(call BuildPlugin,feedback,))
+$(eval $(call BuildPlugin,file_key_management,))
+$(eval $(call BuildPlugin,ha_archive,))
+$(eval $(call BuildPlugin,ha_blackhole,))
+$(eval $(call BuildPlugin,ha_connect,+libxml2))
+$(eval $(call BuildPlugin,ha_federated,))
+$(eval $(call BuildPlugin,ha_federatedx,))
+$(eval $(call BuildPlugin,ha_innodb,))
+$(eval $(call BuildPlugin,ha_spider,))
+$(eval $(call BuildPlugin,ha_test_sql_discovery,))
+$(eval $(call BuildPlugin,handlersocket,))
+$(eval $(call BuildPlugin,libdaemon_example,))
+$(eval $(call BuildPlugin,locales,))
+$(eval $(call BuildPlugin,metadata_lock_info,))
+$(eval $(call BuildPlugin,mypluglib,))
+$(eval $(call BuildPlugin,qa_auth_client,))
+$(eval $(call BuildPlugin,qa_auth_interface,))
+$(eval $(call BuildPlugin,qa_auth_server,))
+$(eval $(call BuildPlugin,query_cache_info,))
+$(eval $(call BuildPlugin,query_response_time,))
+$(eval $(call BuildPlugin,semisync_master,))
+$(eval $(call BuildPlugin,semisync_slave,))
+$(eval $(call BuildPlugin,server_audit,))
+$(eval $(call BuildPlugin,simple_password_check,))
+$(eval $(call BuildPlugin,sql_errlog,))
+$(eval $(call BuildPlugin,wsrep_info,))
--- /dev/null
+[client]
+port = 3306
+socket = /var/run/mysqld.sock
+
+[mysqld]
+user = root
+socket = /var/run/mysqld.sock
+port = 3306
+basedir = /usr
+
+############ Don't put this on the NAND #############
+# Figure out where you are going to put the databases
+# And run mysql_install_db --force
+datadir = /mnt/data/mysql/
+
+######### This should also not go on the NAND #######
+tmpdir = /mnt/data/tmp/
+
+skip-external-locking
+
+bind-address = 127.0.0.1
+
+# Fine Tuning
+key_buffer = 16M
+max_allowed_packet = 16M
+thread_stack = 192K
+thread_cache_size = 8
+
+# Here you can see queries with especially long duration
+#log_slow_queries = /var/log/mysql/mysql-slow.log
+#long_query_time = 2
+#log-queries-not-using-indexes
+
+# The following can be used as easy to replay backup logs or for replication.
+#server-id = 1
+#log_bin = /var/log/mysql/mysql-bin.log
+#expire_logs_days = 10
+#max_binlog_size = 100M
+#binlog_do_db = include_database_name
+#binlog_ignore_db = include_database_name
+
+
+[mysqldump]
+quick
+quote-names
+max_allowed_packet = 16M
+
+[mysql]
+#no-auto-rehash # faster start of mysql but no tab completition
+
+[isamchk]
+key_buffer = 16M
+
+
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2011 OpenWrt.org
+
+START=95
+STOP=10
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+SERVICE_STOP_TIME=9
+PROG='/usr/bin/mysqld'
+
+start() {
+ local conf='/etc/my.cnf'
+ local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )"
+
+ [ -d "$datadir" ] || {
+ logger -s "[ERROR] datadir '$datadir' in '$conf' does not exist"
+ return 1
+ }
+
+ [ -f "$datadir/mysql/tables_priv.MYD" ] || {
+ logger -s "[ERROR] can not detect privileges table, you might need to"
+ logger -s "run 'mysql_install_db --force' to initialize the system tables"
+ return 1
+ }
+
+ service_start "$PROG"
+}
+
+stop() {
+ service_stop "$PROG"
+}
--- /dev/null
+--- a/scripts/mysql_install_db.sh
++++ b/scripts/mysql_install_db.sh
+@@ -379,7 +379,7 @@ fi
+
+
+ # Try to determine the hostname
+-hostname=`@HOSTNAME@`
++hostname=`cat /proc/sys/kernel/hostname`
+
+ # Check if hostname is valid
+ if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
--- /dev/null
+--- a/cmake/pcre.cmake
++++ b/cmake/pcre.cmake
+@@ -14,6 +14,8 @@ MACRO (CHECK_PCRE)
+ return -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) < 256;
+ }" PCRE_STACK_SIZE_OK)
+ SET(CMAKE_REQUIRED_LIBRARIES)
++ ELSE()
++ SET(PCRE_STACK_SIZE_OK TRUE)
+ ENDIF()
+ ENDIF()
+ IF(NOT HAVE_PCRE_STACK_GUARD OR NOT PCRE_STACK_SIZE_OK OR
--- /dev/null
+--- a/configure.cmake
++++ b/configure.cmake
+@@ -1107,9 +1107,12 @@ SET(CMAKE_EXTRA_INCLUDE_FILES)
+ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO)
+ CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN)
+ SET(SPRINTF_RETURNS_INT 1)
+-CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H)
+-IF(NOT HAVE_UCONTEXT_H)
+- CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H)
++CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_HEADER)
++IF(NOT HAVE_UCONTEXT_HEADER)
++ CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_HEADER)
++ENDIF()
++IF(HAVE_UCONTEXT_HEADER)
++ CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
+ ENDIF()
+ IF(HAVE_UCONTEXT_H)
+ CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H)
--- /dev/null
+Description: Fix mips missing atomics primitives
+ On mips we don't have native support for 64bit atomic operations. Make use
+ of libatomic to emulate them.
+Author: Vicențiu Ciorbaru <vicentiu@mariadb.org>
+
+--- a/configure.cmake
++++ b/configure.cmake
+@@ -128,7 +128,7 @@ IF(UNIX)
+ ENDIF()
+ FIND_PACKAGE(Threads)
+
+- SET(CMAKE_REQUIRED_LIBRARIES
++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES
+ ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO})
+ # Need explicit pthread for gcc -fsanitize=address
+ IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
+@@ -1038,7 +1038,26 @@ ELSEIF(NOT WITH_ATOMIC_OPS)
+ long long int *ptr= &var;
+ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
+ }"
+- HAVE_GCC_C11_ATOMICS)
++ HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
++ IF(HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC)
++ SET(HAVE_GCC_C11_ATOMICS True)
++ ELSE()
++ SET(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
++ LIST(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
++ CHECK_CXX_SOURCE_COMPILES("
++ int main()
++ {
++ long long int var= 1;
++ long long int *ptr= &var;
++ return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
++ }"
++ HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++ IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++ SET(HAVE_GCC_C11_ATOMICS True)
++ ELSE()
++ SET(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES})
++ ENDIF()
++ ENDIF()
+ ELSE()
+ MESSAGE(FATAL_ERROR "${WITH_ATOMIC_OPS} is not a valid value for WITH_ATOMIC_OPS!")
+ ENDIF()
+--- a/include/atomic/gcc_builtins.h
++++ b/include/atomic/gcc_builtins.h
+@@ -16,6 +16,7 @@
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
++#if defined (HAVE_GCC_ATOMIC_BUILTINS)
+ #define make_atomic_add_body(S) \
+ v= __sync_fetch_and_add(a, v);
+ #define make_atomic_fas_body(S) \
+@@ -26,6 +27,20 @@
+ sav= __sync_val_compare_and_swap(a, cmp_val, set);\
+ if (!(ret= (sav == cmp_val))) *cmp= sav
+
++#elif defined(HAVE_GCC_C11_ATOMICS)
++
++#define make_atomic_add_body(S) \
++ v= __atomic_fetch_add(a, v, __ATOMIC_SEQ_CST)
++#define make_atomic_fas_body(S) \
++ v= __atomic_exchange_n(a, v, __ATOMIC_SEQ_CST)
++#define make_atomic_cas_body(S) \
++ int ## S sav; \
++ ret= __atomic_compare_exchange_n(a, cmp, set, \
++ 0, \
++ __ATOMIC_SEQ_CST,\
++ __ATOMIC_SEQ_CST);
++#endif
++
+ #ifdef MY_ATOMIC_MODE_DUMMY
+ #define make_atomic_load_body(S) ret= *a
+ #define make_atomic_store_body(S) *a= v
+--- a/include/atomic/nolock.h
++++ b/include/atomic/nolock.h
+@@ -17,7 +17,7 @@
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+ #if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
+- || defined(HAVE_GCC_ATOMIC_BUILTINS) \
++ || defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS) \
+ || defined(HAVE_SOLARIS_ATOMIC)
+
+ # ifdef MY_ATOMIC_MODE_DUMMY
+@@ -41,7 +41,7 @@
+ # elif __GNUC__
+ # if defined(HAVE_SOLARIS_ATOMIC)
+ # include "solaris.h"
+-# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
++# elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(HAVE_GCC_C11_ATOMICS)
+ # include "gcc_builtins.h"
+ # elif defined(__i386__) || defined(__x86_64__)
+ # include "x86-gcc.h"
+--- a/mysys/CMakeLists.txt
++++ b/mysys/CMakeLists.txt
+@@ -78,6 +78,10 @@ IF(HAVE_BFD_H)
+ TARGET_LINK_LIBRARIES(mysys bfd)
+ ENDIF(HAVE_BFD_H)
+
++IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++ TARGET_LINK_LIBRARIES(mysys atomic)
++ENDIF()
++
+ IF (WIN32)
+ TARGET_LINK_LIBRARIES(mysys IPHLPAPI)
+ ENDIF(WIN32)
+--- a/sql/CMakeLists.txt
++++ b/sql/CMakeLists.txt
+@@ -165,6 +165,10 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI
+ ${SSL_LIBRARIES}
+ ${LIBSYSTEMD})
+
++IF(HAVE_GCC_C11_ATOMICS_WITH_LIBATOMIC)
++ TARGET_LINK_LIBRARIES(sql atomic)
++ENDIF()
++
+ IF(WIN32)
+ SET(MYSQLD_SOURCE main.cc nt_servc.cc message.rc)
+ TARGET_LINK_LIBRARIES(sql psapi)
--- /dev/null
+Description: Handle unaligned buffers in connect's TYPBLK class
+ On MIPS platforms (and probably others) unaligned memory access results in a
+ bus error. In the connect storage engine, block data for some data formats is
+ stored packed in memory and the TYPBLK class is used to read values from it.
+ Since TYPBLK does not have special handling for this packed memory, it can
+ quite easily result in unaligned memory accesses.
+ .
+ The simple way to fix this is to perform all accesses to the main buffer
+ through memcpy. With GCC and optimizations turned on, this call to memcpy is
+ completely optimized away on architectures where unaligned accesses are ok
+ (like x86).
+Author: James Cowgill <jcowgill@debian.org>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/storage/connect/valblk.h
++++ b/storage/connect/valblk.h
+@@ -139,6 +139,7 @@ class VALBLK : public BLOCK {
+ int Prec; // Precision of float values
+ }; // end of class VALBLK
+
++
+ /***********************************************************************/
+ /* Class TYPBLK: represents a block of typed values. */
+ /***********************************************************************/
+@@ -151,40 +152,41 @@ class TYPBLK : public VALBLK {
+ // Implementation
+ virtual bool Init(PGLOBAL g, bool check);
+ virtual int GetVlen(void) {return sizeof(TYPE);}
+- virtual char GetTinyValue(int n) {return (char)Typp[n];}
+- virtual uchar GetUTinyValue(int n) {return (uchar)Typp[n];}
+- virtual short GetShortValue(int n) {return (short)Typp[n];}
+- virtual ushort GetUShortValue(int n) {return (ushort)Typp[n];}
+- virtual int GetIntValue(int n) {return (int)Typp[n];}
+- virtual uint GetUIntValue(int n) {return (uint)Typp[n];}
+- virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
+- virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
+- virtual double GetFloatValue(int n) {return (double)Typp[n];}
++
++ virtual char GetTinyValue(int n) {return (char)UnalignedRead(n);}
++ virtual uchar GetUTinyValue(int n) {return (uchar)UnalignedRead(n);}
++ virtual short GetShortValue(int n) {return (short)UnalignedRead(n);}
++ virtual ushort GetUShortValue(int n) {return (ushort)UnalignedRead(n);}
++ virtual int GetIntValue(int n) {return (int)UnalignedRead(n);}
++ virtual uint GetUIntValue(int n) {return (uint)UnalignedRead(n);}
++ virtual longlong GetBigintValue(int n) {return (longlong)UnalignedRead(n);}
++ virtual ulonglong GetUBigintValue(int n) {return (ulonglong)UnalignedRead(n);}
++ virtual double GetFloatValue(int n) {return (double)UnalignedRead(n);}
+ virtual char *GetCharString(char *p, int n);
+- virtual void Reset(int n) {Typp[n] = 0;}
++ virtual void Reset(int n) {UnalignedWrite(n, 0);}
+
+ // Methods
+ using VALBLK::SetValue;
+ virtual void SetValue(PCSZ sp, int n);
+ virtual void SetValue(const char *sp, uint len, int n);
+ virtual void SetValue(short sval, int n)
+- {Typp[n] = (TYPE)sval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
+ virtual void SetValue(ushort sval, int n)
+- {Typp[n] = (TYPE)sval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)sval); SetNull(n, false);}
+ virtual void SetValue(int lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(uint lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(longlong lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(ulonglong lval, int n)
+- {Typp[n] = (TYPE)lval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)lval); SetNull(n, false);}
+ virtual void SetValue(double fval, int n)
+- {Typp[n] = (TYPE)fval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)fval); SetNull(n, false);}
+ virtual void SetValue(char cval, int n)
+- {Typp[n] = (TYPE)cval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
+ virtual void SetValue(uchar cval, int n)
+- {Typp[n] = (TYPE)cval; SetNull(n, false);}
++ {UnalignedWrite(n, (TYPE)cval); SetNull(n, false);}
+ virtual void SetValue(PVAL valp, int n);
+ virtual void SetValue(PVBLK pv, int n1, int n2);
+ virtual void SetMin(PVAL valp, int n);
+@@ -206,6 +208,17 @@ class TYPBLK : public VALBLK {
+ // Members
+ TYPE* const &Typp;
+ const char *Fmt;
++
++ // Unaligned access
++ TYPE UnalignedRead(int n) const {
++ TYPE result;
++ memcpy(&result, Typp + n, sizeof(TYPE));
++ return result;
++ }
++
++ void UnalignedWrite(int n, TYPE value) {
++ memcpy(Typp + n, &value, sizeof(TYPE));
++ }
+ }; // end of class TYPBLK
+
+ /***********************************************************************/
+--- a/storage/connect/valblk.cpp
++++ b/storage/connect/valblk.cpp
+@@ -266,14 +266,14 @@ bool TYPBLK<TYPE>::Init(PGLOBAL g, bool
+ template <class TYPE>
+ char *TYPBLK<TYPE>::GetCharString(char *p, int n)
+ {
+- sprintf(p, Fmt, Typp[n]);
++ sprintf(p, Fmt, UnalignedRead(n));
+ return p;
+ } // end of GetCharString
+
+ template <>
+ char *TYPBLK<double>::GetCharString(char *p, int n)
+ {
+- sprintf(p, Fmt, Prec, Typp[n]);
++ sprintf(p, Fmt, Prec, UnalignedRead(n));
+ return p;
+ } // end of GetCharString
+
+@@ -289,7 +289,7 @@ void TYPBLK<TYPE>::SetValue(PVAL valp, i
+ ChkTyp(valp);
+
+ if (!(b = valp->IsNull()))
+- Typp[n] = GetTypedValue(valp);
++ UnalignedWrite(n, GetTypedValue(valp));
+ else
+ Reset(n);
+
+@@ -351,9 +351,9 @@ void TYPBLK<TYPE>::SetValue(PCSZ p, int
+ ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus);
+
+ if (minus && val < maxval)
+- Typp[n] = (TYPE)(-(signed)val);
++ UnalignedWrite(n, (TYPE)(-(signed)val));
+ else
+- Typp[n] = (TYPE)val;
++ UnalignedWrite(n, (TYPE)val);
+
+ SetNull(n, false);
+ } // end of SetValue
+@@ -396,7 +396,7 @@ void TYPBLK<double>::SetValue(PCSZ p, in
+ throw Type;
+ } // endif Check
+
+- Typp[n] = atof(p);
++ UnalignedWrite(n, atof(p));
+ SetNull(n, false);
+ } // end of SetValue
+
+@@ -428,7 +428,7 @@ void TYPBLK<TYPE>::SetValue(PVBLK pv, in
+ ChkTyp(pv);
+
+ if (!(b = pv->IsNull(n2) && Nullable))
+- Typp[n1] = GetTypedValue(pv, n2);
++ UnalignedWrite(n1, GetTypedValue(pv, n2));
+ else
+ Reset(n1);
+
+@@ -479,10 +479,10 @@ void TYPBLK<TYPE>::SetMin(PVAL valp, int
+ {
+ CheckParms(valp, n)
+ TYPE tval = GetTypedValue(valp);
+- TYPE& tmin = Typp[n];
++ TYPE tmin = UnalignedRead(n);
+
+ if (tval < tmin)
+- tmin = tval;
++ UnalignedWrite(n, tval);
+
+ } // end of SetMin
+
+@@ -494,10 +494,10 @@ void TYPBLK<TYPE>::SetMax(PVAL valp, int
+ {
+ CheckParms(valp, n)
+ TYPE tval = GetTypedValue(valp);
+- TYPE& tmin = Typp[n];
++ TYPE tmin = UnalignedRead(n);
+
+ if (tval > tmin)
+- tmin = tval;
++ UnalignedWrite(n, tval);
+
+ } // end of SetMax
+
+@@ -511,8 +511,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
+ CheckType(pv)
+ TYPE *lp = ((TYPBLK*)pv)->Typp;
+
+- for (register int i = k; i < n; i++) // TODO
+- Typp[i] = lp[i];
++ memcpy(Typp + k, lp + k, sizeof(TYPE) * n);
+
+ } // end of SetValues
+ #endif // 0
+@@ -523,7 +522,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, i
+ template <class TYPE>
+ void TYPBLK<TYPE>::Move(int i, int j)
+ {
+- Typp[j] = Typp[i];
++ UnalignedWrite(j, UnalignedRead(i));
+ MoveNull(i, j);
+ } // end of Move
+
+@@ -537,7 +536,7 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
+ ChkIndx(n);
+ ChkTyp(vp);
+ #endif // _DEBUG
+- TYPE mlv = Typp[n];
++ TYPE mlv = UnalignedRead(n);
+ TYPE vlv = GetTypedValue(vp);
+
+ return (vlv > mlv) ? 1 : (vlv < mlv) ? (-1) : 0;
+@@ -549,8 +548,8 @@ int TYPBLK<TYPE>::CompVal(PVAL vp, int n
+ template <class TYPE>
+ int TYPBLK<TYPE>::CompVal(int i1, int i2)
+ {
+- TYPE lv1 = Typp[i1];
+- TYPE lv2 = Typp[i2];
++ TYPE lv1 = UnalignedRead(i1);
++ TYPE lv2 = UnalignedRead(i2);
+
+ return (lv1 > lv2) ? 1 : (lv1 < lv2) ? (-1) : 0;
+ } // end of CompVal
+@@ -587,7 +586,7 @@ int TYPBLK<TYPE>::Find(PVAL vp)
+ TYPE n = GetTypedValue(vp);
+
+ for (i = 0; i < Nval; i++)
+- if (n == Typp[i])
++ if (n == UnalignedRead(i))
+ break;
+
+ return (i < Nval) ? i : (-1);
+@@ -603,7 +602,7 @@ int TYPBLK<TYPE>::GetMaxLength(void)
+ int i, n, m;
+
+ for (i = n = 0; i < Nval; i++) {
+- m = sprintf(buf, Fmt, Typp[i]);
++ m = sprintf(buf, Fmt, UnalignedRead(i));
+ n = MY_MAX(n, m);
+ } // endfor i
+
+@@ -1333,7 +1332,7 @@ char *DATBLK::GetCharString(char *p, int
+ char *vp;
+
+ if (Dvalp) {
+- Dvalp->SetValue(Typp[n]);
++ Dvalp->SetValue(UnalignedRead(n));
+ vp = Dvalp->GetCharString(p);
+ } else
+ vp = TYPBLK<int>::GetCharString(p, n);
+@@ -1349,7 +1348,7 @@ void DATBLK::SetValue(PCSZ p, int n)
+ if (Dvalp) {
+ // Decode the string according to format
+ Dvalp->SetValue_psz(p);
+- Typp[n] = Dvalp->GetIntValue();
++ UnalignedWrite(n, Dvalp->GetIntValue());
+ } else
+ TYPBLK<int>::SetValue(p, n);
+
--- /dev/null
+Author: James Cowgill <jcowgill@debian.org>
+Description: fix FTBFS on 32-bit mips*
+Bug-Debian: #864298
+
+--- a/storage/innobase/include/os0sync.h
++++ b/storage/innobase/include/os0sync.h
+@@ -37,6 +37,7 @@ Created 9/6/1995 Heikki Tuuri
+
+ #include "univ.i"
+ #include "ut0lst.h"
++#include "sync0types.h"
+
+ /** CPU cache line size */
+ #ifdef __powerpc__
--- /dev/null
+Description: Fix DEFAULT_MACHINE on mips
+ The DEFAULT_MACHINE constant is calculated from the CMAKE_SYSTEM_PROCESSOR
+ variable which contains the processor which built mariadb. Since most Debian
+ buildds run on 64-bit hardware even though they build 32-bit binaries,
+ DEFAULT_MACHINE previously contained "mips64" on 32-bit builds. This confuses
+ some mroonga tests which rely on DEFAULT_MACHINE to detect 64-bitness.
+ .
+ This patch fixes the value of DEFAULT_MACHINE so it always contains just "mips"
+ on 32-bit mips builds.
+Author: James Cowgill <jcowgill@debian.org>
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- mariadb-10.1.orig/cmake/package_name.cmake
++++ mariadb-10.1/cmake/package_name.cmake
+@@ -34,6 +34,10 @@ IF(NOT VERSION)
+ SET(DEFAULT_MACHINE "mips")
+ ENDIF()
+
++ IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64")
++ SET(DEFAULT_MACHINE "mips")
++ ENDIF()
++
+ IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
+ SET(DEFAULT_PLATFORM "win")
--- /dev/null
+From f5cf70d9d1dc7f4cbeffb7fb75cbbe08720e3873 Mon Sep 17 00:00:00 2001
+From: Gustavo Romero <gromero@br.ibm.com>
+Date: Sun, 26 Mar 2017 15:08:15 +0000
+Subject: [PATCH] Remove dependency on glibc on PPC
+
+Remove dependency on glibc by using gcc builtin function and no glibc
+wrappers.
+
+Currently there are no surrogates in musl for:
+
+ __ppc_get_timebase()
+ __ppc_set_ppr_low()
+ __ppc_set_ppr_med()
+
+however glibc __ppc_get_timebase() is just a wrapper for GCC builtin
+__builtin_get_timebase() available since GCC 4.8 [1], so assuming that
+aports on ppc64le will never be built using GCC < 4.8 we can just
+switch directly to the GCC builtin function.
+
+Also __ppc_set_ppr_{low,med}() are not available on musl but both
+are simple glibc wrappers on a single asm instruction, hence there
+is no harm in using asm directly instead. Actually, using asm
+directly was the first solution adopted in MariaDB [2].
+
+[1] https://goo.gl/jxLV6O
+[2] https://goo.gl/9bjuVC
+
+--- a/storage/xtradb/include/ut0ut.h
++++ b/storage/xtradb/include/ut0ut.h
+@@ -86,8 +86,7 @@ private:
+ independent way by using YieldProcessor. */
+ # define UT_RELAX_CPU() YieldProcessor()
+ # elif defined(__powerpc__)
+-#include <sys/platform/ppc.h>
+-# define UT_RELAX_CPU() __ppc_get_timebase()
++# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
+ # else
+ # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
+ # endif
+@@ -101,9 +100,8 @@ private:
+ #endif
+
+ # if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
+-#include <sys/platform/ppc.h>
+-# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
+-# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
++# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
++# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
+ # else
+ # define UT_LOW_PRIORITY_CPU() ((void)0)
+ # define UT_RESUME_PRIORITY_CPU() ((void)0)
+--- a/storage/innobase/include/ut0ut.h
++++ b/storage/innobase/include/ut0ut.h
+@@ -89,8 +89,7 @@ private:
+ independent way by using YieldProcessor. */
+ # define UT_RELAX_CPU() YieldProcessor()
+ # elif defined(__powerpc__)
+-#include <sys/platform/ppc.h>
+-# define UT_RELAX_CPU() __ppc_get_timebase()
++# define UT_RELAX_CPU() __builtin_ppc_get_timebase()
+ # else
+ # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
+ # endif
+@@ -104,9 +103,8 @@ private:
+ #endif
+
+ # if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
+-#include <sys/platform/ppc.h>
+-# define UT_LOW_PRIORITY_CPU() __ppc_set_ppr_low()
+-# define UT_RESUME_PRIORITY_CPU() __ppc_set_ppr_med()
++# define UT_LOW_PRIORITY_CPU() __asm__ __volatile__ ("or 1,1,1")
++# define UT_RESUME_PRIORITY_CPU() __asm__ __volatile__ ("or 2,2,2")
+ # else
+ # define UT_LOW_PRIORITY_CPU() ((void)0)
+ # define UT_RESUME_PRIORITY_CPU() ((void)0)
#
-# Copyright (C) 2006-2017 OpenWrt.org
-#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
PKG_NAME:=mc
PKG_VERSION:=4.8.20
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
PKG_LICENSE:=GPL-3.0+
ac_cv_search_addwstr=no \
ifeq ($(CONFIG_MC_DIFFVIEWER),)
-CONFIGURE_ARGS += \
- --without-diff-viewer
+CONFIGURE_ARGS += --without-diff-viewer
endif
ifeq ($(CONFIG_MC_EDITOR),)
-CONFIGURE_ARGS += \
- --without-internal-edit
+CONFIGURE_ARGS += --without-internal-edit
endif
ifeq ($(CONFIG_MC_SUBSHELL),)
-CONFIGURE_ARGS += \
- --without-subshell
+CONFIGURE_ARGS += --without-subshell
endif
ifeq ($(CONFIG_MC_LARGEFILE),)
-CONFIGURE_ARGS += \
- --disable-largefile
+CONFIGURE_ARGS += --disable-largefile
endif
ifeq ($(CONFIG_MC_BACKGROUND),)
-CONFIGURE_ARGS += \
- --disable-background
+CONFIGURE_ARGS += --disable-background
endif
ifeq ($(CONFIG_MC_CHARSET),)
-CONFIGURE_ARGS += \
- --disable-charset
+CONFIGURE_ARGS += --disable-charset
endif
ifeq ($(CONFIG_MC_VFS),)
-CONFIGURE_ARGS += \
- --disable-vfs
+CONFIGURE_ARGS += --disable-vfs
endif
define Package/mc/install
$(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.ext $(1)/etc/mc
$(INSTALL_DIR) $(1)/usr/share/mc/help
$(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/hlp/mc.hlp $(1)/usr/share/mc/help
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.menu $(1)/etc/mc
+ $(INSTALL_DIR) $(1)/etc/mc/skins
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/skins/default.ini $(1)/etc/mc/skins
+ $(INSTALL_DIR) $(1)/etc/mc/mcedit/Syntax
ifeq ($(CONFIG_MC_DIFFVIEWER),y)
ln -sf mc $(1)/usr/bin/mcdiff
endif
ifeq ($(CONFIG_MC_EDITOR),y)
ln -sf mc $(1)/usr/bin/mcedit
endif
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/mc.menu $(1)/etc/mc
- $(INSTALL_DIR) $(1)/etc/mc/skins
- $(INSTALL_DATA) $(PKG_BUILD_DIR)/misc/skins/default.ini $(1)/etc/mc/skins
- $(INSTALL_DIR) $(1)/etc/mc/mcedit/Syntax
+ifeq ($(CONFIG_MC_VFS),y)
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/vfs/extfs/helpers/sfs.ini $(1)/etc/mc
+ $(INSTALL_DIR) $(1)/usr/lib/mc/extfs.d
+endif
endef
define Package/mc/conffiles
include $(TOPDIR)/rules.mk
PKG_NAME:=mksh
-PKG_VERSION:=55
+PKG_VERSION:=56c
PKG_RELEASE:=1
-PKG_MAINTAINER:=Thorsten Glaser <tg@mirbsd.org>
+PKG_MAINTAINER:=Thorsten Glaser <tg@mirbsd.org>, \
+ Alif M. Ahmad <alive4ever@live.com>
PKG_LICENSE:=MirOS
PKG_SOURCE:=$(PKG_NAME)-R$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh \
http://pub.allbsd.org/MirOS/dist/mir/mksh
-PKG_HASH:=ced42cb4a181d97d52d98009eed753bd553f7c34e6991d404f9a8dcb45c35a57
+PKG_HASH:=dd86ebc421215a7b44095dc13b056921ba81e61b9f6f4cdab08ca135d02afb77
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/mksh
- SECTION:=shells
- CATEGORY:=Base system
+ SECTION:=utils
+ CATEGORY:=Utilities
+ SUBMENU:=Shells
TITLE:=MirBSD Korn Shell
DEPENDS:=$(DEP)
URL:=http://mirbsd.de/mksh
* Use `/etc/mkshrc` as default startup file, so there is no need to
manually source it during interactive session.
+From: Alif M. A. <alive4ever@live.com>
+Date: Thu, 11 Jan 2018 02:13:46 +0000
+Subject: [PATCH] Refresh 100-dot_mkshrc for mksh-R55
+
+Refreshed 100-dot_mkshrc for mksh-r56b
+
---
Reviewed-by: Thorsten Glaser <tg at mirbsd.org>
Signed-off-by: Alif M. A. <alive4ever at live.com>
--- a/dot.mkshrc
+++ b/dot.mkshrc
-@@ -56,10 +56,9 @@
- done
- )
+@@ -63,10 +63,9 @@
+ EDITOR=
+ done
-\\builtin alias ls=ls l='ls -F' la='l -a' ll='l -l' lo='l -alo'
-\: "${HOSTNAME:=$(\\builtin ulimit -c 0; \\builtin print -r -- $(hostname \
include $(TOPDIR)/rules.mk
PKG_NAME:=mktorrent
-PKG_VERSION:=1.0
+PKG_VERSION:=1.1
PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://github.com/Rudde/$(PKG_NAME)
+PKG_SOURCE_VERSION:=b20ef699b4ee5ded2f078ead776c7deac969e19a
+PKG_MIRROR_HASH:=abe5f96d1a91c00bd6dcf86640a205583e8607d2b0e9299a588cec76c556a8e8
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://downloads.sourceforge.net/$(PKG_NAME)/
-PKG_HASH:=6f8e562af6366e0d9bde76e434f740b55722c6c3c555860dbe80083f9d1d119f
-
include $(INCLUDE_DIR)/package.mk
define Package/mktorrent
SECTION:=net
CATEGORY:=Network
TITLE:=mktorrent
- URL:=http://mktorrent.sourceforge.net/
+ URL:=https://github.com/Rudde/mktorrent
endef
define Package/mktorrent/Description
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git
-PKG_SOURCE_DATE:=2017-03-20
-PKG_SOURCE_VERSION:=37c86e60c0442fef570b75cd81aeb1db4d0cbafd
-PKG_MIRROR_HASH:=652958e818d984804be6846ba504961f31c6e98414d0d34ec7a0d76d0844584a
+PKG_SOURCE_DATE:=2018-03-27
+PKG_SOURCE_VERSION:=b4fe0c8c0e57a74c01755fa9362703b60d7ee49d
+PKG_MIRROR_HASH:=ce7018d6ba6f2cccc64a40103cfb64f8905c96262140cdc8bf5f7674f192b81b
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
+++ /dev/null
-Sent already upstream, no response yet.
-
---- a/mmc.h 2016-09-11 18:01:53.000000000 +0200
-+++ b/mmc.h 2016-09-23 23:41:02.462632858 +0200
-@@ -17,7 +17,6 @@
- * those modifications are Copyright (c) 2016 SanDisk Corp.
- */
-
--#include <asm-generic/int-ll64.h>
- #include <linux/mmc/ioctl.h>
- #include <stdio.h>
-
+++ /dev/null
-#
-# Copyright (C) 2006-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/uclibc++.mk
-
-PKG_NAME:=mysql
-PKG_VERSION:=5.1.73
-PKG_RELEASE:=2
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=\
- http://mysql.he.net/Downloads/MySQL-5.1/ \
- http://www.linorg.usp.br/mysql/Downloads/MySQL-5.1/ \
- http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/ \
- http://mirror.switch.ch/ftp/mirror/mysql/Downloads/MySQL-5.1/
-
-PKG_HASH:=05ebe21305408b24407d14b77607a3e5ffa3c300e03f1359d3066f301989dcb5
-PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
-PKG_LICENSE:=GPL-2.0
-
-PKG_BUILD_PARALLEL:=1
-PKG_USE_MIPS16:=0
-
-PKG_FIXUP:=libtool
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libmysqlclient/Default
- SECTION:=libs
- CATEGORY:=Libraries
- DEPENDS:=$(CXX_DEPENDS) +zlib
- TITLE:=MySQL client library
- URL:=http://dev.mysql.com/
-endef
-
-define Package/mysql-server
- SECTION:=utils
- CATEGORY:=Utilities
- DEPENDS:=+libmysqlclient +libpthread +libncurses +libreadline
- TITLE:=MySQL Server
- URL:=http://dev.mysql.com/
- SUBMENU:=database
-endef
-
-define Package/libmysqlclient
- $(call Package/libmysqlclient/Default)
-endef
-
-define Package/libmysqlclient-r
- $(call Package/libmysqlclient/Default)
- TITLE += threadsafe
- DEPENDS+= +libpthread
-endef
-
-ifneq ($(CONFIG_USE_UCLIBCXX),)
- TARGET_CXX=g++-uc
-endif
-
-TARGET_CFLAGS += $(FPIC)
-
-CONFIGURE_ARGS += \
- --enable-shared \
- --enable-static \
- --enable-thread-safe-client \
- --disable-assembler \
- --with-pthread \
- --with-server \
- --without-mysqlmanager \
- --with-mysqld-user=root \
- --with-unix-socket-path=/tmp \
- --without-libwrap \
- --with-low-memory \
- --without-embedded-server \
- --without-query-cache \
- --without-ssl \
- --without-docs \
- --without-man \
- --without-readline \
- --without-debug \
- --with-named-thread-libs=-lpthread
-
-CONFIGURE_VARS += \
- mysql_cv_compress=yes \
- mysql_cv_gethostname_style=glibc2 \
- mysql_cv_gcc_atomic_builtins=yes \
- mysql_cv_gcc_atomic_builtins_pthread_t=yes \
- ac_cv_c_stack_direction=-1
-
-define Build/Compile
- +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="include" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- all
- $(MAKE) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="include" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- install
- g++ -I $(PKG_BUILD_DIR)/include \
- -o $(PKG_BUILD_DIR)/sql/gen_lex_hash \
- $(PKG_BUILD_DIR)/sql/gen_lex_hash.cc
- +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)/libmysql" \
- CC="g++" \
- CFLAGS="$(HOST_CFLAGS)" \
- CPPFLAGS="$(HOST_CFLAGS)" \
- LDFLAGS="$(HOST_LDFLAGS)" \
- conf_to_src
- +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="libmysql" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- all
- $(MAKE) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="libmysql" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- install
- +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="libmysql_r" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- all
- $(MAKE) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="libmysql_r" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- install
- $(MAKE) -C "$(PKG_BUILD_DIR)" \
- SUBDIRS="scripts" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- bin_SCRIPTS="mysql_config" \
- install
- +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- all
- $(MAKE) -C "$(PKG_BUILD_DIR)" \
- DESTDIR="$(PKG_INSTALL_DIR)" \
- install
-endef
-
-
-define Build/InstallDev
- $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_config $(1)/usr/bin/
- ln -sf $(STAGING_DIR)/usr/bin/mysql_config $(2)/bin/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/mysql $(1)/usr/include/
- # NOTE: needed for MySQL-Python
- $(CP) $(PKG_BUILD_DIR)/include/mysqld_error.h $(1)/usr/include/mysql/
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql $(1)/usr/lib/
- rm -f $(1)/usr/lib/mysql/libmysqlclient.la
-endef
-
-define Package/libmysqlclient/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient.so.* $(1)/usr/lib/
-endef
-define Package/libmysqlclient-r/install
- $(INSTALL_DIR) $(1)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/mysql/libmysqlclient_r.so.* $(1)/usr/lib/
-endef
-
-define Package/mysql-server/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/mysqld $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/myisamchk $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqladmin $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysqldump $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mysql_install_db $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/my_print_defaults $(1)/usr/bin/
- $(INSTALL_DIR) $(1)/etc/init.d/
- $(INSTALL_BIN) files/mysqld.init $(1)/etc/init.d/mysqld
- $(INSTALL_CONF) conf/my.cnf $(1)/etc/
- $(INSTALL_DIR) $(1)/usr/share/mysql
- $(INSTALL_DIR) $(1)/usr/share/mysql/english
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/english/errmsg.sys $(1)/usr/share/mysql/english
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/fill_help_tables.sql $(1)/usr/share/mysql/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables.sql $(1)/usr/share/mysql/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/mysql/mysql_system_tables_data.sql $(1)/usr/share/mysql/
-endef
-
-define Package/mysql-server/conffiles
-/etc/my.cnf
-endef
-
-$(eval $(call BuildPackage,mysql-server))
-$(eval $(call BuildPackage,libmysqlclient))
-$(eval $(call BuildPackage,libmysqlclient-r))
+++ /dev/null
-[client]
-port = 3306
-socket = /var/run/mysqld.sock
-
-[mysqld]
-user = root
-socket = /var/run/mysqld.sock
-port = 3306
-basedir = /usr
-
-############ Don't put this on the NAND #############
-# Figure out where you are going to put the databases
-# And run mysql_install_db --force
-datadir = /mnt/data/mysql/
-
-######### This should also not go on the NAND #######
-tmpdir = /mnt/data/tmp/
-
-skip-external-locking
-
-bind-address = 127.0.0.1
-
-# Fine Tuning
-key_buffer = 16M
-max_allowed_packet = 16M
-thread_stack = 192K
-thread_cache_size = 8
-
-# Here you can see queries with especially long duration
-#log_slow_queries = /var/log/mysql/mysql-slow.log
-#long_query_time = 2
-#log-queries-not-using-indexes
-
-# The following can be used as easy to replay backup logs or for replication.
-#server-id = 1
-#log_bin = /var/log/mysql/mysql-bin.log
-#expire_logs_days = 10
-#max_binlog_size = 100M
-#binlog_do_db = include_database_name
-#binlog_ignore_db = include_database_name
-
-
-[mysqldump]
-quick
-quote-names
-max_allowed_packet = 16M
-
-[mysql]
-#no-auto-rehash # faster start of mysql but no tab completition
-
-[isamchk]
-key_buffer = 16M
-
-
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2010-2011 OpenWrt.org
-
-START=95
-STOP=10
-
-SERVICE_DAEMONIZE=1
-SERVICE_WRITE_PID=1
-SERVICE_STOP_TIME=9
-PROG='/usr/bin/mysqld'
-
-start() {
- local conf='/etc/my.cnf'
- local datadir="$( sed -nE "s/^\s*datadir\s*=\s*('([^']*)'|\x22([^\x22]*)\x22|(.*\S))\s*$/\2\3\4/p" "$conf" )"
-
- [ -d "$datadir" ] || {
- logger -s "[ERROR] datadir '$datadir' in '$conf' does not exist"
- return 1
- }
-
- [ -f "$datadir/mysql/tables_priv.MYD" ] || {
- logger -s "[ERROR] can not detect privileges table, you might need to"
- logger -s "run 'mysql_install_db --force' to initialize the system tables"
- return 1
- }
-
- service_start "$PROG"
-}
-
-stop() {
- service_stop "$PROG"
-}
+++ /dev/null
---- a/scripts/mysql_install_db.sh
-+++ b/scripts/mysql_install_db.sh
-@@ -322,7 +322,7 @@ then
- fi
-
- # Try to determine the hostname
--hostname=`@HOSTNAME@`
-+hostname=`cat /proc/sys/kernel/hostname`
-
- # Check if hostname is valid
- if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
+++ /dev/null
---- a/storage/innodb_plugin/plug.in
-+++ b/storage/innodb_plugin/plug.in
-@@ -56,10 +56,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
- esac
- AC_SUBST(INNODB_DYNAMIC_CFLAGS)
-
-- AC_MSG_CHECKING(whether GCC atomic builtins are available)
-- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
-- AC_TRY_RUN(
-- [
-+ AC_CACHE_CHECK([whether GCC atomic builtins are available],
-+ [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
- int main()
- {
- long x;
-@@ -96,21 +94,18 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
-
- return(0);
- }
-- ],
-- [
-- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
-- [GCC atomic builtins are available])
-- AC_MSG_RESULT(yes)
-- ],
-- [
-- AC_MSG_RESULT(no)
-- ]
-- )
-+ ], [mysql_cv_gcc_atomic_builtins=yes],
-+ [mysql_cv_gcc_atomic_builtins=no],
-+ [mysql_cv_gcc_atomic_builtins=no])])
-+
-+ if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
-+ AC_DEFINE(HAVE_IB_GCC_ATOMIC_BUILTINS, 1,
-+ [Define to 1 if compiler provides atomic builtins.])
-+ fi
-
-- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
-- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
-- AC_TRY_RUN(
-- [
-+
-+ AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
-+ [mysql_cv_gcc_atomic_builtins_pthread_t], [AC_TRY_RUN([
- #include <pthread.h>
- #include <string.h>
-
-@@ -127,16 +122,14 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
-
- return(0);
- }
-- ],
-- [
-- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
-- [pthread_t can be used by GCC atomic builtins])
-- AC_MSG_RESULT(yes)
-- ],
-- [
-- AC_MSG_RESULT(no)
-- ]
-- )
-+ ], [mysql_cv_gcc_atomic_builtins_pthread_t=yes],
-+ [mysql_cv_gcc_atomic_builtins_pthread_t=no],
-+ [mysql_cv_gcc_atomic_builtins_pthread_t=no])])
-+
-+ if test "x$mysql_cv_gcc_atomic_builtins_pthread_t" = xyes; then
-+ AC_DEFINE(HAVE_IB_ATOMIC_PTHREAD_T_GCC, 1,
-+ [Define to 1 if pthread_t can be used by GCC atomic builtins])
-+ fi
-
- AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
- # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following
-@@ -156,7 +149,6 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
- AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
- [Define to 1 if Solaris libc atomic functions are available]
- )
-- fi
-
- AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
- # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
-@@ -230,6 +222,8 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
- AC_MSG_RESULT(no)
- ]
- )
-+ fi
-+
- ])
-
- # vim: set ft=config:
---- a/sql/gen_lex_hash.cc
-+++ b/sql/gen_lex_hash.cc
-@@ -344,55 +344,6 @@ void print_find_structs()
- }
-
-
--static void usage(int version)
--{
-- printf("%s Ver 3.6 Distrib %s, for %s (%s)\n",
-- my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-- if (version)
-- return;
-- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
-- puts("This program generates a perfect hashing function for the sql_lex.cc");
-- printf("Usage: %s [OPTIONS]\n\n", my_progname);
-- my_print_help(my_long_options);
--}
--
--
--extern "C" my_bool
--get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
-- char *argument __attribute__((unused)))
--{
-- switch(optid) {
-- case 'V':
-- usage(1);
-- exit(0);
-- case 'I':
-- case '?':
-- usage(0);
-- exit(0);
-- case '#':
-- DBUG_PUSH(argument ? argument : default_dbug_option);
-- break;
-- }
-- return 0;
--}
--
--
--static int get_options(int argc, char **argv)
--{
-- int ho_error;
--
-- if ((ho_error= handle_options(&argc, &argv, my_long_options, get_one_option)))
-- exit(ho_error);
--
-- if (argc >= 1)
-- {
-- usage(0);
-- exit(1);
-- }
-- return(0);
--}
--
--
- int check_dup_symbols(SYMBOL *s1, SYMBOL *s2)
- {
- if (s1->length!=s2->length || strncmp(s1->name,s2->name,s1->length))
-@@ -443,12 +394,6 @@ int check_duplicates()
-
- int main(int argc,char **argv)
- {
-- MY_INIT(argv[0]);
-- DBUG_PROCESS(argv[0]);
--
-- if (get_options(argc,(char **) argv))
-- exit(1);
--
- /* Broken up to indicate that it's not advice to you, gentle reader. */
- printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
-
-@@ -549,7 +494,6 @@ static SYMBOL *get_hash_symbol(const cha
- }\n\
- }\n"
- );
-- my_end(0);
- exit(0);
- }
-
---- a/sql/Makefile.am
-+++ b/sql/Makefile.am
-@@ -26,7 +26,6 @@ INCLUDES = @ZLIB_INCLUDES@ \
- WRAPLIBS= @WRAPLIBS@
- SUBDIRS = share
- libexec_PROGRAMS = mysqld
--EXTRA_PROGRAMS = gen_lex_hash
- bin_PROGRAMS = mysql_tzinfo_to_sql
-
- noinst_LTLIBRARIES= libndb.la \
+++ /dev/null
---- a/sql/sql_lex.cc
-+++ b/sql/sql_lex.cc
-@@ -775,14 +775,13 @@ bool consume_comment(Lex_input_stream *l
- (which can't be followed by a signed number)
- */
-
--int MYSQLlex(void *arg, void *yythd)
-+int MYSQLlex(void *arg, THD *thd)
- {
- reg1 uchar c= 0;
- bool comment_closed;
- int tokval, result_state;
- uint length;
- enum my_lex_states state;
-- THD *thd= (THD *)yythd;
- Lex_input_stream *lip= & thd->m_parser_state->m_lip;
- LEX *lex= thd->lex;
- YYSTYPE *yylval=(YYSTYPE*) arg;
---- a/sql/sql_lex.h
-+++ b/sql/sql_lex.h
-@@ -2072,7 +2072,7 @@ extern void lex_init(void);
- extern void lex_free(void);
- extern void lex_start(THD *thd);
- extern void lex_end(LEX *lex);
--extern int MYSQLlex(void *arg, void *yythd);
-+extern int MYSQLlex(void *arg, THD *thd);
-
- extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
-
---- a/sql/sql_parse.cc
-+++ b/sql/sql_parse.cc
-@@ -8012,7 +8012,7 @@ bool check_host_name(LEX_STRING *str)
- }
-
-
--extern int MYSQLparse(void *thd); // from sql_yacc.cc
-+extern int MYSQLparse(THD *thd); // from sql_yacc.cc
-
-
- /**
---- a/sql/sql_yacc.yy
-+++ b/sql/sql_yacc.yy
-@@ -25,17 +25,15 @@
- %{
- /* thd is passed as an argument to yyparse(), and subsequently to yylex().
- ** The type will be void*, so it must be cast to (THD*) when used.
--** Use the YYTHD macro for this.
-+** Use the thd macro for this.
- */
--#define YYPARSE_PARAM yythd
--#define YYLEX_PARAM yythd
--#define YYTHD ((THD *)yythd)
--#define YYLIP (& YYTHD->m_parser_state->m_lip)
-+#define YYLIP (& thd->m_parser_state->m_lip)
-+#define YYPS (& thd->m_parser_state->m_yacc)
-
- #define MYSQL_YACC
- #define YYINITDEPTH 100
- #define YYMAXDEPTH 3200 /* Because of 64K stack */
--#define Lex (YYTHD->lex)
-+#define Lex (thd->lex)
- #define Select Lex->current_select
- #include "mysql_priv.h"
- #include "slave.h"
-@@ -64,7 +62,7 @@ const LEX_STRING null_lex_str= {0,0};
- ulong val= *(F); \
- if (my_yyoverflow((B), (D), &val)) \
- { \
-- yyerror((char*) (A)); \
-+ yyerror(current_thd, (char*) (A)); \
- return 2; \
- } \
- else \
-@@ -76,7 +74,7 @@ const LEX_STRING null_lex_str= {0,0};
- #define MYSQL_YYABORT \
- do \
- { \
-- LEX::cleanup_lex_after_parse_error(YYTHD);\
-+ LEX::cleanup_lex_after_parse_error(thd); \
- YYABORT; \
- } while (0)
-
-@@ -159,10 +157,8 @@ void my_parse_error(const char *s)
- to abort from the parser.
- */
-
--void MYSQLerror(const char *s)
-+void MYSQLerror(THD *thd, const char *s)
- {
-- THD *thd= current_thd;
--
- /*
- Restore the original LEX if it was replaced when parsing
- a stored procedure. We must ensure that a parsing error
-@@ -675,7 +671,10 @@ static bool add_create_index (LEX *lex,
- bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
- %}
-
--%pure_parser /* We have threads */
-+/* We have threads */
-+%define api.pure
-+%parse-param { THD *thd }
-+%lex-param { THD *thd }
- /*
- Currently there are 169 shift/reduce conflicts.
- We should not introduce new conflicts any more.
-@@ -1516,7 +1515,6 @@ rule: <-- starts at col 1
- query:
- END_OF_INPUT
- {
-- THD *thd= YYTHD;
- if (!thd->bootstrap &&
- (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
- {
-@@ -1530,7 +1528,7 @@ query:
- {
- Lex_input_stream *lip = YYLIP;
-
-- if ((YYTHD->client_capabilities & CLIENT_MULTI_QUERIES) &&
-+ if ((thd->client_capabilities & CLIENT_MULTI_QUERIES) &&
- ! lip->stmt_prepare_mode &&
- ! lip->eof())
- {
-@@ -1626,7 +1624,6 @@ statement:
- deallocate:
- deallocate_or_drop PREPARE_SYM ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
- lex->prepared_stmt_name= $3;
-@@ -1641,7 +1638,6 @@ deallocate_or_drop:
- prepare:
- PREPARE_SYM ident FROM prepare_src
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->sql_command= SQLCOM_PREPARE;
- lex->prepared_stmt_name= $2;
-@@ -1651,14 +1647,12 @@ prepare:
- prepare_src:
- TEXT_STRING_sys
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->prepared_stmt_code= $1;
- lex->prepared_stmt_code_is_varref= FALSE;
- }
- | '@' ident_or_text
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->prepared_stmt_code= $2;
- lex->prepared_stmt_code_is_varref= TRUE;
-@@ -1668,7 +1662,6 @@ prepare_src:
- execute:
- EXECUTE_SYM ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->sql_command= SQLCOM_EXECUTE;
- lex->prepared_stmt_name= $2;
-@@ -1826,7 +1819,6 @@ master_file_def:
- create:
- CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->sql_command= SQLCOM_CREATE_TABLE;
- if (!lex->select_lex.add_table_to_list(thd, $5, NULL,
-@@ -1844,13 +1836,13 @@ create:
- }
- create2
- {
-- LEX *lex= YYTHD->lex;
-+ LEX *lex= thd->lex;
- lex->current_select= &lex->select_lex;
- if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) &&
- !lex->create_info.db_type)
- {
-- lex->create_info.db_type= ha_default_handlerton(YYTHD);
-- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
-+ lex->create_info.db_type= ha_default_handlerton(thd);
-+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_WARN_USING_OTHER_HANDLER,
- ER(ER_WARN_USING_OTHER_HANDLER),
- ha_resolve_storage_engine_name(lex->create_info.db_type),
-@@ -1979,7 +1971,6 @@ server_option:
- event_tail:
- remember_name EVENT_SYM opt_if_not_exists sp_name
- {
-- THD *thd= YYTHD;
- LEX *lex=Lex;
-
- lex->stmt_definition_begin= $1;
-@@ -2046,7 +2037,7 @@ opt_ev_status:
- ev_starts:
- /* empty */
- {
-- Item *item= new (YYTHD->mem_root) Item_func_now_local();
-+ Item *item= new (thd->mem_root) Item_func_now_local();
- if (item == NULL)
- MYSQL_YYABORT;
- Lex->event_parse_data->item_starts= item;
-@@ -2096,7 +2087,6 @@ opt_ev_comment:
-
- ev_sql_stmt:
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
-
-@@ -2139,7 +2129,6 @@ ev_sql_stmt:
- }
- ev_sql_stmt_inner
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
-
- /* return back to the original memory root ASAP */
-@@ -2198,11 +2187,10 @@ sp_name:
- $$= new sp_name($1, $3, true);
- if ($$ == NULL)
- MYSQL_YYABORT;
-- $$->init_qname(YYTHD);
-+ $$->init_qname(thd);
- }
- | ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- LEX_STRING db;
- if (check_routine_name(&$1))
-@@ -2272,7 +2260,7 @@ call:
- lex->sql_command= SQLCOM_CALL;
- lex->spname= $2;
- lex->value_list.empty();
-- sp_add_used_routine(lex, YYTHD, $2, TYPE_ENUM_PROCEDURE);
-+ sp_add_used_routine(lex, thd, $2, TYPE_ENUM_PROCEDURE);
- }
- opt_sp_cparam_list {}
- ;
-@@ -2345,7 +2333,7 @@ sp_fdparam:
- (enum enum_field_types)$3,
- sp_param_in);
-
-- if (lex->sphead->fill_field_definition(YYTHD, lex,
-+ if (lex->sphead->fill_field_definition(thd, lex,
- (enum enum_field_types) $3,
- &spvar->field_def))
- {
-@@ -2382,7 +2370,7 @@ sp_pdparam:
- (enum enum_field_types)$4,
- (sp_param_mode_t)$1);
-
-- if (lex->sphead->fill_field_definition(YYTHD, lex,
-+ if (lex->sphead->fill_field_definition(thd, lex,
- (enum enum_field_types) $4,
- &spvar->field_def))
- {
-@@ -2445,13 +2433,12 @@ sp_decl:
- {
- LEX *lex= Lex;
-
-- lex->sphead->reset_lex(YYTHD);
-+ lex->sphead->reset_lex(thd);
- lex->spcont->declare_var_boundary($2);
- }
- type
- sp_opt_default
- {
-- THD *thd= YYTHD;
- LEX *lex= Lex;
- sp_pcontext *pctx= lex->spcont;
- uint num_vars= pctx->context_var_count();
-@@ -2477,7 +2464,7 @@ sp_decl:
- spvar->type= var_type;
- spvar->dflt= dflt_value_item;
-
-- if (lex->sphead->fill_field_definition(YYTHD, lex, var_type,
-+ if (lex->sphead->fill_field_definition(thd, lex, var_type,
- &spvar->field_def))
- {
- MYSQL_YYABORT;
-@@ -2501,7 +2488,7 @@ sp_decl:
- }
-
- pctx->declare_var_boundary(0);
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- $$.vars= $2;
- $$.conds= $$.hndlrs= $$.curs= 0;
-@@ -2516,7 +2503,7 @@ sp_decl:
- my_error(ER_SP_DUP_COND, MYF(0), $2.str);
- MYSQL_YYABORT;
- }
-- if(YYTHD->lex->spcont->push_cond(&$2, $5))
-+ if(thd->lex->spcont->push_cond(&$2, $5))
- MYSQL_YYABORT;
- $$.vars= $$.hndlrs= $$.curs= 0;
- $$.conds= 1;
-@@ -2602,7 +2589,7 @@ sp_decl:
-
- sp_cursor_stmt:
- {
-- Lex->sphead->reset_lex(YYTHD);
-+ Lex->sphead->reset_lex(thd);
- }
- select
- {
-@@ -2618,7 +2605,7 @@ sp_cursor_stmt:
- }
- lex->sp_lex_in_use= TRUE;
- $$= lex;
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- }
- ;
-@@ -2662,7 +2649,7 @@ sp_hcond_element:
- sp_cond:
- ulong_num
- { /* mysql errno */
-- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
-+ $$= (sp_cond_type_t *)thd->alloc(sizeof(sp_cond_type_t));
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->type= sp_cond_type_t::number;
-@@ -2675,7 +2662,7 @@ sp_cond:
- my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
- MYSQL_YYABORT;
- }
-- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
-+ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t));
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->type= sp_cond_type_t::state;
-@@ -2705,21 +2692,21 @@ sp_hcond:
- }
- | SQLWARNING_SYM /* SQLSTATEs 01??? */
- {
-- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
-+ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t));
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->type= sp_cond_type_t::warning;
- }
- | not FOUND_SYM /* SQLSTATEs 02??? */
- {
-- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
-+ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t));
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->type= sp_cond_type_t::notfound;
- }
- | SQLEXCEPTION_SYM /* All other SQLSTATEs */
- {
-- $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
-+ $$= (sp_cond_type_t *) thd->alloc(sizeof(sp_cond_type_t));
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->type= sp_cond_type_t::exception;
-@@ -2789,7 +2776,6 @@ sp_proc_stmt_if:
-
- sp_proc_stmt_statement:
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
-
-@@ -2798,7 +2784,6 @@ sp_proc_stmt_statement:
- }
- statement
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_head *sp= lex->sphead;
-@@ -2845,7 +2830,7 @@ sp_proc_stmt_statement:
-
- sp_proc_stmt_return:
- RETURN_SYM
-- { Lex->sphead->reset_lex(YYTHD); }
-+ { Lex->sphead->reset_lex(thd); }
- expr
- {
- LEX *lex= Lex;
-@@ -2867,7 +2852,7 @@ sp_proc_stmt_return:
- MYSQL_YYABORT;
- sp->m_flags|= sp_head::HAS_RETURN;
- }
-- if (sp->restore_lex(YYTHD))
-+ if (sp->restore_lex(thd))
- MYSQL_YYABORT;
- }
- ;
-@@ -3094,7 +3079,7 @@ sp_fetch_list:
- ;
-
- sp_if:
-- { Lex->sphead->reset_lex(YYTHD); }
-+ { Lex->sphead->reset_lex(thd); }
- expr THEN_SYM
- {
- LEX *lex= Lex;
-@@ -3108,7 +3093,7 @@ sp_if:
- sp->add_cont_backpatch(i) ||
- sp->add_instr(i))
- MYSQL_YYABORT;
-- if (sp->restore_lex(YYTHD))
-+ if (sp->restore_lex(thd))
- MYSQL_YYABORT;
- }
- sp_proc_stmts1
-@@ -3147,7 +3132,7 @@ simple_case_stmt:
- {
- LEX *lex= Lex;
- case_stmt_action_case(lex);
-- lex->sphead->reset_lex(YYTHD); /* For expr $3 */
-+ lex->sphead->reset_lex(thd); /* For expr $3 */
- }
- expr
- {
-@@ -3156,7 +3141,7 @@ simple_case_stmt:
- MYSQL_YYABORT;
-
- /* For expr $3 */
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- }
- simple_when_clause_list
-@@ -3198,7 +3183,7 @@ searched_when_clause_list:
- simple_when_clause:
- WHEN_SYM
- {
-- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
-+ Lex->sphead->reset_lex(thd); /* For expr $3 */
- }
- expr
- {
-@@ -3208,7 +3193,7 @@ simple_when_clause:
- if (case_stmt_action_when(lex, $3, true))
- MYSQL_YYABORT;
- /* For expr $3 */
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- }
- THEN_SYM
-@@ -3223,7 +3208,7 @@ simple_when_clause:
- searched_when_clause:
- WHEN_SYM
- {
-- Lex->sphead->reset_lex(YYTHD); /* For expr $3 */
-+ Lex->sphead->reset_lex(thd); /* For expr $3 */
- }
- expr
- {
-@@ -3231,7 +3216,7 @@ searched_when_clause:
- if (case_stmt_action_when(lex, $3, false))
- MYSQL_YYABORT;
- /* For expr $3 */
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- }
- THEN_SYM
-@@ -3395,7 +3380,7 @@ sp_unlabeled_control:
- MYSQL_YYABORT;
- }
- | WHILE_SYM
-- { Lex->sphead->reset_lex(YYTHD); }
-+ { Lex->sphead->reset_lex(thd); }
- expr DO_SYM
- {
- LEX *lex= Lex;
-@@ -3409,7 +3394,7 @@ sp_unlabeled_control:
- sp->new_cont_backpatch(i) ||
- sp->add_instr(i))
- MYSQL_YYABORT;
-- if (sp->restore_lex(YYTHD))
-+ if (sp->restore_lex(thd))
- MYSQL_YYABORT;
- }
- sp_proc_stmts1 END WHILE_SYM
-@@ -3424,7 +3409,7 @@ sp_unlabeled_control:
- lex->sphead->do_cont_backpatch();
- }
- | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM
-- { Lex->sphead->reset_lex(YYTHD); }
-+ { Lex->sphead->reset_lex(thd); }
- expr END REPEAT_SYM
- {
- LEX *lex= Lex;
-@@ -3436,7 +3421,7 @@ sp_unlabeled_control:
- if (i == NULL ||
- lex->sphead->add_instr(i))
- MYSQL_YYABORT;
-- if (lex->sphead->restore_lex(YYTHD))
-+ if (lex->sphead->restore_lex(thd))
- MYSQL_YYABORT;
- /* We can shortcut the cont_backpatch here */
- i->m_cont_dest= ip+1;
-@@ -3859,7 +3844,6 @@ create2:
- create3 {}
- | LIKE table_ident
- {
-- THD *thd= YYTHD;
- TABLE_LIST *src_table;
- LEX *lex= thd->lex;
-
-@@ -3873,7 +3857,6 @@ create2:
- }
- | '(' LIKE table_ident ')'
- {
-- THD *thd= YYTHD;
- TABLE_LIST *src_table;
- LEX *lex= thd->lex;
-
-@@ -4342,7 +4325,6 @@ part_bit_expr:
- bit_expr
- {
- Item *part_expr= $1;
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Name_resolution_context *context= &lex->current_select->context;
- TABLE_LIST *save_list= context->table_list;
-@@ -4364,7 +4346,7 @@ part_bit_expr:
- my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
- MYSQL_YYABORT;
- }
-- if (part_expr->fix_fields(YYTHD, (Item**)0) ||
-+ if (part_expr->fix_fields(thd, (Item**)0) ||
- ((context->table_list= save_list), FALSE) ||
- (!part_expr->const_item()) ||
- (!lex->safe_to_cache_query))
-@@ -4629,7 +4611,7 @@ create_table_option:
- | TYPE_SYM opt_equal storage_engines
- {
- Lex->create_info.db_type= $3;
-- WARN_DEPRECATED(yythd, "6.0", "TYPE=storage_engine",
-+ WARN_DEPRECATED(thd, "6.0", "TYPE=storage_engine",
- "'ENGINE=storage_engine'");
- Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
- }
-@@ -4791,19 +4773,19 @@ default_collation:
- storage_engines:
- ident_or_text
- {
-- plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1);
-+ plugin_ref plugin= ha_resolve_by_name(thd, &$1);
-
- if (plugin)
- $$= plugin_data(plugin, handlerton*);
- else
- {
-- if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
-+ if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
- MYSQL_YYABORT;
- }
- $$= 0;
-- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
-+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_UNKNOWN_STORAGE_ENGINE,
- ER(ER_UNKNOWN_STORAGE_ENGINE),
- $1.str);
-@@ -4815,7 +4797,7 @@ known_storage_engines:
- ident_or_text
- {
- plugin_ref plugin;
-- if ((plugin= ha_resolve_by_name(YYTHD, &$1)))
-+ if ((plugin= ha_resolve_by_name(thd, &$1)))
- $$= plugin_data(plugin, handlerton*);
- else
- {
-@@ -5043,7 +5025,7 @@ type:
- {
- char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
- my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
-- push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE,
-+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
- ER_WARN_DEPRECATED_SYNTAX,
- ER(ER_WARN_DEPRECATED_SYNTAX),
- buff, "YEAR(4)");
-@@ -5057,7 +5039,7 @@ type:
- { $$=MYSQL_TYPE_TIME; }
- | TIMESTAMP opt_field_length
- {
-- if (YYTHD->variables.sql_mode & MODE_MAXDB)
-+ if (thd->variables.sql_mode & MODE_MAXDB)
- $$=MYSQL_TYPE_DATETIME;
- else
- {
-@@ -5189,7 +5171,7 @@ int_type:
- real_type:
- REAL
- {
-- $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
-+ $$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ?
- MYSQL_TYPE_FLOAT : MYSQL_TYPE_DOUBLE;
- }
- | DOUBLE_SYM
-@@ -5263,7 +5245,7 @@ attribute:
- | DEFAULT now_or_signed_literal { Lex->default_value=$2; }
- | ON UPDATE_SYM NOW_SYM optional_braces
- {
-- Item *item= new (YYTHD->mem_root) Item_func_now_local();
-+ Item *item= new (thd->mem_root) Item_func_now_local();
- if (item == NULL)
- MYSQL_YYABORT;
- Lex->on_update_value= item;
-@@ -5312,7 +5294,7 @@ attribute:
- now_or_signed_literal:
- NOW_SYM optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_now_local();
-+ $$= new (thd->mem_root) Item_func_now_local();
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -5673,7 +5655,6 @@ string_list:
- alter:
- ALTER opt_ignore TABLE_SYM table_ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->name.str= 0;
- lex->name.length= 0;
-@@ -5799,7 +5780,7 @@ alter:
- Event_parse_data.
- */
-
-- if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD)))
-+ if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd)))
- MYSQL_YYABORT;
- Lex->event_parse_data->identifier= $4;
-
-@@ -6192,7 +6173,6 @@ alter_list_item:
- {
- if (!$4)
- {
-- THD *thd= YYTHD;
- $4= thd->variables.collation_database;
- }
- $5= $5 ? $5 : $4;
-@@ -6556,7 +6536,7 @@ keycache_list:
- assign_to_keycache:
- table_ident cache_keys_spec
- {
-- if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ,
-+ if (!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ,
- Select->pop_index_hints()))
- MYSQL_YYABORT;
- }
-@@ -6585,7 +6565,7 @@ preload_list:
- preload_keys:
- table_ident cache_keys_spec opt_ignore_leaves
- {
-- if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ,
-+ if (!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ,
- Select->pop_index_hints()))
- MYSQL_YYABORT;
- }
-@@ -6593,7 +6573,7 @@ preload_keys:
-
- cache_keys_spec:
- {
-- Lex->select_lex.alloc_index_hints(YYTHD);
-+ Lex->select_lex.alloc_index_hints(thd);
- Select->set_index_hint_type(INDEX_HINT_USE,
- global_system_variables.old_mode ?
- INDEX_HINT_MASK_JOIN :
-@@ -6813,7 +6793,6 @@ select_item_list:
- | select_item
- | '*'
- {
-- THD *thd= YYTHD;
- Item *item= new (thd->mem_root)
- Item_field(&thd->lex->current_select->context,
- NULL, NULL, "*");
-@@ -6828,7 +6807,6 @@ select_item_list:
- select_item:
- remember_name select_item2 remember_end select_alias
- {
-- THD *thd= YYTHD;
- DBUG_ASSERT($1 < $3);
-
- if (add_item_to_list(thd, $2))
-@@ -6929,7 +6907,7 @@ expr:
- else
- {
- /* X OR Y */
-- $$ = new (YYTHD->mem_root) Item_cond_or($1, $3);
-+ $$ = new (thd->mem_root) Item_cond_or($1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -6937,7 +6915,7 @@ expr:
- | expr XOR expr %prec XOR
- {
- /* XOR is a proprietary extension */
-- $$ = new (YYTHD->mem_root) Item_cond_xor($1, $3);
-+ $$ = new (thd->mem_root) Item_cond_xor($1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -6979,50 +6957,50 @@ expr:
- else
- {
- /* X AND Y */
-- $$ = new (YYTHD->mem_root) Item_cond_and($1, $3);
-+ $$ = new (thd->mem_root) Item_cond_and($1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- }
- | NOT_SYM expr %prec NOT_SYM
- {
-- $$= negate_expression(YYTHD, $2);
-+ $$= negate_expression(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS TRUE_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_istrue($1);
-+ $$= new (thd->mem_root) Item_func_istrue($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS not TRUE_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnottrue($1);
-+ $$= new (thd->mem_root) Item_func_isnottrue($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS FALSE_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isfalse($1);
-+ $$= new (thd->mem_root) Item_func_isfalse($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS not FALSE_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnotfalse($1);
-+ $$= new (thd->mem_root) Item_func_isnotfalse($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS UNKNOWN_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnull($1);
-+ $$= new (thd->mem_root) Item_func_isnull($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS not UNKNOWN_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
-+ $$= new (thd->mem_root) Item_func_isnotnull($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7032,19 +7010,19 @@ expr:
- bool_pri:
- bool_pri IS NULL_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnull($1);
-+ $$= new (thd->mem_root) Item_func_isnull($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri IS not NULL_SYM %prec IS
- {
-- $$= new (YYTHD->mem_root) Item_func_isnotnull($1);
-+ $$= new (thd->mem_root) Item_func_isnotnull($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
- {
-- $$= new (YYTHD->mem_root) Item_func_equal($1,$3);
-+ $$= new (thd->mem_root) Item_func_equal($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7066,13 +7044,12 @@ bool_pri:
- predicate:
- bit_expr IN_SYM '(' subselect ')'
- {
-- $$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
-+ $$= new (thd->mem_root) Item_in_subselect($1, $4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr not IN_SYM '(' subselect ')'
- {
-- THD *thd= YYTHD;
- Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
- if (item == NULL)
- MYSQL_YYABORT;
-@@ -7082,7 +7059,7 @@ predicate:
- }
- | bit_expr IN_SYM '(' expr ')'
- {
-- $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
-+ $$= handle_sql2003_note184_exception(thd, $1, true, $4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7090,13 +7067,13 @@ predicate:
- {
- $6->push_front($4);
- $6->push_front($1);
-- $$= new (YYTHD->mem_root) Item_func_in(*$6);
-+ $$= new (thd->mem_root) Item_func_in(*$6);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr not IN_SYM '(' expr ')'
- {
-- $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
-+ $$= handle_sql2003_note184_exception(thd, $1, false, $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7104,7 +7081,7 @@ predicate:
- {
- $7->push_front($5);
- $7->push_front($1);
-- Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
-+ Item_func_in *item = new (thd->mem_root) Item_func_in(*$7);
- if (item == NULL)
- MYSQL_YYABORT;
- item->negate();
-@@ -7112,14 +7089,14 @@ predicate:
- }
- | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
- {
-- $$= new (YYTHD->mem_root) Item_func_between($1,$3,$5);
-+ $$= new (thd->mem_root) Item_func_between($1,$3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
- {
- Item_func_between *item;
-- item= new (YYTHD->mem_root) Item_func_between($1,$4,$6);
-+ item= new (thd->mem_root) Item_func_between($1,$4,$6);
- if (item == NULL)
- MYSQL_YYABORT;
- item->negate();
-@@ -7127,42 +7104,42 @@ predicate:
- }
- | bit_expr SOUNDS_SYM LIKE bit_expr
- {
-- Item *item1= new (YYTHD->mem_root) Item_func_soundex($1);
-- Item *item4= new (YYTHD->mem_root) Item_func_soundex($4);
-+ Item *item1= new (thd->mem_root) Item_func_soundex($1);
-+ Item *item4= new (thd->mem_root) Item_func_soundex($4);
- if ((item1 == NULL) || (item4 == NULL))
- MYSQL_YYABORT;
-- $$= new (YYTHD->mem_root) Item_func_eq(item1, item4);
-+ $$= new (thd->mem_root) Item_func_eq(item1, item4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr LIKE simple_expr opt_escape
- {
-- $$= new (YYTHD->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
-+ $$= new (thd->mem_root) Item_func_like($1,$3,$4,Lex->escape_used);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr not LIKE simple_expr opt_escape
- {
-- Item *item= new (YYTHD->mem_root) Item_func_like($1,$4,$5,
-+ Item *item= new (thd->mem_root) Item_func_like($1,$4,$5,
- Lex->escape_used);
- if (item == NULL)
- MYSQL_YYABORT;
-- $$= new (YYTHD->mem_root) Item_func_not(item);
-+ $$= new (thd->mem_root) Item_func_not(item);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr REGEXP bit_expr
- {
-- $$= new (YYTHD->mem_root) Item_func_regex($1,$3);
-+ $$= new (thd->mem_root) Item_func_regex($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr not REGEXP bit_expr
- {
-- Item *item= new (YYTHD->mem_root) Item_func_regex($1,$4);
-+ Item *item= new (thd->mem_root) Item_func_regex($1,$4);
- if (item == NULL)
- MYSQL_YYABORT;
-- $$= negate_expression(YYTHD, item);
-+ $$= negate_expression(thd, item);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7172,85 +7149,85 @@ predicate:
- bit_expr:
- bit_expr '|' bit_expr %prec '|'
- {
-- $$= new (YYTHD->mem_root) Item_func_bit_or($1,$3);
-+ $$= new (thd->mem_root) Item_func_bit_or($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '&' bit_expr %prec '&'
- {
-- $$= new (YYTHD->mem_root) Item_func_bit_and($1,$3);
-+ $$= new (thd->mem_root) Item_func_bit_and($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT
- {
-- $$= new (YYTHD->mem_root) Item_func_shift_left($1,$3);
-+ $$= new (thd->mem_root) Item_func_shift_left($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT
- {
-- $$= new (YYTHD->mem_root) Item_func_shift_right($1,$3);
-+ $$= new (thd->mem_root) Item_func_shift_right($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '+' bit_expr %prec '+'
- {
-- $$= new (YYTHD->mem_root) Item_func_plus($1,$3);
-+ $$= new (thd->mem_root) Item_func_plus($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '-' bit_expr %prec '-'
- {
-- $$= new (YYTHD->mem_root) Item_func_minus($1,$3);
-+ $$= new (thd->mem_root) Item_func_minus($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '+' INTERVAL_SYM expr interval %prec '+'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,0);
-+ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '-' INTERVAL_SYM expr interval %prec '-'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($1,$4,$5,1);
-+ $$= new (thd->mem_root) Item_date_add_interval($1,$4,$5,1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '*' bit_expr %prec '*'
- {
-- $$= new (YYTHD->mem_root) Item_func_mul($1,$3);
-+ $$= new (thd->mem_root) Item_func_mul($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '/' bit_expr %prec '/'
- {
-- $$= new (YYTHD->mem_root) Item_func_div($1,$3);
-+ $$= new (thd->mem_root) Item_func_div($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '%' bit_expr %prec '%'
- {
-- $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
-+ $$= new (thd->mem_root) Item_func_mod($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr DIV_SYM bit_expr %prec DIV_SYM
- {
-- $$= new (YYTHD->mem_root) Item_func_int_div($1,$3);
-+ $$= new (thd->mem_root) Item_func_int_div($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr MOD_SYM bit_expr %prec MOD_SYM
- {
-- $$= new (YYTHD->mem_root) Item_func_mod($1,$3);
-+ $$= new (thd->mem_root) Item_func_mod($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | bit_expr '^' bit_expr
- {
-- $$= new (YYTHD->mem_root) Item_func_bit_xor($1,$3);
-+ $$= new (thd->mem_root) Item_func_bit_xor($1,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7299,7 +7276,6 @@ simple_expr:
- | function_call_conflict
- | simple_expr COLLATE_SYM ident_or_text %prec NEG
- {
-- THD *thd= YYTHD;
- Item *i1= new (thd->mem_root) Item_string($3.str,
- $3.length,
- thd->charset());
-@@ -7315,7 +7291,7 @@ simple_expr:
- | sum_expr
- | simple_expr OR_OR_SYM simple_expr
- {
-- $$= new (YYTHD->mem_root) Item_func_concat($1, $3);
-+ $$= new (thd->mem_root) Item_func_concat($1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7325,25 +7301,25 @@ simple_expr:
- }
- | '-' simple_expr %prec NEG
- {
-- $$= new (YYTHD->mem_root) Item_func_neg($2);
-+ $$= new (thd->mem_root) Item_func_neg($2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '~' simple_expr %prec NEG
- {
-- $$= new (YYTHD->mem_root) Item_func_bit_neg($2);
-+ $$= new (thd->mem_root) Item_func_bit_neg($2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | not2 simple_expr %prec NEG
- {
-- $$= negate_expression(YYTHD, $2);
-+ $$= negate_expression(thd, $2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | '(' subselect ')'
- {
-- $$= new (YYTHD->mem_root) Item_singlerow_subselect($2);
-+ $$= new (thd->mem_root) Item_singlerow_subselect($2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7352,20 +7328,20 @@ simple_expr:
- | '(' expr ',' expr_list ')'
- {
- $4->push_front($2);
-- $$= new (YYTHD->mem_root) Item_row(*$4);
-+ $$= new (thd->mem_root) Item_row(*$4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | ROW_SYM '(' expr ',' expr_list ')'
- {
- $5->push_front($3);
-- $$= new (YYTHD->mem_root) Item_row(*$5);
-+ $$= new (thd->mem_root) Item_row(*$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | EXISTS '(' subselect ')'
- {
-- $$= new (YYTHD->mem_root) Item_exists_subselect($3);
-+ $$= new (thd->mem_root) Item_exists_subselect($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7374,7 +7350,7 @@ simple_expr:
- | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
- {
- $2->push_front($5);
-- Item_func_match *i1= new (YYTHD->mem_root) Item_func_match(*$2, $6);
-+ Item_func_match *i1= new (thd->mem_root) Item_func_match(*$2, $6);
- if (i1 == NULL)
- MYSQL_YYABORT;
- Select->add_ftfunc_to_list(i1);
-@@ -7382,7 +7358,7 @@ simple_expr:
- }
- | BINARY simple_expr %prec NEG
- {
-- $$= create_func_cast(YYTHD, $2, ITEM_CAST_CHAR, NULL, NULL,
-+ $$= create_func_cast(thd, $2, ITEM_CAST_CHAR, NULL, NULL,
- &my_charset_bin);
- if ($$ == NULL)
- MYSQL_YYABORT;
-@@ -7390,27 +7366,27 @@ simple_expr:
- | CAST_SYM '(' expr AS cast_type ')'
- {
- LEX *lex= Lex;
-- $$= create_func_cast(YYTHD, $3, $5, lex->length, lex->dec,
-+ $$= create_func_cast(thd, $3, $5, lex->length, lex->dec,
- lex->charset);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CASE_SYM opt_expr when_list opt_else END
- {
-- $$= new (YYTHD->mem_root) Item_func_case(* $3, $2, $4 );
-+ $$= new (thd->mem_root) Item_func_case(* $3, $2, $4 );
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CONVERT_SYM '(' expr ',' cast_type ')'
- {
-- $$= create_func_cast(YYTHD, $3, $5, Lex->length, Lex->dec,
-+ $$= create_func_cast(thd, $3, $5, Lex->length, Lex->dec,
- Lex->charset);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CONVERT_SYM '(' expr USING charset_name ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_conv_charset($3,$5);
-+ $$= new (thd->mem_root) Item_func_conv_charset($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7423,14 +7399,14 @@ simple_expr:
- my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
- MYSQL_YYABORT;
- }
-- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context(),
-+ $$= new (thd->mem_root) Item_default_value(Lex->current_context(),
- $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | VALUES '(' simple_ident_nospvar ')'
- {
-- $$= new (YYTHD->mem_root) Item_insert_value(Lex->current_context(),
-+ $$= new (thd->mem_root) Item_insert_value(Lex->current_context(),
- $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
-@@ -7438,7 +7414,7 @@ simple_expr:
- | INTERVAL_SYM expr interval '+' expr %prec INTERVAL_SYM
- /* we cannot put interval before - */
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($5,$2,$3,0);
-+ $$= new (thd->mem_root) Item_date_add_interval($5,$2,$3,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7453,19 +7429,19 @@ simple_expr:
- function_call_keyword:
- CHAR_SYM '(' expr_list ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_char(*$3);
-+ $$= new (thd->mem_root) Item_func_char(*$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CHAR_SYM '(' expr_list USING charset_name ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_char(*$3, $5);
-+ $$= new (thd->mem_root) Item_func_char(*$3, $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CURRENT_USER optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
-+ $$= new (thd->mem_root) Item_func_current_user(Lex->current_context());
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->set_stmt_unsafe();
-@@ -7473,31 +7449,30 @@ function_call_keyword:
- }
- | DATE_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_typecast($3);
-+ $$= new (thd->mem_root) Item_date_typecast($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | DAY_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_dayofmonth($3);
-+ $$= new (thd->mem_root) Item_func_dayofmonth($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | HOUR_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_hour($3);
-+ $$= new (thd->mem_root) Item_func_hour($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | INSERT '(' expr ',' expr ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_insert($3,$5,$7,$9);
-+ $$= new (thd->mem_root) Item_func_insert($3,$5,$7,$9);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | INTERVAL_SYM '(' expr ',' expr ')' %prec INTERVAL_SYM
- {
-- THD *thd= YYTHD;
- List<Item> *list= new (thd->mem_root) List<Item>;
- if (list == NULL)
- MYSQL_YYABORT;
-@@ -7512,7 +7487,6 @@ function_call_keyword:
- }
- | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' %prec INTERVAL_SYM
- {
-- THD *thd= YYTHD;
- $7->push_front($5);
- $7->push_front($3);
- Item_row *item= new (thd->mem_root) Item_row(*$7);
-@@ -7524,103 +7498,103 @@ function_call_keyword:
- }
- | LEFT '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_left($3,$5);
-+ $$= new (thd->mem_root) Item_func_left($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MINUTE_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_minute($3);
-+ $$= new (thd->mem_root) Item_func_minute($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MONTH_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_month($3);
-+ $$= new (thd->mem_root) Item_func_month($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | RIGHT '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_right($3,$5);
-+ $$= new (thd->mem_root) Item_func_right($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SECOND_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_second($3);
-+ $$= new (thd->mem_root) Item_func_second($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TIME_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_time_typecast($3);
-+ $$= new (thd->mem_root) Item_time_typecast($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TIMESTAMP '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_datetime_typecast($3);
-+ $$= new (thd->mem_root) Item_datetime_typecast($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TIMESTAMP '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_add_time($3, $5, 1, 0);
-+ $$= new (thd->mem_root) Item_func_add_time($3, $5, 1, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_trim($3);
-+ $$= new (thd->mem_root) Item_func_trim($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' LEADING expr FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_ltrim($6,$4);
-+ $$= new (thd->mem_root) Item_func_ltrim($6,$4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' TRAILING expr FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_rtrim($6,$4);
-+ $$= new (thd->mem_root) Item_func_rtrim($6,$4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' BOTH expr FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_trim($6,$4);
-+ $$= new (thd->mem_root) Item_func_trim($6,$4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' LEADING FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_ltrim($5);
-+ $$= new (thd->mem_root) Item_func_ltrim($5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' TRAILING FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_rtrim($5);
-+ $$= new (thd->mem_root) Item_func_rtrim($5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' BOTH FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_trim($5);
-+ $$= new (thd->mem_root) Item_func_trim($5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRIM '(' expr FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_trim($5,$3);
-+ $$= new (thd->mem_root) Item_func_trim($5,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | USER '(' ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_user();
-+ $$= new (thd->mem_root) Item_func_user();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->set_stmt_unsafe();
-@@ -7628,7 +7602,7 @@ function_call_keyword:
- }
- | YEAR_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_year($3);
-+ $$= new (thd->mem_root) Item_func_year($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7649,34 +7623,34 @@ function_call_keyword:
- function_call_nonkeyword:
- ADDDATE_SYM '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
-+ $$= new (thd->mem_root) Item_date_add_interval($3, $5,
- INTERVAL_DAY, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 0);
-+ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CURDATE optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_curdate_local();
-+ $$= new (thd->mem_root) Item_func_curdate_local();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | CURTIME optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_curtime_local();
-+ $$= new (thd->mem_root) Item_func_curtime_local();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | CURTIME '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_curtime_local($3);
-+ $$= new (thd->mem_root) Item_func_curtime_local($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
-@@ -7684,83 +7658,83 @@ function_call_nonkeyword:
- | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
- %prec INTERVAL_SYM
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,0);
-+ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')'
- %prec INTERVAL_SYM
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3,$6,$7,1);
-+ $$= new (thd->mem_root) Item_date_add_interval($3,$6,$7,1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | EXTRACT_SYM '(' interval FROM expr ')'
- {
-- $$=new (YYTHD->mem_root) Item_extract( $3, $5);
-+ $$=new (thd->mem_root) Item_extract( $3, $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | GET_FORMAT '(' date_time_type ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_get_format($3, $5);
-+ $$= new (thd->mem_root) Item_func_get_format($3, $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | NOW_SYM optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_now_local();
-+ $$= new (thd->mem_root) Item_func_now_local();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | NOW_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_now_local($3);
-+ $$= new (thd->mem_root) Item_func_now_local($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | POSITION_SYM '(' bit_expr IN_SYM expr ')'
- {
-- $$ = new (YYTHD->mem_root) Item_func_locate($5,$3);
-+ $$ = new (thd->mem_root) Item_func_locate($5,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBDATE_SYM '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $5,
-+ $$= new (thd->mem_root) Item_date_add_interval($3, $5,
- INTERVAL_DAY, 1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($3, $6, $7, 1);
-+ $$= new (thd->mem_root) Item_date_add_interval($3, $6, $7, 1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBSTRING '(' expr ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7);
-+ $$= new (thd->mem_root) Item_func_substr($3,$5,$7);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBSTRING '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_substr($3,$5);
-+ $$= new (thd->mem_root) Item_func_substr($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_substr($3,$5,$7);
-+ $$= new (thd->mem_root) Item_func_substr($3,$5,$7);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUBSTRING '(' expr FROM expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_substr($3,$5);
-+ $$= new (thd->mem_root) Item_func_substr($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7775,9 +7749,9 @@ function_call_nonkeyword:
- */
- Lex->set_stmt_unsafe();
- if (global_system_variables.sysdate_is_now == 0)
-- $$= new (YYTHD->mem_root) Item_func_sysdate_local();
-+ $$= new (thd->mem_root) Item_func_sysdate_local();
- else
-- $$= new (YYTHD->mem_root) Item_func_now_local();
-+ $$= new (thd->mem_root) Item_func_now_local();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
-@@ -7785,42 +7759,42 @@ function_call_nonkeyword:
- | SYSDATE '(' expr ')'
- {
- if (global_system_variables.sysdate_is_now == 0)
-- $$= new (YYTHD->mem_root) Item_func_sysdate_local($3);
-+ $$= new (thd->mem_root) Item_func_sysdate_local($3);
- else
-- $$= new (YYTHD->mem_root) Item_func_now_local($3);
-+ $$= new (thd->mem_root) Item_func_now_local($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_date_add_interval($7,$5,$3,0);
-+ $$= new (thd->mem_root) Item_date_add_interval($7,$5,$3,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_timestamp_diff($5,$7,$3);
-+ $$= new (thd->mem_root) Item_func_timestamp_diff($5,$7,$3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | UTC_DATE_SYM optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_curdate_utc();
-+ $$= new (thd->mem_root) Item_func_curdate_utc();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | UTC_TIME_SYM optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_curtime_utc();
-+ $$= new (thd->mem_root) Item_func_curtime_utc();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | UTC_TIMESTAMP_SYM optional_braces
- {
-- $$= new (YYTHD->mem_root) Item_func_now_utc();
-+ $$= new (thd->mem_root) Item_func_now_utc();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
-@@ -7835,62 +7809,61 @@ function_call_nonkeyword:
- function_call_conflict:
- ASCII_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_ascii($3);
-+ $$= new (thd->mem_root) Item_func_ascii($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | CHARSET '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_charset($3);
-+ $$= new (thd->mem_root) Item_func_charset($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | COALESCE '(' expr_list ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_coalesce(* $3);
-+ $$= new (thd->mem_root) Item_func_coalesce(* $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | COLLATION_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_collation($3);
-+ $$= new (thd->mem_root) Item_func_collation($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | DATABASE '(' ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_database();
-+ $$= new (thd->mem_root) Item_func_database();
- if ($$ == NULL)
- MYSQL_YYABORT;
- Lex->safe_to_cache_query=0;
- }
- | IF '(' expr ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_if($3,$5,$7);
-+ $$= new (thd->mem_root) Item_func_if($3,$5,$7);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MICROSECOND_SYM '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_microsecond($3);
-+ $$= new (thd->mem_root) Item_func_microsecond($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MOD_SYM '(' expr ',' expr ')'
- {
-- $$ = new (YYTHD->mem_root) Item_func_mod($3, $5);
-+ $$ = new (thd->mem_root) Item_func_mod($3, $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | OLD_PASSWORD '(' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_old_password($3);
-+ $$= new (thd->mem_root) Item_func_old_password($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | PASSWORD '(' expr ')'
- {
-- THD *thd= YYTHD;
- Item* i1;
- if (thd->variables.old_passwords)
- i1= new (thd->mem_root) Item_func_old_password($3);
-@@ -7902,31 +7875,30 @@ function_call_conflict:
- }
- | QUARTER_SYM '(' expr ')'
- {
-- $$ = new (YYTHD->mem_root) Item_func_quarter($3);
-+ $$ = new (thd->mem_root) Item_func_quarter($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | REPEAT_SYM '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_repeat($3,$5);
-+ $$= new (thd->mem_root) Item_func_repeat($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | REPLACE '(' expr ',' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_replace($3,$5,$7);
-+ $$= new (thd->mem_root) Item_func_replace($3,$5,$7);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRUNCATE_SYM '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_round($3,$5,1);
-+ $$= new (thd->mem_root) Item_func_round($3,$5,1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | WEEK_SYM '(' expr ')'
- {
-- THD *thd= YYTHD;
- Item *i1= new (thd->mem_root) Item_int((char*) "0",
- thd->variables.default_week_format,
- 1);
-@@ -7938,7 +7910,7 @@ function_call_conflict:
- }
- | WEEK_SYM '(' expr ',' expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_func_week($3,$5);
-+ $$= new (thd->mem_root) Item_func_week($3,$5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -7960,52 +7932,52 @@ function_call_conflict:
- geometry_function:
- CONTAINS_SYM '(' expr ',' expr ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_rel($3, $5,
- Item_func::SP_CONTAINS_FUNC));
- }
- | GEOMETRYCOLLECTION '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_geometrycollection,
- Geometry::wkb_point));
- }
- | LINESTRING '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_linestring,
- Geometry::wkb_point));
- }
- | MULTILINESTRING '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_multilinestring,
- Geometry::wkb_linestring));
- }
- | MULTIPOINT '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_multipoint,
- Geometry::wkb_point));
- }
- | MULTIPOLYGON '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_multipolygon,
- Geometry::wkb_polygon));
- }
- | POINT_SYM '(' expr ',' expr ')'
- {
-- $$= GEOM_NEW(YYTHD, Item_func_point($3,$5));
-+ $$= GEOM_NEW(thd, Item_func_point($3,$5));
- }
- | POLYGON '(' expr_list ')'
- {
-- $$= GEOM_NEW(YYTHD,
-+ $$= GEOM_NEW(thd,
- Item_func_spatial_collection(* $3,
- Geometry::wkb_polygon,
- Geometry::wkb_linestring));
-@@ -8043,7 +8015,6 @@ function_call_generic:
- }
- opt_udf_expr_list ')'
- {
-- THD *thd= YYTHD;
- Create_func *builder;
- Item *item= NULL;
-
-@@ -8097,7 +8068,6 @@ function_call_generic:
- }
- | ident '.' ident '(' opt_expr_list ')'
- {
-- THD *thd= YYTHD;
- Create_qfunc *builder;
- Item *item= NULL;
-
-@@ -8161,7 +8131,7 @@ opt_udf_expr_list:
- udf_expr_list:
- udf_expr
- {
-- $$= new (YYTHD->mem_root) List<Item>;
-+ $$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->push_back($1);
-@@ -8194,7 +8164,7 @@ udf_expr:
- remember_name we may get quoted or escaped names.
- */
- else if ($2->type() != Item::FIELD_ITEM)
-- $2->set_name($1, (uint) ($3 - $1), YYTHD->charset());
-+ $2->set_name($1, (uint) ($3 - $1), thd->charset());
- $$= $2;
- }
- ;
-@@ -8202,46 +8172,46 @@ udf_expr:
- sum_expr:
- AVG_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_avg($3);
-+ $$= new (thd->mem_root) Item_sum_avg($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | AVG_SYM '(' DISTINCT in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_avg_distinct($4);
-+ $$= new (thd->mem_root) Item_sum_avg_distinct($4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | BIT_AND '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_and($3);
-+ $$= new (thd->mem_root) Item_sum_and($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | BIT_OR '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_or($3);
-+ $$= new (thd->mem_root) Item_sum_or($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | BIT_XOR '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_xor($3);
-+ $$= new (thd->mem_root) Item_sum_xor($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | COUNT_SYM '(' opt_all '*' ')'
- {
-- Item *item= new (YYTHD->mem_root) Item_int((int32) 0L,1);
-+ Item *item= new (thd->mem_root) Item_int((int32) 0L,1);
- if (item == NULL)
- MYSQL_YYABORT;
-- $$= new (YYTHD->mem_root) Item_sum_count(item);
-+ $$= new (thd->mem_root) Item_sum_count(item);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | COUNT_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_count($3);
-+ $$= new (thd->mem_root) Item_sum_count($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -8251,13 +8221,13 @@ sum_expr:
- { Select->in_sum_expr--; }
- ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_count_distinct(* $5);
-+ $$= new (thd->mem_root) Item_sum_count_distinct(* $5);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MIN_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_min($3);
-+ $$= new (thd->mem_root) Item_sum_min($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -8268,55 +8238,55 @@ sum_expr:
- */
- | MIN_SYM '(' DISTINCT in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_min($4);
-+ $$= new (thd->mem_root) Item_sum_min($4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MAX_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_max($3);
-+ $$= new (thd->mem_root) Item_sum_max($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | MAX_SYM '(' DISTINCT in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_max($4);
-+ $$= new (thd->mem_root) Item_sum_max($4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | STD_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_std($3, 0);
-+ $$= new (thd->mem_root) Item_sum_std($3, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | VARIANCE_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_variance($3, 0);
-+ $$= new (thd->mem_root) Item_sum_variance($3, 0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | STDDEV_SAMP_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_std($3, 1);
-+ $$= new (thd->mem_root) Item_sum_std($3, 1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | VAR_SAMP_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_variance($3, 1);
-+ $$= new (thd->mem_root) Item_sum_variance($3, 1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUM_SYM '(' in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_sum($3);
-+ $$= new (thd->mem_root) Item_sum_sum($3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | SUM_SYM '(' DISTINCT in_sum_expr ')'
- {
-- $$= new (YYTHD->mem_root) Item_sum_sum_distinct($4);
-+ $$= new (thd->mem_root) Item_sum_sum_distinct($4);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -8328,7 +8298,7 @@ sum_expr:
- {
- SELECT_LEX *sel= Select;
- sel->in_sum_expr--;
-- $$= new (YYTHD->mem_root)
-+ $$= new (thd->mem_root)
- Item_func_group_concat(Lex->current_context(), $3, $5,
- sel->gorder_list, $7);
- if ($$ == NULL)
-@@ -8357,7 +8327,7 @@ variable_aux:
- ident_or_text SET_VAR expr
- {
- Item_func_set_user_var *item;
-- $$= item= new (YYTHD->mem_root) Item_func_set_user_var($1, $3);
-+ $$= item= new (thd->mem_root) Item_func_set_user_var($1, $3);
- if ($$ == NULL)
- MYSQL_YYABORT;
- LEX *lex= Lex;
-@@ -8366,7 +8336,7 @@ variable_aux:
- }
- | ident_or_text
- {
-- $$= new (YYTHD->mem_root) Item_func_get_user_var($1);
-+ $$= new (thd->mem_root) Item_func_get_user_var($1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- LEX *lex= Lex;
-@@ -8380,7 +8350,7 @@ variable_aux:
- my_parse_error(ER(ER_SYNTAX_ERROR));
- MYSQL_YYABORT;
- }
-- if (!($$= get_system_var(YYTHD, $2, $3, $4)))
-+ if (!($$= get_system_var(thd, $2, $3, $4)))
- MYSQL_YYABORT;
- if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
- Lex->set_stmt_unsafe();
-@@ -8395,7 +8365,7 @@ opt_distinct:
- opt_gconcat_separator:
- /* empty */
- {
-- $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1);
-+ $$= new (thd->mem_root) String(",", 1, &my_charset_latin1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -8422,9 +8392,9 @@ opt_gorder_clause:
-
- gorder_list:
- gorder_list ',' order_ident order_dir
-- { if (add_gorder_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
-+ { if (add_gorder_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
- | order_ident order_dir
-- { if (add_gorder_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
-+ { if (add_gorder_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
- ;
-
- in_sum_expr:
-@@ -8477,7 +8447,7 @@ opt_expr_list:
- expr_list:
- expr
- {
-- $$= new (YYTHD->mem_root) List<Item>;
-+ $$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->push_back($1);
-@@ -8497,7 +8467,7 @@ ident_list_arg:
- ident_list:
- simple_ident
- {
-- $$= new (YYTHD->mem_root) List<Item>;
-+ $$= new (thd->mem_root) List<Item>;
- if ($$ == NULL)
- MYSQL_YYABORT;
- $$->push_back($1);
-@@ -8595,7 +8565,7 @@ join_table:
- {
- MYSQL_YYABORT_UNLESS($1 && $3);
- /* Change the current name resolution context to a local context. */
-- if (push_new_name_resolution_context(YYTHD, $1, $3))
-+ if (push_new_name_resolution_context(thd, $1, $3))
- MYSQL_YYABORT;
- Select->parsing_place= IN_ON;
- }
-@@ -8610,7 +8580,7 @@ join_table:
- {
- MYSQL_YYABORT_UNLESS($1 && $3);
- /* Change the current name resolution context to a local context. */
-- if (push_new_name_resolution_context(YYTHD, $1, $3))
-+ if (push_new_name_resolution_context(thd, $1, $3))
- MYSQL_YYABORT;
- Select->parsing_place= IN_ON;
- }
-@@ -8640,7 +8610,7 @@ join_table:
- {
- MYSQL_YYABORT_UNLESS($1 && $5);
- /* Change the current name resolution context to a local context. */
-- if (push_new_name_resolution_context(YYTHD, $1, $5))
-+ if (push_new_name_resolution_context(thd, $1, $5))
- MYSQL_YYABORT;
- Select->parsing_place= IN_ON;
- }
-@@ -8676,7 +8646,7 @@ join_table:
- {
- MYSQL_YYABORT_UNLESS($1 && $5);
- /* Change the current name resolution context to a local context. */
-- if (push_new_name_resolution_context(YYTHD, $1, $5))
-+ if (push_new_name_resolution_context(thd, $1, $5))
- MYSQL_YYABORT;
- Select->parsing_place= IN_ON;
- }
-@@ -8724,7 +8694,7 @@ table_factor:
- }
- table_ident opt_table_alias opt_key_definition
- {
-- if (!($$= Select->add_table_to_list(YYTHD, $2, $3,
-+ if (!($$= Select->add_table_to_list(thd, $2, $3,
- Select->get_table_join_options(),
- Lex->lock_option,
- Select->pop_index_hints())))
-@@ -8922,7 +8892,7 @@ index_hints_list:
-
- opt_index_hints_list:
- /* empty */
-- | { Select->alloc_index_hints(YYTHD); } index_hints_list
-+ | { Select->alloc_index_hints(thd); } index_hints_list
- ;
-
- opt_key_definition:
-@@ -8931,15 +8901,15 @@ opt_key_definition:
- ;
-
- opt_key_usage_list:
-- /* empty */ { Select->add_index_hint(YYTHD, NULL, 0); }
-+ /* empty */ { Select->add_index_hint(thd, NULL, 0); }
- | key_usage_list {}
- ;
-
- key_usage_element:
- ident
-- { Select->add_index_hint(YYTHD, $1.str, $1.length); }
-+ { Select->add_index_hint(thd, $1.str, $1.length); }
- | PRIMARY_SYM
-- { Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7); }
-+ { Select->add_index_hint(thd, (char *)"PRIMARY", 7); }
- ;
-
- key_usage_list:
-@@ -8952,7 +8922,7 @@ using_list:
- {
- if (!($$= new List<String>))
- MYSQL_YYABORT;
-- String *s= new (YYTHD->mem_root) String((const char *) $1.str,
-+ String *s= new (thd->mem_root) String((const char *) $1.str,
- $1.length,
- system_charset_info);
- if (s == NULL)
-@@ -8961,7 +8931,7 @@ using_list:
- }
- | using_list ',' ident
- {
-- String *s= new (YYTHD->mem_root) String((const char *) $3.str,
-+ String *s= new (thd->mem_root) String((const char *) $3.str,
- $3.length,
- system_charset_info);
- if (s == NULL)
-@@ -9002,7 +8972,7 @@ interval_time_stamp:
- implementation without changing its
- resolution.
- */
-- WARN_DEPRECATED(yythd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND");
-+ WARN_DEPRECATED(thd, VER_CELOSIA, "FRAC_SECOND", "MICROSECOND");
- }
- ;
-
-@@ -9086,7 +9056,6 @@ opt_escape:
- }
- | /* empty */
- {
-- THD *thd= YYTHD;
- Lex->escape_used= FALSE;
- $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
- new (thd->mem_root) Item_string("", 0, &my_charset_latin1) :
-@@ -9107,9 +9076,9 @@ group_clause:
-
- group_list:
- group_list ',' order_ident order_dir
-- { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
-+ { if (add_group_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
- | order_ident order_dir
-- { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
-+ { if (add_group_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
- ;
-
- olap_opt:
-@@ -9156,7 +9125,6 @@ alter_order_list:
- alter_order_item:
- simple_ident_nospvar order_dir
- {
-- THD *thd= YYTHD;
- bool ascending= ($2 == 1) ? true : false;
- if (add_order_to_list(thd, $1, ascending))
- MYSQL_YYABORT;
-@@ -9209,9 +9177,9 @@ order_clause:
-
- order_list:
- order_list ',' order_ident order_dir
-- { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
-+ { if (add_order_to_list(thd, $3,(bool) $4)) MYSQL_YYABORT; }
- | order_ident order_dir
-- { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; }
-+ { if (add_order_to_list(thd, $1,(bool) $2)) MYSQL_YYABORT; }
- ;
-
- order_dir:
-@@ -9271,19 +9239,19 @@ limit_option:
- }
- | ULONGLONG_NUM
- {
-- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
-+ $$= new (thd->mem_root) Item_uint($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | LONG_NUM
- {
-- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
-+ $$= new (thd->mem_root) Item_uint($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | NUM
- {
-- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
-+ $$= new (thd->mem_root) Item_uint($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -9365,7 +9333,7 @@ procedure_clause:
- lex->proc_list.elements=0;
- lex->proc_list.first=0;
- lex->proc_list.next= &lex->proc_list.first;
-- Item_field *item= new (YYTHD->mem_root)
-+ Item_field *item= new (thd->mem_root)
- Item_field(&lex->current_select->context,
- NULL, NULL, $2.str);
- if (item == NULL)
-@@ -9390,8 +9358,6 @@ procedure_list2:
- procedure_item:
- remember_name expr remember_end
- {
-- THD *thd= YYTHD;
--
- if (add_proc_to_list(thd, $2))
- MYSQL_YYABORT;
- if (!$2->name)
-@@ -9560,7 +9526,6 @@ drop:
- }
- | DROP FUNCTION_SYM if_exists ident '.' ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- sp_name *spname;
- if ($4.str && check_db_name(&$4))
-@@ -9583,7 +9548,6 @@ drop:
- }
- | DROP FUNCTION_SYM if_exists ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- LEX_STRING db= {0, 0};
- sp_name *spname;
-@@ -9664,7 +9628,7 @@ table_list:
- table_name:
- table_ident
- {
-- if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
-+ if (!Select->add_table_to_list(thd, $1, NULL, TL_OPTION_UPDATING))
- MYSQL_YYABORT;
- }
- ;
-@@ -9677,7 +9641,7 @@ table_alias_ref_list:
- table_alias_ref:
- table_ident_opt_wild
- {
-- if (!Select->add_table_to_list(YYTHD, $1, NULL,
-+ if (!Select->add_table_to_list(thd, $1, NULL,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
- Lex->lock_option ))
- MYSQL_YYABORT;
-@@ -9868,7 +9832,7 @@ expr_or_default:
- expr { $$= $1;}
- | DEFAULT
- {
-- $$= new (YYTHD->mem_root) Item_default_value(Lex->current_context());
-+ $$= new (thd->mem_root) Item_default_value(Lex->current_context());
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -9922,7 +9886,7 @@ update_list:
- update_elem:
- simple_ident_nospvar equal expr_or_default
- {
-- if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3))
-+ if (add_item_to_list(thd, $1) || add_value_to_list(thd, $3))
- MYSQL_YYABORT;
- }
- ;
-@@ -9965,7 +9929,7 @@ delete:
- single_multi:
- FROM table_ident
- {
-- if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
-+ if (!Select->add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING,
- Lex->lock_option))
- MYSQL_YYABORT;
- }
-@@ -9998,7 +9962,7 @@ table_wild_one:
- Table_ident *ti= new Table_ident($1);
- if (ti == NULL)
- MYSQL_YYABORT;
-- if (!Select->add_table_to_list(YYTHD,
-+ if (!Select->add_table_to_list(thd,
- ti,
- $3,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
-@@ -10007,10 +9971,10 @@ table_wild_one:
- }
- | ident '.' ident opt_wild opt_table_alias
- {
-- Table_ident *ti= new Table_ident(YYTHD, $1, $3, 0);
-+ Table_ident *ti= new Table_ident(thd, $1, $3, 0);
- if (ti == NULL)
- MYSQL_YYABORT;
-- if (!Select->add_table_to_list(YYTHD,
-+ if (!Select->add_table_to_list(thd,
- ti,
- $5,
- TL_OPTION_UPDATING | TL_OPTION_ALIAS,
-@@ -10130,7 +10094,7 @@ show_param:
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_DATABASES;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
-+ if (prepare_schema_table(thd, lex, 0, SCH_SCHEMATA))
- MYSQL_YYABORT;
- }
- | opt_full TABLES opt_db wild_and_where
-@@ -10138,7 +10102,7 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_TABLES;
- lex->select_lex.db= $3;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES))
- MYSQL_YYABORT;
- }
- | opt_full TRIGGERS_SYM opt_db wild_and_where
-@@ -10146,7 +10110,7 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_TRIGGERS;
- lex->select_lex.db= $3;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_TRIGGERS))
- MYSQL_YYABORT;
- }
- | EVENTS_SYM opt_db wild_and_where
-@@ -10154,7 +10118,7 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_EVENTS;
- lex->select_lex.db= $2;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_EVENTS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_EVENTS))
- MYSQL_YYABORT;
- }
- | TABLE_SYM STATUS_SYM opt_db wild_and_where
-@@ -10162,7 +10126,7 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
- lex->select_lex.db= $3;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_TABLES))
- MYSQL_YYABORT;
- }
- | OPEN_SYM TABLES opt_db wild_and_where
-@@ -10170,22 +10134,22 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
- lex->select_lex.db= $3;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES))
- MYSQL_YYABORT;
- }
- | opt_full PLUGIN_SYM
- {
- LEX *lex= Lex;
-- WARN_DEPRECATED(yythd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'");
-+ WARN_DEPRECATED(thd, "6.0", "SHOW PLUGIN", "'SHOW PLUGINS'");
- lex->sql_command= SQLCOM_SHOW_PLUGINS;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS))
- MYSQL_YYABORT;
- }
- | PLUGINS_SYM
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_PLUGINS;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_PLUGINS))
- MYSQL_YYABORT;
- }
- | ENGINE_SYM known_storage_engines show_engine_param
-@@ -10198,7 +10162,7 @@ show_param:
- lex->sql_command= SQLCOM_SHOW_FIELDS;
- if ($5)
- $4->change_db($5);
-- if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
-+ if (prepare_schema_table(thd, lex, $4, SCH_COLUMNS))
- MYSQL_YYABORT;
- }
- | NEW_SYM MASTER_SYM FOR_SYM SLAVE
-@@ -10233,7 +10197,7 @@ show_param:
- lex->sql_command= SQLCOM_SHOW_KEYS;
- if ($4)
- $3->change_db($4);
-- if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
-+ if (prepare_schema_table(thd, lex, $3, SCH_STATISTICS))
- MYSQL_YYABORT;
- }
- | COLUMN_SYM TYPES_SYM
-@@ -10245,15 +10209,15 @@ show_param:
- {
- LEX *lex=Lex;
- lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
-- WARN_DEPRECATED(yythd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'");
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES))
-+ WARN_DEPRECATED(thd, "6.0", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'");
-+ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES))
- MYSQL_YYABORT;
- }
- | opt_storage ENGINES_SYM
- {
- LEX *lex=Lex;
- lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_ENGINES))
- MYSQL_YYABORT;
- }
- | AUTHORS_SYM
-@@ -10285,7 +10249,7 @@ show_param:
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_PROFILE;
-- if (prepare_schema_table(YYTHD, lex, NULL, SCH_PROFILES) != 0)
-+ if (prepare_schema_table(thd, lex, NULL, SCH_PROFILES) != 0)
- YYABORT;
- }
- | opt_var_type STATUS_SYM wild_and_where
-@@ -10293,7 +10257,7 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_STATUS;
- lex->option_type= $1;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_STATUS))
- MYSQL_YYABORT;
- }
- | INNOBASE_SYM STATUS_SYM
-@@ -10301,24 +10265,24 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_ENGINE_STATUS;
- if (!(lex->create_info.db_type=
-- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
-+ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB)))
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
- MYSQL_YYABORT;
- }
-- WARN_DEPRECATED(yythd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'");
-+ WARN_DEPRECATED(thd, "6.0", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'");
- }
- | MUTEX_SYM STATUS_SYM
- {
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
- if (!(lex->create_info.db_type=
-- ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
-+ ha_resolve_by_legacy_type(thd, DB_TYPE_INNODB)))
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
- MYSQL_YYABORT;
- }
-- WARN_DEPRECATED(yythd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'");
-+ WARN_DEPRECATED(thd, "6.0", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'");
- }
- | opt_full PROCESSLIST_SYM
- { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
-@@ -10327,21 +10291,21 @@ show_param:
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_VARIABLES;
- lex->option_type= $1;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_VARIABLES))
- MYSQL_YYABORT;
- }
- | charset wild_and_where
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_CHARSETS;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_CHARSETS))
- MYSQL_YYABORT;
- }
- | COLLATION_SYM wild_and_where
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_COLLATIONS;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
-+ if (prepare_schema_table(thd, lex, 0, SCH_COLLATIONS))
- MYSQL_YYABORT;
- }
- | GRANTS
-@@ -10371,7 +10335,7 @@ show_param:
- {
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_CREATE;
-- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0))
-+ if (!lex->select_lex.add_table_to_list(thd, $3, NULL,0))
- MYSQL_YYABORT;
- lex->only_view= 0;
- lex->create_info.storage_media= HA_SM_DEFAULT;
-@@ -10380,7 +10344,7 @@ show_param:
- {
- LEX *lex= Lex;
- lex->sql_command = SQLCOM_SHOW_CREATE;
-- if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0))
-+ if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0))
- MYSQL_YYABORT;
- lex->only_view= 1;
- }
-@@ -10416,14 +10380,14 @@ show_param:
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_STATUS_PROC;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
- MYSQL_YYABORT;
- }
- | FUNCTION_SYM STATUS_SYM wild_and_where
- {
- LEX *lex= Lex;
- lex->sql_command= SQLCOM_SHOW_STATUS_FUNC;
-- if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
-+ if (prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))
- MYSQL_YYABORT;
- }
- | PROCEDURE CODE_SYM sp_name
-@@ -10501,7 +10465,7 @@ wild_and_where:
- /* empty */
- | LIKE TEXT_STRING_sys
- {
-- Lex->wild= new (YYTHD->mem_root) String($2.str, $2.length,
-+ Lex->wild= new (thd->mem_root) String($2.str, $2.length,
- system_charset_info);
- if (Lex->wild == NULL)
- MYSQL_YYABORT;
-@@ -10525,7 +10489,7 @@ describe:
- lex->sql_command= SQLCOM_SHOW_FIELDS;
- lex->select_lex.db= 0;
- lex->verbose= 0;
-- if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS))
-+ if (prepare_schema_table(thd, lex, $2, SCH_COLUMNS))
- MYSQL_YYABORT;
- }
- opt_describe_column {}
-@@ -10554,7 +10518,7 @@ opt_describe_column:
- | text_string { Lex->wild= $1; }
- | ident
- {
-- Lex->wild= new (YYTHD->mem_root) String((const char*) $1.str,
-+ Lex->wild= new (thd->mem_root) String((const char*) $1.str,
- $1.length,
- system_charset_info);
- if (Lex->wild == NULL)
-@@ -10697,7 +10661,6 @@ use:
- load:
- LOAD DATA_SYM
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
-
- if (lex->sphead)
-@@ -10711,7 +10674,7 @@ load:
- | LOAD TABLE_SYM table_ident FROM MASTER_SYM
- {
- LEX *lex=Lex;
-- WARN_DEPRECATED(yythd, "6.0", "LOAD TABLE FROM MASTER",
-+ WARN_DEPRECATED(thd, "6.0", "LOAD TABLE FROM MASTER",
- "MySQL Administrator (mysqldump, mysql)");
- if (lex->sphead)
- {
-@@ -10719,7 +10682,7 @@ load:
- MYSQL_YYABORT;
- }
- lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
-- if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
-+ if (!Select->add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING))
- MYSQL_YYABORT;
- }
- ;
-@@ -10739,7 +10702,7 @@ load_data:
- opt_duplicate INTO TABLE_SYM table_ident
- {
- LEX *lex=Lex;
-- if (!Select->add_table_to_list(YYTHD, $9, NULL, TL_OPTION_UPDATING,
-+ if (!Select->add_table_to_list(thd, $9, NULL, TL_OPTION_UPDATING,
- lex->lock_option))
- MYSQL_YYABORT;
- lex->field_list.empty();
-@@ -10754,7 +10717,7 @@ load_data:
- | FROM MASTER_SYM
- {
- Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
-- WARN_DEPRECATED(yythd, "6.0", "LOAD DATA FROM MASTER",
-+ WARN_DEPRECATED(thd, "6.0", "LOAD DATA FROM MASTER",
- "mysqldump or future "
- "BACKUP/RESTORE DATABASE facility");
- }
-@@ -10872,7 +10835,7 @@ field_or_var:
- simple_ident_nospvar {$$= $1;}
- | '@' ident_or_text
- {
-- $$= new (YYTHD->mem_root) Item_user_var_as_out_param($2);
-+ $$= new (thd->mem_root) Item_user_var_as_out_param($2);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -10889,7 +10852,6 @@ text_literal:
- TEXT_STRING
- {
- LEX_STRING tmp;
-- THD *thd= YYTHD;
- CHARSET_INFO *cs_con= thd->variables.collation_connection;
- CHARSET_INFO *cs_cli= thd->variables.character_set_client;
- uint repertoire= thd->lex->text_string_is_7bit &&
-@@ -10915,7 +10877,7 @@ text_literal:
- uint repertoire= Lex->text_string_is_7bit ?
- MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
- DBUG_ASSERT(my_charset_is_ascii_based(national_charset_info));
-- $$= new (YYTHD->mem_root) Item_string($1.str, $1.length,
-+ $$= new (thd->mem_root) Item_string($1.str, $1.length,
- national_charset_info,
- DERIVATION_COERCIBLE,
- repertoire);
-@@ -10924,7 +10886,7 @@ text_literal:
- }
- | UNDERSCORE_CHARSET TEXT_STRING
- {
-- Item_string *str= new (YYTHD->mem_root) Item_string($2.str,
-+ Item_string *str= new (thd->mem_root) Item_string($2.str,
- $2.length, $1);
- if (str == NULL)
- MYSQL_YYABORT;
-@@ -10943,7 +10905,7 @@ text_literal:
- If the string has been pure ASCII so far,
- check the new part.
- */
-- CHARSET_INFO *cs= YYTHD->variables.collation_connection;
-+ CHARSET_INFO *cs= thd->variables.collation_connection;
- item->collation.repertoire|= my_string_repertoire(cs,
- $2.str,
- $2.length);
-@@ -10954,15 +10916,15 @@ text_literal:
- text_string:
- TEXT_STRING_literal
- {
-- $$= new (YYTHD->mem_root) String($1.str,
-+ $$= new (thd->mem_root) String($1.str,
- $1.length,
-- YYTHD->variables.collation_connection);
-+ thd->variables.collation_connection);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | HEX_NUM
- {
-- Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
-+ Item *tmp= new (thd->mem_root) Item_hex_string($1.str, $1.length);
- if (tmp == NULL)
- MYSQL_YYABORT;
- /*
-@@ -10974,7 +10936,7 @@ text_string:
- }
- | BIN_NUM
- {
-- Item *tmp= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length);
-+ Item *tmp= new (thd->mem_root) Item_bin_string($1.str, $1.length);
- if (tmp == NULL)
- MYSQL_YYABORT;
- /*
-@@ -10989,7 +10951,6 @@ text_string:
- param_marker:
- PARAM_MARKER
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- Item_param *item;
-@@ -11022,38 +10983,38 @@ literal:
- | NUM_literal { $$ = $1; }
- | NULL_SYM
- {
-- $$ = new (YYTHD->mem_root) Item_null();
-+ $$ = new (thd->mem_root) Item_null();
- if ($$ == NULL)
- MYSQL_YYABORT;
- YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT;
- }
- | FALSE_SYM
- {
-- $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1);
-+ $$= new (thd->mem_root) Item_int((char*) "FALSE",0,1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | TRUE_SYM
- {
-- $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1);
-+ $$= new (thd->mem_root) Item_int((char*) "TRUE",1,1);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | HEX_NUM
- {
-- $$ = new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
-+ $$ = new (thd->mem_root) Item_hex_string($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | BIN_NUM
- {
-- $$= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length);
-+ $$= new (thd->mem_root) Item_bin_string($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | UNDERSCORE_CHARSET HEX_NUM
- {
-- Item *tmp= new (YYTHD->mem_root) Item_hex_string($2.str, $2.length);
-+ Item *tmp= new (thd->mem_root) Item_hex_string($2.str, $2.length);
- if (tmp == NULL)
- MYSQL_YYABORT;
- /*
-@@ -11064,7 +11025,7 @@ literal:
- String *str= tmp->val_str((String*) 0);
-
- Item_string *item_str;
-- item_str= new (YYTHD->mem_root)
-+ item_str= new (thd->mem_root)
- Item_string(NULL, /* name will be set in select_item */
- str ? str->ptr() : "",
- str ? str->length() : 0,
-@@ -11082,7 +11043,7 @@ literal:
- }
- | UNDERSCORE_CHARSET BIN_NUM
- {
-- Item *tmp= new (YYTHD->mem_root) Item_bin_string($2.str, $2.length);
-+ Item *tmp= new (thd->mem_root) Item_bin_string($2.str, $2.length);
- if (tmp == NULL)
- MYSQL_YYABORT;
- /*
-@@ -11093,7 +11054,7 @@ literal:
- String *str= tmp->val_str((String*) 0);
-
- Item_string *item_str;
-- item_str= new (YYTHD->mem_root)
-+ item_str= new (thd->mem_root)
- Item_string(NULL, /* name will be set in select_item */
- str ? str->ptr() : "",
- str ? str->length() : 0,
-@@ -11117,7 +11078,7 @@ NUM_literal:
- NUM
- {
- int error;
-- $$= new (YYTHD->mem_root)
-+ $$= new (thd->mem_root)
- Item_int($1.str,
- (longlong) my_strtoll10($1.str, NULL, &error),
- $1.length);
-@@ -11127,7 +11088,7 @@ NUM_literal:
- | LONG_NUM
- {
- int error;
-- $$= new (YYTHD->mem_root)
-+ $$= new (thd->mem_root)
- Item_int($1.str,
- (longlong) my_strtoll10($1.str, NULL, &error),
- $1.length);
-@@ -11136,23 +11097,23 @@ NUM_literal:
- }
- | ULONGLONG_NUM
- {
-- $$= new (YYTHD->mem_root) Item_uint($1.str, $1.length);
-+ $$= new (thd->mem_root) Item_uint($1.str, $1.length);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | DECIMAL_NUM
- {
-- $$= new (YYTHD->mem_root) Item_decimal($1.str, $1.length,
-- YYTHD->charset());
-- if (($$ == NULL) || (YYTHD->is_error()))
-+ $$= new (thd->mem_root) Item_decimal($1.str, $1.length,
-+ thd->charset());
-+ if (($$ == NULL) || (thd->is_error()))
- {
- MYSQL_YYABORT;
- }
- }
- | FLOAT_NUM
- {
-- $$= new (YYTHD->mem_root) Item_float($1.str, $1.length);
-- if (($$ == NULL) || (YYTHD->is_error()))
-+ $$= new (thd->mem_root) Item_float($1.str, $1.length);
-+ if (($$ == NULL) || (thd->is_error()))
- {
- MYSQL_YYABORT;
- }
-@@ -11172,7 +11133,7 @@ table_wild:
- ident '.' '*'
- {
- SELECT_LEX *sel= Select;
-- $$= new (YYTHD->mem_root) Item_field(Lex->current_context(),
-+ $$= new (thd->mem_root) Item_field(Lex->current_context(),
- NullS, $1.str, "*");
- if ($$ == NULL)
- MYSQL_YYABORT;
-@@ -11180,7 +11141,6 @@ table_wild:
- }
- | ident '.' ident '.' '*'
- {
-- THD *thd= YYTHD;
- SELECT_LEX *sel= Select;
- const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
- NullS : $1.str;
-@@ -11200,7 +11160,6 @@ order_ident:
- simple_ident:
- ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_variable_t *spv;
-@@ -11251,7 +11210,6 @@ simple_ident:
- simple_ident_nospvar:
- ident
- {
-- THD *thd= YYTHD;
- SELECT_LEX *sel=Select;
- if ((sel->parsing_place != IN_HAVING) ||
- (sel->get_in_sum_expr() > 0))
-@@ -11273,7 +11231,6 @@ simple_ident_nospvar:
- simple_ident_q:
- ident '.' ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
-
- /*
-@@ -11352,7 +11309,6 @@ simple_ident_q:
- }
- | '.' ident '.' ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- SELECT_LEX *sel= lex->current_select;
- if (sel->no_table_names_allowed)
-@@ -11377,7 +11333,6 @@ simple_ident_q:
- }
- | ident '.' ident '.' ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- SELECT_LEX *sel= lex->current_select;
- const char* schema= (thd->client_capabilities & CLIENT_NO_SCHEMA ?
-@@ -11445,7 +11400,7 @@ table_ident:
- }
- | ident '.' ident
- {
-- $$= new Table_ident(YYTHD, $1,$3,0);
-+ $$= new Table_ident(thd, $1,$3,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -11467,7 +11422,7 @@ table_ident_opt_wild:
- }
- | ident '.' ident opt_wild
- {
-- $$= new Table_ident(YYTHD, $1,$3,0);
-+ $$= new Table_ident(thd, $1,$3,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -11477,7 +11432,7 @@ table_ident_nodb:
- ident
- {
- LEX_STRING db={(char*) any_db,3};
-- $$= new Table_ident(YYTHD, db,$1,0);
-+ $$= new Table_ident(thd, db,$1,0);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -11487,8 +11442,6 @@ IDENT_sys:
- IDENT { $$= $1; }
- | IDENT_QUOTED
- {
-- THD *thd= YYTHD;
--
- if (thd->charset_is_system_charset)
- {
- CHARSET_INFO *cs= system_charset_info;
-@@ -11516,8 +11469,6 @@ IDENT_sys:
- TEXT_STRING_sys:
- TEXT_STRING
- {
-- THD *thd= YYTHD;
--
- if (thd->charset_is_system_charset)
- $$= $1;
- else
-@@ -11532,8 +11483,6 @@ TEXT_STRING_sys:
- TEXT_STRING_literal:
- TEXT_STRING
- {
-- THD *thd= YYTHD;
--
- if (thd->charset_is_collation_connection)
- $$= $1;
- else
-@@ -11548,8 +11497,6 @@ TEXT_STRING_literal:
- TEXT_STRING_filesystem:
- TEXT_STRING
- {
-- THD *thd= YYTHD;
--
- if (thd->charset_is_character_set_filesystem)
- $$= $1;
- else
-@@ -11566,7 +11513,6 @@ ident:
- IDENT_sys { $$=$1; }
- | keyword
- {
-- THD *thd= YYTHD;
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
- MYSQL_YYABORT;
-@@ -11578,7 +11524,6 @@ label_ident:
- IDENT_sys { $$=$1; }
- | keyword_sp
- {
-- THD *thd= YYTHD;
- $$.str= thd->strmake($1.str, $1.length);
- if ($$.str == NULL)
- MYSQL_YYABORT;
-@@ -11595,7 +11540,6 @@ ident_or_text:
- user:
- ident_or_text
- {
-- THD *thd= YYTHD;
- if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- MYSQL_YYABORT;
- $$->user = $1;
-@@ -11609,7 +11553,6 @@ user:
- }
- | ident_or_text '@' ident_or_text
- {
-- THD *thd= YYTHD;
- if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- MYSQL_YYABORT;
- $$->user = $1; $$->host=$3;
-@@ -11628,7 +11571,7 @@ user:
- }
- | CURRENT_USER optional_braces
- {
-- if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
-+ if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
- MYSQL_YYABORT;
- /*
- empty LEX_USER means current_user and
-@@ -11991,7 +11934,6 @@ option_value_list:
-
- option_type_value:
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
-
-@@ -12022,7 +11964,6 @@ option_type_value:
- }
- ext_option_value
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
-
-@@ -12105,7 +12046,6 @@ ext_option_value:
- sys_option_value:
- option_type internal_variable_name equal set_expr_or_default
- {
-- THD *thd= YYTHD;
- LEX *lex= Lex;
- LEX_STRING *name= &$2.base_name;
-
-@@ -12117,7 +12057,7 @@ sys_option_value:
- my_parse_error(ER(ER_SYNTAX_ERROR));
- MYSQL_YYABORT;
- }
-- if (set_trigger_new_row(YYTHD, name, $4))
-+ if (set_trigger_new_row(thd, name, $4))
- MYSQL_YYABORT;
- }
- else if ($2.var)
-@@ -12147,7 +12087,6 @@ sys_option_value:
- }
- | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
- {
-- THD *thd= YYTHD;
- LEX *lex=Lex;
- lex->option_type= $1;
- Item *item= new (thd->mem_root) Item_int((int32) $5);
-@@ -12167,7 +12106,7 @@ option_value:
- '@' ident_or_text equal expr
- {
- Item_func_set_user_var *item;
-- item= new (YYTHD->mem_root) Item_func_set_user_var($2, $4);
-+ item= new (thd->mem_root) Item_func_set_user_var($2, $4);
- if (item == NULL)
- MYSQL_YYABORT;
- set_var_user *var= new set_var_user(item);
-@@ -12177,7 +12116,6 @@ option_value:
- }
- | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
- {
-- THD *thd= YYTHD;
- struct sys_var_with_base tmp= $4;
- /* Lookup if necessary: must be a system variable. */
- if (tmp.var == NULL)
-@@ -12190,7 +12128,6 @@ option_value:
- }
- | charset old_or_new_charset_name_or_default
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- CHARSET_INFO *cs2;
- cs2= $2 ? $2: global_system_variables.character_set_client;
-@@ -12238,7 +12175,6 @@ option_value:
- }
- | PASSWORD equal text_or_password
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- LEX_USER *user;
- sp_pcontext *spc= lex->spcont;
-@@ -12278,7 +12214,6 @@ option_value:
- internal_variable_name:
- ident
- {
-- THD *thd= YYTHD;
- sp_pcontext *spc= thd->lex->spcont;
- sp_variable_t *spv;
-
-@@ -12337,7 +12272,7 @@ internal_variable_name:
- }
- else
- {
-- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
-+ sys_var *tmp=find_sys_var(thd, $3.str, $3.length);
- if (!tmp)
- MYSQL_YYABORT;
- if (!tmp->is_struct())
-@@ -12348,7 +12283,7 @@ internal_variable_name:
- }
- | DEFAULT '.' ident
- {
-- sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
-+ sys_var *tmp=find_sys_var(thd, $3.str, $3.length);
- if (!tmp)
- MYSQL_YYABORT;
- if (!tmp->is_struct())
-@@ -12370,16 +12305,16 @@ text_or_password:
- TEXT_STRING { $$=$1.str;}
- | PASSWORD '(' TEXT_STRING ')'
- {
-- $$= $3.length ? YYTHD->variables.old_passwords ?
-- Item_func_old_password::alloc(YYTHD, $3.str, $3.length) :
-- Item_func_password::alloc(YYTHD, $3.str, $3.length) :
-+ $$= $3.length ? thd->variables.old_passwords ?
-+ Item_func_old_password::alloc(thd, $3.str, $3.length) :
-+ Item_func_password::alloc(thd, $3.str, $3.length) :
- $3.str;
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | OLD_PASSWORD '(' TEXT_STRING ')'
- {
-- $$= $3.length ? Item_func_old_password::alloc(YYTHD, $3.str,
-+ $$= $3.length ? Item_func_old_password::alloc(thd, $3.str,
- $3.length) :
- $3.str;
- if ($$ == NULL)
-@@ -12393,19 +12328,19 @@ set_expr_or_default:
- | DEFAULT { $$=0; }
- | ON
- {
-- $$=new (YYTHD->mem_root) Item_string("ON", 2, system_charset_info);
-+ $$=new (thd->mem_root) Item_string("ON", 2, system_charset_info);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | ALL
- {
-- $$=new (YYTHD->mem_root) Item_string("ALL", 3, system_charset_info);
-+ $$=new (thd->mem_root) Item_string("ALL", 3, system_charset_info);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
- | BINARY
- {
-- $$=new (YYTHD->mem_root) Item_string("binary", 6, system_charset_info);
-+ $$=new (thd->mem_root) Item_string("binary", 6, system_charset_info);
- if ($$ == NULL)
- MYSQL_YYABORT;
- }
-@@ -12443,7 +12378,7 @@ table_lock:
- table_ident opt_table_alias lock_option
- {
- thr_lock_type lock_type= (thr_lock_type) $3;
-- if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type))
-+ if (!Select->add_table_to_list(thd, $1, $2, 0, lock_type))
- MYSQL_YYABORT;
- /* If table is to be write locked, protect from a impending GRL. */
- if (lock_type >= TL_WRITE_ALLOW_WRITE)
-@@ -12514,7 +12449,7 @@ handler:
- lex->expr_allows_subselect= FALSE;
- lex->sql_command = SQLCOM_HA_READ;
- lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
-- Item *one= new (YYTHD->mem_root) Item_int((int32) 1);
-+ Item *one= new (thd->mem_root) Item_int((int32) 1);
- if (one == NULL)
- MYSQL_YYABORT;
- lex->current_select->select_limit= one;
-@@ -12836,10 +12771,10 @@ grant_user:
- $$=$1; $1->password=$4;
- if ($4.length)
- {
-- if (YYTHD->variables.old_passwords)
-+ if (thd->variables.old_passwords)
- {
- char *buff=
-- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1);
-+ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1);
- if (buff == NULL)
- MYSQL_YYABORT;
- my_make_scrambled_password_323(buff, $4.str, $4.length);
-@@ -12849,7 +12784,7 @@ grant_user:
- else
- {
- char *buff=
-- (char *) YYTHD->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
-+ (char *) thd->alloc(SCRAMBLED_PASSWORD_CHAR_LENGTH+1);
- if (buff == NULL)
- MYSQL_YYABORT;
- my_make_scrambled_password(buff, $4.str, $4.length);
-@@ -12881,7 +12816,7 @@ column_list:
- column_list_id:
- ident
- {
-- String *new_str = new (YYTHD->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
-+ String *new_str = new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info);
- if (new_str == NULL)
- MYSQL_YYABORT;
- List_iterator <LEX_COLUMN> iter(Lex->columns);
-@@ -12981,14 +12916,14 @@ opt_work:
-
- opt_chain:
- /* empty */
-- { $$= (YYTHD->variables.completion_type == 1); }
-+ { $$= (thd->variables.completion_type == 1); }
- | AND_SYM NO_SYM CHAIN_SYM { $$=0; }
- | AND_SYM CHAIN_SYM { $$=1; }
- ;
-
- opt_release:
- /* empty */
-- { $$= (YYTHD->variables.completion_type == 2); }
-+ { $$= (thd->variables.completion_type == 2); }
- | RELEASE_SYM { $$=1; }
- | NO_SYM RELEASE_SYM { $$=0; }
- ;
-@@ -13102,7 +13037,6 @@ union_opt:
-
- union_order_or_limit:
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
- SELECT_LEX *sel= lex->current_select;
-@@ -13118,7 +13052,6 @@ union_order_or_limit:
- }
- order_or_limit
- {
-- THD *thd= YYTHD;
- thd->lex->current_select->no_table_names_allowed= 0;
- thd->where= "";
- }
-@@ -13255,14 +13188,14 @@ no_definer:
- from older master servers (i.e. to create non-suid trigger in this
- case).
- */
-- YYTHD->lex->definer= 0;
-+ thd->lex->definer= 0;
- }
- ;
-
- definer:
- DEFINER_SYM EQ user
- {
-- YYTHD->lex->definer= get_current_user(YYTHD, $3);
-+ thd->lex->definer= get_current_user(thd, $3);
- }
- ;
-
-@@ -13307,7 +13240,6 @@ view_suid:
- view_tail:
- view_suid VIEW_SYM table_ident
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- lex->sql_command= SQLCOM_CREATE_VIEW;
- /* first table in list is target VIEW name */
-@@ -13347,7 +13279,6 @@ view_select:
- }
- view_select_aux view_check_option
- {
-- THD *thd= YYTHD;
- LEX *lex= Lex;
- uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str;
- void *create_view_select= thd->memdup(lex->create_view_select.str, len);
-@@ -13403,7 +13334,6 @@ trigger_tail:
- EACH_SYM
- ROW_SYM
- { /* $15 */
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_head *sp;
-@@ -13437,8 +13367,8 @@ trigger_tail:
- sp_head *sp= lex->sphead;
-
- lex->sql_command= SQLCOM_CREATE_TRIGGER;
-- sp->set_stmt_end(YYTHD);
-- sp->restore_thd_mem_root(YYTHD);
-+ sp->set_stmt_end(thd);
-+ sp->restore_thd_mem_root(thd);
-
- if (sp->is_not_allowed_in_function("trigger"))
- MYSQL_YYABORT;
-@@ -13448,7 +13378,7 @@ trigger_tail:
- sp_proc_stmt alternatives are not saving/restoring LEX, so
- lex->query_tables can be wiped out.
- */
-- if (!lex->select_lex.add_table_to_list(YYTHD, $9,
-+ if (!lex->select_lex.add_table_to_list(thd, $9,
- (LEX_STRING*) 0,
- TL_OPTION_UPDATING,
- TL_IGNORE))
-@@ -13466,7 +13396,6 @@ udf_tail:
- AGGREGATE_SYM remember_name FUNCTION_SYM ident
- RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- if (is_native_function(thd, & $4))
- {
-@@ -13484,7 +13413,6 @@ udf_tail:
- | remember_name FUNCTION_SYM ident
- RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- if (is_native_function(thd, & $3))
- {
-@@ -13507,7 +13435,6 @@ sf_tail:
- sp_name /* $3 */
- '(' /* $4 */
- { /* $5 */
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
- sp_head *sp;
-@@ -13565,7 +13492,7 @@ sf_tail:
- MYSQL_YYABORT;
- }
-
-- if (sp->fill_field_definition(YYTHD, lex,
-+ if (sp->fill_field_definition(thd, lex,
- (enum enum_field_types) $11,
- &sp->m_return_field_def))
- MYSQL_YYABORT;
-@@ -13574,7 +13501,6 @@ sf_tail:
- }
- sp_c_chistics /* $13 */
- { /* $14 */
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- Lex_input_stream *lip= YYLIP;
-
-@@ -13583,7 +13509,6 @@ sf_tail:
- }
- sp_proc_stmt /* $15 */
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
- sp_head *sp= lex->sphead;
-
-@@ -13654,10 +13579,10 @@ sp_tail:
- sp= new sp_head();
- if (sp == NULL)
- MYSQL_YYABORT;
-- sp->reset_thd_mem_root(YYTHD);
-+ sp->reset_thd_mem_root(thd);
- sp->init(lex);
- sp->m_type= TYPE_ENUM_PROCEDURE;
-- sp->init_sp_name(YYTHD, $3);
-+ sp->init_sp_name(thd, $3);
-
- lex->sphead= sp;
- }
-@@ -13672,7 +13597,6 @@ sp_tail:
- sp_pdparam_list
- ')'
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
-
- lex->sphead->m_param_end= YYLIP->get_cpp_tok_start();
-@@ -13680,7 +13604,6 @@ sp_tail:
- }
- sp_c_chistics
- {
-- THD *thd= YYTHD;
- LEX *lex= thd->lex;
-
- lex->sphead->m_chistics= &lex->sp_chistics;
-@@ -13691,9 +13614,9 @@ sp_tail:
- LEX *lex= Lex;
- sp_head *sp= lex->sphead;
-
-- sp->set_stmt_end(YYTHD);
-+ sp->set_stmt_end(thd);
- lex->sql_command= SQLCOM_CREATE_PROCEDURE;
-- sp->restore_thd_mem_root(YYTHD);
-+ sp->restore_thd_mem_root(thd);
- }
- ;
-
-@@ -13730,21 +13653,21 @@ xid:
- text_string
- {
- MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
-- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
-+ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
- MYSQL_YYABORT;
- Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
- }
- | text_string ',' text_string
- {
- MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
-- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
-+ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
- MYSQL_YYABORT;
- Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
- }
- | text_string ',' text_string ',' ulong_num
- {
- MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
-- if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
-+ if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
- MYSQL_YYABORT;
- Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
- }
include $(TOPDIR)/rules.mk
PKG_NAME:=nano
-PKG_VERSION:=2.9.2
+PKG_VERSION:=2.9.6
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILES:=COPYING
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/nano
-PKG_HASH:=4eccb7451b5729ce8abae8f9a5679f32e41ae58df73ea86b850ec45b10a83d55
+PKG_HASH:=a373507ebb4e9307a8202fbc19b5d29718025c8ec773669349211c362545d4c6
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(TOPDIR)/rules.mk
PKG_NAME:=ncdu
-PKG_VERSION:=1.12
+PKG_VERSION:=1.13
PKG_RELEASE=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://dev.yorhel.nl/download
-PKG_HASH:=820e4e4747a2a2ec7a2e9f06d2f5a353516362c22496a10a9834f871b877499a
+PKG_HASH:=f4d9285c38292c2de05e444d0ba271cbfe1a705eee37c2b23ea7c448ab37255a
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
TITLE:=Open-ZWave Device Configs
endef
+TARGET_CPPFLAGS+=-Wno-format -Wno-format-security
+
MAKE_FLAGS += \
LD="$(TARGET_CROSS)g++" \
LIBDIR="$(PKG_BUILD_DIR)" \
--- /dev/null
+diff --git a/cpp/build/Makefile b/cpp/build/Makefile
+index 666472d..41dc58c 100644
+--- a/cpp/build/Makefile
++++ b/cpp/build/Makefile
+@@ -139,8 +139,8 @@ $(top_builddir)/libopenzwave.pc: $(top_srcdir)/cpp/build/libopenzwave.pc.in $(PK
+ @$(SED) \
+ -e 's|[@]prefix@|$(PREFIX)|g' \
+ -e 's|[@]exec_prefix@|$(PREFIX)/bin|g' \
+- -e 's|[@]libdir@|$(instlibdir)|g' \
+- -e 's|[@]includedir@|$(PREFIX)/include/openzwave/|g' \
++ -e 's|[@]libdir@|$${prefix}/lib|g' \
++ -e 's|[@]includedir@|$${prefix}/include/openzwave/|g' \
+ -e 's|[@]sysconfdir@|/etc/openzwave/|g' \
+ -e 's|[@]gitversion@|$(GITVERSION)|g' \
+ -e 's|[@]docdir@|$(docdir)/|g' \
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=https://alioth.debian.org/frs/download.php/file/4235
+PKG_SOURCE_URL:=https://pcsclite.apdu.fr/files/
PKG_HASH:=5a27262586eff39cfd5c19aadc8891dd71c0818d3d629539bd631b958be689c9
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=BSD-3-Clause
define Package/pcsc-lite/Default
TITLE:=Access a smart card using SCard API (PC/SC)
- URL:=http://pcsclite.alioth.debian.org/
+ URL:=https://pcsclite.apdu.fr/
endef
define Package/pcsc-lite/Default/description
include $(TOPDIR)/rules.mk
PKG_NAME:=pcsc-tools
-PKG_VERSION=1.5.2
+PKG_VERSION=1.5.3
PKG_RELEASE:=1
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://ludovic.rousseau.free.fr/softwares/pcsc-tools/
-PKG_HASH:=ff4e087c76700aa5a25dd7d0bc4f55bb4a5e71cd4f0d6b5301babe0b434f86fc
+PKG_HASH:=daaa011c28daa00653bd8e2a3d8b0b9f8abae00f7344f50b1a94fbd2b01f1d14
PKG_FIXUP:=autoreconf
-Windows (Win32) doesn't support the analyze ATR perl-script and since we
-don't want to pull in perl as a dependency add the same workaround here.
+Disable the analyze ATR perl-script and as we don't want to pull in perl
+as a dependency.
diff --git a/pcsc_scan.c b/pcsc_scan.c
-index e1d8942..81344e1 100644
+index d89bc3e..134b675 100644
--- a/pcsc_scan.c
+++ b/pcsc_scan.c
-@@ -224,9 +224,7 @@ int main(int argc, char *argv[])
- printf("PC/SC device scanner\n");
- printf("V " PACKAGE_VERSION " (c) 2001-2017, Ludovic Rousseau <ludovic.rousseau@free.fr>\n");
-
--#ifdef WIN32
- analyse_atr = FALSE;
--#endif
-
- while ((opt = getopt(argc, argv, "Vhns")) != EOF)
- {
+@@ -241,7 +241,7 @@ static void initialize_options(options_t *options, const char *pname)
+ #ifdef WIN32
+ options->analyse_atr = False;
+ #else
+- options->analyse_atr = True;
++ options->analyse_atr = False;
+ #endif
+ options->stress_card = False;
+ options->print_version = False;
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://picocom.googlecode.com/files
+PKG_SOURCE_URL:=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/picocom
PKG_HASH:=d0f31c8f7a215a76922d30c81a52b9a2348c89e02a84935517002b3bc2c1129e
PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
PKG_NAME:=procps-ng
PKG_VERSION:=3.3.11
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING COPYING.LIB
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=60da7bd78e834112494e4019998c9de8d61f747eab244ef3c42cadc7fd0958cc
+PKG_MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
CONFIGURE_ARGS += --enable-skill
+# most of these have alternatives provided by busybox applets
PROCPS_APPLETS := \
free kill pgrep pkill pmap ps pwdx skill slabtop \
snice tload top uptime vmstat w watch
+# procps-ng will be configured with "--bindir=/usr/bin --sbindir=/usr/sbin" and
+# as such executables will be installed there by default, but some of them need
+# to reside in locations such as /bin and /sbin to be in accordance with
+# busybox alternatives which is also other distributions like debian and centos
+# are doing
+PROCPS_APPLETS_DIR_bin:=kill ps watch
+procps-applets-dir=$(if $(findstring $(1),$(PROCPS_APPLETS_DIR_bin)),/bin,/usr/bin)
+
define Package/procps-ng/Default
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libncurses
TITLE:=procps-ng utilities
URL:=https://gitlab.com/procps-ng/procps
- MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
endef
define Build/Prepare
DEPENDS:=procps-ng
TITLE:=Applet $(2) from the procps-ng package
DEFAULT:=y
+ ALTERNATIVES:=200:$(3)/$(2):$(3)/$(1)
endef
define Package/$(1)/description
endef
endef
-$(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,procps-ng-$(a),$(a))))
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call GenPlugin,procps-ng-$(a),$(a),$(call procps-applets-dir,$(a)))))
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
define Package/procps-ng/install
- $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libprocps.so* $(1)/usr/lib/
endef
define BuildPlugin
define Package/$(1)/install
- $(INSTALL_DIR) $$(1)/usr/bin
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
+ $(INSTALL_DIR) $$(1)$(3)
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)$(3)/$(1)
endef
$$(eval $$(call BuildPackage,$(1)))
endef
-$(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,procps-ng-$(a),$(a))))
+$(foreach a,$(PROCPS_APPLETS),$(eval $(call BuildPlugin,procps-ng-$(a),$(a),$(call procps-applets-dir,$(a)))))
$(eval $(call BuildPackage,procps-ng))
include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua
-PKG_VERSION:=2017.05.07
-PKG_RELEASE:=1
+PKG_VERSION:=2017.12.08
+PKG_RELEASE:=3
PKG_MAINTAINER:=Christian Simon <simon@swine.de>
PKG_LICENSE:=Apache-2.0
include $(INCLUDE_DIR)/package.mk
-define Package/prometheus-node-exporter-lua
+define Package/prometheus-node-exporter-lua/Default
SECTION:=utils
CATEGORY:=Utilities
- TITLE:=Provides system statistics as Prometheus scraping endpoint
- DEPENDS:=+luasocket
- URL:=https://github.com/rbo/openwrt_exporter
+ TITLE:=Prometheus node exporter
PKGARCH:=all
endef
+define Package/prometheus-node-exporter-lua
+ $(call Package/prometheus-node-exporter-lua/Default)
+ DEPENDS:=+luasocket +lua
+endef
+
define Package/prometheus-node-exporter-lua/conffiles
/etc/config/prometheus-node-exporter-lua
endef
This service is a lightweight rewrite in LUA of the offical Prometheus node_exporter.
endef
+define Package/prometheus-node-exporter-lua-nat_traffic
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (nat_traffic collector)
+ DEPENDS:=prometheus-node-exporter-lua
+endef
+
+define Package/prometheus-node-exporter-lua-netstat
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (netstat collector)
+ DEPENDS:=prometheus-node-exporter-lua
+endef
+
+define Package/prometheus-node-exporter-lua-wifi
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (wifi collector)
+ DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
+endef
+
+define Package/prometheus-node-exporter-lua-wifi_stations
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (wifi_stations collector)
+ DEPENDS:=prometheus-node-exporter-lua +libiwinfo-lua +libubus-lua
+endef
+
+define Package/prometheus-node-exporter-lua-bmx6
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (bmx6 links collector)
+ DEPENDS:=prometheus-node-exporter-lua bmx6 +lua-cjson +bmx6-json
+endef
+
+define Package/prometheus-node-exporter-lua-bmx7
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (bmx7 links collector)
+ DEPENDS:=prometheus-node-exporter-lua bmx7 +lua-cjson +bmx7-json
+endef
+
+define Package/prometheus-node-exporter-lua-textfile
+ $(call Package/prometheus-node-exporter-lua/Default)
+ TITLE+= (textfile collector)
+ DEPENDS:=prometheus-node-exporter-lua +luci-lib-nixio
+endef
+
Build/Compile=
define Package/prometheus-node-exporter-lua/install
$(INSTALL_BIN) ./files/etc/init.d/prometheus-node-exporter-lua $(1)/etc/init.d/prometheus-node-exporter-lua
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/prometheus-node-exporter-lua $(1)/usr/bin/prometheus-node-exporter-lua
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/cpu.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/filefd.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/loadavg.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/meminfo.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netdev.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/time.lua $(1)/usr/lib/lua/prometheus-collectors/
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/uname.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-nat_traffic/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/nat_traffic.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-netstat/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/netstat.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-wifi/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-wifi_stations/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/wifi_stations.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-bmx6/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx6.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-bmx7/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx7.lua $(1)/usr/lib/lua/prometheus-collectors/
+endef
+
+define Package/prometheus-node-exporter-lua-textfile/install
+ $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
+ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/textfile.lua $(1)/usr/lib/lua/prometheus-collectors/
endef
$(eval $(call BuildPackage,prometheus-node-exporter-lua))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-nat_traffic))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-netstat))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi_stations))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx6))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7))
+$(eval $(call BuildPackage,prometheus-node-exporter-lua-textfile))
procd_append_param command --port ${port}
procd_append_param command --bind ${bind}
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+
procd_close_instance
}
socket = require("socket")
--- Allow us to call unpack under both lua5.1 and lua5.2+
-local unpack = unpack or table.unpack
-
--- This table defines the scrapers to run.
--- Each corresponds directly to a scraper_<name> function.
-scrapers = { "cpu", "load_averages", "memory", "file_handles", "network",
- "network_devices", "time", "uname", "nat", "wifi"}
-
-- Parsing
function space_split(s)
- elements = {}
+ local elements = {}
for element in s:gmatch("%S+") do
table.insert(elements, element)
end
return elements
end
-function line_split(s)
- elements = {}
- for element in s:gmatch("[^\n]+") do
- table.insert(elements, element)
- end
- return elements
-end
-
function get_contents(filename)
local f = io.open(filename, "rb")
local contents = ""
return outputter
end
-function scraper_wifi()
- local rv = { }
- local ntm = require "luci.model.network".init()
-
- local metric_wifi_network_up = metric("wifi_network_up","gauge")
- local metric_wifi_network_quality = metric("wifi_network_quality","gauge")
- local metric_wifi_network_bitrate = metric("wifi_network_bitrate","gauge")
- local metric_wifi_network_noise = metric("wifi_network_noise","gauge")
- local metric_wifi_network_signal = metric("wifi_network_signal","gauge")
-
- local metric_wifi_station_signal = metric("wifi_station_signal","gauge")
- local metric_wifi_station_tx_packets = metric("wifi_station_tx_packets","gauge")
- local metric_wifi_station_rx_packets = metric("wifi_station_rx_packets","gauge")
-
- local dev
- for _, dev in ipairs(ntm:get_wifidevs()) do
- local rd = {
- up = dev:is_up(),
- device = dev:name(),
- name = dev:get_i18n(),
- networks = { }
- }
-
- local net
- for _, net in ipairs(dev:get_wifinets()) do
- local labels = {
- channel = net:channel(),
- ssid = net:active_ssid(),
- bssid = net:active_bssid(),
- mode = net:active_mode(),
- ifname = net:ifname(),
- country = net:country(),
- frequency = net:frequency(),
- }
- if net:is_up() then
- metric_wifi_network_up(labels, 1)
- local signal = net:signal_percent()
- if signal ~= 0 then
- metric_wifi_network_quality(labels, net:signal_percent())
- end
- metric_wifi_network_noise(labels, net:noise())
- local bitrate = net:bitrate()
- if bitrate then
- metric_wifi_network_bitrate(labels, bitrate)
- end
-
- local assoclist = net:assoclist()
- for mac, station in pairs(assoclist) do
- local labels = {
- ifname = net:ifname(),
- mac = mac,
- }
- metric_wifi_station_signal(labels, station.signal)
- metric_wifi_station_tx_packets(labels, station.tx_packets)
- metric_wifi_station_rx_packets(labels, station.rx_packets)
- end
- else
- metric_wifi_network_up(labels, 0)
- end
- end
- rv[#rv+1] = rd
- end
-end
-
-function scraper_cpu()
- local stat = get_contents("/proc/stat")
-
- -- system boot time, seconds since epoch
- metric("node_boot_time", "gauge", nil, string.match(stat, "btime ([0-9]+)"))
-
- -- context switches since boot (all CPUs)
- metric("node_context_switches", "counter", nil, string.match(stat, "ctxt ([0-9]+)"))
-
- -- cpu times, per CPU, per mode
- local cpu_mode = {"user", "nice", "system", "idle", "iowait", "irq",
- "softirq", "steal", "guest", "guest_nice"}
- local i = 0
- local cpu_metric = metric("node_cpu", "counter")
- while string.match(stat, string.format("cpu%d ", i)) do
- local cpu = space_split(string.match(stat, string.format("cpu%d ([0-9 ]+)", i)))
- local labels = {cpu = "cpu" .. i}
- for ii, mode in ipairs(cpu_mode) do
- labels['mode'] = mode
- cpu_metric(labels, cpu[ii] / 100)
- end
- i = i + 1
- end
-
- -- interrupts served
- metric("node_intr", "counter", nil, string.match(stat, "intr ([0-9]+)"))
-
- -- processes forked
- metric("node_forks", "counter", nil, string.match(stat, "processes ([0-9]+)"))
-
- -- processes running
- metric("node_procs_running", "gauge", nil, string.match(stat, "procs_running ([0-9]+)"))
-
- -- processes blocked for I/O
- metric("node_procs_blocked", "gauge", nil, string.match(stat, "procs_blocked ([0-9]+)"))
-end
-
-function scraper_load_averages()
- local loadavg = space_split(get_contents("/proc/loadavg"))
-
- metric("node_load1", "gauge", nil, loadavg[1])
- metric("node_load5", "gauge", nil, loadavg[2])
- metric("node_load15", "gauge", nil, loadavg[3])
-end
-
-function scraper_memory()
- local meminfo = line_split(get_contents("/proc/meminfo"):gsub("[):]", ""):gsub("[(]", "_"))
-
- for i, mi in ipairs(meminfo) do
- local name, size, unit = unpack(space_split(mi))
- if unit == 'kB' then
- size = size * 1024
- end
- metric("node_memory_" .. name, "gauge", nil, size)
- end
-end
-
-function scraper_file_handles()
- local file_nr = space_split(get_contents("/proc/sys/fs/file-nr"))
-
- metric("node_filefd_allocated", "gauge", nil, file_nr[1])
- metric("node_filefd_maximum", "gauge", nil, file_nr[3])
-end
-
-function scraper_network()
- -- NOTE: Both of these are missing in OpenWRT kernels.
- -- See: https://dev.openwrt.org/ticket/15781
- local netstat = get_contents("/proc/net/netstat") .. get_contents("/proc/net/snmp")
-
- -- all devices
- local netsubstat = {"IcmpMsg", "Icmp", "IpExt", "Ip", "TcpExt", "Tcp", "UdpLite", "Udp"}
- for i, nss in ipairs(netsubstat) do
- local substat_s = string.match(netstat, nss .. ": ([A-Z][A-Za-z0-9 ]+)")
- if substat_s then
- local substat = space_split(substat_s)
- local substatv = space_split(string.match(netstat, nss .. ": ([0-9 -]+)"))
- for ii, ss in ipairs(substat) do
- metric("node_netstat_" .. nss .. "_" .. ss, "gauge", nil, substatv[ii])
- end
- end
- end
-end
-
-function scraper_network_devices()
- local netdevstat = line_split(get_contents("/proc/net/dev"))
- local netdevsubstat = {"receive_bytes", "receive_packets", "receive_errs",
- "receive_drop", "receive_fifo", "receive_frame", "receive_compressed",
- "receive_multicast", "transmit_bytes", "transmit_packets",
- "transmit_errs", "transmit_drop", "transmit_fifo", "transmit_colls",
- "transmit_carrier", "transmit_compressed"}
- for i, line in ipairs(netdevstat) do
- netdevstat[i] = string.match(netdevstat[i], "%S.*")
- end
- local nds_table = {}
- local devs = {}
- for i, nds in ipairs(netdevstat) do
- local dev, stat_s = string.match(netdevstat[i], "([^:]+): (.*)")
- if dev then
- nds_table[dev] = space_split(stat_s)
- table.insert(devs, dev)
- end
- end
- for i, ndss in ipairs(netdevsubstat) do
- netdev_metric = metric("node_network_" .. ndss, "gauge")
- for ii, d in ipairs(devs) do
- netdev_metric({device=d}, nds_table[d][i])
- end
- end
-end
-
-function scraper_time()
- -- current time
- metric("node_time", "counter", nil, os.time())
-end
-
-function scraper_uname()
- -- version can have spaces, so grab it directly
- local version = string.sub(io.popen("uname -v"):read("*a"), 1, -2)
- -- avoid individual popen calls for the rest of the values
- local uname_string = io.popen("uname -a"):read("*a")
- local sysname, nodename, release = unpack(space_split(uname_string))
- local labels = {domainname = "(none)", nodename = nodename, release = release,
- sysname = sysname, version = version}
-
- -- The machine hardware name is immediately after the version string, so add
- -- up the values we know and add in the 4 spaces to find the offset...
- machine_offset = string.len(sysname .. nodename .. release .. version) + 4
- labels['machine'] = string.match(string.sub(uname_string, machine_offset), "(%S+)" )
- metric("node_uname_info", "gauge", labels, 1)
-end
-
-function scraper_nat()
- -- documetation about nf_conntrack:
- -- https://www.frozentux.net/iptables-tutorial/chunkyhtml/x1309.html
- -- local natstat = line_split(get_contents("/proc/net/nf_conntrack"))
- local natstat = line_split(get_contents("nf_conntrack"))
-
- nat_metric = metric("node_nat_traffic", "gauge" )
- for i, e in ipairs(natstat) do
- -- output(string.format("%s\n",e ))
- local fields = space_split(e)
- local src, dest, bytes;
- bytes = 0;
- for ii, field in ipairs(fields) do
- if src == nil and string.match(field, '^src') then
- src = string.match(field,"src=([^ ]+)");
- elseif dest == nil and string.match(field, '^dst') then
- dest = string.match(field,"dst=([^ ]+)");
- elseif string.match(field, '^bytes') then
- local b = string.match(field, "bytes=([^ ]+)");
- bytes = bytes + b;
- -- output(string.format("\t%d %s",ii,field ));
- end
-
- end
- -- local src, dest, bytes = string.match(natstat[i], "src=([^ ]+) dst=([^ ]+) .- bytes=([^ ]+)");
- -- local src, dest, bytes = string.match(natstat[i], "src=([^ ]+) dst=([^ ]+) sport=[^ ]+ dport=[^ ]+ packets=[^ ]+ bytes=([^ ]+)")
-
- local labels = { src = src, dest = dest }
- -- output(string.format("src=|%s| dest=|%s| bytes=|%s|", src, dest, bytes ))
- nat_metric(labels, bytes )
- end
-end
-
-function timed_scrape(scraper)
+function timed_scrape(collector)
local start_time = socket.gettime()
- -- build the function name and call it from global variable table
- _G["scraper_"..scraper]()
- local duration = socket.gettime() - start_time
- return duration
-end
-
-function run_all_scrapers()
- times = {}
- for i,scraper in ipairs(scrapers) do
- runtime = timed_scrape(scraper)
- times[scraper] = runtime
- scrape_time_sums[scraper] = scrape_time_sums[scraper] + runtime
- scrape_counts[scraper] = scrape_counts[scraper] + 1
- end
-
- local name = "node_exporter_scrape_duration_seconds"
- local duration_metric = metric(name, "summary")
- for i,scraper in ipairs(scrapers) do
- local labels = {collector=scraper, result="success"}
- duration_metric(labels, times[scraper])
- print_metric(name.."_sum", labels, scrape_time_sums[scraper])
- print_metric(name.."_count", labels, scrape_counts[scraper])
+ local success = 1
+ local status, err = pcall(collector.scrape)
+ if not status then
+ success = 0
+ print(err)
+ end
+ return (socket.gettime() - start_time), success
+end
+
+function run_all_collectors(collectors)
+ local metric_duration = metric("node_scrape_collector_duration_seconds", "gauge")
+ local metric_success = metric("node_scrape_collector_success", "gauge")
+ for _,cname in pairs(collectors) do
+ if col_mods[cname] ~= nil then
+ local duration, success = timed_scrape(col_mods[cname])
+ local labels = {collector=cname}
+ metric_duration(labels, duration)
+ metric_success(labels, success)
+ end
end
end
-- Web server-specific functions
function http_ok_header()
- output("HTTP/1.1 200 OK\r")
- output("Server: lua-metrics\r")
- output("Content-Type: text/plain; version=0.0.4\r")
- output("\r")
+ output("HTTP/1.0 200 OK\r\nServer: lua-metrics\r\nContent-Type: text/plain; version=0.0.4\r\n\r")
end
function http_not_found()
- output("HTTP/1.1 404 Not Found\r")
- output("Server: lua-metrics\r")
- output("Content-Type: text/plain\r")
- output("\r")
- output("ERROR: File Not Found.")
+ output("HTTP/1.0 404 Not Found\r\nServer: lua-metrics\r\nContent-Type: text/plain\r\n\r\nERROR: File Not Found.")
end
function serve(request)
- if not string.match(request, "GET /metrics.*") then
+ local q = request:match("^GET /metrics%??([^ ]*) HTTP/1%.[01]$")
+ if q == nil then
http_not_found()
else
http_ok_header()
- run_all_scrapers()
+ local cols = {}
+ for c in q:gmatch("collect[^=]*=([^&]+)") do
+ cols[#cols+1] = c
+ end
+ if #cols == 0 then
+ cols = col_names
+ end
+ run_all_collectors(cols)
end
client:close()
return true
end
end
-scrape_counts = {}
-scrape_time_sums = {}
-for i,scraper in ipairs(scrapers) do
- scrape_counts[scraper] = 0
- scrape_time_sums[scraper] = 0
+col_mods = {}
+col_names = {}
+for c in io.popen("ls -1 /usr/lib/lua/prometheus-collectors/*.lua"):lines() do
+ c = c:match("([^/]+)%.lua$")
+ col_mods[c] = require('prometheus-collectors.'..c)
+ col_names[#col_names+1] = c
end
if port then
end
else
output = print
- run_all_scrapers()
+ run_all_collectors(col_names)
end
--- /dev/null
+#!/usr/bin/lua
+
+local json = require "cjson"
+
+local function interpret_suffix(rate)
+ local value = string.sub(rate, 1, -2)
+ local suffix = string.sub(rate, -1)
+ if suffix == "K" then return tonumber(value) * 10^3 end
+ if suffix == "M" then return tonumber(value) * 10^6 end
+ if suffix == "G" then return tonumber(value) * 10^9 end
+ return rate
+end
+
+local function scrape()
+ local status = json.decode(get_contents("/var/run/bmx6/json/status")).status
+ local labels = {
+ version = status.version,
+ id = status.name,
+ address = status.primaryIp
+ }
+
+ metric("bmx6_status", "gauge", labels, 1)
+
+ local links = json.decode(get_contents("/var/run/bmx6/json/links")).links
+ local metric_bmx6_rxRate = metric("bmx6_link_rxRate","gauge")
+ local metric_bmx6_txRate = metric("bmx6_link_txRate","gauge")
+
+ for _, link in pairs(links) do
+ local labels = {
+ source = status.name,
+ target = link.name,
+ dev = link.viaDev
+ }
+ metric_bmx6_rxRate(labels, interpret_suffix(link.rxRate))
+ metric_bmx6_txRate(labels, interpret_suffix(link.txRate))
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+#!/usr/bin/lua
+
+local json = require "cjson"
+
+local function interpret_suffix(rate)
+ if rate ~= nil then
+ local value = string.sub(rate, 1, -2)
+ local suffix = string.sub(rate, -1)
+ if suffix == "K" then return tonumber(value) * 10^3 end
+ if suffix == "M" then return tonumber(value) * 10^6 end
+ if suffix == "G" then return tonumber(value) * 10^9 end
+ end
+ return rate
+end
+
+local function scrape()
+ local status = json.decode(get_contents("/var/run/bmx7/json/status")).status
+ local labels = {
+ id = status.shortId,
+ name = status.name,
+ address = status.primaryIp,
+ revision = status.revision,
+ }
+
+ metric("bmx7_status", "gauge", labels, 1)
+ metric("bmx7_cpu_usage", "gauge", nil, status.cpu)
+ metric("bmx7_mem_usage", "gauge", nil, interpret_suffix(status.mem))
+
+ local links = json.decode(get_contents("/var/run/bmx7/json/links")).links
+ local metric_bmx7_rxRate = metric("bmx7_link_rxRate","gauge")
+ local metric_bmx7_txRate = metric("bmx7_link_txRate","gauge")
+
+ for _, link in pairs(links) do
+ local labels = {
+ source = status.shortId,
+ target = link.shortId,
+ name = link.name,
+ dev = link.dev
+ }
+ metric_bmx7_rxRate(labels, interpret_suffix(link.rxRate))
+ metric_bmx7_txRate(labels, interpret_suffix(link.txRate))
+ end
+
+ local metric_bmx7_tunIn = metric("bmx7_tunIn", "gauge")
+ local parameters = json.decode(get_contents("/var/run/bmx7/json/parameters")).OPTIONS
+ for _, option in pairs(parameters) do
+ if option.name == "tunIn" then
+ for _, instance in pairs(option.INSTANCES) do
+ for _, child_instance in pairs(instance.CHILD_INSTANCES) do
+ local labels = {
+ name = instance.value,
+ network = child_instance.value
+ }
+ metric_bmx7_tunIn(labels, 1)
+ end
+ end
+ elseif option.name == "plugin" then
+ local metric_bmx7_plugin = metric("bmx7_plugin", "gauge")
+ for _, instance in pairs(option.INSTANCES) do
+ metric_bmx7_plugin({ name = instance.value }, 1)
+ end
+ end
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+-- stat/cpu collector
+local function scrape()
+ local stat = get_contents("/proc/stat")
+
+ -- system boot time, seconds since epoch
+ metric("node_boot_time", "gauge", nil, string.match(stat, "btime ([0-9]+)"))
+
+ -- context switches since boot (all CPUs)
+ metric("node_context_switches", "counter", nil, string.match(stat, "ctxt ([0-9]+)"))
+
+ -- cpu times, per CPU, per mode
+ local cpu_mode = {"user", "nice", "system", "idle", "iowait", "irq",
+ "softirq", "steal", "guest", "guest_nice"}
+ local i = 0
+ local cpu_metric = metric("node_cpu", "counter")
+ while true do
+ local cpu = {string.match(stat, "cpu"..i.." (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+) (%d+)")}
+ if #cpu ~= 10 then
+ break
+ end
+ for ii, mode in ipairs(cpu_mode) do
+ cpu_metric({cpu="cpu"..i, mode=mode}, cpu[ii] / 100)
+ end
+ i = i + 1
+ end
+
+ -- interrupts served
+ metric("node_intr", "counter", nil, string.match(stat, "intr ([0-9]+)"))
+
+ -- processes forked
+ metric("node_forks", "counter", nil, string.match(stat, "processes ([0-9]+)"))
+
+ -- processes running
+ metric("node_procs_running", "gauge", nil, string.match(stat, "procs_running ([0-9]+)"))
+
+ -- processes blocked for I/O
+ metric("node_procs_blocked", "gauge", nil, string.match(stat, "procs_blocked ([0-9]+)"))
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ local file_nr = space_split(get_contents("/proc/sys/fs/file-nr"))
+
+ metric("node_filefd_allocated", "gauge", nil, file_nr[1])
+ metric("node_filefd_maximum", "gauge", nil, file_nr[3])
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ local loadavg = space_split(get_contents("/proc/loadavg"))
+
+ metric("node_load1", "gauge", nil, loadavg[1])
+ metric("node_load5", "gauge", nil, loadavg[2])
+ metric("node_load15", "gauge", nil, loadavg[3])
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ for line in io.lines("/proc/meminfo") do
+ local name, size, unit = string.match(line, "([^:]+):%s+(%d+)%s?(k?B?)")
+ if unit == 'kB' then
+ size = size * 1024
+ end
+ metric("node_memory_" .. name:gsub("[):]", ""):gsub("[(]", "_"), "gauge", nil, size)
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ -- documetation about nf_conntrack:
+ -- https://www.frozentux.net/iptables-tutorial/chunkyhtml/x1309.html
+ nat_metric = metric("node_nat_traffic", "gauge" )
+ for e in io.lines("/proc/net/nf_conntrack") do
+ -- output(string.format("%s\n",e ))
+ local fields = space_split(e)
+ local src, dest, bytes;
+ bytes = 0;
+ for _, field in ipairs(fields) do
+ if src == nil and string.match(field, '^src') then
+ src = string.match(field,"src=([^ ]+)");
+ elseif dest == nil and string.match(field, '^dst') then
+ dest = string.match(field,"dst=([^ ]+)");
+ elseif string.match(field, '^bytes') then
+ local b = string.match(field, "bytes=([^ ]+)");
+ bytes = bytes + b;
+ -- output(string.format("\t%d %s",ii,field ));
+ end
+
+ end
+ -- local src, dest, bytes = string.match(natstat[i], "src=([^ ]+) dst=([^ ]+) .- bytes=([^ ]+)");
+ -- local src, dest, bytes = string.match(natstat[i], "src=([^ ]+) dst=([^ ]+) sport=[^ ]+ dport=[^ ]+ packets=[^ ]+ bytes=([^ ]+)")
+
+ local labels = { src = src, dest = dest }
+ -- output(string.format("src=|%s| dest=|%s| bytes=|%s|", src, dest, bytes ))
+ nat_metric(labels, bytes )
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+
+local netdevsubstat = {"receive_bytes", "receive_packets", "receive_errs",
+ "receive_drop", "receive_fifo", "receive_frame", "receive_compressed",
+ "receive_multicast", "transmit_bytes", "transmit_packets",
+ "transmit_errs", "transmit_drop", "transmit_fifo", "transmit_colls",
+ "transmit_carrier", "transmit_compressed"}
+local pattern = "([^%s:]+):%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)"
+
+local function scrape()
+ local nds_table = {}
+ for line in io.lines("/proc/net/dev") do
+ local t = {string.match(line, pattern)}
+ if #t == 17 then
+ nds_table[t[1]] = t
+ end
+ end
+ for i, ndss in ipairs(netdevsubstat) do
+ netdev_metric = metric("node_network_" .. ndss, "gauge")
+ for dev, nds_dev in pairs(nds_table) do
+ netdev_metric({device=dev}, nds_dev[i+1])
+ end
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ -- NOTE: Both of these are missing in OpenWRT kernels.
+ -- See: https://dev.openwrt.org/ticket/15781
+ local netstat = get_contents("/proc/net/netstat") .. get_contents("/proc/net/snmp")
+
+ -- all devices
+ local netsubstat = {"IcmpMsg", "Icmp", "IpExt", "Ip", "TcpExt", "Tcp", "UdpLite", "Udp"}
+ for i, nss in ipairs(netsubstat) do
+ local substat_s = string.match(netstat, nss .. ": ([A-Z][A-Za-z0-9 ]+)")
+ if substat_s then
+ local substat = space_split(substat_s)
+ local substatv = space_split(string.match(netstat, nss .. ": ([0-9 -]+)"))
+ for ii, ss in ipairs(substat) do
+ metric("node_netstat_" .. nss .. "_" .. ss, "gauge", nil, substatv[ii])
+ end
+ end
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+#!/usr/bin/lua
+
+local fs = require "nixio.fs"
+
+local function scrape()
+ for metrics in fs.glob("/var/prometheus/*.prom") do
+ output(get_contents(metrics), '\n')
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+local function scrape()
+ -- current time
+ metric("node_time", "counter", nil, os.time())
+end
+
+return { scrape = scrape }
--- /dev/null
+local labels = {
+ domainname = "",
+ nodename = "",
+ release = string.sub(get_contents("/proc/sys/kernel/osrelease"), 1, -2),
+ sysname = string.sub(get_contents("/proc/sys/kernel/ostype"), 1, -2),
+ version = string.sub(get_contents("/proc/sys/kernel/version"), 1, -2),
+ machine = string.sub(io.popen("uname -m"):read("*a"), 1, -2)
+}
+
+local function scrape()
+ labels["domainname"] = string.sub(get_contents("/proc/sys/kernel/domainname"), 1, -2)
+ labels["nodename"] = string.sub(get_contents("/proc/sys/kernel/hostname"), 1, -2)
+ metric("node_uname_info", "gauge", labels, 1)
+end
+
+return { scrape = scrape }
--- /dev/null
+local ubus = require "ubus"
+local iwinfo = require "iwinfo"
+
+local function scrape()
+ local metric_wifi_network_quality = metric("wifi_network_quality","gauge")
+ local metric_wifi_network_bitrate = metric("wifi_network_bitrate","gauge")
+ local metric_wifi_network_noise = metric("wifi_network_noise","gauge")
+ local metric_wifi_network_signal = metric("wifi_network_signal","gauge")
+
+ local u = ubus.connect()
+ local status = u:call("network.wireless", "status", {})
+
+ for dev, dev_table in pairs(status) do
+ for _, intf in ipairs(dev_table['interfaces']) do
+ local ifname = intf['ifname']
+ local iw = iwinfo[iwinfo.type(ifname)]
+ local labels = {
+ channel = iw.channel(ifname),
+ ssid = iw.ssid(ifname),
+ bssid = iw.bssid(ifname),
+ mode = iw.mode(ifname),
+ ifname = ifname,
+ country = iw.country(ifname),
+ frequency = iw.frequency(ifname),
+ device = dev,
+ }
+
+ local qc = iw.quality(ifname) or 0
+ local qm = iw.quality_max(ifname) or 0
+ local quality = 0
+ if qc > 0 and qm > 0 then
+ quality = math.floor((100 / qm) * qc)
+ end
+
+ metric_wifi_network_quality(labels, quality)
+ metric_wifi_network_noise(labels, iw.noise(ifname) or 0)
+ metric_wifi_network_bitrate(labels, iw.bitrate(ifname) or 0)
+ metric_wifi_network_signal(labels, iw.signal(ifname) or -255)
+ end
+ end
+end
+
+return { scrape = scrape }
--- /dev/null
+local ubus = require "ubus"
+local iwinfo = require "iwinfo"
+
+local function scrape()
+ local metric_wifi_station_signal = metric("wifi_station_signal","gauge")
+ local metric_wifi_station_tx_packets = metric("wifi_station_tx_packets","gauge")
+ local metric_wifi_station_rx_packets = metric("wifi_station_rx_packets","gauge")
+
+ local u = ubus.connect()
+ local status = u:call("network.wireless", "status", {})
+
+ for dev, dev_table in pairs(status) do
+ for _, intf in ipairs(dev_table['interfaces']) do
+ local ifname = intf['ifname']
+ local iw = iwinfo[iwinfo.type(ifname)]
+
+ local assoclist = iw.assoclist(ifname)
+ for mac, station in pairs(assoclist) do
+ local labels = {
+ ifname = ifname,
+ mac = mac,
+ }
+ metric_wifi_station_signal(labels, station.signal)
+ metric_wifi_station_tx_packets(labels, station.tx_packets)
+ metric_wifi_station_rx_packets(labels, station.rx_packets)
+ end
+ end
+ end
+end
+
+return { scrape = scrape }
#
# Copyright (C) 2016 OpenWrt.org
-# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
+# Copyright (C) 2016-2018 Yousong Zhou <yszhou4tech@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=qemu
-PKG_VERSION:=2.6.2
-PKG_RELEASE:=3
+PKG_VERSION:=2.11.1
+PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_HASH:=9a7ec64f147b9e1e570c410e00ebe271869b5d4c85392ba047db7617c297faa3
+PKG_HASH:=d9df2213ceed32e91dab7bc9dd19c1af83f91ba72c7aeef7605dfaaf81732ccb
PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE tcg/LICENSE
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
+PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_USE_MIPS16:=0
TITLE:=QEMU target $(1)
URL:=http://www.qemu.org
DEPENDS:= +glib2 +libpthread +zlib $(CXX_DEPENDS) $(QEMU_DEPS_IN_HOST) \
- $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +qemu-blobs)
+ $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +pixman +qemu-blobs)
endef
define Package/qemu-$(1)/description
--disable-tools \
--disable-seccomp \
--disable-glusterfs \
- --disable-archipelago \
--disable-gtk \
--disable-gnutls \
--disable-nettle \
+++ /dev/null
---- a/configure.orig 2016-11-22 11:53:25.739180380 +0800
-+++ b/configure 2016-11-22 11:53:55.183189596 +0800
-@@ -1147,6 +1147,8 @@ for opt do
- ;;
- --enable-jemalloc) jemalloc="yes"
- ;;
-+ --disable-fortify-source) fortify_source="no"
-+ ;;
- *)
- echo "ERROR: unknown option $opt"
- echo "Try '$0 --help' for more information"
--- /dev/null
+From 0b4011cd0983ced6e065f397049f967656494793 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Sat, 24 Feb 2018 13:43:19 +0800
+Subject: [PATCH 1/3] configure: allow disable fortify_source
+
+Tell build system of qemu to not add _FORTIFY_SOURCE options and let the
+OpenWrt base build system decide flavor of fortify_source to use
+---
+ configure | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure b/configure
+index 0c6e757..8ea3fdd 100755
+--- a/configure
++++ b/configure
+@@ -1313,6 +1313,8 @@ for opt do
+ ;;
+ --disable-git-update) git_update=no
+ ;;
++ --disable-fortify-source) fortify_source="no"
++ ;;
+ *)
+ echo "ERROR: unknown option $opt"
+ echo "Try '$0 --help' for more information"
+--
+1.8.3.1
+
--- /dev/null
+From 83e72b93889fbcbbfff281b0dbcc58c5a7455257 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Sat, 24 Feb 2018 13:45:25 +0800
+Subject: [PATCH 2/3] disas: fix compilation failure when isnan is a macro
+
+---
+ disas/libvixl/vixl/utils.h | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/disas/libvixl/vixl/utils.h b/disas/libvixl/vixl/utils.h
+index 5ab134e..df30663 100644
+--- a/disas/libvixl/vixl/utils.h
++++ b/disas/libvixl/vixl/utils.h
+@@ -118,11 +118,17 @@ double double_pack(uint64_t sign, uint64_t exp, uint64_t mantissa);
+ // An fpclassify() function for 16-bit half-precision floats.
+ int float16classify(float16 value);
+
++#ifdef isnan
++#define isnan_ isnan
++#else
++#define isnan_ std::isnan
++#endif
++
+ // NaN tests.
+ inline bool IsSignallingNaN(double num) {
+ const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000);
+ uint64_t raw = double_to_rawbits(num);
+- if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) {
++ if (isnan_(num) && ((raw & kFP64QuietNaNMask) == 0)) {
+ return true;
+ }
+ return false;
+@@ -132,7 +138,7 @@ inline bool IsSignallingNaN(double num) {
+ inline bool IsSignallingNaN(float num) {
+ const uint32_t kFP32QuietNaNMask = 0x00400000;
+ uint32_t raw = float_to_rawbits(num);
+- if (std::isnan(num) && ((raw & kFP32QuietNaNMask) == 0)) {
++ if (isnan_(num) && ((raw & kFP32QuietNaNMask) == 0)) {
+ return true;
+ }
+ return false;
+@@ -148,21 +154,21 @@ inline bool IsSignallingNaN(float16 num) {
+
+ template <typename T>
+ inline bool IsQuietNaN(T num) {
+- return std::isnan(num) && !IsSignallingNaN(num);
++ return isnan_(num) && !IsSignallingNaN(num);
+ }
+
+
+ // Convert the NaN in 'num' to a quiet NaN.
+ inline double ToQuietNaN(double num) {
+ const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000);
+- VIXL_ASSERT(std::isnan(num));
++ VIXL_ASSERT(isnan_(num));
+ return rawbits_to_double(double_to_rawbits(num) | kFP64QuietNaNMask);
+ }
+
+
+ inline float ToQuietNaN(float num) {
+ const uint32_t kFP32QuietNaNMask = 0x00400000;
+- VIXL_ASSERT(std::isnan(num));
++ VIXL_ASSERT(isnan_(num));
+ return rawbits_to_float(float_to_rawbits(num) | kFP32QuietNaNMask);
+ }
+
+--
+1.8.3.1
+
+++ /dev/null
---- a/rules.mak.orig 2016-11-22 13:30:40.933006727 +0800
-+++ b/rules.mak 2016-11-22 13:30:47.229008698 +0800
-@@ -70,7 +70,7 @@ LINK = $(call quiet-command, $(LINKPROG)
- $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -o $@ $<," CPP $(TARGET_DIR)$@")
-
- %.o: %.asm
-- $(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<," AS $(TARGET_DIR)$@")
-+ $(call quiet-command,$(AS) $(ASFLAGS) -o $@ -x assembler $<," AS $(TARGET_DIR)$@")
-
- %.o: %.cc
- $(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) $($@-cflags) -c -o $@ $<," CXX $(TARGET_DIR)$@")
+++ /dev/null
---- a/configure.orig 2016-11-22 17:35:12.069598617 +0800
-+++ b/configure 2016-11-22 18:24:01.042515353 +0800
-@@ -1789,7 +1789,10 @@ static void foo(void) __attribute__((ifu
- int main(void) { foo(); return 0; }
- EOF
- if compile_prog "-mavx2" "" ; then
-- if readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then
-+ if readelf --program-headers $TMPE | grep -iq 'Requesting program interpreter: .*ld-musl'; then
-+ # ifunc support is not available with dynamic linker of musl
-+ avx2_opt="no"
-+ elif readelf --syms $TMPE |grep "IFUNC.*foo" >/dev/null 2>&1; then
- avx2_opt="yes"
- fi
- fi
--- /dev/null
+From b6d4bff30f2bdc3a6f26c9f6c7f32e352270d119 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou <yszhou4tech@gmail.com>
+Date: Sat, 24 Feb 2018 13:46:31 +0800
+Subject: [PATCH 3/3] pc-bios: fix compilation when $(AS) is actually gcc
+ driver
+
+---
+ pc-bios/optionrom/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
+index a9a9e5e..f88b3ee 100644
+--- a/pc-bios/optionrom/Makefile
++++ b/pc-bios/optionrom/Makefile
+@@ -34,7 +34,7 @@ endif
+ QEMU_INCLUDES += -I$(SRC_PATH)
+
+ Wa = -Wa,
+-ASFLAGS += -32
++ASFLAGS += $(Wa)-32
+ QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
+
+ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
+@@ -44,7 +44,7 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
+
+
+ %.o: %.S
+- $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
++ $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@ -x assembler -,"AS","$(TARGET_DIR)$@")
+
+ %.img: %.o
+ $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
+--
+1.8.3.1
+
+++ /dev/null
---- a/pixman/configure.ac.orig 2016-11-22 20:44:21.205150763 +0800
-+++ b/pixman/configure.ac 2016-11-22 20:44:55.505161500 +0800
-@@ -720,7 +720,6 @@ dnl Check if assembler is gas compatible
- have_mips_dspr2=no
- AC_MSG_CHECKING(whether to use MIPS DSPr2 assembler)
- xserver_save_CFLAGS=$CFLAGS
--CFLAGS="-mdspr2 $CFLAGS"
-
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- #if !(defined(__mips__) && __mips_isa_rev >= 2)
+++ /dev/null
---- a/pixman/pixman/pixman-private.h.orig 2016-11-22 22:10:33.574769654 +0800
-+++ b/pixman/pixman/pixman-private.h 2016-11-22 22:10:47.638774056 +0800
-@@ -1,5 +1,3 @@
--#include <float.h>
--
- #ifndef PIXMAN_PRIVATE_H
- #define PIXMAN_PRIVATE_H
-
-@@ -17,6 +15,8 @@
-
- #ifndef __ASSEMBLER__
-
-+#include <float.h>
-+
- #ifndef PACKAGE
- # error config.h must be included before pixman-private.h
- #endif
+++ /dev/null
---- a/disas/libvixl/vixl/utils.h.orig 2016-11-22 22:36:20.691253883 +0800
-+++ b/disas/libvixl/vixl/utils.h 2016-11-22 22:55:44.639618185 +0800
-@@ -118,11 +118,17 @@ double double_pack(uint64_t sign, uint64
- // An fpclassify() function for 16-bit half-precision floats.
- int float16classify(float16 value);
-
-+#ifdef isnan
-+#define isnan_ isnan
-+#else
-+#define isnan_ std::isnan
-+#endif
-+
- // NaN tests.
- inline bool IsSignallingNaN(double num) {
- const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000);
- uint64_t raw = double_to_rawbits(num);
-- if (std::isnan(num) && ((raw & kFP64QuietNaNMask) == 0)) {
-+ if (isnan_(num) && ((raw & kFP64QuietNaNMask) == 0)) {
- return true;
- }
- return false;
-@@ -132,7 +138,7 @@ inline bool IsSignallingNaN(double num)
- inline bool IsSignallingNaN(float num) {
- const uint32_t kFP32QuietNaNMask = 0x00400000;
- uint32_t raw = float_to_rawbits(num);
-- if (std::isnan(num) && ((raw & kFP32QuietNaNMask) == 0)) {
-+ if (isnan_(num) && ((raw & kFP32QuietNaNMask) == 0)) {
- return true;
- }
- return false;
-@@ -148,21 +154,21 @@ inline bool IsSignallingNaN(float16 num)
-
- template <typename T>
- inline bool IsQuietNaN(T num) {
-- return std::isnan(num) && !IsSignallingNaN(num);
-+ return isnan_(num) && !IsSignallingNaN(num);
- }
-
-
- // Convert the NaN in 'num' to a quiet NaN.
- inline double ToQuietNaN(double num) {
- const uint64_t kFP64QuietNaNMask = UINT64_C(0x0008000000000000);
-- VIXL_ASSERT(std::isnan(num));
-+ VIXL_ASSERT(isnan_(num));
- return rawbits_to_double(double_to_rawbits(num) | kFP64QuietNaNMask);
- }
-
-
- inline float ToQuietNaN(float num) {
- const uint32_t kFP32QuietNaNMask = 0x00400000;
-- VIXL_ASSERT(std::isnan(num));
-+ VIXL_ASSERT(isnan_(num));
- return rawbits_to_float(float_to_rawbits(num) | kFP32QuietNaNMask);
- }
-
--- /dev/null
+#
+# Copyright (C) 2018 Jianhui Zhao
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rtty
+PKG_VERSION:=4.1.1
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=v$(PKG_VERSION)
+PKG_SOURCE_URL=https://github.com/zhaojh329/rtty.git
+PKG_MIRROR_HASH:=2689ffafc7a6b2e649173edff802ec6d7c8476f1998497fca36a26c21fdcdc1c
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
+
+PKG_LICENSE:=LGPL-2.1
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/rtty/default
+ SECTION:=utils
+ CATEGORY:=Utilities
+ SUBMENU:=Terminal
+ TITLE:=A reverse proxy WebTTY
+ DEPENDS:=+libblobmsg-json
+endef
+
+define Package/rtty/default/description
+A reverse proxy WebTTY. This is the client part running on devices to be managed.
+endef
+
+define Package/rtty-nossl
+ $(Package/rtty/default)
+ TITLE += (NO SSL)
+ DEPENDS += +libuwsc-nossl
+ VARIANT:=nossl
+ CONFLICTS:=rtty-openssl rtty-wolfssl rtty-mbedtls
+endef
+
+define Package/rtty-openssl
+ $(Package/rtty/default)
+ TITLE += (openssl)
+ DEPENDS += +libuwsc-openssl
+ VARIANT:=openssl
+ CONFLICTS:=rtty-wolfssl rtty-mbedtls
+endef
+
+define Package/rtty-wolfssl
+ $(Package/rtty/default)
+ TITLE += (wolfssl)
+ DEPENDS += +libuwsc-wolfssl
+ VARIANT:=wolfssl
+ CONFLICTS:=rtty-mbedtls
+endef
+
+define Package/rtty-mbedtls
+ $(Package/rtty/default)
+ TITLE += (mbedtls)
+ DEPENDS += +libuwsc-mbedtls
+ VARIANT:=mbedtls
+endef
+
+Package/rtty-nossl/description = $(Package/rtty/default/description)
+Package/rtty-openssl/description = $(Package/rtty/default/description)
+Package/rtty-wolfssl/description = $(Package/rtty/default/description)
+Package/rtty-mbedtls/description = $(Package/rtty/default/description)
+
+define Package/rtty/default/install
+ $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rtty $(1)/usr/sbin
+ $(INSTALL_BIN) ./files/rtty.init $(1)/etc/init.d/rtty
+ $(INSTALL_CONF) ./files/rtty.config $(1)/etc/config/rtty
+endef
+
+Package/rtty-nossl/install = $(Package/rtty/default/install)
+Package/rtty-openssl/install = $(Package/rtty/default/install)
+Package/rtty-wolfssl/install = $(Package/rtty/default/install)
+Package/rtty-mbedtls/install = $(Package/rtty/default/install)
+
+$(eval $(call BuildPackage,rtty-nossl))
+$(eval $(call BuildPackage,rtty-mbedtls))
+$(eval $(call BuildPackage,rtty-wolfssl))
+$(eval $(call BuildPackage,rtty-openssl))
+
--- /dev/null
+# You must specify an interface or id,
+# If the id is not specified, RTTY will uses the MAC address
+# of the interface you specify as its ID, otherwise the id
+# you specify is used as its ID
+
+#config rtty
+# option interface 'lan'
+# option id 'My-Device'
+# option description 'Description of my device'
+# option host 'your-server-host' # Server host
+# option port '5912' # Server Port
+# option ssl 1 # Whether to use ssl
+# option ping 5 # heartbeat interval(second)
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+. /lib/functions/network.sh
+
+USE_PROCD=1
+START=99
+
+BIN=/usr/sbin/rtty
+
+start_rtty() {
+ local cfg="$1"
+ local interface ifname id description host port ssl
+
+ uci_validate_section rtty rtty "${1}" \
+ 'interface:uci("network", "@interface"):lan' \
+ 'id:maxlength(63)' \
+ 'description:maxlength(126)' \
+ 'host:host' \
+ 'port:port' \
+ 'ssl:bool:0' \
+ 'ping:uinteger:5'
+
+ [ $? -ne 0 ] && {
+ echo "validation failed" >&2
+ return 1
+ }
+
+ [ -n "$interface" ] && network_get_device ifname "$interface"
+
+ [ -z "$ifname" -a -z "$id" ] && {
+ echo "You must specify an interface or ID" >&2
+ return 1
+ }
+
+ [ -z "$host" ] && {
+ echo "host required" >&2
+ return 1
+ }
+
+ [ -z "$port" ] && {
+ echo "port required" >&2
+ return 1
+ }
+
+ procd_open_instance
+ procd_set_param command $BIN -h $host -p $port -a -P $ping
+ [ -n "$ifname" ] && procd_append_param command -i "$ifname"
+ [ -n "$id" ] && procd_append_param command -I "$id"
+ [ -n "$description" ] && procd_append_param command -d "$description"
+ [ "$ssl" = "1" ] && procd_append_param command -s
+ procd_set_param respawn
+ procd_close_instance
+}
+
+start_service() {
+ config_load rtty
+ config_foreach start_rtty rtty
+}
+
$(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+ $(CP) $(PKG_BUILD_DIR)/tools/sane-backends.pc $(1)/usr/lib/pkgconfig/
endef
# 1: short name
include $(TOPDIR)/rules.mk
PKG_NAME:=smstools3
-PKG_VERSION:=3.1.15
-PKG_RELEASE:=3
+PKG_VERSION:=3.1.21
+PKG_RELEASE:=2
-PKG_MAINTAINER:=Gérald Kerma <dreagle@doukki.net>
+PKG_MAINTAINER:=Harald Geyer <harald@ccbib.org>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://smstools3.kekekasvi.com/packages/
-PKG_HASH:=ed00ffaeaa312a5b4f969f4e97a64603a866bbe16e393ea02f5bf05234814d59
+PKG_HASH:=a26ba4c02b16f6cf13177bffca6c9230dc5fefaeba8e3030cd4e4905f6a92084
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
MAKE_VARS += LFLAGS="$(TARGET_LDFLAGS) $(if $(ICONV_FULL),-liconv)"
-BINDIR=/usr/local/bin
-
define Package/smstools3/configure
endef
define Package/smstools3/install
- $(INSTALL_DIR) $(1)/$(BINDIR)
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smsd $(1)/$(BINDIR)/smsd
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sendsms $(1)/$(BINDIR)/sendsms
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sms2html $(1)/$(BINDIR)/sms2html
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/sms2unicode $(1)/$(BINDIR)/sms2unicode
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/unicode2sms $(1)/$(BINDIR)/unicode2sms
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) \
+ $(PKG_BUILD_DIR)/src/smsd \
+ $(PKG_BUILD_DIR)/scripts/sendsms \
+ $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_DATA) -m 0755 ./files/smstools3.init $(1)/etc/init.d/smstools3
+ $(INSTALL_BIN) ./files/smstools3.init $(1)/etc/init.d/smstools3
$(INSTALL_DIR) $(1)/etc
- $(INSTALL_DATA) -m 0755 ./files/smstools3.conf $(1)/etc/smsd.conf
+ $(INSTALL_CONF) ./files/smstools3.conf $(1)/etc/smsd.conf
endef
$(eval $(call BuildPackage,smstools3))
sent = /var/spool/sms/sent
receive_before_send = no
autosplit = 3
+logfile = 1
+loglevel = 5
-[GSM1]
-init = AT+CPMS="ME","ME","ME"
-device = /dev/ttyUSB0
-incoming = yes
-pin = 0000
-baudrate = 9600
+# Uncomment (and edit) this section to allow smsd to start:
+#
+#[GSM1]
+#init = AT+CPMS="ME","ME","ME"
+#device = /dev/ttyUSB0
+#incoming = yes
+#pin = 0000
+#baudrate = 115200
#!/bin/sh /etc/rc.common
-# Copyright (C) 2014 OpenWrt.org
-# smsd initscript openwrt mod
+# Copyright (C) 2014-2018 OpenWrt.org
-START=99
-STOP=99
+START=94
-EXTRA_COMMANDS="status"
-EXTRA_HELP=" status View pid and service status "
-
-# Set USER and GROUP, if necessary:
-USER=""
-GROUP=""
+USE_PROCD=1
# If an unpriviledged user is selected, make sure that next two
# files are writable by that user:
PIDFILE="/var/run/smsd.pid"
INFOFILE="/var/run/smsd.working"
-# Logfile can also be defined in here:
-LOGFILE="/var/log/smsd.log"
-DAEMON=/usr/local/bin/smsd
-# A program which turns power off for couple of seconds:
-RESETMODEMS=/usr/local/bin/smsd_resetmodems
-NAME=smsd
-PSOPT=""
+DAEMON=/usr/bin/smsd
# Set/edit this before starting service !!!!!
WRT_SPOOL=/var/spool
-# Maximum time to stop smsd, after that it gets killed hardly:
-MAXWAIT=45
-
-boot() {
- start
-}
-
-start() {
- test -x $DAEMON || exit 0
-
+start_service() {
echo "Creating minimum spool directories"
mkdir -p $WRT_SPOOL
mkdir -p $WRT_SPOOL/sms
mkdir -p $WRT_SPOOL/sms/failed
mkdir -p $WRT_SPOOL/sms/sent
- echo -n "Starting SMS Daemon: "
- MSG="."
- ARGS="-n MAINPROCESS -p$PIDFILE -i$INFOFILE"
- [ "x$USER" != x ] && ARGS="$ARGS -u$USER"
- [ "x$GROUP" != x ] && ARGS="$ARGS -g$GROUP"
- [ "x$LOGFILE" != x ] && ARGS="$ARGS -l$LOGFILE"
- PID=`cat $PIDFILE 2>/dev/null`
- if [ "x$PID" != x ]; then
- if kill -0 $PID 2>/dev/null; then
- MSG=" already running ($PID)."
- else
- PID=""
- fi
- fi
- if [ "x$PID" = x ]; then
- if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then
- MSG=" already running."
- else
- $DAEMON $ARGS
- sleep 1
- PIDS=`ps $PSOPT | grep $NAME | grep -v grep`
- [ "x$PIDS" = x ] && MSG=" failed."
- fi
- fi
- echo "$NAME$MSG"
-}
-
-stop() {
- if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then
- PID=`cat $PIDFILE 2>/dev/null`
- if [ "x$PID" != x ]; then
- P=`kill -0 $PID 2>/dev/null`
- [ "x$P" != x ] && PID=""
- fi
- if [ "x$PID" != x ]; then
- kill $PID
- else
- kill `ps $PSOPT | grep $NAME | grep -v grep | awk '{print $1}'` >/dev/null 2>&1
- fi
- sleep 1
- if ps $PSOPT | grep $NAME | grep -v grep >/dev/null; then
- echo "Allowing $NAME to terminate gracefully within $MAXWAIT seconds"
- infofound=0
- dots=0
- seconds=0
- while ps $PSOPT | grep $NAME | grep -v grep >/dev/null; do
- if [ $infofound -lt 1 ]; then
- if [ -f $INFOFILE ]; then
- infofound=1
- if [ $dots -gt 0 ]; then
- echo ""
- dots=0
- fi
- $ECHO -n "$NAME is currently "
- cat $INFOFILE
- echo "Time counting is now disabled and we will wait until this job is complete."
- fi
- fi
- [ $infofound -lt 1 ] && seconds=`expr $seconds + 1`
- echo -n "."
- dots=`expr $dots + 1`
- if [ "$seconds" -ge $MAXWAIT ]; then
- if [ $dots -gt 0 ]; then
- echo ""
- dots=0
- fi
- echo "Timeout occurred, killing $NAME hardly."
- kill -9 `ps $PSOPT | grep $NAME | grep -v grep | awk '{print $1}'` >/dev/null 2>&1
- [ -f $PIDFILE ] && rm $PIDFILE
- seconds=0
- fi
- sleep 1
- done
- [ $dots -gt 0 ] && echo ""
- #echo "$NAME is stopped."
- fi
- fi
-}
-
-restart() {
- stop
- start
-}
-
+ procd_open_instance
-status() {
- PID=$(cat $PIDFILE)
+ procd_set_param command $DAEMON -n MAINPROCESS -p$PIDFILE -i$INFOFILE
+ procd_set_param respawn
+ procd_set_param stdout 1
- test -e $PIDFILE
- if [ $? == 0 ]; then
- echo $NAME " running! pid $PID"
- else
- echo $NAME " not running !!!"
- fi
+ procd_close_instance
}
-reset() {
- $0 stop
- [ -f "$RESETMODEMS" ] && "$RESETMODEMS"
- sleep 30
- $0 start
-}
+++ /dev/null
---- a/src/smsd.c 2010-09-21 13:47:48.000000000 +0300
-+++ b/src/smsd.c 2013-03-05 05:26:26.000000000 +0300
-@@ -5200,8 +5200,8 @@
- int result = 1;
- char *cmd;
- char *p;
-- char answer[500];
-- char buffer[600];
-+ char answer[1024];
-+ char buffer[1024];
- int fd;
- int log_retry = 3;
- int i;
# Uncomment for Solaris
# CFLAGS += -D SOLARIS
-@@ -43,7 +43,7 @@ smsd: smsd.c extras.o locking.o cfgfile.
-
- ifneq (,$(findstring SOLARIS,$(CFLAGS)))
- ifeq (,$(findstring DISABLE_INET_SOCKET,$(CFLAGS)))
--override LFLAGS += -lsocket -lnsl
-+ override LFLAGS += -lsocket -lnsl
- endif
- endif
-
--- /dev/null
+--- a/scripts/sendsms
++++ b/scripts/sendsms
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/ash
+ # This script send a text sms at the command line by creating
+ # a sms file in the outgoing queue.
+
--- /dev/null
+commit 3790bd05ed86b1692719df22857ef76c1293b01c
+Author: Harald Geyer <harald@ccbib.org>
+Date: Sun Feb 18 19:24:48 2018 +0100
+
+ Make modem processes terminate when main process dies
+
+diff --git a/src/smsd.c b/src/smsd.c
+index fdfa193..37b2e4d 100755
+--- a/src/smsd.c
++++ b/src/smsd.c
+@@ -34,6 +34,7 @@ Either version 2 of the License, or (at your option) any later version.
+ #ifndef DISABLE_INOTIFY
+ #include <sys/inotify.h>
+ #endif
++#include <sys/prctl.h>
+
+ #include "extras.h"
+ #include "locking.h"
+@@ -8100,6 +8101,7 @@ int main(int argc,char** argv)
+
+ if (pid == 0)
+ {
++ prctl(PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0);
+ process_id = i;
+ strcpy(process_title, DEVICE.name);
+ apply_process_name(argc, argv, process_title);
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://releases.stm32flash.googlecode.com/git
+PKG_SOURCE_URL:=https://sourceforge.net/projects/stm32flash/files
PKG_HASH:=023f28b01f644edc235c8815a4352e359d3ebdbe6368aaf6bbc28bab3e6ffa5b
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_MAINTAINER:=Christian Pointner <equinox@spreadspace.org>
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Microcontroller programming
- URL:=http://code.google.com/p/stm32flash/
+ URL:=https://sourceforge.net/projects/stm32flash
TITLE:=Firmware flash tool for STM32's serial bootloader
endef
include $(TOPDIR)/rules.mk
PKG_NAME:=swig
-PKG_VERSION:=3.0.7
+PKG_VERSION:=3.0.12
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
-PKG_HASH:=06dc8816a225667ce1eee545af3caf87e1bbaa379c32838d4cea53152514348d
+PKG_HASH:=7cf9f447ae7ed1c51722efc45e7f14418d15d7a1e143ac9f09a668999f4fc94d
PKG_INSTALL:=1
-PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Hirokazu MORIKAWA <morikw2@gmail.com>
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
--- /dev/null
+From 1a5aadcd66e85c63d228bfd811a521d617c22a38 Mon Sep 17 00:00:00 2001
+From: Patrick Schneider <patrick.schneider@meetnow.eu>
+Date: Thu, 13 Apr 2017 15:02:53 +0200
+Subject: [PATCH] Add Node 7.x aka V8 5.2+ support
+
+* Use WeakCallbackInfo instead of WeakCallbackData
+* Use GetPrivate instead of GetHiddenValue
+* Adopted new signature for SetWeak to support destructor calling
+* SetAccessor deprecation fixed
+* Proper version checks where applicable
+
+Upstream-Status: Submitted [https://github.com/swig/swig/pull/968]
+
+Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
+---
+ Lib/javascript/v8/javascriptcode.swg | 27 +++++++++++++++++-----
+ Lib/javascript/v8/javascripthelpers.swg | 29 +++++++++++++++++++++---
+ Lib/javascript/v8/javascriptinit.swg | 16 +++++++++++--
+ Lib/javascript/v8/javascriptrun.swg | 40 ++++++++++++++++++++++++++++-----
+ 4 files changed, 95 insertions(+), 17 deletions(-)
+
+diff --git a/Lib/javascript/v8/javascriptcode.swg b/Lib/javascript/v8/javascriptcode.swg
+index fb7d55c..b8c5089 100644
+--- a/Lib/javascript/v8/javascriptcode.swg
++++ b/Lib/javascript/v8/javascriptcode.swg
+@@ -133,10 +133,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SWIGV8_Proxy *proxy) {
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
++#else
++ static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
++ SWIGV8_Proxy *proxy = data.GetParameter();
+ #endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+@@ -147,7 +150,9 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
+ }
+ delete proxy;
+
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ object.Clear();
++#endif
+
+ #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
+ object.Dispose();
+@@ -155,7 +160,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
+ object.Dispose(isolate);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032100)
+ object->Dispose(isolate);
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ object->Dispose();
+ #endif
+ }
+@@ -177,10 +182,13 @@ static void $jswrapper(v8::Isolate *isolate, v8::Persistent<v8::Value> object, v
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ static void $jswrapper(v8::Isolate *isolate, v8::Persistent< v8::Object> *object, SWIGV8_Proxy *proxy) {
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SWIGV8_Proxy *proxy = data.GetParameter();
++#else
++static void $jswrapper(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
++ SWIGV8_Proxy *proxy = data.GetParameter();
+ #endif
+
+ if(proxy->swigCMemOwn && proxy->swigCObject) {
+@@ -197,7 +205,7 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
+ object->Dispose(isolate);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ object.Clear();
+ #endif
+ }
+@@ -211,7 +219,11 @@ static void $jswrapper(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &dat
+ * ----------------------------------------------------------------------------- */
+ %fragment("js_getter", "templates")
+ %{
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ static SwigV8ReturnValue $jswrapper(v8::Local<v8::String> property, const SwigV8PropertyCallbackInfo &info) {
++#else
++static SwigV8ReturnValue $jswrapper(v8::Local<v8::Name> property, const SwigV8PropertyCallbackInfo &info) {
++#endif
+ SWIGV8_HANDLESCOPE();
+
+ v8::Handle<v8::Value> jsresult;
+@@ -233,8 +245,11 @@ fail:
+ * ----------------------------------------------------------------------------- */
+ %fragment("js_setter", "templates")
+ %{
+-static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+- const SwigV8PropertyCallbackInfoVoid &info) {
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
++static void $jswrapper(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
++#else
++static void $jswrapper(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid &info) {
++#endif
+ SWIGV8_HANDLESCOPE();
+
+ $jslocals
+diff --git a/Lib/javascript/v8/javascripthelpers.swg b/Lib/javascript/v8/javascripthelpers.swg
+index 091467d..7461079 100644
+--- a/Lib/javascript/v8/javascripthelpers.swg
++++ b/Lib/javascript/v8/javascripthelpers.swg
+@@ -6,11 +6,16 @@ typedef v8::InvocationCallback SwigV8FunctionCallback;
+ typedef v8::AccessorGetter SwigV8AccessorGetterCallback;
+ typedef v8::AccessorSetter SwigV8AccessorSetterCallback;
+ typedef v8::AccessorInfo SwigV8PropertyCallbackInfoVoid;
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ typedef v8::FunctionCallback SwigV8FunctionCallback;
+ typedef v8::AccessorGetterCallback SwigV8AccessorGetterCallback;
+ typedef v8::AccessorSetterCallback SwigV8AccessorSetterCallback;
+ typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
++#else
++typedef v8::FunctionCallback SwigV8FunctionCallback;
++typedef v8::AccessorNameGetterCallback SwigV8AccessorGetterCallback;
++typedef v8::AccessorNameSetterCallback SwigV8AccessorSetterCallback;
++typedef v8::PropertyCallbackInfo<void> SwigV8PropertyCallbackInfoVoid;
+ #endif
+
+ /**
+@@ -65,18 +70,36 @@ SWIGRUNTIME void SWIGV8_AddStaticFunction(v8::Handle<v8::Object> obj, const char
+ */
+ SWIGRUNTIME void SWIGV8_AddStaticVariable(v8::Handle<v8::Object> obj, const char* symbol,
+ SwigV8AccessorGetterCallback getter, SwigV8AccessorSetterCallback setter) {
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ obj->SetAccessor(SWIGV8_SYMBOL_NEW(symbol), getter, setter);
++#else
++ obj->SetAccessor(SWIGV8_CURRENT_CONTEXT(), SWIGV8_SYMBOL_NEW(symbol), getter, setter);
++#endif
+ }
+
+-SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value,
+- const SwigV8PropertyCallbackInfoVoid& info)
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
++SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::String> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
++#else
++SWIGRUNTIME void JS_veto_set_variable(v8::Local<v8::Name> property, v8::Local<v8::Value> value, const SwigV8PropertyCallbackInfoVoid& info)
++#endif
+ {
+ char buffer[256];
+ char msg[512];
+ int res;
+
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ property->WriteUtf8(buffer, 256);
+ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
++#else
++ v8::Local<v8::String> sproperty;
++ if (property->ToString(SWIGV8_CURRENT_CONTEXT()).ToLocal(&sproperty)) {
++ sproperty->WriteUtf8(buffer, 256);
++ res = sprintf(msg, "Tried to write read-only variable: %s.", buffer);
++ }
++ else {
++ res = -1;
++ }
++#endif
+
+ if(res<0) {
+ SWIG_exception(SWIG_ERROR, "Tried to write read-only variable.");
+diff --git a/Lib/javascript/v8/javascriptinit.swg b/Lib/javascript/v8/javascriptinit.swg
+index 34befa7..86008d9 100644
+--- a/Lib/javascript/v8/javascriptinit.swg
++++ b/Lib/javascript/v8/javascriptinit.swg
+@@ -7,15 +7,27 @@ SWIG_V8_SetModule(void *, swig_module_info *swig_module) {
+ v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
+ v8::Local<v8::External> mod = SWIGV8_EXTERNAL_NEW(swig_module);
+ assert(!mod.IsEmpty());
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ global_obj->SetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"), mod);
++#else
++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
++ global_obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, mod);
++#endif
+ }
+
+ SWIGRUNTIME swig_module_info *
+ SWIG_V8_GetModule(void *) {
+ v8::Local<v8::Object> global_obj = SWIGV8_CURRENT_CONTEXT()->Global();
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ v8::Local<v8::Value> moduleinfo = global_obj->GetHiddenValue(SWIGV8_STRING_NEW("swig_module_info_data"));
++#else
++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("swig_module_info_data"));
++ v8::Local<v8::Value> moduleinfo;
++ if (!global_obj->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&moduleinfo))
++ return 0;
++#endif
+
+- if (moduleinfo.IsEmpty())
++ if (moduleinfo.IsEmpty() || moduleinfo->IsNull() || moduleinfo->IsUndefined())
+ {
+ // It's not yet loaded
+ return 0;
+@@ -23,7 +35,7 @@ SWIG_V8_GetModule(void *) {
+
+ v8::Local<v8::External> moduleinfo_extern = v8::Local<v8::External>::Cast(moduleinfo);
+
+- if (moduleinfo_extern.IsEmpty())
++ if (moduleinfo_extern.IsEmpty() || moduleinfo_extern->IsNull() || moduleinfo_extern->IsUndefined())
+ {
+ // Something's not right
+ return 0;
+diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
+index 5ac52a5..30002c0 100644
+--- a/Lib/javascript/v8/javascriptrun.swg
++++ b/Lib/javascript/v8/javascriptrun.swg
+@@ -193,8 +193,10 @@ public:
+ void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Value> object, void *parameter);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ void (*dtor) (v8::Isolate *isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy);
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ void (*dtor) (const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data);
++#else
++ void (*dtor) (const v8::WeakCallbackInfo<SWIGV8_Proxy> &data);
+ #endif
+ };
+
+@@ -241,9 +243,12 @@ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Val
+ SWIGV8_Proxy *proxy = static_cast<SWIGV8_Proxy *>(parameter);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(v8::Isolate *, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackData<v8::Object, SWIGV8_Proxy> &data) {
+ SWIGV8_Proxy *proxy = data.GetParameter();
++#else
++SWIGRUNTIME void SWIGV8_Proxy_DefaultDtor(const v8::WeakCallbackInfo<SWIGV8_Proxy> &data) {
++ SWIGV8_Proxy *proxy = data.GetParameter();
+ #endif
+
+ delete proxy;
+@@ -312,12 +317,18 @@ SWIGRUNTIME void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void *ptr, sw
+ } else {
+ cdata->handle.MakeWeak(cdata, SWIGV8_Proxy_DefaultDtor);
+ }
+-#else
++#elifif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
+ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor);
+ } else {
+ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor);
+ }
++#else
++ if(cdata->swigCMemOwn && (SWIGV8_ClientData*)info->clientdata) {
++ cdata->handle.SetWeak(cdata, ((SWIGV8_ClientData*)info->clientdata)->dtor, v8::WeakCallbackType::kParameter);
++ } else {
++ cdata->handle.SetWeak(cdata, SWIGV8_Proxy_DefaultDtor, v8::WeakCallbackType::kParameter);
++ }
+ #endif
+
+ #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
+@@ -470,7 +481,14 @@ int SwigV8Packed_Check(v8::Handle<v8::Value> valRef) {
+
+ v8::Handle<v8::Object> objRef = valRef->ToObject();
+ if(objRef->InternalFieldCount() < 1) return false;
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ v8::Handle<v8::Value> flag = objRef->GetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"));
++#else
++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
++ v8::Local<v8::Value> flag;
++ if (!objRef->GetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey).ToLocal(&flag))
++ return false;
++#endif
+ return (flag->IsBoolean() && flag->BooleanValue());
+ }
+
+@@ -519,10 +537,13 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persist
+ SwigV8PackedData *cdata = static_cast<SwigV8PackedData *>(parameter);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(v8::Isolate *isolate, v8::Persistent<v8::Object> *object, SwigV8PackedData *cdata) {
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Object, SwigV8PackedData> &data) {
+ v8::Local<v8::Object> object = data.GetValue();
+ SwigV8PackedData *cdata = data.GetParameter();
++#else
++SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackInfo<SwigV8PackedData> &data) {
++ SwigV8PackedData *cdata = data.GetParameter();
+ #endif
+
+ delete cdata;
+@@ -537,7 +558,7 @@ SWIGRUNTIME void _wrap_SwigV8PackedData_delete(const v8::WeakCallbackData<v8::Ob
+ object->Dispose(isolate);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ object->Dispose();
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ object.Clear();
+ #endif
+ }
+@@ -550,7 +571,12 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
+ // v8::Handle<v8::Object> obj = SWIGV8_OBJECT_NEW();
+ v8::Local<v8::Object> obj = SWIGV8_OBJECT_NEW();
+
++#if (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ obj->SetHiddenValue(SWIGV8_STRING_NEW("__swig__packed_data__"), SWIGV8_BOOLEAN_NEW(true));
++#else
++ v8::Local<v8::Private> privateKey = v8::Private::ForApi(v8::Isolate::GetCurrent(), SWIGV8_STRING_NEW("__swig__packed_data__"));
++ obj->SetPrivate(SWIGV8_CURRENT_CONTEXT(), privateKey, SWIGV8_BOOLEAN_NEW(true));
++#endif
+
+ #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031511)
+ obj->SetPointerInInternalField(0, cdata);
+@@ -573,9 +599,11 @@ v8::Handle<v8::Value> SWIGV8_NewPackedObj(void *data, size_t size, swig_type_inf
+ cdata->handle.MakeWeak(v8::Isolate::GetCurrent(), cdata, _wrap_SwigV8PackedData_delete);
+ #elif (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < SWIGV8_SETWEAK_VERSION)
+ cdata->handle.MakeWeak(cdata, _wrap_SwigV8PackedData_delete);
+-#else
++#elif (V8_MAJOR_VERSION-0) < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 2)
+ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete);
+ // v8::V8::SetWeak(&cdata->handle, cdata, _wrap_SwigV8PackedData_delete);
++#else
++ cdata->handle.SetWeak(cdata, _wrap_SwigV8PackedData_delete, v8::WeakCallbackType::kParameter);
+ #endif
+
+ #if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x031710)
+--
+2.9.5
+
include $(TOPDIR)/rules.mk
PKG_NAME:=tio
-PKG_VERSION:=1.28
+PKG_VERSION:=1.30
PKG_RELEASE:=1
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0+
PKG_SOURCE_URL:=https://github.com/$(PKG_NAME)/$(PKG_NAME)/releases/download/v$(PKG_VERSION)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=bb5fa22b2ca5c2eeb811f57e1af45ae5a2b852eed1aabbeb3a419cc3b4d4d22a
+PKG_HASH:=5c86c392a7783c9a3963421087c4a3fd8a32d5d5c705d2ce979bcf011659ac9d
PKG_FIXUP:=autoreconf
include $(TOPDIR)/rules.mk
PKG_NAME:=tmux
-PKG_VERSION:=2.6
+PKG_VERSION:=2.7
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/tmux/tmux/releases/download/$(PKG_VERSION)
-PKG_HASH:=b17cd170a94d7b58c0698752e1f4f263ab6dc47425230df7e53a6435cc7cd7e8
+PKG_HASH:=9ded7d100313f6bc5a87404a4048b3745d61f2332f99ec1400a7c4ed9485d452
PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
PKG_LICENSE:=ISC
include $(TOPDIR)/rules.mk
PKG_NAME:=tree
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_VERSION:=1.7.0
PKG_SOURCE_URL:=ftp://mama.indstate.edu/linux/tree/
PKG_HASH:=6957c20e82561ac4231638996e74f4cfa4e6faabc5a2f511f0b4e3940e8f7b12
DEPENDS:=+libc +libgcc
endef
+MAKE_FLAGS += \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)"
+
define Package/tree/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tree $(1)/usr/sbin/
include $(TOPDIR)/rules.mk
PKG_NAME:=ttyd
-PKG_VERSION:=1.3.3+git-04d5bc
+PKG_VERSION:=1.4.0
PKG_RELEASE:=1
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/tsl0922/ttyd.git
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=04d5bc1ecb59667d025a94e1967a83c24141f911
-PKG_MIRROR_HASH=87ea900f7bf67daf5131ecfcec0917e175d168ce52771012139c06dbafcc641d
+PKG_SOURCE_URL:=https://codeload.github.com/tsl0922/ttyd/tar.gz/$(PKG_VERSION)?
+PKG_SOURCE_VERSION=$(PKG_VERSION)
+PKG_HASH=757a9b5b5dd3de801d7db8fab6035d97ea144b02a51c78bdab28a8e07bcf05d6
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Command-line tool for sharing terminal over the web
- DEPENDS:=+libopenssl +libjson-c +libpthread +libwebsockets-openssl
+ DEPENDS:=+libopenssl +libjson-c +libpthread +libwebsockets-full
URL:=https://github.com/tsl0922/ttyd
SUBMENU:=Terminal
MAINTAINER:=Shuanglei Tao <tsl0922@gmail.com>
include $(TOPDIR)/rules.mk
PKG_NAME:=unrar
-PKG_VERSION:=5.5.8
+PKG_VERSION:=5.6.1
PKG_RELEASE:=1
PKG_SOURCE:=unrarsrc-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://www.rarlab.com/rar
-PKG_HASH:=9b66e4353a9944bc140eb2a919ff99482dd548f858f5e296d809e8f7cdb2fcf4
+PKG_SOURCE_URL:=https://www.rarlab.com/rar
+PKG_HASH:=67c339dffa95f6c1bedcca40045e99de5852919dbfaa06e4a9c8f18cd5064e70
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>, \
Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=UnRAR
PKG_LICENSE_FILES:=license.txt
+PKG_CPE_ID:=cpe:/a:rarlab:unrar
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(BUILD_VARIANT)/unrar
PKG_INSTALL:=1
define Package/unrar/Default
TITLE:=UnRAR
SUBMENU:=Compression
- URL:=http://www.rarlab.com/
+ URL:=https://www.rarlab.com/
DEPENDS:=$(CXX_DEPENDS) +libpthread
endef
# Linux using GCC
-CXX=c++
--CXXFLAGS=-O2
+-CXXFLAGS=-O2 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else
+#CXX=c++
-+#CXXFLAGS=-O2
++#CXXFLAGS=-O2 -Wno-logical-op-parentheses -Wno-switch -Wno-dangling-else
LIBFLAGS=-fPIC
DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP
STRIP=strip
#
-# Copyright (C) 2007-2017 OpenWrt.org
+# Copyright (C) 2007-2018 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=zoneinfo
-PKG_VERSION:=2017c
-PKG_VERSION_CODE:=2017c
+PKG_VERSION:=2018e
+PKG_VERSION_CODE:=2018e
PKG_RELEASE:=1
#As i couldn't find real license used "Public Domain"
PKG_SOURCE:=tzdata$(PKG_VERSION).tar.gz
PKG_SOURCE_CODE:=tzcode$(PKG_VERSION_CODE).tar.gz
PKG_SOURCE_URL:=http://www.iana.org/time-zones/repository/releases
-PKG_HASH:=d6543f92a929826318e2f44ff3a7611ce5f565a43e10250b42599d0ba4cbd90b
+PKG_HASH:=6b288e5926841a4cb490909fe822d85c36ae75538ad69baf20da9628b63b692e
include $(INCLUDE_DIR)/package.mk
define Download/tzcode
FILE=$(PKG_SOURCE_CODE)
URL=$(PKG_SOURCE_URL)
- HASH:=81e8b4bc23e60906640c266bbff3789661e22f0fa29fe61b96ec7c2816c079b7
+ HASH:=ca340cf20e80b699d6e5c49b4ba47361b3aa681f06f38a0c88a8e8308c00ebce
endef
$(eval $(call Download,tzcode))
CATEGORY:=Utilities
SUBMENU:=Shells
TITLE:=The Z shell
- DEPENDS:=+libncurses +libncursesw +libpcre +librt
+ DEPENDS:=+libcap +libncurses +libncursesw +libpcre +librt
URL:=http://www.zsh.org/
endef