| @@ -41,6 +41,7 @@ require ( | |||
| github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect | |||
| github.com/facebookgo/stats v0.0.0-20151006221625-1b76add642e4 // indirect | |||
| github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect | |||
| github.com/gliderlabs/ssh v0.1.4 // indirect | |||
| github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd // indirect | |||
| github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e // indirect | |||
| github.com/go-macaron/binding v0.0.0-20160711225916-9440f336b443 | |||
| @@ -60,6 +61,7 @@ require ( | |||
| github.com/gogits/chardet v0.0.0-20150115103509-2404f7772561 | |||
| github.com/gogits/cron v0.0.0-20160810035002-7f3990acf183 | |||
| github.com/gogo/protobuf v1.2.1 // indirect | |||
| github.com/google/go-cmp v0.3.0 // indirect | |||
| github.com/google/go-github/v24 v24.0.1 | |||
| github.com/gorilla/context v1.1.1 | |||
| github.com/issue9/assert v1.3.2 // indirect | |||
| @@ -90,7 +92,6 @@ require ( | |||
| github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 | |||
| github.com/oliamb/cutter v0.2.2 | |||
| github.com/philhofer/fwd v1.0.0 // indirect | |||
| github.com/pkg/errors v0.8.1 // indirect | |||
| github.com/pquerna/otp v0.0.0-20160912161815-54653902c20e | |||
| github.com/prometheus/client_golang v0.9.0 | |||
| github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect | |||
| @@ -115,11 +116,12 @@ require ( | |||
| github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 // indirect | |||
| github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 | |||
| go.etcd.io/bbolt v1.3.2 // indirect | |||
| golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480 | |||
| golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519 | |||
| golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 | |||
| golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 | |||
| golang.org/x/oauth2 v0.0.0-20181101160152-c453e0c75759 | |||
| golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e | |||
| golang.org/x/text v0.3.0 | |||
| golang.org/x/sys v0.0.0-20190618155005-516e3c20635f | |||
| golang.org/x/text v0.3.2 | |||
| golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a // indirect | |||
| gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | |||
| gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect | |||
| gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e // indirect | |||
| @@ -130,7 +132,7 @@ require ( | |||
| gopkg.in/macaron.v1 v1.3.2 | |||
| gopkg.in/redis.v2 v2.3.2 // indirect | |||
| gopkg.in/src-d/go-billy.v4 v4.3.0 | |||
| gopkg.in/src-d/go-git.v4 v4.11.0 | |||
| gopkg.in/src-d/go-git.v4 v4.12.0 | |||
| gopkg.in/testfixtures.v2 v2.5.0 | |||
| mvdan.cc/xurls/v2 v2.0.0 | |||
| strk.kbt.io/projects/go/libravatar v0.0.0-20160628055650-5eed7bff870a | |||
| @@ -19,6 +19,8 @@ github.com/andybalholm/cascadia v0.0.0-20161224141413-349dd0209470 h1:4jHLmof+Hb | |||
| github.com/andybalholm/cascadia v0.0.0-20161224141413-349dd0209470/go.mod h1:3I+3V7B6gTBYfdpYgIG2ymALS9H+5VDKUl3lHH7ToM4= | |||
| github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= | |||
| github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= | |||
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= | |||
| github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= | |||
| github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= | |||
| github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= | |||
| github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= | |||
| @@ -62,7 +64,6 @@ github.com/dgrijalva/jwt-go v0.0.0-20161101193935-9ed569b5d1ac h1:xrQJVwQCGqDvOO | |||
| github.com/dgrijalva/jwt-go v0.0.0-20161101193935-9ed569b5d1ac/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= | |||
| github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 h1:aaQcKT9WumO6JEJcRyTqFVq4XUZiUcKR2/GI31TOcz8= | |||
| github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= | |||
| github.com/emirpasic/gods v1.9.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= | |||
| github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= | |||
| github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= | |||
| github.com/etcd-io/bbolt v1.3.2 h1:RLRQ0TKLX7DlBRXAJHvbmXL17Q3KNnTBtZ9B6Qo+/Y0= | |||
| @@ -89,8 +90,9 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr | |||
| github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= | |||
| github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= | |||
| github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= | |||
| github.com/gliderlabs/ssh v0.1.1 h1:j3L6gSLQalDETeEg/Jg0mGY0/y/N6zI2xX1978P0Uqw= | |||
| github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | |||
| github.com/gliderlabs/ssh v0.1.3/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | |||
| github.com/gliderlabs/ssh v0.1.4 h1:5N8AYXpaQAPy0L7linKa5aI+WRfyYagAhjksVzxh+mI= | |||
| github.com/gliderlabs/ssh v0.1.4/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | |||
| github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd h1:r04MMPyLHj/QwZuMJ5+7tJcBr1AQjpiAK/rZWRrQT7o= | |||
| github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= | |||
| github.com/glycerine/goconvey v0.0.0-20190315024820-982ee783a72e h1:SiEs4J3BKVIeaWrH3tKaz3QLZhJ68iJ/A4xrzIoE5+Y= | |||
| @@ -138,6 +140,8 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pO | |||
| github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= | |||
| github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= | |||
| github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | |||
| github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= | |||
| github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | |||
| github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= | |||
| github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= | |||
| github.com/google/go-github/v24 v24.0.1 h1:KCt1LjMJEey1qvPXxa9SjaWxwTsCWSq6p2Ju57UR4Q4= | |||
| @@ -230,8 +234,8 @@ github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX | |||
| github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo= | |||
| github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a h1:d18LCO3ctH2kugUqt0pEyKKP8L+IYrocaPqGFilhTKk= | |||
| github.com/microcosm-cc/bluemonday v0.0.0-20161012083705-f77f16ffc87a/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= | |||
| github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= | |||
| github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | |||
| github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= | |||
| github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | |||
| github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c h1:3wkDRdxK92dF+c1ke2dtj7ZzemFWBHB9plnJOtlwdFA= | |||
| github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM= | |||
| github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbMEn2SZ+gT+3IUKx8BqxyQdz+BY= | |||
| @@ -315,8 +319,8 @@ github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw= | |||
| github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= | |||
| github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621 h1:E8u341JM/N8LCnPXBV6ZFD1RKo/j+qHl1XOqSV+GstA= | |||
| github.com/willf/bitset v0.0.0-20180426185212-8ce1146b8621/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= | |||
| github.com/xanzy/ssh-agent v0.2.0 h1:Adglfbi5p9Z0BmK2oKU9nTG+zKfniSfnaMYB+ULd+Ro= | |||
| github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnWhgSqHD8= | |||
| github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= | |||
| github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= | |||
| github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 h1:HsIQ6yAjfjQ3IxPGrTusxp6Qxn92gNVq2x5CbvQvx3w= | |||
| github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53/go.mod h1:f6elajwZV+xceiaqgRL090YzLEDGSbqr3poGL3ZgXYo= | |||
| github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= | |||
| @@ -324,32 +328,51 @@ github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wK | |||
| go.etcd.io/bbolt v1.3.2 h1:Z/90sZLPOeCy2PwprqkFa25PdkusRzaj9P8zm/KNyvk= | |||
| go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= | |||
| golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | |||
| golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I= | |||
| golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | |||
| golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | |||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | |||
| golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480 h1:O5YqonU5IWby+w98jVUG9h7zlCWCcH4RHyPVReBmhzk= | |||
| golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= | |||
| golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||
| golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 h1:IcSOAf4PyMp3U3XbIEj1/xJ2BjNN2jWv7JoyOsMxXUU= | |||
| golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||
| golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | |||
| golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | |||
| golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | |||
| golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519 h1:x6rhz8Y9CjbgQkccRGmELH6K+LJj7tOoh3XWeC1yaQM= | |||
| golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | |||
| golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | |||
| golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | |||
| golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | |||
| golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU= | |||
| golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||
| golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | |||
| golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | |||
| golang.org/x/oauth2 v0.0.0-20181101160152-c453e0c75759 h1:TMrx+Qdx7uJAeUbv15N72h5Hmyb5+VDjEiMufAEAM04= | |||
| golang.org/x/oauth2 v0.0.0-20181101160152-c453e0c75759/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | |||
| golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= | |||
| golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | |||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= | |||
| golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | |||
| golang.org/x/sys v0.0.0-20180824143301-4910a1d54f87/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= | |||
| golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts= | |||
| golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
| golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
| golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
| golang.org/x/sys v0.0.0-20190618155005-516e3c20635f h1:dHNZYIYdq2QuU6w73vZ/DzesPbVlZVYZTtTZmrnsbQ8= | |||
| golang.org/x/sys v0.0.0-20190618155005-516e3c20635f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||
| golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | |||
| golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | |||
| golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | |||
| golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | |||
| golang.org/x/tools v0.0.0-20180221164845-07fd8470d635 h1:2eB4G6bDQDeP69ZXbOKC00S2Kf6TIiRS+DzfKsKeQU0= | |||
| golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | |||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | |||
| golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a h1:aQmaYPOmKItb96VioBrTlYay5tSNUdKAFEhPCWMeLSM= | |||
| golang.org/x/tools v0.0.0-20190618163018-fdf1049a943a/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | |||
| google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= | |||
| google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24= | |||
| google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= | |||
| @@ -376,13 +399,12 @@ gopkg.in/macaron.v1 v1.3.2 h1:AvWIaPmwBUA87/OWzePkoxeaw6YJWDfBt1pDFPBnLf8= | |||
| gopkg.in/macaron.v1 v1.3.2/go.mod h1:PrsiawTWAGZs6wFbT5hlr7SQ2Ns9h7cUVtcUu4lQOVo= | |||
| gopkg.in/redis.v2 v2.3.2 h1:GPVIIB/JnL1wvfULefy3qXmPu1nfNu2d0yA09FHgwfs= | |||
| gopkg.in/redis.v2 v2.3.2/go.mod h1:4wl9PJ/CqzeHk3LVq1hNLHH8krm3+AXEgut4jVc++LU= | |||
| gopkg.in/src-d/go-billy.v4 v4.2.1/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= | |||
| gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= | |||
| gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= | |||
| gopkg.in/src-d/go-git-fixtures.v3 v3.1.1 h1:XWW/s5W18RaJpmo1l0IYGqXKuJITWRFuA45iOf1dKJs= | |||
| gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= | |||
| gopkg.in/src-d/go-git.v4 v4.11.0 h1:cJwWgJ0DXifrNrXM6RGN1Y2yR60Rr1zQ9Q5DX5S9qgU= | |||
| gopkg.in/src-d/go-git.v4 v4.11.0/go.mod h1:Vtut8izDyrM8BUVQnzJ+YvmNcem2J89EmfZYCkLokZk= | |||
| gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg= | |||
| gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= | |||
| gopkg.in/src-d/go-git.v4 v4.12.0 h1:CKgvBCJCcdfNnyXPYI4Cp8PaDDAmAPEN0CtfEdEAbd8= | |||
| gopkg.in/src-d/go-git.v4 v4.12.0/go.mod h1:zjlNnzc1Wjn43v3Mtii7RVxiReNP0fIu9npcXKzuNp4= | |||
| gopkg.in/stretchr/testify.v1 v1.2.2 h1:yhQC6Uy5CqibAIlk1wlusa/MJ3iAN49/BsR/dCCKz3M= | |||
| gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU= | |||
| gopkg.in/testfixtures.v2 v2.5.0 h1:N08B7l2GzFQenyYbzqthDnKAA+cmb17iAZhhFxr7JHw= | |||
| @@ -76,6 +76,16 @@ func Expand(path string) (string, error) { | |||
| return filepath.Join(dir, path[1:]), nil | |||
| } | |||
| // Reset clears the cache, forcing the next call to Dir to re-detect | |||
| // the home directory. This generally never has to be called, but can be | |||
| // useful in tests if you're modifying the home directory via the HOME | |||
| // env var or something. | |||
| func Reset() { | |||
| cacheLock.Lock() | |||
| defer cacheLock.Unlock() | |||
| homedirCache = "" | |||
| } | |||
| func dirUnix() (string, error) { | |||
| homeEnv := "HOME" | |||
| if runtime.GOOS == "plan9" { | |||
| @@ -0,0 +1,6 @@ | |||
| module github.com/xanzy/ssh-agent | |||
| require ( | |||
| golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2 | |||
| golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0 // indirect | |||
| ) | |||
| @@ -0,0 +1,4 @@ | |||
| golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2 h1:NwxKRvbkH5MsNkvOtPZi3/3kmI8CAzs3mtv+GLQMkNo= | |||
| golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | |||
| golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0 h1:bzeyCHgoAyjZjAhvTpks+qM7sdlh4cCSitmXeCEO3B4= | |||
| golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||
| @@ -32,6 +32,7 @@ import ( | |||
| "time" | |||
| "golang.org/x/crypto/acme" | |||
| "golang.org/x/net/idna" | |||
| ) | |||
| // createCertRetryAfter is how much time to wait before removing a failed state | |||
| @@ -62,10 +63,16 @@ type HostPolicy func(ctx context.Context, host string) error | |||
| // HostWhitelist returns a policy where only the specified host names are allowed. | |||
| // Only exact matches are currently supported. Subdomains, regexp or wildcard | |||
| // will not match. | |||
| // | |||
| // Note that all hosts will be converted to Punycode via idna.Lookup.ToASCII so that | |||
| // Manager.GetCertificate can handle the Unicode IDN and mixedcase hosts correctly. | |||
| // Invalid hosts will be silently ignored. | |||
| func HostWhitelist(hosts ...string) HostPolicy { | |||
| whitelist := make(map[string]bool, len(hosts)) | |||
| for _, h := range hosts { | |||
| whitelist[h] = true | |||
| if h, err := idna.Lookup.ToASCII(h); err == nil { | |||
| whitelist[h] = true | |||
| } | |||
| } | |||
| return func(_ context.Context, host string) error { | |||
| if !whitelist[host] { | |||
| @@ -243,7 +250,17 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, | |||
| if !strings.Contains(strings.Trim(name, "."), ".") { | |||
| return nil, errors.New("acme/autocert: server name component count invalid") | |||
| } | |||
| if strings.ContainsAny(name, `+/\`) { | |||
| // Note that this conversion is necessary because some server names in the handshakes | |||
| // started by some clients (such as cURL) are not converted to Punycode, which will | |||
| // prevent us from obtaining certificates for them. In addition, we should also treat | |||
| // example.com and EXAMPLE.COM as equivalent and return the same certificate for them. | |||
| // Fortunately, this conversion also helped us deal with this kind of mixedcase problems. | |||
| // | |||
| // Due to the "σςΣ" problem (see https://unicode.org/faq/idn.html#22), we can't use | |||
| // idna.Punycode.ToASCII (or just idna.ToASCII) here. | |||
| name, err := idna.Lookup.ToASCII(name) | |||
| if err != nil { | |||
| return nil, errors.New("acme/autocert: server name contains invalid character") | |||
| } | |||
| @@ -2,6 +2,11 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // In Go 1.13, the ed25519 package was promoted to the standard library as | |||
| // crypto/ed25519, and this package became a wrapper for the standard library one. | |||
| // | |||
| // +build !go1.13 | |||
| // Package ed25519 implements the Ed25519 signature algorithm. See | |||
| // https://ed25519.cr.yp.to/. | |||
| // | |||
| @@ -0,0 +1,73 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build go1.13 | |||
| // Package ed25519 implements the Ed25519 signature algorithm. See | |||
| // https://ed25519.cr.yp.to/. | |||
| // | |||
| // These functions are also compatible with the “Ed25519” function defined in | |||
| // RFC 8032. However, unlike RFC 8032's formulation, this package's private key | |||
| // representation includes a public key suffix to make multiple signing | |||
| // operations with the same key more efficient. This package refers to the RFC | |||
| // 8032 private key as the “seed”. | |||
| // | |||
| // Beginning with Go 1.13, the functionality of this package was moved to the | |||
| // standard library as crypto/ed25519. This package only acts as a compatibility | |||
| // wrapper. | |||
| package ed25519 | |||
| import ( | |||
| "crypto/ed25519" | |||
| "io" | |||
| ) | |||
| const ( | |||
| // PublicKeySize is the size, in bytes, of public keys as used in this package. | |||
| PublicKeySize = 32 | |||
| // PrivateKeySize is the size, in bytes, of private keys as used in this package. | |||
| PrivateKeySize = 64 | |||
| // SignatureSize is the size, in bytes, of signatures generated and verified by this package. | |||
| SignatureSize = 64 | |||
| // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. | |||
| SeedSize = 32 | |||
| ) | |||
| // PublicKey is the type of Ed25519 public keys. | |||
| // | |||
| // This type is an alias for crypto/ed25519's PublicKey type. | |||
| // See the crypto/ed25519 package for the methods on this type. | |||
| type PublicKey = ed25519.PublicKey | |||
| // PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer. | |||
| // | |||
| // This type is an alias for crypto/ed25519's PrivateKey type. | |||
| // See the crypto/ed25519 package for the methods on this type. | |||
| type PrivateKey = ed25519.PrivateKey | |||
| // GenerateKey generates a public/private key pair using entropy from rand. | |||
| // If rand is nil, crypto/rand.Reader will be used. | |||
| func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) { | |||
| return ed25519.GenerateKey(rand) | |||
| } | |||
| // NewKeyFromSeed calculates a private key from a seed. It will panic if | |||
| // len(seed) is not SeedSize. This function is provided for interoperability | |||
| // with RFC 8032. RFC 8032's private keys correspond to seeds in this | |||
| // package. | |||
| func NewKeyFromSeed(seed []byte) PrivateKey { | |||
| return ed25519.NewKeyFromSeed(seed) | |||
| } | |||
| // Sign signs the message with privateKey and returns a signature. It will | |||
| // panic if len(privateKey) is not PrivateKeySize. | |||
| func Sign(privateKey PrivateKey, message []byte) []byte { | |||
| return ed25519.Sign(privateKey, message) | |||
| } | |||
| // Verify reports whether sig is a valid signature of message by publicKey. It | |||
| // will panic if len(publicKey) is not PublicKeySize. | |||
| func Verify(publicKey PublicKey, message, sig []byte) bool { | |||
| return ed25519.Verify(publicKey, message, sig) | |||
| } | |||
| @@ -0,0 +1,668 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // Based on CRYPTOGAMS code with the following comment: | |||
| // # ==================================================================== | |||
| // # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL | |||
| // # project. The module is, however, dual licensed under OpenSSL and | |||
| // # CRYPTOGAMS licenses depending on where you obtain it. For further | |||
| // # details see http://www.openssl.org/~appro/cryptogams/. | |||
| // # ==================================================================== | |||
| // Original code can be found at the link below: | |||
| // https://github.com/dot-asm/cryptogams/commit/a60f5b50ed908e91e5c39ca79126a4a876d5d8ff | |||
| // There are some differences between CRYPTOGAMS code and this one. The round | |||
| // loop for "_int" isn't the same as the original. Some adjustments were | |||
| // necessary because there are less vector registers available. For example, some | |||
| // X variables (r12, r13, r14, and r15) share the same register used by the | |||
| // counter. The original code uses ctr to name the counter. Here we use CNT | |||
| // because golang uses CTR as the counter register name. | |||
| // +build ppc64le,!gccgo,!appengine | |||
| #include "textflag.h" | |||
| #define OUT R3 | |||
| #define INP R4 | |||
| #define LEN R5 | |||
| #define KEY R6 | |||
| #define CNT R7 | |||
| #define TEMP R8 | |||
| #define X0 R11 | |||
| #define X1 R12 | |||
| #define X2 R14 | |||
| #define X3 R15 | |||
| #define X4 R16 | |||
| #define X5 R17 | |||
| #define X6 R18 | |||
| #define X7 R19 | |||
| #define X8 R20 | |||
| #define X9 R21 | |||
| #define X10 R22 | |||
| #define X11 R23 | |||
| #define X12 R24 | |||
| #define X13 R25 | |||
| #define X14 R26 | |||
| #define X15 R27 | |||
| #define CON0 X0 | |||
| #define CON1 X1 | |||
| #define CON2 X2 | |||
| #define CON3 X3 | |||
| #define KEY0 X4 | |||
| #define KEY1 X5 | |||
| #define KEY2 X6 | |||
| #define KEY3 X7 | |||
| #define KEY4 X8 | |||
| #define KEY5 X9 | |||
| #define KEY6 X10 | |||
| #define KEY7 X11 | |||
| #define CNT0 X12 | |||
| #define CNT1 X13 | |||
| #define CNT2 X14 | |||
| #define CNT3 X15 | |||
| #define TMP0 R9 | |||
| #define TMP1 R10 | |||
| #define TMP2 R28 | |||
| #define TMP3 R29 | |||
| #define CONSTS R8 | |||
| #define A0 V0 | |||
| #define B0 V1 | |||
| #define C0 V2 | |||
| #define D0 V3 | |||
| #define A1 V4 | |||
| #define B1 V5 | |||
| #define C1 V6 | |||
| #define D1 V7 | |||
| #define A2 V8 | |||
| #define B2 V9 | |||
| #define C2 V10 | |||
| #define D2 V11 | |||
| #define T0 V12 | |||
| #define T1 V13 | |||
| #define T2 V14 | |||
| #define K0 V15 | |||
| #define K1 V16 | |||
| #define K2 V17 | |||
| #define K3 V18 | |||
| #define K4 V19 | |||
| #define K5 V20 | |||
| #define FOUR V21 | |||
| #define SIXTEEN V22 | |||
| #define TWENTY4 V23 | |||
| #define TWENTY V24 | |||
| #define TWELVE V25 | |||
| #define TWENTY5 V26 | |||
| #define SEVEN V27 | |||
| #define INPPERM V28 | |||
| #define OUTPERM V29 | |||
| #define OUTMASK V30 | |||
| #define DD0 V31 | |||
| #define DD1 SEVEN | |||
| #define DD2 T0 | |||
| #define DD3 T1 | |||
| #define DD4 T2 | |||
| DATA ·consts+0x00(SB)/8, $0x3320646e61707865 | |||
| DATA ·consts+0x08(SB)/8, $0x6b20657479622d32 | |||
| DATA ·consts+0x10(SB)/8, $0x0000000000000001 | |||
| DATA ·consts+0x18(SB)/8, $0x0000000000000000 | |||
| DATA ·consts+0x20(SB)/8, $0x0000000000000004 | |||
| DATA ·consts+0x28(SB)/8, $0x0000000000000000 | |||
| DATA ·consts+0x30(SB)/8, $0x0a0b08090e0f0c0d | |||
| DATA ·consts+0x38(SB)/8, $0x0203000106070405 | |||
| DATA ·consts+0x40(SB)/8, $0x090a0b080d0e0f0c | |||
| DATA ·consts+0x48(SB)/8, $0x0102030005060704 | |||
| GLOBL ·consts(SB), RODATA, $80 | |||
| //func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[32]byte, counter *[16]byte) | |||
| TEXT ·chaCha20_ctr32_vmx(SB),NOSPLIT|NOFRAME,$0 | |||
| // Load the arguments inside the registers | |||
| MOVD out+0(FP), OUT | |||
| MOVD inp+8(FP), INP | |||
| MOVD len+16(FP), LEN | |||
| MOVD key+24(FP), KEY | |||
| MOVD counter+32(FP), CNT | |||
| MOVD $·consts(SB), CONSTS // point to consts addr | |||
| MOVD $16, X0 | |||
| MOVD $32, X1 | |||
| MOVD $48, X2 | |||
| MOVD $64, X3 | |||
| MOVD $31, X4 | |||
| MOVD $15, X5 | |||
| // Load key | |||
| LVX (KEY)(R0), K1 | |||
| LVSR (KEY)(R0), T0 | |||
| LVX (KEY)(X0), K2 | |||
| LVX (KEY)(X4), DD0 | |||
| // Load counter | |||
| LVX (CNT)(R0), K3 | |||
| LVSR (CNT)(R0), T1 | |||
| LVX (CNT)(X5), DD1 | |||
| // Load constants | |||
| LVX (CONSTS)(R0), K0 | |||
| LVX (CONSTS)(X0), K5 | |||
| LVX (CONSTS)(X1), FOUR | |||
| LVX (CONSTS)(X2), SIXTEEN | |||
| LVX (CONSTS)(X3), TWENTY4 | |||
| // Align key and counter | |||
| VPERM K2, K1, T0, K1 | |||
| VPERM DD0, K2, T0, K2 | |||
| VPERM DD1, K3, T1, K3 | |||
| // Load counter to GPR | |||
| MOVWZ 0(CNT), CNT0 | |||
| MOVWZ 4(CNT), CNT1 | |||
| MOVWZ 8(CNT), CNT2 | |||
| MOVWZ 12(CNT), CNT3 | |||
| // Adjust vectors for the initial state | |||
| VADDUWM K3, K5, K3 | |||
| VADDUWM K3, K5, K4 | |||
| VADDUWM K4, K5, K5 | |||
| // Synthesized constants | |||
| VSPLTISW $-12, TWENTY | |||
| VSPLTISW $12, TWELVE | |||
| VSPLTISW $-7, TWENTY5 | |||
| VXOR T0, T0, T0 | |||
| VSPLTISW $-1, OUTMASK | |||
| LVSR (INP)(R0), INPPERM | |||
| LVSL (OUT)(R0), OUTPERM | |||
| VPERM OUTMASK, T0, OUTPERM, OUTMASK | |||
| loop_outer_vmx: | |||
| // Load constant | |||
| MOVD $0x61707865, CON0 | |||
| MOVD $0x3320646e, CON1 | |||
| MOVD $0x79622d32, CON2 | |||
| MOVD $0x6b206574, CON3 | |||
| VOR K0, K0, A0 | |||
| VOR K0, K0, A1 | |||
| VOR K0, K0, A2 | |||
| VOR K1, K1, B0 | |||
| MOVD $10, TEMP | |||
| // Load key to GPR | |||
| MOVWZ 0(KEY), X4 | |||
| MOVWZ 4(KEY), X5 | |||
| MOVWZ 8(KEY), X6 | |||
| MOVWZ 12(KEY), X7 | |||
| VOR K1, K1, B1 | |||
| VOR K1, K1, B2 | |||
| MOVWZ 16(KEY), X8 | |||
| MOVWZ 0(CNT), X12 | |||
| MOVWZ 20(KEY), X9 | |||
| MOVWZ 4(CNT), X13 | |||
| VOR K2, K2, C0 | |||
| VOR K2, K2, C1 | |||
| MOVWZ 24(KEY), X10 | |||
| MOVWZ 8(CNT), X14 | |||
| VOR K2, K2, C2 | |||
| VOR K3, K3, D0 | |||
| MOVWZ 28(KEY), X11 | |||
| MOVWZ 12(CNT), X15 | |||
| VOR K4, K4, D1 | |||
| VOR K5, K5, D2 | |||
| MOVD X4, TMP0 | |||
| MOVD X5, TMP1 | |||
| MOVD X6, TMP2 | |||
| MOVD X7, TMP3 | |||
| VSPLTISW $7, SEVEN | |||
| MOVD TEMP, CTR | |||
| loop_vmx: | |||
| // CRYPTOGAMS uses a macro to create a loop using perl. This isn't possible | |||
| // using assembly macros. Therefore, the macro expansion result was used | |||
| // in order to maintain the algorithm efficiency. | |||
| // This loop generates three keystream blocks using VMX instructions and, | |||
| // in parallel, one keystream block using scalar instructions. | |||
| ADD X4, X0, X0 | |||
| ADD X5, X1, X1 | |||
| VADDUWM A0, B0, A0 | |||
| VADDUWM A1, B1, A1 | |||
| ADD X6, X2, X2 | |||
| ADD X7, X3, X3 | |||
| VADDUWM A2, B2, A2 | |||
| VXOR D0, A0, D0 | |||
| XOR X0, X12, X12 | |||
| XOR X1, X13, X13 | |||
| VXOR D1, A1, D1 | |||
| VXOR D2, A2, D2 | |||
| XOR X2, X14, X14 | |||
| XOR X3, X15, X15 | |||
| VPERM D0, D0, SIXTEEN, D0 | |||
| VPERM D1, D1, SIXTEEN, D1 | |||
| ROTLW $16, X12, X12 | |||
| ROTLW $16, X13, X13 | |||
| VPERM D2, D2, SIXTEEN, D2 | |||
| VADDUWM C0, D0, C0 | |||
| ROTLW $16, X14, X14 | |||
| ROTLW $16, X15, X15 | |||
| VADDUWM C1, D1, C1 | |||
| VADDUWM C2, D2, C2 | |||
| ADD X12, X8, X8 | |||
| ADD X13, X9, X9 | |||
| VXOR B0, C0, T0 | |||
| VXOR B1, C1, T1 | |||
| ADD X14, X10, X10 | |||
| ADD X15, X11, X11 | |||
| VXOR B2, C2, T2 | |||
| VRLW T0, TWELVE, B0 | |||
| XOR X8, X4, X4 | |||
| XOR X9, X5, X5 | |||
| VRLW T1, TWELVE, B1 | |||
| VRLW T2, TWELVE, B2 | |||
| XOR X10, X6, X6 | |||
| XOR X11, X7, X7 | |||
| VADDUWM A0, B0, A0 | |||
| VADDUWM A1, B1, A1 | |||
| ROTLW $12, X4, X4 | |||
| ROTLW $12, X5, X5 | |||
| VADDUWM A2, B2, A2 | |||
| VXOR D0, A0, D0 | |||
| ROTLW $12, X6, X6 | |||
| ROTLW $12, X7, X7 | |||
| VXOR D1, A1, D1 | |||
| VXOR D2, A2, D2 | |||
| ADD X4, X0, X0 | |||
| ADD X5, X1, X1 | |||
| VPERM D0, D0, TWENTY4, D0 | |||
| VPERM D1, D1, TWENTY4, D1 | |||
| ADD X6, X2, X2 | |||
| ADD X7, X3, X3 | |||
| VPERM D2, D2, TWENTY4, D2 | |||
| VADDUWM C0, D0, C0 | |||
| XOR X0, X12, X12 | |||
| XOR X1, X13, X13 | |||
| VADDUWM C1, D1, C1 | |||
| VADDUWM C2, D2, C2 | |||
| XOR X2, X14, X14 | |||
| XOR X3, X15, X15 | |||
| VXOR B0, C0, T0 | |||
| VXOR B1, C1, T1 | |||
| ROTLW $8, X12, X12 | |||
| ROTLW $8, X13, X13 | |||
| VXOR B2, C2, T2 | |||
| VRLW T0, SEVEN, B0 | |||
| ROTLW $8, X14, X14 | |||
| ROTLW $8, X15, X15 | |||
| VRLW T1, SEVEN, B1 | |||
| VRLW T2, SEVEN, B2 | |||
| ADD X12, X8, X8 | |||
| ADD X13, X9, X9 | |||
| VSLDOI $8, C0, C0, C0 | |||
| VSLDOI $8, C1, C1, C1 | |||
| ADD X14, X10, X10 | |||
| ADD X15, X11, X11 | |||
| VSLDOI $8, C2, C2, C2 | |||
| VSLDOI $12, B0, B0, B0 | |||
| XOR X8, X4, X4 | |||
| XOR X9, X5, X5 | |||
| VSLDOI $12, B1, B1, B1 | |||
| VSLDOI $12, B2, B2, B2 | |||
| XOR X10, X6, X6 | |||
| XOR X11, X7, X7 | |||
| VSLDOI $4, D0, D0, D0 | |||
| VSLDOI $4, D1, D1, D1 | |||
| ROTLW $7, X4, X4 | |||
| ROTLW $7, X5, X5 | |||
| VSLDOI $4, D2, D2, D2 | |||
| VADDUWM A0, B0, A0 | |||
| ROTLW $7, X6, X6 | |||
| ROTLW $7, X7, X7 | |||
| VADDUWM A1, B1, A1 | |||
| VADDUWM A2, B2, A2 | |||
| ADD X5, X0, X0 | |||
| ADD X6, X1, X1 | |||
| VXOR D0, A0, D0 | |||
| VXOR D1, A1, D1 | |||
| ADD X7, X2, X2 | |||
| ADD X4, X3, X3 | |||
| VXOR D2, A2, D2 | |||
| VPERM D0, D0, SIXTEEN, D0 | |||
| XOR X0, X15, X15 | |||
| XOR X1, X12, X12 | |||
| VPERM D1, D1, SIXTEEN, D1 | |||
| VPERM D2, D2, SIXTEEN, D2 | |||
| XOR X2, X13, X13 | |||
| XOR X3, X14, X14 | |||
| VADDUWM C0, D0, C0 | |||
| VADDUWM C1, D1, C1 | |||
| ROTLW $16, X15, X15 | |||
| ROTLW $16, X12, X12 | |||
| VADDUWM C2, D2, C2 | |||
| VXOR B0, C0, T0 | |||
| ROTLW $16, X13, X13 | |||
| ROTLW $16, X14, X14 | |||
| VXOR B1, C1, T1 | |||
| VXOR B2, C2, T2 | |||
| ADD X15, X10, X10 | |||
| ADD X12, X11, X11 | |||
| VRLW T0, TWELVE, B0 | |||
| VRLW T1, TWELVE, B1 | |||
| ADD X13, X8, X8 | |||
| ADD X14, X9, X9 | |||
| VRLW T2, TWELVE, B2 | |||
| VADDUWM A0, B0, A0 | |||
| XOR X10, X5, X5 | |||
| XOR X11, X6, X6 | |||
| VADDUWM A1, B1, A1 | |||
| VADDUWM A2, B2, A2 | |||
| XOR X8, X7, X7 | |||
| XOR X9, X4, X4 | |||
| VXOR D0, A0, D0 | |||
| VXOR D1, A1, D1 | |||
| ROTLW $12, X5, X5 | |||
| ROTLW $12, X6, X6 | |||
| VXOR D2, A2, D2 | |||
| VPERM D0, D0, TWENTY4, D0 | |||
| ROTLW $12, X7, X7 | |||
| ROTLW $12, X4, X4 | |||
| VPERM D1, D1, TWENTY4, D1 | |||
| VPERM D2, D2, TWENTY4, D2 | |||
| ADD X5, X0, X0 | |||
| ADD X6, X1, X1 | |||
| VADDUWM C0, D0, C0 | |||
| VADDUWM C1, D1, C1 | |||
| ADD X7, X2, X2 | |||
| ADD X4, X3, X3 | |||
| VADDUWM C2, D2, C2 | |||
| VXOR B0, C0, T0 | |||
| XOR X0, X15, X15 | |||
| XOR X1, X12, X12 | |||
| VXOR B1, C1, T1 | |||
| VXOR B2, C2, T2 | |||
| XOR X2, X13, X13 | |||
| XOR X3, X14, X14 | |||
| VRLW T0, SEVEN, B0 | |||
| VRLW T1, SEVEN, B1 | |||
| ROTLW $8, X15, X15 | |||
| ROTLW $8, X12, X12 | |||
| VRLW T2, SEVEN, B2 | |||
| VSLDOI $8, C0, C0, C0 | |||
| ROTLW $8, X13, X13 | |||
| ROTLW $8, X14, X14 | |||
| VSLDOI $8, C1, C1, C1 | |||
| VSLDOI $8, C2, C2, C2 | |||
| ADD X15, X10, X10 | |||
| ADD X12, X11, X11 | |||
| VSLDOI $4, B0, B0, B0 | |||
| VSLDOI $4, B1, B1, B1 | |||
| ADD X13, X8, X8 | |||
| ADD X14, X9, X9 | |||
| VSLDOI $4, B2, B2, B2 | |||
| VSLDOI $12, D0, D0, D0 | |||
| XOR X10, X5, X5 | |||
| XOR X11, X6, X6 | |||
| VSLDOI $12, D1, D1, D1 | |||
| VSLDOI $12, D2, D2, D2 | |||
| XOR X8, X7, X7 | |||
| XOR X9, X4, X4 | |||
| ROTLW $7, X5, X5 | |||
| ROTLW $7, X6, X6 | |||
| ROTLW $7, X7, X7 | |||
| ROTLW $7, X4, X4 | |||
| BC 0x10, 0, loop_vmx | |||
| SUB $256, LEN, LEN | |||
| // Accumulate key block | |||
| ADD $0x61707865, X0, X0 | |||
| ADD $0x3320646e, X1, X1 | |||
| ADD $0x79622d32, X2, X2 | |||
| ADD $0x6b206574, X3, X3 | |||
| ADD TMP0, X4, X4 | |||
| ADD TMP1, X5, X5 | |||
| ADD TMP2, X6, X6 | |||
| ADD TMP3, X7, X7 | |||
| MOVWZ 16(KEY), TMP0 | |||
| MOVWZ 20(KEY), TMP1 | |||
| MOVWZ 24(KEY), TMP2 | |||
| MOVWZ 28(KEY), TMP3 | |||
| ADD TMP0, X8, X8 | |||
| ADD TMP1, X9, X9 | |||
| ADD TMP2, X10, X10 | |||
| ADD TMP3, X11, X11 | |||
| MOVWZ 12(CNT), TMP0 | |||
| MOVWZ 8(CNT), TMP1 | |||
| MOVWZ 4(CNT), TMP2 | |||
| MOVWZ 0(CNT), TEMP | |||
| ADD TMP0, X15, X15 | |||
| ADD TMP1, X14, X14 | |||
| ADD TMP2, X13, X13 | |||
| ADD TEMP, X12, X12 | |||
| // Accumulate key block | |||
| VADDUWM A0, K0, A0 | |||
| VADDUWM A1, K0, A1 | |||
| VADDUWM A2, K0, A2 | |||
| VADDUWM B0, K1, B0 | |||
| VADDUWM B1, K1, B1 | |||
| VADDUWM B2, K1, B2 | |||
| VADDUWM C0, K2, C0 | |||
| VADDUWM C1, K2, C1 | |||
| VADDUWM C2, K2, C2 | |||
| VADDUWM D0, K3, D0 | |||
| VADDUWM D1, K4, D1 | |||
| VADDUWM D2, K5, D2 | |||
| // Increment counter | |||
| ADD $4, TEMP, TEMP | |||
| MOVW TEMP, 0(CNT) | |||
| VADDUWM K3, FOUR, K3 | |||
| VADDUWM K4, FOUR, K4 | |||
| VADDUWM K5, FOUR, K5 | |||
| // XOR the input slice (INP) with the keystream, which is stored in GPRs (X0-X3). | |||
| // Load input (aligned or not) | |||
| MOVWZ 0(INP), TMP0 | |||
| MOVWZ 4(INP), TMP1 | |||
| MOVWZ 8(INP), TMP2 | |||
| MOVWZ 12(INP), TMP3 | |||
| // XOR with input | |||
| XOR TMP0, X0, X0 | |||
| XOR TMP1, X1, X1 | |||
| XOR TMP2, X2, X2 | |||
| XOR TMP3, X3, X3 | |||
| MOVWZ 16(INP), TMP0 | |||
| MOVWZ 20(INP), TMP1 | |||
| MOVWZ 24(INP), TMP2 | |||
| MOVWZ 28(INP), TMP3 | |||
| XOR TMP0, X4, X4 | |||
| XOR TMP1, X5, X5 | |||
| XOR TMP2, X6, X6 | |||
| XOR TMP3, X7, X7 | |||
| MOVWZ 32(INP), TMP0 | |||
| MOVWZ 36(INP), TMP1 | |||
| MOVWZ 40(INP), TMP2 | |||
| MOVWZ 44(INP), TMP3 | |||
| XOR TMP0, X8, X8 | |||
| XOR TMP1, X9, X9 | |||
| XOR TMP2, X10, X10 | |||
| XOR TMP3, X11, X11 | |||
| MOVWZ 48(INP), TMP0 | |||
| MOVWZ 52(INP), TMP1 | |||
| MOVWZ 56(INP), TMP2 | |||
| MOVWZ 60(INP), TMP3 | |||
| XOR TMP0, X12, X12 | |||
| XOR TMP1, X13, X13 | |||
| XOR TMP2, X14, X14 | |||
| XOR TMP3, X15, X15 | |||
| // Store output (aligned or not) | |||
| MOVW X0, 0(OUT) | |||
| MOVW X1, 4(OUT) | |||
| MOVW X2, 8(OUT) | |||
| MOVW X3, 12(OUT) | |||
| ADD $64, INP, INP // INP points to the end of the slice for the alignment code below | |||
| MOVW X4, 16(OUT) | |||
| MOVD $16, TMP0 | |||
| MOVW X5, 20(OUT) | |||
| MOVD $32, TMP1 | |||
| MOVW X6, 24(OUT) | |||
| MOVD $48, TMP2 | |||
| MOVW X7, 28(OUT) | |||
| MOVD $64, TMP3 | |||
| MOVW X8, 32(OUT) | |||
| MOVW X9, 36(OUT) | |||
| MOVW X10, 40(OUT) | |||
| MOVW X11, 44(OUT) | |||
| MOVW X12, 48(OUT) | |||
| MOVW X13, 52(OUT) | |||
| MOVW X14, 56(OUT) | |||
| MOVW X15, 60(OUT) | |||
| ADD $64, OUT, OUT | |||
| // Load input | |||
| LVX (INP)(R0), DD0 | |||
| LVX (INP)(TMP0), DD1 | |||
| LVX (INP)(TMP1), DD2 | |||
| LVX (INP)(TMP2), DD3 | |||
| LVX (INP)(TMP3), DD4 | |||
| ADD $64, INP, INP | |||
| VPERM DD1, DD0, INPPERM, DD0 // Align input | |||
| VPERM DD2, DD1, INPPERM, DD1 | |||
| VPERM DD3, DD2, INPPERM, DD2 | |||
| VPERM DD4, DD3, INPPERM, DD3 | |||
| VXOR A0, DD0, A0 // XOR with input | |||
| VXOR B0, DD1, B0 | |||
| LVX (INP)(TMP0), DD1 // Keep loading input | |||
| VXOR C0, DD2, C0 | |||
| LVX (INP)(TMP1), DD2 | |||
| VXOR D0, DD3, D0 | |||
| LVX (INP)(TMP2), DD3 | |||
| LVX (INP)(TMP3), DD0 | |||
| ADD $64, INP, INP | |||
| MOVD $63, TMP3 // 63 is not a typo | |||
| VPERM A0, A0, OUTPERM, A0 | |||
| VPERM B0, B0, OUTPERM, B0 | |||
| VPERM C0, C0, OUTPERM, C0 | |||
| VPERM D0, D0, OUTPERM, D0 | |||
| VPERM DD1, DD4, INPPERM, DD4 // Align input | |||
| VPERM DD2, DD1, INPPERM, DD1 | |||
| VPERM DD3, DD2, INPPERM, DD2 | |||
| VPERM DD0, DD3, INPPERM, DD3 | |||
| VXOR A1, DD4, A1 | |||
| VXOR B1, DD1, B1 | |||
| LVX (INP)(TMP0), DD1 // Keep loading | |||
| VXOR C1, DD2, C1 | |||
| LVX (INP)(TMP1), DD2 | |||
| VXOR D1, DD3, D1 | |||
| LVX (INP)(TMP2), DD3 | |||
| // Note that the LVX address is always rounded down to the nearest 16-byte | |||
| // boundary, and that it always points to at most 15 bytes beyond the end of | |||
| // the slice, so we cannot cross a page boundary. | |||
| LVX (INP)(TMP3), DD4 // Redundant in aligned case. | |||
| ADD $64, INP, INP | |||
| VPERM A1, A1, OUTPERM, A1 // Pre-misalign output | |||
| VPERM B1, B1, OUTPERM, B1 | |||
| VPERM C1, C1, OUTPERM, C1 | |||
| VPERM D1, D1, OUTPERM, D1 | |||
| VPERM DD1, DD0, INPPERM, DD0 // Align Input | |||
| VPERM DD2, DD1, INPPERM, DD1 | |||
| VPERM DD3, DD2, INPPERM, DD2 | |||
| VPERM DD4, DD3, INPPERM, DD3 | |||
| VXOR A2, DD0, A2 | |||
| VXOR B2, DD1, B2 | |||
| VXOR C2, DD2, C2 | |||
| VXOR D2, DD3, D2 | |||
| VPERM A2, A2, OUTPERM, A2 | |||
| VPERM B2, B2, OUTPERM, B2 | |||
| VPERM C2, C2, OUTPERM, C2 | |||
| VPERM D2, D2, OUTPERM, D2 | |||
| ANDCC $15, OUT, X1 // Is out aligned? | |||
| MOVD OUT, X0 | |||
| VSEL A0, B0, OUTMASK, DD0 // Collect pre-misaligned output | |||
| VSEL B0, C0, OUTMASK, DD1 | |||
| VSEL C0, D0, OUTMASK, DD2 | |||
| VSEL D0, A1, OUTMASK, DD3 | |||
| VSEL A1, B1, OUTMASK, B0 | |||
| VSEL B1, C1, OUTMASK, C0 | |||
| VSEL C1, D1, OUTMASK, D0 | |||
| VSEL D1, A2, OUTMASK, A1 | |||
| VSEL A2, B2, OUTMASK, B1 | |||
| VSEL B2, C2, OUTMASK, C1 | |||
| VSEL C2, D2, OUTMASK, D1 | |||
| STVX DD0, (OUT+TMP0) | |||
| STVX DD1, (OUT+TMP1) | |||
| STVX DD2, (OUT+TMP2) | |||
| ADD $64, OUT, OUT | |||
| STVX DD3, (OUT+R0) | |||
| STVX B0, (OUT+TMP0) | |||
| STVX C0, (OUT+TMP1) | |||
| STVX D0, (OUT+TMP2) | |||
| ADD $64, OUT, OUT | |||
| STVX A1, (OUT+R0) | |||
| STVX B1, (OUT+TMP0) | |||
| STVX C1, (OUT+TMP1) | |||
| STVX D1, (OUT+TMP2) | |||
| ADD $64, OUT, OUT | |||
| BEQ aligned_vmx | |||
| SUB X1, OUT, X2 // in misaligned case edges | |||
| MOVD $0, X3 // are written byte-by-byte | |||
| unaligned_tail_vmx: | |||
| STVEBX D2, (X2+X3) | |||
| ADD $1, X3, X3 | |||
| CMPW X3, X1 | |||
| BNE unaligned_tail_vmx | |||
| SUB X1, X0, X2 | |||
| unaligned_head_vmx: | |||
| STVEBX A0, (X2+X1) | |||
| CMPW X1, $15 | |||
| ADD $1, X1, X1 | |||
| BNE unaligned_head_vmx | |||
| CMPU LEN, $255 // done with 256-byte block yet? | |||
| BGT loop_outer_vmx | |||
| JMP done_vmx | |||
| aligned_vmx: | |||
| STVX A0, (X0+R0) | |||
| CMPU LEN, $255 // done with 256-byte block yet? | |||
| BGT loop_outer_vmx | |||
| done_vmx: | |||
| RET | |||
| @@ -2,7 +2,7 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !arm64,!s390x arm64,!go1.11 gccgo appengine | |||
| // +build !ppc64le,!arm64,!s390x arm64,!go1.11 gccgo appengine | |||
| package chacha20 | |||
| @@ -0,0 +1,52 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build ppc64le,!gccgo,!appengine | |||
| package chacha20 | |||
| import "encoding/binary" | |||
| const ( | |||
| bufSize = 256 | |||
| haveAsm = true | |||
| ) | |||
| //go:noescape | |||
| func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[8]uint32, counter *uint32) | |||
| func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { | |||
| if len(src) >= bufSize { | |||
| chaCha20_ctr32_vmx(&dst[0], &src[0], len(src)-len(src)%bufSize, &c.key, &c.counter) | |||
| } | |||
| if len(src)%bufSize != 0 { | |||
| chaCha20_ctr32_vmx(&c.buf[0], &c.buf[0], bufSize, &c.key, &c.counter) | |||
| start := len(src) - len(src)%bufSize | |||
| ts, td, tb := src[start:], dst[start:], c.buf[:] | |||
| // Unroll loop to XOR 32 bytes per iteration. | |||
| for i := 0; i < len(ts)-32; i += 32 { | |||
| td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination | |||
| s0 := binary.LittleEndian.Uint64(ts[0:8]) | |||
| s1 := binary.LittleEndian.Uint64(ts[8:16]) | |||
| s2 := binary.LittleEndian.Uint64(ts[16:24]) | |||
| s3 := binary.LittleEndian.Uint64(ts[24:32]) | |||
| b0 := binary.LittleEndian.Uint64(tb[0:8]) | |||
| b1 := binary.LittleEndian.Uint64(tb[8:16]) | |||
| b2 := binary.LittleEndian.Uint64(tb[16:24]) | |||
| b3 := binary.LittleEndian.Uint64(tb[24:32]) | |||
| binary.LittleEndian.PutUint64(td[0:8], s0^b0) | |||
| binary.LittleEndian.PutUint64(td[8:16], s1^b1) | |||
| binary.LittleEndian.PutUint64(td[16:24], s2^b2) | |||
| binary.LittleEndian.PutUint64(td[24:32], s3^b3) | |||
| ts, td, tb = ts[32:], td[32:], tb[32:] | |||
| } | |||
| td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination | |||
| for i, v := range ts { | |||
| td[i] = tb[i] ^ v | |||
| } | |||
| c.len = bufSize - (len(src) % bufSize) | |||
| } | |||
| } | |||
| @@ -504,7 +504,7 @@ const defaultRSAKeyBits = 2048 | |||
| // which may be empty but must not contain any of "()<>\x00". | |||
| // If config is nil, sensible defaults will be used. | |||
| func NewEntity(name, comment, email string, config *packet.Config) (*Entity, error) { | |||
| currentTime := config.Now() | |||
| creationTime := config.Now() | |||
| bits := defaultRSAKeyBits | |||
| if config != nil && config.RSABits != 0 { | |||
| @@ -525,8 +525,8 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err | |||
| } | |||
| e := &Entity{ | |||
| PrimaryKey: packet.NewRSAPublicKey(currentTime, &signingPriv.PublicKey), | |||
| PrivateKey: packet.NewRSAPrivateKey(currentTime, signingPriv), | |||
| PrimaryKey: packet.NewRSAPublicKey(creationTime, &signingPriv.PublicKey), | |||
| PrivateKey: packet.NewRSAPrivateKey(creationTime, signingPriv), | |||
| Identities: make(map[string]*Identity), | |||
| } | |||
| isPrimaryId := true | |||
| @@ -534,7 +534,7 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err | |||
| Name: uid.Id, | |||
| UserId: uid, | |||
| SelfSignature: &packet.Signature{ | |||
| CreationTime: currentTime, | |||
| CreationTime: creationTime, | |||
| SigType: packet.SigTypePositiveCert, | |||
| PubKeyAlgo: packet.PubKeyAlgoRSA, | |||
| Hash: config.Hash(), | |||
| @@ -563,10 +563,10 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err | |||
| e.Subkeys = make([]Subkey, 1) | |||
| e.Subkeys[0] = Subkey{ | |||
| PublicKey: packet.NewRSAPublicKey(currentTime, &encryptingPriv.PublicKey), | |||
| PrivateKey: packet.NewRSAPrivateKey(currentTime, encryptingPriv), | |||
| PublicKey: packet.NewRSAPublicKey(creationTime, &encryptingPriv.PublicKey), | |||
| PrivateKey: packet.NewRSAPrivateKey(creationTime, encryptingPriv), | |||
| Sig: &packet.Signature{ | |||
| CreationTime: currentTime, | |||
| CreationTime: creationTime, | |||
| SigType: packet.SigTypeSubkeyBinding, | |||
| PubKeyAlgo: packet.PubKeyAlgoRSA, | |||
| Hash: config.Hash(), | |||
| @@ -36,49 +36,49 @@ type PrivateKey struct { | |||
| iv []byte | |||
| } | |||
| func NewRSAPrivateKey(currentTime time.Time, priv *rsa.PrivateKey) *PrivateKey { | |||
| func NewRSAPrivateKey(creationTime time.Time, priv *rsa.PrivateKey) *PrivateKey { | |||
| pk := new(PrivateKey) | |||
| pk.PublicKey = *NewRSAPublicKey(currentTime, &priv.PublicKey) | |||
| pk.PublicKey = *NewRSAPublicKey(creationTime, &priv.PublicKey) | |||
| pk.PrivateKey = priv | |||
| return pk | |||
| } | |||
| func NewDSAPrivateKey(currentTime time.Time, priv *dsa.PrivateKey) *PrivateKey { | |||
| func NewDSAPrivateKey(creationTime time.Time, priv *dsa.PrivateKey) *PrivateKey { | |||
| pk := new(PrivateKey) | |||
| pk.PublicKey = *NewDSAPublicKey(currentTime, &priv.PublicKey) | |||
| pk.PublicKey = *NewDSAPublicKey(creationTime, &priv.PublicKey) | |||
| pk.PrivateKey = priv | |||
| return pk | |||
| } | |||
| func NewElGamalPrivateKey(currentTime time.Time, priv *elgamal.PrivateKey) *PrivateKey { | |||
| func NewElGamalPrivateKey(creationTime time.Time, priv *elgamal.PrivateKey) *PrivateKey { | |||
| pk := new(PrivateKey) | |||
| pk.PublicKey = *NewElGamalPublicKey(currentTime, &priv.PublicKey) | |||
| pk.PublicKey = *NewElGamalPublicKey(creationTime, &priv.PublicKey) | |||
| pk.PrivateKey = priv | |||
| return pk | |||
| } | |||
| func NewECDSAPrivateKey(currentTime time.Time, priv *ecdsa.PrivateKey) *PrivateKey { | |||
| func NewECDSAPrivateKey(creationTime time.Time, priv *ecdsa.PrivateKey) *PrivateKey { | |||
| pk := new(PrivateKey) | |||
| pk.PublicKey = *NewECDSAPublicKey(currentTime, &priv.PublicKey) | |||
| pk.PublicKey = *NewECDSAPublicKey(creationTime, &priv.PublicKey) | |||
| pk.PrivateKey = priv | |||
| return pk | |||
| } | |||
| // NewSignerPrivateKey creates a PrivateKey from a crypto.Signer that | |||
| // implements RSA or ECDSA. | |||
| func NewSignerPrivateKey(currentTime time.Time, signer crypto.Signer) *PrivateKey { | |||
| func NewSignerPrivateKey(creationTime time.Time, signer crypto.Signer) *PrivateKey { | |||
| pk := new(PrivateKey) | |||
| // In general, the public Keys should be used as pointers. We still | |||
| // type-switch on the values, for backwards-compatibility. | |||
| switch pubkey := signer.Public().(type) { | |||
| case *rsa.PublicKey: | |||
| pk.PublicKey = *NewRSAPublicKey(currentTime, pubkey) | |||
| pk.PublicKey = *NewRSAPublicKey(creationTime, pubkey) | |||
| case rsa.PublicKey: | |||
| pk.PublicKey = *NewRSAPublicKey(currentTime, &pubkey) | |||
| pk.PublicKey = *NewRSAPublicKey(creationTime, &pubkey) | |||
| case *ecdsa.PublicKey: | |||
| pk.PublicKey = *NewECDSAPublicKey(currentTime, pubkey) | |||
| pk.PublicKey = *NewECDSAPublicKey(creationTime, pubkey) | |||
| case ecdsa.PublicKey: | |||
| pk.PublicKey = *NewECDSAPublicKey(currentTime, &pubkey) | |||
| pk.PublicKey = *NewECDSAPublicKey(creationTime, &pubkey) | |||
| default: | |||
| panic("openpgp: unknown crypto.Signer type in NewSignerPrivateKey") | |||
| } | |||
| @@ -2,7 +2,7 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !amd64 gccgo appengine | |||
| // +build !amd64,!ppc64le gccgo appengine | |||
| package poly1305 | |||
| @@ -2,7 +2,7 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build s390x,!go1.11 !arm,!amd64,!s390x gccgo appengine nacl | |||
| // +build s390x,!go1.11 !arm,!amd64,!s390x,!ppc64le gccgo appengine nacl | |||
| package poly1305 | |||
| @@ -0,0 +1,68 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build ppc64le,!gccgo,!appengine | |||
| package poly1305 | |||
| //go:noescape | |||
| func initialize(state *[7]uint64, key *[32]byte) | |||
| //go:noescape | |||
| func update(state *[7]uint64, msg []byte) | |||
| //go:noescape | |||
| func finalize(tag *[TagSize]byte, state *[7]uint64) | |||
| // Sum generates an authenticator for m using a one-time key and puts the | |||
| // 16-byte result into out. Authenticating two different messages with the same | |||
| // key allows an attacker to forge messages at will. | |||
| func Sum(out *[16]byte, m []byte, key *[32]byte) { | |||
| h := newMAC(key) | |||
| h.Write(m) | |||
| h.Sum(out) | |||
| } | |||
| func newMAC(key *[32]byte) (h mac) { | |||
| initialize(&h.state, key) | |||
| return | |||
| } | |||
| type mac struct { | |||
| state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 } | |||
| buffer [TagSize]byte | |||
| offset int | |||
| } | |||
| func (h *mac) Write(p []byte) (n int, err error) { | |||
| n = len(p) | |||
| if h.offset > 0 { | |||
| remaining := TagSize - h.offset | |||
| if n < remaining { | |||
| h.offset += copy(h.buffer[h.offset:], p) | |||
| return n, nil | |||
| } | |||
| copy(h.buffer[h.offset:], p[:remaining]) | |||
| p = p[remaining:] | |||
| h.offset = 0 | |||
| update(&h.state, h.buffer[:]) | |||
| } | |||
| if nn := len(p) - (len(p) % TagSize); nn > 0 { | |||
| update(&h.state, p[:nn]) | |||
| p = p[nn:] | |||
| } | |||
| if len(p) > 0 { | |||
| h.offset += copy(h.buffer[h.offset:], p) | |||
| } | |||
| return n, nil | |||
| } | |||
| func (h *mac) Sum(out *[16]byte) { | |||
| state := h.state | |||
| if h.offset > 0 { | |||
| update(&state, h.buffer[:h.offset]) | |||
| } | |||
| finalize(out, &state) | |||
| } | |||
| @@ -0,0 +1,247 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build ppc64le,!gccgo,!appengine | |||
| #include "textflag.h" | |||
| // This was ported from the amd64 implementation. | |||
| #define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \ | |||
| MOVD (msg), t0; \ | |||
| MOVD 8(msg), t1; \ | |||
| MOVD $1, t2; \ | |||
| ADDC t0, h0, h0; \ | |||
| ADDE t1, h1, h1; \ | |||
| ADDE t2, h2; \ | |||
| ADD $16, msg | |||
| #define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \ | |||
| MULLD r0, h0, t0; \ | |||
| MULLD r0, h1, t4; \ | |||
| MULHDU r0, h0, t1; \ | |||
| MULHDU r0, h1, t5; \ | |||
| ADDC t4, t1, t1; \ | |||
| MULLD r0, h2, t2; \ | |||
| ADDZE t5; \ | |||
| MULHDU r1, h0, t4; \ | |||
| MULLD r1, h0, h0; \ | |||
| ADD t5, t2, t2; \ | |||
| ADDC h0, t1, t1; \ | |||
| MULLD h2, r1, t3; \ | |||
| ADDZE t4, h0; \ | |||
| MULHDU r1, h1, t5; \ | |||
| MULLD r1, h1, t4; \ | |||
| ADDC t4, t2, t2; \ | |||
| ADDE t5, t3, t3; \ | |||
| ADDC h0, t2, t2; \ | |||
| MOVD $-4, t4; \ | |||
| MOVD t0, h0; \ | |||
| MOVD t1, h1; \ | |||
| ADDZE t3; \ | |||
| ANDCC $3, t2, h2; \ | |||
| AND t2, t4, t0; \ | |||
| ADDC t0, h0, h0; \ | |||
| ADDE t3, h1, h1; \ | |||
| SLD $62, t3, t4; \ | |||
| SRD $2, t2; \ | |||
| ADDZE h2; \ | |||
| OR t4, t2, t2; \ | |||
| SRD $2, t3; \ | |||
| ADDC t2, h0, h0; \ | |||
| ADDE t3, h1, h1; \ | |||
| ADDZE h2 | |||
| DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF | |||
| DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC | |||
| GLOBL ·poly1305Mask<>(SB), RODATA, $16 | |||
| // func update(state *[7]uint64, msg []byte) | |||
| TEXT ·update(SB), $0-32 | |||
| MOVD state+0(FP), R3 | |||
| MOVD msg_base+8(FP), R4 | |||
| MOVD msg_len+16(FP), R5 | |||
| MOVD 0(R3), R8 // h0 | |||
| MOVD 8(R3), R9 // h1 | |||
| MOVD 16(R3), R10 // h2 | |||
| MOVD 24(R3), R11 // r0 | |||
| MOVD 32(R3), R12 // r1 | |||
| CMP R5, $16 | |||
| BLT bytes_between_0_and_15 | |||
| loop: | |||
| POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22) | |||
| multiply: | |||
| POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21) | |||
| ADD $-16, R5 | |||
| CMP R5, $16 | |||
| BGE loop | |||
| bytes_between_0_and_15: | |||
| CMP $0, R5 | |||
| BEQ done | |||
| MOVD $0, R16 // h0 | |||
| MOVD $0, R17 // h1 | |||
| flush_buffer: | |||
| CMP R5, $8 | |||
| BLE just1 | |||
| MOVD $8, R21 | |||
| SUB R21, R5, R21 | |||
| // Greater than 8 -- load the rightmost remaining bytes in msg | |||
| // and put into R17 (h1) | |||
| MOVD (R4)(R21), R17 | |||
| MOVD $16, R22 | |||
| // Find the offset to those bytes | |||
| SUB R5, R22, R22 | |||
| SLD $3, R22 | |||
| // Shift to get only the bytes in msg | |||
| SRD R22, R17, R17 | |||
| // Put 1 at high end | |||
| MOVD $1, R23 | |||
| SLD $3, R21 | |||
| SLD R21, R23, R23 | |||
| OR R23, R17, R17 | |||
| // Remainder is 8 | |||
| MOVD $8, R5 | |||
| just1: | |||
| CMP R5, $8 | |||
| BLT less8 | |||
| // Exactly 8 | |||
| MOVD (R4), R16 | |||
| CMP $0, R17 | |||
| // Check if we've already set R17; if not | |||
| // set 1 to indicate end of msg. | |||
| BNE carry | |||
| MOVD $1, R17 | |||
| BR carry | |||
| less8: | |||
| MOVD $0, R16 // h0 | |||
| MOVD $0, R22 // shift count | |||
| CMP R5, $4 | |||
| BLT less4 | |||
| MOVWZ (R4), R16 | |||
| ADD $4, R4 | |||
| ADD $-4, R5 | |||
| MOVD $32, R22 | |||
| less4: | |||
| CMP R5, $2 | |||
| BLT less2 | |||
| MOVHZ (R4), R21 | |||
| SLD R22, R21, R21 | |||
| OR R16, R21, R16 | |||
| ADD $16, R22 | |||
| ADD $-2, R5 | |||
| ADD $2, R4 | |||
| less2: | |||
| CMP $0, R5 | |||
| BEQ insert1 | |||
| MOVBZ (R4), R21 | |||
| SLD R22, R21, R21 | |||
| OR R16, R21, R16 | |||
| ADD $8, R22 | |||
| insert1: | |||
| // Insert 1 at end of msg | |||
| MOVD $1, R21 | |||
| SLD R22, R21, R21 | |||
| OR R16, R21, R16 | |||
| carry: | |||
| // Add new values to h0, h1, h2 | |||
| ADDC R16, R8 | |||
| ADDE R17, R9 | |||
| ADDE $0, R10 | |||
| MOVD $16, R5 | |||
| ADD R5, R4 | |||
| BR multiply | |||
| done: | |||
| // Save h0, h1, h2 in state | |||
| MOVD R8, 0(R3) | |||
| MOVD R9, 8(R3) | |||
| MOVD R10, 16(R3) | |||
| RET | |||
| // func initialize(state *[7]uint64, key *[32]byte) | |||
| TEXT ·initialize(SB), $0-16 | |||
| MOVD state+0(FP), R3 | |||
| MOVD key+8(FP), R4 | |||
| // state[0...7] is initialized with zero | |||
| // Load key | |||
| MOVD 0(R4), R5 | |||
| MOVD 8(R4), R6 | |||
| MOVD 16(R4), R7 | |||
| MOVD 24(R4), R8 | |||
| // Address of key mask | |||
| MOVD $·poly1305Mask<>(SB), R9 | |||
| // Save original key in state | |||
| MOVD R7, 40(R3) | |||
| MOVD R8, 48(R3) | |||
| // Get mask | |||
| MOVD (R9), R7 | |||
| MOVD 8(R9), R8 | |||
| // And with key | |||
| AND R5, R7, R5 | |||
| AND R6, R8, R6 | |||
| // Save masked key in state | |||
| MOVD R5, 24(R3) | |||
| MOVD R6, 32(R3) | |||
| RET | |||
| // func finalize(tag *[TagSize]byte, state *[7]uint64) | |||
| TEXT ·finalize(SB), $0-16 | |||
| MOVD tag+0(FP), R3 | |||
| MOVD state+8(FP), R4 | |||
| // Get h0, h1, h2 from state | |||
| MOVD 0(R4), R5 | |||
| MOVD 8(R4), R6 | |||
| MOVD 16(R4), R7 | |||
| // Save h0, h1 | |||
| MOVD R5, R8 | |||
| MOVD R6, R9 | |||
| MOVD $3, R20 | |||
| MOVD $-1, R21 | |||
| SUBC $-5, R5 | |||
| SUBE R21, R6 | |||
| SUBE R20, R7 | |||
| MOVD $0, R21 | |||
| SUBZE R21 | |||
| // Check for carry | |||
| CMP $0, R21 | |||
| ISEL $2, R5, R8, R5 | |||
| ISEL $2, R6, R9, R6 | |||
| MOVD 40(R4), R8 | |||
| MOVD 48(R4), R9 | |||
| ADDC R8, R5 | |||
| ADDE R9, R6 | |||
| MOVD R5, 0(R3) | |||
| MOVD R6, 8(R3) | |||
| RET | |||
| @@ -523,3 +523,117 @@ func (r *retryableAuthMethod) method() string { | |||
| func RetryableAuthMethod(auth AuthMethod, maxTries int) AuthMethod { | |||
| return &retryableAuthMethod{authMethod: auth, maxTries: maxTries} | |||
| } | |||
| // GSSAPIWithMICAuthMethod is an AuthMethod with "gssapi-with-mic" authentication. | |||
| // See RFC 4462 section 3 | |||
| // gssAPIClient is implementation of the GSSAPIClient interface, see the definition of the interface for details. | |||
| // target is the server host you want to log in to. | |||
| func GSSAPIWithMICAuthMethod(gssAPIClient GSSAPIClient, target string) AuthMethod { | |||
| if gssAPIClient == nil { | |||
| panic("gss-api client must be not nil with enable gssapi-with-mic") | |||
| } | |||
| return &gssAPIWithMICCallback{gssAPIClient: gssAPIClient, target: target} | |||
| } | |||
| type gssAPIWithMICCallback struct { | |||
| gssAPIClient GSSAPIClient | |||
| target string | |||
| } | |||
| func (g *gssAPIWithMICCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { | |||
| m := &userAuthRequestMsg{ | |||
| User: user, | |||
| Service: serviceSSH, | |||
| Method: g.method(), | |||
| } | |||
| // The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST. | |||
| // See RFC 4462 section 3.2. | |||
| m.Payload = appendU32(m.Payload, 1) | |||
| m.Payload = appendString(m.Payload, string(krb5OID)) | |||
| if err := c.writePacket(Marshal(m)); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| // The server responds to the SSH_MSG_USERAUTH_REQUEST with either an | |||
| // SSH_MSG_USERAUTH_FAILURE if none of the mechanisms are supported or | |||
| // with an SSH_MSG_USERAUTH_GSSAPI_RESPONSE. | |||
| // See RFC 4462 section 3.3. | |||
| // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,so I don't want to check | |||
| // selected mech if it is valid. | |||
| packet, err := c.readPacket() | |||
| if err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| userAuthGSSAPIResp := &userAuthGSSAPIResponse{} | |||
| if err := Unmarshal(packet, userAuthGSSAPIResp); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| // Start the loop into the exchange token. | |||
| // See RFC 4462 section 3.4. | |||
| var token []byte | |||
| defer g.gssAPIClient.DeleteSecContext() | |||
| for { | |||
| // Initiates the establishment of a security context between the application and a remote peer. | |||
| nextToken, needContinue, err := g.gssAPIClient.InitSecContext("host@"+g.target, token, false) | |||
| if err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| if len(nextToken) > 0 { | |||
| if err := c.writePacket(Marshal(&userAuthGSSAPIToken{ | |||
| Token: nextToken, | |||
| })); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| } | |||
| if !needContinue { | |||
| break | |||
| } | |||
| packet, err = c.readPacket() | |||
| if err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| switch packet[0] { | |||
| case msgUserAuthFailure: | |||
| var msg userAuthFailureMsg | |||
| if err := Unmarshal(packet, &msg); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| if msg.PartialSuccess { | |||
| return authPartialSuccess, msg.Methods, nil | |||
| } | |||
| return authFailure, msg.Methods, nil | |||
| case msgUserAuthGSSAPIError: | |||
| userAuthGSSAPIErrorResp := &userAuthGSSAPIError{} | |||
| if err := Unmarshal(packet, userAuthGSSAPIErrorResp); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| return authFailure, nil, fmt.Errorf("GSS-API Error:\n"+ | |||
| "Major Status: %d\n"+ | |||
| "Minor Status: %d\n"+ | |||
| "Error Message: %s\n", userAuthGSSAPIErrorResp.MajorStatus, userAuthGSSAPIErrorResp.MinorStatus, | |||
| userAuthGSSAPIErrorResp.Message) | |||
| case msgUserAuthGSSAPIToken: | |||
| userAuthGSSAPITokenReq := &userAuthGSSAPIToken{} | |||
| if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| token = userAuthGSSAPITokenReq.Token | |||
| } | |||
| } | |||
| // Binding Encryption Keys. | |||
| // See RFC 4462 section 3.5. | |||
| micField := buildMIC(string(session), user, "ssh-connection", "gssapi-with-mic") | |||
| micToken, err := g.gssAPIClient.GetMIC(micField) | |||
| if err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| if err := c.writePacket(Marshal(&userAuthGSSAPIMIC{ | |||
| MIC: micToken, | |||
| })); err != nil { | |||
| return authFailure, nil, err | |||
| } | |||
| return handleAuthResponse(c) | |||
| } | |||
| func (g *gssAPIWithMICCallback) method() string { | |||
| return "gssapi-with-mic" | |||
| } | |||
| @@ -51,6 +51,13 @@ var supportedKexAlgos = []string{ | |||
| kexAlgoDH14SHA1, kexAlgoDH1SHA1, | |||
| } | |||
| // serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden | |||
| // for the server half. | |||
| var serverForbiddenKexAlgos = map[string]struct{}{ | |||
| kexAlgoDHGEXSHA1: {}, // server half implementation is only minimal to satisfy the automated tests | |||
| kexAlgoDHGEXSHA256: {}, // server half implementation is only minimal to satisfy the automated tests | |||
| } | |||
| // supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods | |||
| // of authenticating servers) in preference order. | |||
| var supportedHostKeyAlgos = []string{ | |||
| @@ -10,7 +10,9 @@ import ( | |||
| "crypto/elliptic" | |||
| "crypto/rand" | |||
| "crypto/subtle" | |||
| "encoding/binary" | |||
| "errors" | |||
| "fmt" | |||
| "io" | |||
| "math/big" | |||
| @@ -24,6 +26,12 @@ const ( | |||
| kexAlgoECDH384 = "ecdh-sha2-nistp384" | |||
| kexAlgoECDH521 = "ecdh-sha2-nistp521" | |||
| kexAlgoCurve25519SHA256 = "curve25519-sha256@libssh.org" | |||
| // For the following kex only the client half contains a production | |||
| // ready implementation. The server half only consists of a minimal | |||
| // implementation to satisfy the automated tests. | |||
| kexAlgoDHGEXSHA1 = "diffie-hellman-group-exchange-sha1" | |||
| kexAlgoDHGEXSHA256 = "diffie-hellman-group-exchange-sha256" | |||
| ) | |||
| // kexResult captures the outcome of a key exchange. | |||
| @@ -402,6 +410,8 @@ func init() { | |||
| kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()} | |||
| kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()} | |||
| kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{} | |||
| kexAlgoMap[kexAlgoDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1} | |||
| kexAlgoMap[kexAlgoDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256} | |||
| } | |||
| // curve25519sha256 implements the curve25519-sha256@libssh.org key | |||
| @@ -538,3 +548,242 @@ func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handsh | |||
| Hash: crypto.SHA256, | |||
| }, nil | |||
| } | |||
| // dhGEXSHA implements the diffie-hellman-group-exchange-sha1 and | |||
| // diffie-hellman-group-exchange-sha256 key agreement protocols, | |||
| // as described in RFC 4419 | |||
| type dhGEXSHA struct { | |||
| g, p *big.Int | |||
| hashFunc crypto.Hash | |||
| } | |||
| const numMRTests = 64 | |||
| const ( | |||
| dhGroupExchangeMinimumBits = 2048 | |||
| dhGroupExchangePreferredBits = 2048 | |||
| dhGroupExchangeMaximumBits = 8192 | |||
| ) | |||
| func (gex *dhGEXSHA) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) { | |||
| if theirPublic.Sign() <= 0 || theirPublic.Cmp(gex.p) >= 0 { | |||
| return nil, fmt.Errorf("ssh: DH parameter out of bounds") | |||
| } | |||
| return new(big.Int).Exp(theirPublic, myPrivate, gex.p), nil | |||
| } | |||
| func (gex *dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) { | |||
| // Send GexRequest | |||
| kexDHGexRequest := kexDHGexRequestMsg{ | |||
| MinBits: dhGroupExchangeMinimumBits, | |||
| PreferedBits: dhGroupExchangePreferredBits, | |||
| MaxBits: dhGroupExchangeMaximumBits, | |||
| } | |||
| if err := c.writePacket(Marshal(&kexDHGexRequest)); err != nil { | |||
| return nil, err | |||
| } | |||
| // Receive GexGroup | |||
| packet, err := c.readPacket() | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| var kexDHGexGroup kexDHGexGroupMsg | |||
| if err = Unmarshal(packet, &kexDHGexGroup); err != nil { | |||
| return nil, err | |||
| } | |||
| // reject if p's bit length < dhGroupExchangeMinimumBits or > dhGroupExchangeMaximumBits | |||
| if kexDHGexGroup.P.BitLen() < dhGroupExchangeMinimumBits || kexDHGexGroup.P.BitLen() > dhGroupExchangeMaximumBits { | |||
| return nil, fmt.Errorf("ssh: server-generated gex p is out of range (%d bits)", kexDHGexGroup.P.BitLen()) | |||
| } | |||
| gex.p = kexDHGexGroup.P | |||
| gex.g = kexDHGexGroup.G | |||
| // Check if p is safe by verifing that p and (p-1)/2 are primes | |||
| one := big.NewInt(1) | |||
| var pHalf = &big.Int{} | |||
| pHalf.Rsh(gex.p, 1) | |||
| if !gex.p.ProbablyPrime(numMRTests) || !pHalf.ProbablyPrime(numMRTests) { | |||
| return nil, fmt.Errorf("ssh: server provided gex p is not safe") | |||
| } | |||
| // Check if g is safe by verifing that g > 1 and g < p - 1 | |||
| var pMinusOne = &big.Int{} | |||
| pMinusOne.Sub(gex.p, one) | |||
| if gex.g.Cmp(one) != 1 && gex.g.Cmp(pMinusOne) != -1 { | |||
| return nil, fmt.Errorf("ssh: server provided gex g is not safe") | |||
| } | |||
| // Send GexInit | |||
| x, err := rand.Int(randSource, pHalf) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| X := new(big.Int).Exp(gex.g, x, gex.p) | |||
| kexDHGexInit := kexDHGexInitMsg{ | |||
| X: X, | |||
| } | |||
| if err := c.writePacket(Marshal(&kexDHGexInit)); err != nil { | |||
| return nil, err | |||
| } | |||
| // Receive GexReply | |||
| packet, err = c.readPacket() | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| var kexDHGexReply kexDHGexReplyMsg | |||
| if err = Unmarshal(packet, &kexDHGexReply); err != nil { | |||
| return nil, err | |||
| } | |||
| kInt, err := gex.diffieHellman(kexDHGexReply.Y, x) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| // Check if k is safe by verifing that k > 1 and k < p - 1 | |||
| if kInt.Cmp(one) != 1 && kInt.Cmp(pMinusOne) != -1 { | |||
| return nil, fmt.Errorf("ssh: derived k is not safe") | |||
| } | |||
| h := gex.hashFunc.New() | |||
| magics.write(h) | |||
| writeString(h, kexDHGexReply.HostKey) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits)) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits)) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits)) | |||
| writeInt(h, gex.p) | |||
| writeInt(h, gex.g) | |||
| writeInt(h, X) | |||
| writeInt(h, kexDHGexReply.Y) | |||
| K := make([]byte, intLength(kInt)) | |||
| marshalInt(K, kInt) | |||
| h.Write(K) | |||
| return &kexResult{ | |||
| H: h.Sum(nil), | |||
| K: K, | |||
| HostKey: kexDHGexReply.HostKey, | |||
| Signature: kexDHGexReply.Signature, | |||
| Hash: gex.hashFunc, | |||
| }, nil | |||
| } | |||
| // Server half implementation of the Diffie Hellman Key Exchange with SHA1 and SHA256. | |||
| // | |||
| // This is a minimal implementation to satisfy the automated tests. | |||
| func (gex *dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv Signer) (result *kexResult, err error) { | |||
| // Receive GexRequest | |||
| packet, err := c.readPacket() | |||
| if err != nil { | |||
| return | |||
| } | |||
| var kexDHGexRequest kexDHGexRequestMsg | |||
| if err = Unmarshal(packet, &kexDHGexRequest); err != nil { | |||
| return | |||
| } | |||
| // smoosh the user's preferred size into our own limits | |||
| if kexDHGexRequest.PreferedBits > dhGroupExchangeMaximumBits { | |||
| kexDHGexRequest.PreferedBits = dhGroupExchangeMaximumBits | |||
| } | |||
| if kexDHGexRequest.PreferedBits < dhGroupExchangeMinimumBits { | |||
| kexDHGexRequest.PreferedBits = dhGroupExchangeMinimumBits | |||
| } | |||
| // fix min/max if they're inconsistent. technically, we could just pout | |||
| // and hang up, but there's no harm in giving them the benefit of the | |||
| // doubt and just picking a bitsize for them. | |||
| if kexDHGexRequest.MinBits > kexDHGexRequest.PreferedBits { | |||
| kexDHGexRequest.MinBits = kexDHGexRequest.PreferedBits | |||
| } | |||
| if kexDHGexRequest.MaxBits < kexDHGexRequest.PreferedBits { | |||
| kexDHGexRequest.MaxBits = kexDHGexRequest.PreferedBits | |||
| } | |||
| // Send GexGroup | |||
| // This is the group called diffie-hellman-group14-sha1 in RFC | |||
| // 4253 and Oakley Group 14 in RFC 3526. | |||
| p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16) | |||
| gex.p = p | |||
| gex.g = big.NewInt(2) | |||
| kexDHGexGroup := kexDHGexGroupMsg{ | |||
| P: gex.p, | |||
| G: gex.g, | |||
| } | |||
| if err := c.writePacket(Marshal(&kexDHGexGroup)); err != nil { | |||
| return nil, err | |||
| } | |||
| // Receive GexInit | |||
| packet, err = c.readPacket() | |||
| if err != nil { | |||
| return | |||
| } | |||
| var kexDHGexInit kexDHGexInitMsg | |||
| if err = Unmarshal(packet, &kexDHGexInit); err != nil { | |||
| return | |||
| } | |||
| var pHalf = &big.Int{} | |||
| pHalf.Rsh(gex.p, 1) | |||
| y, err := rand.Int(randSource, pHalf) | |||
| if err != nil { | |||
| return | |||
| } | |||
| Y := new(big.Int).Exp(gex.g, y, gex.p) | |||
| kInt, err := gex.diffieHellman(kexDHGexInit.X, y) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| hostKeyBytes := priv.PublicKey().Marshal() | |||
| h := gex.hashFunc.New() | |||
| magics.write(h) | |||
| writeString(h, hostKeyBytes) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits)) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits)) | |||
| binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits)) | |||
| writeInt(h, gex.p) | |||
| writeInt(h, gex.g) | |||
| writeInt(h, kexDHGexInit.X) | |||
| writeInt(h, Y) | |||
| K := make([]byte, intLength(kInt)) | |||
| marshalInt(K, kInt) | |||
| h.Write(K) | |||
| H := h.Sum(nil) | |||
| // H is already a hash, but the hostkey signing will apply its | |||
| // own key-specific hash algorithm. | |||
| sig, err := signAndMarshal(priv, randSource, H) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| kexDHGexReply := kexDHGexReplyMsg{ | |||
| HostKey: hostKeyBytes, | |||
| Y: Y, | |||
| Signature: sig, | |||
| } | |||
| packet = Marshal(&kexDHGexReply) | |||
| err = c.writePacket(packet) | |||
| return &kexResult{ | |||
| H: H, | |||
| K: K, | |||
| HostKey: hostKeyBytes, | |||
| Signature: sig, | |||
| Hash: gex.hashFunc, | |||
| }, err | |||
| } | |||
| @@ -97,6 +97,36 @@ type kexDHReplyMsg struct { | |||
| Signature []byte | |||
| } | |||
| // See RFC 4419, section 5. | |||
| const msgKexDHGexGroup = 31 | |||
| type kexDHGexGroupMsg struct { | |||
| P *big.Int `sshtype:"31"` | |||
| G *big.Int | |||
| } | |||
| const msgKexDHGexInit = 32 | |||
| type kexDHGexInitMsg struct { | |||
| X *big.Int `sshtype:"32"` | |||
| } | |||
| const msgKexDHGexReply = 33 | |||
| type kexDHGexReplyMsg struct { | |||
| HostKey []byte `sshtype:"33"` | |||
| Y *big.Int | |||
| Signature []byte | |||
| } | |||
| const msgKexDHGexRequest = 34 | |||
| type kexDHGexRequestMsg struct { | |||
| MinBits uint32 `sshtype:"34"` | |||
| PreferedBits uint32 | |||
| MaxBits uint32 | |||
| } | |||
| // See RFC 4253, section 10. | |||
| const msgServiceRequest = 5 | |||
| @@ -275,6 +305,42 @@ type userAuthPubKeyOkMsg struct { | |||
| PubKey []byte | |||
| } | |||
| // See RFC 4462, section 3 | |||
| const msgUserAuthGSSAPIResponse = 60 | |||
| type userAuthGSSAPIResponse struct { | |||
| SupportMech []byte `sshtype:"60"` | |||
| } | |||
| const msgUserAuthGSSAPIToken = 61 | |||
| type userAuthGSSAPIToken struct { | |||
| Token []byte `sshtype:"61"` | |||
| } | |||
| const msgUserAuthGSSAPIMIC = 66 | |||
| type userAuthGSSAPIMIC struct { | |||
| MIC []byte `sshtype:"66"` | |||
| } | |||
| // See RFC 4462, section 3.9 | |||
| const msgUserAuthGSSAPIErrTok = 64 | |||
| type userAuthGSSAPIErrTok struct { | |||
| ErrorToken []byte `sshtype:"64"` | |||
| } | |||
| // See RFC 4462, section 3.8 | |||
| const msgUserAuthGSSAPIError = 65 | |||
| type userAuthGSSAPIError struct { | |||
| MajorStatus uint32 `sshtype:"65"` | |||
| MinorStatus uint32 | |||
| Message string | |||
| LanguageTag string | |||
| } | |||
| // typeTags returns the possible type bytes for the given reflect.Type, which | |||
| // should be a struct. The possible values are separated by a '|' character. | |||
| func typeTags(structType reflect.Type) (tags []byte) { | |||
| @@ -756,6 +822,14 @@ func decode(packet []byte) (interface{}, error) { | |||
| msg = new(channelRequestSuccessMsg) | |||
| case msgChannelFailure: | |||
| msg = new(channelRequestFailureMsg) | |||
| case msgUserAuthGSSAPIToken: | |||
| msg = new(userAuthGSSAPIToken) | |||
| case msgUserAuthGSSAPIMIC: | |||
| msg = new(userAuthGSSAPIMIC) | |||
| case msgUserAuthGSSAPIErrTok: | |||
| msg = new(userAuthGSSAPIErrTok) | |||
| case msgUserAuthGSSAPIError: | |||
| msg = new(userAuthGSSAPIError) | |||
| default: | |||
| return nil, unexpectedMessageError(0, packet[0]) | |||
| } | |||
| @@ -45,6 +45,20 @@ type Permissions struct { | |||
| Extensions map[string]string | |||
| } | |||
| type GSSAPIWithMICConfig struct { | |||
| // AllowLogin, must be set, is called when gssapi-with-mic | |||
| // authentication is selected (RFC 4462 section 3). The srcName is from the | |||
| // results of the GSS-API authentication. The format is username@DOMAIN. | |||
| // GSSAPI just guarantees to the server who the user is, but not if they can log in, and with what permissions. | |||
| // This callback is called after the user identity is established with GSSAPI to decide if the user can login with | |||
| // which permissions. If the user is allowed to login, it should return a nil error. | |||
| AllowLogin func(conn ConnMetadata, srcName string) (*Permissions, error) | |||
| // Server must be set. It's the implementation | |||
| // of the GSSAPIServer interface. See GSSAPIServer interface for details. | |||
| Server GSSAPIServer | |||
| } | |||
| // ServerConfig holds server specific configuration data. | |||
| type ServerConfig struct { | |||
| // Config contains configuration shared between client and server. | |||
| @@ -99,6 +113,10 @@ type ServerConfig struct { | |||
| // BannerCallback, if present, is called and the return string is sent to | |||
| // the client after key exchange completed but before authentication. | |||
| BannerCallback func(conn ConnMetadata) string | |||
| // GSSAPIWithMICConfig includes gssapi server and callback, which if both non-nil, is used | |||
| // when gssapi-with-mic authentication is selected (RFC 4462 section 3). | |||
| GSSAPIWithMICConfig *GSSAPIWithMICConfig | |||
| } | |||
| // AddHostKey adds a private key as a host key. If an existing host | |||
| @@ -175,6 +193,12 @@ func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewCha | |||
| if fullConf.MaxAuthTries == 0 { | |||
| fullConf.MaxAuthTries = 6 | |||
| } | |||
| // Check if the config contains any unsupported key exchanges | |||
| for _, kex := range fullConf.KeyExchanges { | |||
| if _, ok := serverForbiddenKexAlgos[kex]; ok { | |||
| return nil, nil, nil, fmt.Errorf("ssh: unsupported key exchange %s for server", kex) | |||
| } | |||
| } | |||
| s := &connection{ | |||
| sshConn: sshConn{conn: c}, | |||
| @@ -204,7 +228,9 @@ func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) | |||
| return nil, errors.New("ssh: server has no host keys") | |||
| } | |||
| if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil { | |||
| if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil && | |||
| config.KeyboardInteractiveCallback == nil && (config.GSSAPIWithMICConfig == nil || | |||
| config.GSSAPIWithMICConfig.AllowLogin == nil || config.GSSAPIWithMICConfig.Server == nil) { | |||
| return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false") | |||
| } | |||
| @@ -295,6 +321,55 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error { | |||
| return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr) | |||
| } | |||
| func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *connection, | |||
| sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) { | |||
| gssAPIServer := gssapiConfig.Server | |||
| defer gssAPIServer.DeleteSecContext() | |||
| var srcName string | |||
| for { | |||
| var ( | |||
| outToken []byte | |||
| needContinue bool | |||
| ) | |||
| outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(firstToken) | |||
| if err != nil { | |||
| return err, nil, nil | |||
| } | |||
| if len(outToken) != 0 { | |||
| if err := s.transport.writePacket(Marshal(&userAuthGSSAPIToken{ | |||
| Token: outToken, | |||
| })); err != nil { | |||
| return nil, nil, err | |||
| } | |||
| } | |||
| if !needContinue { | |||
| break | |||
| } | |||
| packet, err := s.transport.readPacket() | |||
| if err != nil { | |||
| return nil, nil, err | |||
| } | |||
| userAuthGSSAPITokenReq := &userAuthGSSAPIToken{} | |||
| if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil { | |||
| return nil, nil, err | |||
| } | |||
| } | |||
| packet, err := s.transport.readPacket() | |||
| if err != nil { | |||
| return nil, nil, err | |||
| } | |||
| userAuthGSSAPIMICReq := &userAuthGSSAPIMIC{} | |||
| if err := Unmarshal(packet, userAuthGSSAPIMICReq); err != nil { | |||
| return nil, nil, err | |||
| } | |||
| mic := buildMIC(string(sessionID), userAuthReq.User, userAuthReq.Service, userAuthReq.Method) | |||
| if err := gssAPIServer.VerifyMIC(mic, userAuthGSSAPIMICReq.MIC); err != nil { | |||
| return err, nil, nil | |||
| } | |||
| perms, authErr = gssapiConfig.AllowLogin(s, srcName) | |||
| return authErr, perms, nil | |||
| } | |||
| // ServerAuthError represents server authentication errors and is | |||
| // sometimes returned by NewServerConn. It appends any authentication | |||
| // errors that may occur, and is returned if all of the authentication | |||
| @@ -496,6 +571,49 @@ userAuthLoop: | |||
| authErr = candidate.result | |||
| perms = candidate.perms | |||
| } | |||
| case "gssapi-with-mic": | |||
| gssapiConfig := config.GSSAPIWithMICConfig | |||
| userAuthRequestGSSAPI, err := parseGSSAPIPayload(userAuthReq.Payload) | |||
| if err != nil { | |||
| return nil, parseError(msgUserAuthRequest) | |||
| } | |||
| // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication. | |||
| if userAuthRequestGSSAPI.N == 0 { | |||
| authErr = fmt.Errorf("ssh: Mechanism negotiation is not supported") | |||
| break | |||
| } | |||
| var i uint32 | |||
| present := false | |||
| for i = 0; i < userAuthRequestGSSAPI.N; i++ { | |||
| if userAuthRequestGSSAPI.OIDS[i].Equal(krb5Mesh) { | |||
| present = true | |||
| break | |||
| } | |||
| } | |||
| if !present { | |||
| authErr = fmt.Errorf("ssh: GSSAPI authentication must use the Kerberos V5 mechanism") | |||
| break | |||
| } | |||
| // Initial server response, see RFC 4462 section 3.3. | |||
| if err := s.transport.writePacket(Marshal(&userAuthGSSAPIResponse{ | |||
| SupportMech: krb5OID, | |||
| })); err != nil { | |||
| return nil, err | |||
| } | |||
| // Exchange token, see RFC 4462 section 3.4. | |||
| packet, err := s.transport.readPacket() | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| userAuthGSSAPITokenReq := &userAuthGSSAPIToken{} | |||
| if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil { | |||
| return nil, err | |||
| } | |||
| authErr, perms, err = gssExchangeToken(gssapiConfig, userAuthGSSAPITokenReq.Token, s, sessionID, | |||
| userAuthReq) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| default: | |||
| authErr = fmt.Errorf("ssh: unknown method %q", userAuthReq.Method) | |||
| } | |||
| @@ -522,6 +640,10 @@ userAuthLoop: | |||
| if config.KeyboardInteractiveCallback != nil { | |||
| failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive") | |||
| } | |||
| if config.GSSAPIWithMICConfig != nil && config.GSSAPIWithMICConfig.Server != nil && | |||
| config.GSSAPIWithMICConfig.AllowLogin != nil { | |||
| failureMsg.Methods = append(failureMsg.Methods, "gssapi-with-mic") | |||
| } | |||
| if len(failureMsg.Methods) == 0 { | |||
| return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false") | |||
| @@ -0,0 +1,139 @@ | |||
| // Copyright 2011 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package ssh | |||
| import ( | |||
| "encoding/asn1" | |||
| "errors" | |||
| ) | |||
| var krb5OID []byte | |||
| func init() { | |||
| krb5OID, _ = asn1.Marshal(krb5Mesh) | |||
| } | |||
| // GSSAPIClient provides the API to plug-in GSSAPI authentication for client logins. | |||
| type GSSAPIClient interface { | |||
| // InitSecContext initiates the establishment of a security context for GSS-API between the | |||
| // ssh client and ssh server. Initially the token parameter should be specified as nil. | |||
| // The routine may return a outputToken which should be transferred to | |||
| // the ssh server, where the ssh server will present it to | |||
| // AcceptSecContext. If no token need be sent, InitSecContext will indicate this by setting | |||
| // needContinue to false. To complete the context | |||
| // establishment, one or more reply tokens may be required from the ssh | |||
| // server;if so, InitSecContext will return a needContinue which is true. | |||
| // In this case, InitSecContext should be called again when the | |||
| // reply token is received from the ssh server, passing the reply | |||
| // token to InitSecContext via the token parameters. | |||
| // See RFC 2743 section 2.2.1 and RFC 4462 section 3.4. | |||
| InitSecContext(target string, token []byte, isGSSDelegCreds bool) (outputToken []byte, needContinue bool, err error) | |||
| // GetMIC generates a cryptographic MIC for the SSH2 message, and places | |||
| // the MIC in a token for transfer to the ssh server. | |||
| // The contents of the MIC field are obtained by calling GSS_GetMIC() | |||
| // over the following, using the GSS-API context that was just | |||
| // established: | |||
| // string session identifier | |||
| // byte SSH_MSG_USERAUTH_REQUEST | |||
| // string user name | |||
| // string service | |||
| // string "gssapi-with-mic" | |||
| // See RFC 2743 section 2.3.1 and RFC 4462 3.5. | |||
| GetMIC(micFiled []byte) ([]byte, error) | |||
| // Whenever possible, it should be possible for | |||
| // DeleteSecContext() calls to be successfully processed even | |||
| // if other calls cannot succeed, thereby enabling context-related | |||
| // resources to be released. | |||
| // In addition to deleting established security contexts, | |||
| // gss_delete_sec_context must also be able to delete "half-built" | |||
| // security contexts resulting from an incomplete sequence of | |||
| // InitSecContext()/AcceptSecContext() calls. | |||
| // See RFC 2743 section 2.2.3. | |||
| DeleteSecContext() error | |||
| } | |||
| // GSSAPIServer provides the API to plug in GSSAPI authentication for server logins. | |||
| type GSSAPIServer interface { | |||
| // AcceptSecContext allows a remotely initiated security context between the application | |||
| // and a remote peer to be established by the ssh client. The routine may return a | |||
| // outputToken which should be transferred to the ssh client, | |||
| // where the ssh client will present it to InitSecContext. | |||
| // If no token need be sent, AcceptSecContext will indicate this | |||
| // by setting the needContinue to false. To | |||
| // complete the context establishment, one or more reply tokens may be | |||
| // required from the ssh client. if so, AcceptSecContext | |||
| // will return a needContinue which is true, in which case it | |||
| // should be called again when the reply token is received from the ssh | |||
| // client, passing the token to AcceptSecContext via the | |||
| // token parameters. | |||
| // The srcName return value is the authenticated username. | |||
| // See RFC 2743 section 2.2.2 and RFC 4462 section 3.4. | |||
| AcceptSecContext(token []byte) (outputToken []byte, srcName string, needContinue bool, err error) | |||
| // VerifyMIC verifies that a cryptographic MIC, contained in the token parameter, | |||
| // fits the supplied message is received from the ssh client. | |||
| // See RFC 2743 section 2.3.2. | |||
| VerifyMIC(micField []byte, micToken []byte) error | |||
| // Whenever possible, it should be possible for | |||
| // DeleteSecContext() calls to be successfully processed even | |||
| // if other calls cannot succeed, thereby enabling context-related | |||
| // resources to be released. | |||
| // In addition to deleting established security contexts, | |||
| // gss_delete_sec_context must also be able to delete "half-built" | |||
| // security contexts resulting from an incomplete sequence of | |||
| // InitSecContext()/AcceptSecContext() calls. | |||
| // See RFC 2743 section 2.2.3. | |||
| DeleteSecContext() error | |||
| } | |||
| var ( | |||
| // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication, | |||
| // so we also support the krb5 mechanism only. | |||
| // See RFC 1964 section 1. | |||
| krb5Mesh = asn1.ObjectIdentifier{1, 2, 840, 113554, 1, 2, 2} | |||
| ) | |||
| // The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST | |||
| // See RFC 4462 section 3.2. | |||
| type userAuthRequestGSSAPI struct { | |||
| N uint32 | |||
| OIDS []asn1.ObjectIdentifier | |||
| } | |||
| func parseGSSAPIPayload(payload []byte) (*userAuthRequestGSSAPI, error) { | |||
| n, rest, ok := parseUint32(payload) | |||
| if !ok { | |||
| return nil, errors.New("parse uint32 failed") | |||
| } | |||
| s := &userAuthRequestGSSAPI{ | |||
| N: n, | |||
| OIDS: make([]asn1.ObjectIdentifier, n), | |||
| } | |||
| for i := 0; i < int(n); i++ { | |||
| var ( | |||
| desiredMech []byte | |||
| err error | |||
| ) | |||
| desiredMech, rest, ok = parseString(rest) | |||
| if !ok { | |||
| return nil, errors.New("parse string failed") | |||
| } | |||
| if rest, err = asn1.Unmarshal(desiredMech, &s.OIDS[i]); err != nil { | |||
| return nil, err | |||
| } | |||
| } | |||
| return s, nil | |||
| } | |||
| // See RFC 4462 section 3.6. | |||
| func buildMIC(sessionID string, username string, service string, authMethod string) []byte { | |||
| out := make([]byte, 0, 0) | |||
| out = appendString(out, sessionID) | |||
| out = append(out, msgUserAuthRequest) | |||
| out = appendString(out, username) | |||
| out = appendString(out, service) | |||
| out = appendString(out, authMethod) | |||
| return out | |||
| } | |||
| @@ -2,18 +2,15 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build go1.7 | |||
| // Package ctxhttp provides helper functions for performing context-aware HTTP requests. | |||
| package ctxhttp // import "golang.org/x/net/context/ctxhttp" | |||
| import ( | |||
| "context" | |||
| "io" | |||
| "net/http" | |||
| "net/url" | |||
| "strings" | |||
| "golang.org/x/net/context" | |||
| ) | |||
| // Do sends an HTTP request with the provided http.Client and returns | |||
| @@ -1,147 +0,0 @@ | |||
| // Copyright 2015 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !go1.7 | |||
| package ctxhttp // import "golang.org/x/net/context/ctxhttp" | |||
| import ( | |||
| "io" | |||
| "net/http" | |||
| "net/url" | |||
| "strings" | |||
| "golang.org/x/net/context" | |||
| ) | |||
| func nop() {} | |||
| var ( | |||
| testHookContextDoneBeforeHeaders = nop | |||
| testHookDoReturned = nop | |||
| testHookDidBodyClose = nop | |||
| ) | |||
| // Do sends an HTTP request with the provided http.Client and returns an HTTP response. | |||
| // If the client is nil, http.DefaultClient is used. | |||
| // If the context is canceled or times out, ctx.Err() will be returned. | |||
| func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) { | |||
| if client == nil { | |||
| client = http.DefaultClient | |||
| } | |||
| // TODO(djd): Respect any existing value of req.Cancel. | |||
| cancel := make(chan struct{}) | |||
| req.Cancel = cancel | |||
| type responseAndError struct { | |||
| resp *http.Response | |||
| err error | |||
| } | |||
| result := make(chan responseAndError, 1) | |||
| // Make local copies of test hooks closed over by goroutines below. | |||
| // Prevents data races in tests. | |||
| testHookDoReturned := testHookDoReturned | |||
| testHookDidBodyClose := testHookDidBodyClose | |||
| go func() { | |||
| resp, err := client.Do(req) | |||
| testHookDoReturned() | |||
| result <- responseAndError{resp, err} | |||
| }() | |||
| var resp *http.Response | |||
| select { | |||
| case <-ctx.Done(): | |||
| testHookContextDoneBeforeHeaders() | |||
| close(cancel) | |||
| // Clean up after the goroutine calling client.Do: | |||
| go func() { | |||
| if r := <-result; r.resp != nil { | |||
| testHookDidBodyClose() | |||
| r.resp.Body.Close() | |||
| } | |||
| }() | |||
| return nil, ctx.Err() | |||
| case r := <-result: | |||
| var err error | |||
| resp, err = r.resp, r.err | |||
| if err != nil { | |||
| return resp, err | |||
| } | |||
| } | |||
| c := make(chan struct{}) | |||
| go func() { | |||
| select { | |||
| case <-ctx.Done(): | |||
| close(cancel) | |||
| case <-c: | |||
| // The response's Body is closed. | |||
| } | |||
| }() | |||
| resp.Body = ¬ifyingReader{resp.Body, c} | |||
| return resp, nil | |||
| } | |||
| // Get issues a GET request via the Do function. | |||
| func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) { | |||
| req, err := http.NewRequest("GET", url, nil) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return Do(ctx, client, req) | |||
| } | |||
| // Head issues a HEAD request via the Do function. | |||
| func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) { | |||
| req, err := http.NewRequest("HEAD", url, nil) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return Do(ctx, client, req) | |||
| } | |||
| // Post issues a POST request via the Do function. | |||
| func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) { | |||
| req, err := http.NewRequest("POST", url, body) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| req.Header.Set("Content-Type", bodyType) | |||
| return Do(ctx, client, req) | |||
| } | |||
| // PostForm issues a POST request via the Do function. | |||
| func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) { | |||
| return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode())) | |||
| } | |||
| // notifyingReader is an io.ReadCloser that closes the notify channel after | |||
| // Close is called or a Read fails on the underlying ReadCloser. | |||
| type notifyingReader struct { | |||
| io.ReadCloser | |||
| notify chan<- struct{} | |||
| } | |||
| func (r *notifyingReader) Read(p []byte) (int, error) { | |||
| n, err := r.ReadCloser.Read(p) | |||
| if err != nil && r.notify != nil { | |||
| close(r.notify) | |||
| r.notify = nil | |||
| } | |||
| return n, err | |||
| } | |||
| func (r *notifyingReader) Close() error { | |||
| err := r.ReadCloser.Close() | |||
| if r.notify != nil { | |||
| close(r.notify) | |||
| r.notify = nil | |||
| } | |||
| return err | |||
| } | |||
| @@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int { | |||
| // contains returns whether a is within s. | |||
| func (s *nodeStack) contains(a atom.Atom) bool { | |||
| for _, n := range *s { | |||
| if n.DataAtom == a { | |||
| if n.DataAtom == a && n.Namespace == "" { | |||
| return true | |||
| } | |||
| } | |||
| @@ -439,9 +439,6 @@ func (p *parser) resetInsertionMode() { | |||
| case a.Select: | |||
| if !last { | |||
| for ancestor, first := n, p.oe[0]; ancestor != first; { | |||
| if ancestor == first { | |||
| break | |||
| } | |||
| ancestor = p.oe[p.oe.index(ancestor)-1] | |||
| switch ancestor.DataAtom { | |||
| case a.Template: | |||
| @@ -633,7 +630,16 @@ func inHeadIM(p *parser) bool { | |||
| p.oe.pop() | |||
| p.acknowledgeSelfClosingTag() | |||
| return true | |||
| case a.Script, a.Title, a.Noscript, a.Noframes, a.Style: | |||
| case a.Noscript: | |||
| p.addElement() | |||
| if p.scripting { | |||
| p.setOriginalIM() | |||
| p.im = textIM | |||
| } else { | |||
| p.im = inHeadNoscriptIM | |||
| } | |||
| return true | |||
| case a.Script, a.Title, a.Noframes, a.Style: | |||
| p.addElement() | |||
| p.setOriginalIM() | |||
| p.im = textIM | |||
| @@ -695,6 +701,49 @@ func inHeadIM(p *parser) bool { | |||
| return false | |||
| } | |||
| // 12.2.6.4.5. | |||
| func inHeadNoscriptIM(p *parser) bool { | |||
| switch p.tok.Type { | |||
| case DoctypeToken: | |||
| // Ignore the token. | |||
| return true | |||
| case StartTagToken: | |||
| switch p.tok.DataAtom { | |||
| case a.Html: | |||
| return inBodyIM(p) | |||
| case a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Style: | |||
| return inHeadIM(p) | |||
| case a.Head, a.Noscript: | |||
| // Ignore the token. | |||
| return true | |||
| } | |||
| case EndTagToken: | |||
| switch p.tok.DataAtom { | |||
| case a.Noscript, a.Br: | |||
| default: | |||
| // Ignore the token. | |||
| return true | |||
| } | |||
| case TextToken: | |||
| s := strings.TrimLeft(p.tok.Data, whitespace) | |||
| if len(s) == 0 { | |||
| // It was all whitespace. | |||
| return inHeadIM(p) | |||
| } | |||
| case CommentToken: | |||
| return inHeadIM(p) | |||
| } | |||
| p.oe.pop() | |||
| if p.top().DataAtom != a.Head { | |||
| panic("html: the new current node will be a head element.") | |||
| } | |||
| p.im = inHeadIM | |||
| if p.tok.DataAtom == a.Noscript { | |||
| return true | |||
| } | |||
| return false | |||
| } | |||
| // Section 12.2.6.4.6. | |||
| func afterHeadIM(p *parser) bool { | |||
| switch p.tok.Type { | |||
| @@ -904,7 +953,7 @@ func inBodyIM(p *parser) bool { | |||
| case a.A: | |||
| for i := len(p.afe) - 1; i >= 0 && p.afe[i].Type != scopeMarkerNode; i-- { | |||
| if n := p.afe[i]; n.Type == ElementNode && n.DataAtom == a.A { | |||
| p.inBodyEndTagFormatting(a.A) | |||
| p.inBodyEndTagFormatting(a.A, "a") | |||
| p.oe.remove(n) | |||
| p.afe.remove(n) | |||
| break | |||
| @@ -918,7 +967,7 @@ func inBodyIM(p *parser) bool { | |||
| case a.Nobr: | |||
| p.reconstructActiveFormattingElements() | |||
| if p.elementInScope(defaultScope, a.Nobr) { | |||
| p.inBodyEndTagFormatting(a.Nobr) | |||
| p.inBodyEndTagFormatting(a.Nobr, "nobr") | |||
| p.reconstructActiveFormattingElements() | |||
| } | |||
| p.addFormattingElement() | |||
| @@ -1126,7 +1175,7 @@ func inBodyIM(p *parser) bool { | |||
| case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: | |||
| p.popUntil(defaultScope, a.H1, a.H2, a.H3, a.H4, a.H5, a.H6) | |||
| case a.A, a.B, a.Big, a.Code, a.Em, a.Font, a.I, a.Nobr, a.S, a.Small, a.Strike, a.Strong, a.Tt, a.U: | |||
| p.inBodyEndTagFormatting(p.tok.DataAtom) | |||
| p.inBodyEndTagFormatting(p.tok.DataAtom, p.tok.Data) | |||
| case a.Applet, a.Marquee, a.Object: | |||
| if p.popUntil(defaultScope, p.tok.DataAtom) { | |||
| p.clearActiveFormattingElements() | |||
| @@ -1137,7 +1186,7 @@ func inBodyIM(p *parser) bool { | |||
| case a.Template: | |||
| return inHeadIM(p) | |||
| default: | |||
| p.inBodyEndTagOther(p.tok.DataAtom) | |||
| p.inBodyEndTagOther(p.tok.DataAtom, p.tok.Data) | |||
| } | |||
| case CommentToken: | |||
| p.addChild(&Node{ | |||
| @@ -1164,7 +1213,7 @@ func inBodyIM(p *parser) bool { | |||
| return true | |||
| } | |||
| func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { | |||
| func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom, tagName string) { | |||
| // This is the "adoption agency" algorithm, described at | |||
| // https://html.spec.whatwg.org/multipage/syntax.html#adoptionAgency | |||
| @@ -1186,7 +1235,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { | |||
| } | |||
| } | |||
| if formattingElement == nil { | |||
| p.inBodyEndTagOther(tagAtom) | |||
| p.inBodyEndTagOther(tagAtom, tagName) | |||
| return | |||
| } | |||
| feIndex := p.oe.index(formattingElement) | |||
| @@ -1291,9 +1340,17 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { | |||
| // inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM. | |||
| // "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content | |||
| // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign | |||
| func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { | |||
| func (p *parser) inBodyEndTagOther(tagAtom a.Atom, tagName string) { | |||
| for i := len(p.oe) - 1; i >= 0; i-- { | |||
| if p.oe[i].DataAtom == tagAtom { | |||
| // Two element nodes have the same tag if they have the same Data (a | |||
| // string-typed field). As an optimization, for common HTML tags, each | |||
| // Data string is assigned a unique, non-zero DataAtom (a uint32-typed | |||
| // field), since integer comparison is faster than string comparison. | |||
| // Uncommon (custom) tags get a zero DataAtom. | |||
| // | |||
| // The if condition here is equivalent to (p.oe[i].Data == tagName). | |||
| if (p.oe[i].DataAtom == tagAtom) && | |||
| ((tagAtom != 0) || (p.oe[i].Data == tagName)) { | |||
| p.oe = p.oe[:i] | |||
| break | |||
| } | |||
| @@ -1687,8 +1744,9 @@ func inCellIM(p *parser) bool { | |||
| return true | |||
| } | |||
| // Close the cell and reprocess. | |||
| p.popUntil(tableScope, a.Td, a.Th) | |||
| p.clearActiveFormattingElements() | |||
| if p.popUntil(tableScope, a.Td, a.Th) { | |||
| p.clearActiveFormattingElements() | |||
| } | |||
| p.im = inRowIM | |||
| return false | |||
| } | |||
| @@ -1719,8 +1777,12 @@ func inSelectIM(p *parser) bool { | |||
| } | |||
| p.addElement() | |||
| case a.Select: | |||
| p.tok.Type = EndTagToken | |||
| return false | |||
| if p.popUntil(selectScope, a.Select) { | |||
| p.resetInsertionMode() | |||
| } else { | |||
| // Ignore the token. | |||
| return true | |||
| } | |||
| case a.Input, a.Keygen, a.Textarea: | |||
| if p.elementInScope(selectScope, a.Select) { | |||
| p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) | |||
| @@ -1750,6 +1812,9 @@ func inSelectIM(p *parser) bool { | |||
| case a.Select: | |||
| if p.popUntil(selectScope, a.Select) { | |||
| p.resetInsertionMode() | |||
| } else { | |||
| // Ignore the token. | |||
| return true | |||
| } | |||
| case a.Template: | |||
| return inHeadIM(p) | |||
| @@ -1775,13 +1840,22 @@ func inSelectInTableIM(p *parser) bool { | |||
| case StartTagToken, EndTagToken: | |||
| switch p.tok.DataAtom { | |||
| case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th: | |||
| if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) { | |||
| p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) | |||
| return false | |||
| } else { | |||
| if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) { | |||
| // Ignore the token. | |||
| return true | |||
| } | |||
| // This is like p.popUntil(selectScope, a.Select), but it also | |||
| // matches <math select>, not just <select>. Matching the MathML | |||
| // tag is arguably incorrect (conceptually), but it mimics what | |||
| // Chromium does. | |||
| for i := len(p.oe) - 1; i >= 0; i-- { | |||
| if n := p.oe[i]; n.DataAtom == a.Select { | |||
| p.oe = p.oe[:i] | |||
| break | |||
| } | |||
| } | |||
| p.resetInsertionMode() | |||
| return false | |||
| } | |||
| } | |||
| return inSelectIM(p) | |||
| @@ -2226,6 +2300,33 @@ func (p *parser) parse() error { | |||
| // | |||
| // The input is assumed to be UTF-8 encoded. | |||
| func Parse(r io.Reader) (*Node, error) { | |||
| return ParseWithOptions(r) | |||
| } | |||
| // ParseFragment parses a fragment of HTML and returns the nodes that were | |||
| // found. If the fragment is the InnerHTML for an existing element, pass that | |||
| // element in context. | |||
| // | |||
| // It has the same intricacies as Parse. | |||
| func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { | |||
| return ParseFragmentWithOptions(r, context) | |||
| } | |||
| // ParseOption configures a parser. | |||
| type ParseOption func(p *parser) | |||
| // ParseOptionEnableScripting configures the scripting flag. | |||
| // https://html.spec.whatwg.org/multipage/webappapis.html#enabling-and-disabling-scripting | |||
| // | |||
| // By default, scripting is enabled. | |||
| func ParseOptionEnableScripting(enable bool) ParseOption { | |||
| return func(p *parser) { | |||
| p.scripting = enable | |||
| } | |||
| } | |||
| // ParseWithOptions is like Parse, with options. | |||
| func ParseWithOptions(r io.Reader, opts ...ParseOption) (*Node, error) { | |||
| p := &parser{ | |||
| tokenizer: NewTokenizer(r), | |||
| doc: &Node{ | |||
| @@ -2235,6 +2336,11 @@ func Parse(r io.Reader) (*Node, error) { | |||
| framesetOK: true, | |||
| im: initialIM, | |||
| } | |||
| for _, f := range opts { | |||
| f(p) | |||
| } | |||
| err := p.parse() | |||
| if err != nil { | |||
| return nil, err | |||
| @@ -2242,12 +2348,8 @@ func Parse(r io.Reader) (*Node, error) { | |||
| return p.doc, nil | |||
| } | |||
| // ParseFragment parses a fragment of HTML and returns the nodes that were | |||
| // found. If the fragment is the InnerHTML for an existing element, pass that | |||
| // element in context. | |||
| // | |||
| // It has the same intricacies as Parse. | |||
| func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { | |||
| // ParseFragmentWithOptions is like ParseFragment, with options. | |||
| func ParseFragmentWithOptions(r io.Reader, context *Node, opts ...ParseOption) ([]*Node, error) { | |||
| contextTag := "" | |||
| if context != nil { | |||
| if context.Type != ElementNode { | |||
| @@ -2271,6 +2373,10 @@ func ParseFragment(r io.Reader, context *Node) ([]*Node, error) { | |||
| context: context, | |||
| } | |||
| for _, f := range opts { | |||
| f(p) | |||
| } | |||
| root := &Node{ | |||
| Type: ElementNode, | |||
| DataAtom: a.Html, | |||
| @@ -0,0 +1,734 @@ | |||
| // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. | |||
| // Copyright 2016 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build go1.10 | |||
| // Package idna implements IDNA2008 using the compatibility processing | |||
| // defined by UTS (Unicode Technical Standard) #46, which defines a standard to | |||
| // deal with the transition from IDNA2003. | |||
| // | |||
| // IDNA2008 (Internationalized Domain Names for Applications), is defined in RFC | |||
| // 5890, RFC 5891, RFC 5892, RFC 5893 and RFC 5894. | |||
| // UTS #46 is defined in https://www.unicode.org/reports/tr46. | |||
| // See https://unicode.org/cldr/utility/idna.jsp for a visualization of the | |||
| // differences between these two standards. | |||
| package idna // import "golang.org/x/net/idna" | |||
| import ( | |||
| "fmt" | |||
| "strings" | |||
| "unicode/utf8" | |||
| "golang.org/x/text/secure/bidirule" | |||
| "golang.org/x/text/unicode/bidi" | |||
| "golang.org/x/text/unicode/norm" | |||
| ) | |||
| // NOTE: Unlike common practice in Go APIs, the functions will return a | |||
| // sanitized domain name in case of errors. Browsers sometimes use a partially | |||
| // evaluated string as lookup. | |||
| // TODO: the current error handling is, in my opinion, the least opinionated. | |||
| // Other strategies are also viable, though: | |||
| // Option 1) Return an empty string in case of error, but allow the user to | |||
| // specify explicitly which errors to ignore. | |||
| // Option 2) Return the partially evaluated string if it is itself a valid | |||
| // string, otherwise return the empty string in case of error. | |||
| // Option 3) Option 1 and 2. | |||
| // Option 4) Always return an empty string for now and implement Option 1 as | |||
| // needed, and document that the return string may not be empty in case of | |||
| // error in the future. | |||
| // I think Option 1 is best, but it is quite opinionated. | |||
| // ToASCII is a wrapper for Punycode.ToASCII. | |||
| func ToASCII(s string) (string, error) { | |||
| return Punycode.process(s, true) | |||
| } | |||
| // ToUnicode is a wrapper for Punycode.ToUnicode. | |||
| func ToUnicode(s string) (string, error) { | |||
| return Punycode.process(s, false) | |||
| } | |||
| // An Option configures a Profile at creation time. | |||
| type Option func(*options) | |||
| // Transitional sets a Profile to use the Transitional mapping as defined in UTS | |||
| // #46. This will cause, for example, "ß" to be mapped to "ss". Using the | |||
| // transitional mapping provides a compromise between IDNA2003 and IDNA2008 | |||
| // compatibility. It is used by most browsers when resolving domain names. This | |||
| // option is only meaningful if combined with MapForLookup. | |||
| func Transitional(transitional bool) Option { | |||
| return func(o *options) { o.transitional = true } | |||
| } | |||
| // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts | |||
| // are longer than allowed by the RFC. | |||
| func VerifyDNSLength(verify bool) Option { | |||
| return func(o *options) { o.verifyDNSLength = verify } | |||
| } | |||
| // RemoveLeadingDots removes leading label separators. Leading runes that map to | |||
| // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. | |||
| // | |||
| // This is the behavior suggested by the UTS #46 and is adopted by some | |||
| // browsers. | |||
| func RemoveLeadingDots(remove bool) Option { | |||
| return func(o *options) { o.removeLeadingDots = remove } | |||
| } | |||
| // ValidateLabels sets whether to check the mandatory label validation criteria | |||
| // as defined in Section 5.4 of RFC 5891. This includes testing for correct use | |||
| // of hyphens ('-'), normalization, validity of runes, and the context rules. | |||
| func ValidateLabels(enable bool) Option { | |||
| return func(o *options) { | |||
| // Don't override existing mappings, but set one that at least checks | |||
| // normalization if it is not set. | |||
| if o.mapping == nil && enable { | |||
| o.mapping = normalize | |||
| } | |||
| o.trie = trie | |||
| o.validateLabels = enable | |||
| o.fromPuny = validateFromPunycode | |||
| } | |||
| } | |||
| // StrictDomainName limits the set of permissible ASCII characters to those | |||
| // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the | |||
| // hyphen). This is set by default for MapForLookup and ValidateForRegistration. | |||
| // | |||
| // This option is useful, for instance, for browsers that allow characters | |||
| // outside this range, for example a '_' (U+005F LOW LINE). See | |||
| // http://www.rfc-editor.org/std/std3.txt for more details This option | |||
| // corresponds to the UseSTD3ASCIIRules option in UTS #46. | |||
| func StrictDomainName(use bool) Option { | |||
| return func(o *options) { | |||
| o.trie = trie | |||
| o.useSTD3Rules = use | |||
| o.fromPuny = validateFromPunycode | |||
| } | |||
| } | |||
| // NOTE: the following options pull in tables. The tables should not be linked | |||
| // in as long as the options are not used. | |||
| // BidiRule enables the Bidi rule as defined in RFC 5893. Any application | |||
| // that relies on proper validation of labels should include this rule. | |||
| func BidiRule() Option { | |||
| return func(o *options) { o.bidirule = bidirule.ValidString } | |||
| } | |||
| // ValidateForRegistration sets validation options to verify that a given IDN is | |||
| // properly formatted for registration as defined by Section 4 of RFC 5891. | |||
| func ValidateForRegistration() Option { | |||
| return func(o *options) { | |||
| o.mapping = validateRegistration | |||
| StrictDomainName(true)(o) | |||
| ValidateLabels(true)(o) | |||
| VerifyDNSLength(true)(o) | |||
| BidiRule()(o) | |||
| } | |||
| } | |||
| // MapForLookup sets validation and mapping options such that a given IDN is | |||
| // transformed for domain name lookup according to the requirements set out in | |||
| // Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, | |||
| // RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option | |||
| // to add this check. | |||
| // | |||
| // The mappings include normalization and mapping case, width and other | |||
| // compatibility mappings. | |||
| func MapForLookup() Option { | |||
| return func(o *options) { | |||
| o.mapping = validateAndMap | |||
| StrictDomainName(true)(o) | |||
| ValidateLabels(true)(o) | |||
| } | |||
| } | |||
| type options struct { | |||
| transitional bool | |||
| useSTD3Rules bool | |||
| validateLabels bool | |||
| verifyDNSLength bool | |||
| removeLeadingDots bool | |||
| trie *idnaTrie | |||
| // fromPuny calls validation rules when converting A-labels to U-labels. | |||
| fromPuny func(p *Profile, s string) error | |||
| // mapping implements a validation and mapping step as defined in RFC 5895 | |||
| // or UTS 46, tailored to, for example, domain registration or lookup. | |||
| mapping func(p *Profile, s string) (mapped string, isBidi bool, err error) | |||
| // bidirule, if specified, checks whether s conforms to the Bidi Rule | |||
| // defined in RFC 5893. | |||
| bidirule func(s string) bool | |||
| } | |||
| // A Profile defines the configuration of an IDNA mapper. | |||
| type Profile struct { | |||
| options | |||
| } | |||
| func apply(o *options, opts []Option) { | |||
| for _, f := range opts { | |||
| f(o) | |||
| } | |||
| } | |||
| // New creates a new Profile. | |||
| // | |||
| // With no options, the returned Profile is the most permissive and equals the | |||
| // Punycode Profile. Options can be passed to further restrict the Profile. The | |||
| // MapForLookup and ValidateForRegistration options set a collection of options, | |||
| // for lookup and registration purposes respectively, which can be tailored by | |||
| // adding more fine-grained options, where later options override earlier | |||
| // options. | |||
| func New(o ...Option) *Profile { | |||
| p := &Profile{} | |||
| apply(&p.options, o) | |||
| return p | |||
| } | |||
| // ToASCII converts a domain or domain label to its ASCII form. For example, | |||
| // ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and | |||
| // ToASCII("golang") is "golang". If an error is encountered it will return | |||
| // an error and a (partially) processed result. | |||
| func (p *Profile) ToASCII(s string) (string, error) { | |||
| return p.process(s, true) | |||
| } | |||
| // ToUnicode converts a domain or domain label to its Unicode form. For example, | |||
| // ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and | |||
| // ToUnicode("golang") is "golang". If an error is encountered it will return | |||
| // an error and a (partially) processed result. | |||
| func (p *Profile) ToUnicode(s string) (string, error) { | |||
| pp := *p | |||
| pp.transitional = false | |||
| return pp.process(s, false) | |||
| } | |||
| // String reports a string with a description of the profile for debugging | |||
| // purposes. The string format may change with different versions. | |||
| func (p *Profile) String() string { | |||
| s := "" | |||
| if p.transitional { | |||
| s = "Transitional" | |||
| } else { | |||
| s = "NonTransitional" | |||
| } | |||
| if p.useSTD3Rules { | |||
| s += ":UseSTD3Rules" | |||
| } | |||
| if p.validateLabels { | |||
| s += ":ValidateLabels" | |||
| } | |||
| if p.verifyDNSLength { | |||
| s += ":VerifyDNSLength" | |||
| } | |||
| return s | |||
| } | |||
| var ( | |||
| // Punycode is a Profile that does raw punycode processing with a minimum | |||
| // of validation. | |||
| Punycode *Profile = punycode | |||
| // Lookup is the recommended profile for looking up domain names, according | |||
| // to Section 5 of RFC 5891. The exact configuration of this profile may | |||
| // change over time. | |||
| Lookup *Profile = lookup | |||
| // Display is the recommended profile for displaying domain names. | |||
| // The configuration of this profile may change over time. | |||
| Display *Profile = display | |||
| // Registration is the recommended profile for checking whether a given | |||
| // IDN is valid for registration, according to Section 4 of RFC 5891. | |||
| Registration *Profile = registration | |||
| punycode = &Profile{} | |||
| lookup = &Profile{options{ | |||
| transitional: true, | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateAndMap, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| display = &Profile{options{ | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateAndMap, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| registration = &Profile{options{ | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| verifyDNSLength: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateRegistration, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| // TODO: profiles | |||
| // Register: recommended for approving domain names: don't do any mappings | |||
| // but rather reject on invalid input. Bundle or block deviation characters. | |||
| ) | |||
| type labelError struct{ label, code_ string } | |||
| func (e labelError) code() string { return e.code_ } | |||
| func (e labelError) Error() string { | |||
| return fmt.Sprintf("idna: invalid label %q", e.label) | |||
| } | |||
| type runeError rune | |||
| func (e runeError) code() string { return "P1" } | |||
| func (e runeError) Error() string { | |||
| return fmt.Sprintf("idna: disallowed rune %U", e) | |||
| } | |||
| // process implements the algorithm described in section 4 of UTS #46, | |||
| // see https://www.unicode.org/reports/tr46. | |||
| func (p *Profile) process(s string, toASCII bool) (string, error) { | |||
| var err error | |||
| var isBidi bool | |||
| if p.mapping != nil { | |||
| s, isBidi, err = p.mapping(p, s) | |||
| } | |||
| // Remove leading empty labels. | |||
| if p.removeLeadingDots { | |||
| for ; len(s) > 0 && s[0] == '.'; s = s[1:] { | |||
| } | |||
| } | |||
| // TODO: allow for a quick check of the tables data. | |||
| // It seems like we should only create this error on ToASCII, but the | |||
| // UTS 46 conformance tests suggests we should always check this. | |||
| if err == nil && p.verifyDNSLength && s == "" { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| labels := labelIter{orig: s} | |||
| for ; !labels.done(); labels.next() { | |||
| label := labels.label() | |||
| if label == "" { | |||
| // Empty labels are not okay. The label iterator skips the last | |||
| // label if it is empty. | |||
| if err == nil && p.verifyDNSLength { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| continue | |||
| } | |||
| if strings.HasPrefix(label, acePrefix) { | |||
| u, err2 := decode(label[len(acePrefix):]) | |||
| if err2 != nil { | |||
| if err == nil { | |||
| err = err2 | |||
| } | |||
| // Spec says keep the old label. | |||
| continue | |||
| } | |||
| isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight | |||
| labels.set(u) | |||
| if err == nil && p.validateLabels { | |||
| err = p.fromPuny(p, u) | |||
| } | |||
| if err == nil { | |||
| // This should be called on NonTransitional, according to the | |||
| // spec, but that currently does not have any effect. Use the | |||
| // original profile to preserve options. | |||
| err = p.validateLabel(u) | |||
| } | |||
| } else if err == nil { | |||
| err = p.validateLabel(label) | |||
| } | |||
| } | |||
| if isBidi && p.bidirule != nil && err == nil { | |||
| for labels.reset(); !labels.done(); labels.next() { | |||
| if !p.bidirule(labels.label()) { | |||
| err = &labelError{s, "B"} | |||
| break | |||
| } | |||
| } | |||
| } | |||
| if toASCII { | |||
| for labels.reset(); !labels.done(); labels.next() { | |||
| label := labels.label() | |||
| if !ascii(label) { | |||
| a, err2 := encode(acePrefix, label) | |||
| if err == nil { | |||
| err = err2 | |||
| } | |||
| label = a | |||
| labels.set(a) | |||
| } | |||
| n := len(label) | |||
| if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { | |||
| err = &labelError{label, "A4"} | |||
| } | |||
| } | |||
| } | |||
| s = labels.result() | |||
| if toASCII && p.verifyDNSLength && err == nil { | |||
| // Compute the length of the domain name minus the root label and its dot. | |||
| n := len(s) | |||
| if n > 0 && s[n-1] == '.' { | |||
| n-- | |||
| } | |||
| if len(s) < 1 || n > 253 { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| } | |||
| return s, err | |||
| } | |||
| func normalize(p *Profile, s string) (mapped string, isBidi bool, err error) { | |||
| // TODO: consider first doing a quick check to see if any of these checks | |||
| // need to be done. This will make it slower in the general case, but | |||
| // faster in the common case. | |||
| mapped = norm.NFC.String(s) | |||
| isBidi = bidirule.DirectionString(mapped) == bidi.RightToLeft | |||
| return mapped, isBidi, nil | |||
| } | |||
| func validateRegistration(p *Profile, s string) (idem string, bidi bool, err error) { | |||
| // TODO: filter need for normalization in loop below. | |||
| if !norm.NFC.IsNormalString(s) { | |||
| return s, false, &labelError{s, "V1"} | |||
| } | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| if sz == 0 { | |||
| return s, bidi, runeError(utf8.RuneError) | |||
| } | |||
| bidi = bidi || info(v).isBidi(s[i:]) | |||
| // Copy bytes not copied so far. | |||
| switch p.simplify(info(v).category()) { | |||
| // TODO: handle the NV8 defined in the Unicode idna data set to allow | |||
| // for strict conformance to IDNA2008. | |||
| case valid, deviation: | |||
| case disallowed, mapped, unknown, ignored: | |||
| r, _ := utf8.DecodeRuneInString(s[i:]) | |||
| return s, bidi, runeError(r) | |||
| } | |||
| i += sz | |||
| } | |||
| return s, bidi, nil | |||
| } | |||
| func (c info) isBidi(s string) bool { | |||
| if !c.isMapped() { | |||
| return c&attributesMask == rtl | |||
| } | |||
| // TODO: also store bidi info for mapped data. This is possible, but a bit | |||
| // cumbersome and not for the common case. | |||
| p, _ := bidi.LookupString(s) | |||
| switch p.Class() { | |||
| case bidi.R, bidi.AL, bidi.AN: | |||
| return true | |||
| } | |||
| return false | |||
| } | |||
| func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) { | |||
| var ( | |||
| b []byte | |||
| k int | |||
| ) | |||
| // combinedInfoBits contains the or-ed bits of all runes. We use this | |||
| // to derive the mayNeedNorm bit later. This may trigger normalization | |||
| // overeagerly, but it will not do so in the common case. The end result | |||
| // is another 10% saving on BenchmarkProfile for the common case. | |||
| var combinedInfoBits info | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| if sz == 0 { | |||
| b = append(b, s[k:i]...) | |||
| b = append(b, "\ufffd"...) | |||
| k = len(s) | |||
| if err == nil { | |||
| err = runeError(utf8.RuneError) | |||
| } | |||
| break | |||
| } | |||
| combinedInfoBits |= info(v) | |||
| bidi = bidi || info(v).isBidi(s[i:]) | |||
| start := i | |||
| i += sz | |||
| // Copy bytes not copied so far. | |||
| switch p.simplify(info(v).category()) { | |||
| case valid: | |||
| continue | |||
| case disallowed: | |||
| if err == nil { | |||
| r, _ := utf8.DecodeRuneInString(s[start:]) | |||
| err = runeError(r) | |||
| } | |||
| continue | |||
| case mapped, deviation: | |||
| b = append(b, s[k:start]...) | |||
| b = info(v).appendMapping(b, s[start:i]) | |||
| case ignored: | |||
| b = append(b, s[k:start]...) | |||
| // drop the rune | |||
| case unknown: | |||
| b = append(b, s[k:start]...) | |||
| b = append(b, "\ufffd"...) | |||
| } | |||
| k = i | |||
| } | |||
| if k == 0 { | |||
| // No changes so far. | |||
| if combinedInfoBits&mayNeedNorm != 0 { | |||
| s = norm.NFC.String(s) | |||
| } | |||
| } else { | |||
| b = append(b, s[k:]...) | |||
| if norm.NFC.QuickSpan(b) != len(b) { | |||
| b = norm.NFC.Bytes(b) | |||
| } | |||
| // TODO: the punycode converters require strings as input. | |||
| s = string(b) | |||
| } | |||
| return s, bidi, err | |||
| } | |||
| // A labelIter allows iterating over domain name labels. | |||
| type labelIter struct { | |||
| orig string | |||
| slice []string | |||
| curStart int | |||
| curEnd int | |||
| i int | |||
| } | |||
| func (l *labelIter) reset() { | |||
| l.curStart = 0 | |||
| l.curEnd = 0 | |||
| l.i = 0 | |||
| } | |||
| func (l *labelIter) done() bool { | |||
| return l.curStart >= len(l.orig) | |||
| } | |||
| func (l *labelIter) result() string { | |||
| if l.slice != nil { | |||
| return strings.Join(l.slice, ".") | |||
| } | |||
| return l.orig | |||
| } | |||
| func (l *labelIter) label() string { | |||
| if l.slice != nil { | |||
| return l.slice[l.i] | |||
| } | |||
| p := strings.IndexByte(l.orig[l.curStart:], '.') | |||
| l.curEnd = l.curStart + p | |||
| if p == -1 { | |||
| l.curEnd = len(l.orig) | |||
| } | |||
| return l.orig[l.curStart:l.curEnd] | |||
| } | |||
| // next sets the value to the next label. It skips the last label if it is empty. | |||
| func (l *labelIter) next() { | |||
| l.i++ | |||
| if l.slice != nil { | |||
| if l.i >= len(l.slice) || l.i == len(l.slice)-1 && l.slice[l.i] == "" { | |||
| l.curStart = len(l.orig) | |||
| } | |||
| } else { | |||
| l.curStart = l.curEnd + 1 | |||
| if l.curStart == len(l.orig)-1 && l.orig[l.curStart] == '.' { | |||
| l.curStart = len(l.orig) | |||
| } | |||
| } | |||
| } | |||
| func (l *labelIter) set(s string) { | |||
| if l.slice == nil { | |||
| l.slice = strings.Split(l.orig, ".") | |||
| } | |||
| l.slice[l.i] = s | |||
| } | |||
| // acePrefix is the ASCII Compatible Encoding prefix. | |||
| const acePrefix = "xn--" | |||
| func (p *Profile) simplify(cat category) category { | |||
| switch cat { | |||
| case disallowedSTD3Mapped: | |||
| if p.useSTD3Rules { | |||
| cat = disallowed | |||
| } else { | |||
| cat = mapped | |||
| } | |||
| case disallowedSTD3Valid: | |||
| if p.useSTD3Rules { | |||
| cat = disallowed | |||
| } else { | |||
| cat = valid | |||
| } | |||
| case deviation: | |||
| if !p.transitional { | |||
| cat = valid | |||
| } | |||
| case validNV8, validXV8: | |||
| // TODO: handle V2008 | |||
| cat = valid | |||
| } | |||
| return cat | |||
| } | |||
| func validateFromPunycode(p *Profile, s string) error { | |||
| if !norm.NFC.IsNormalString(s) { | |||
| return &labelError{s, "V1"} | |||
| } | |||
| // TODO: detect whether string may have to be normalized in the following | |||
| // loop. | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| if sz == 0 { | |||
| return runeError(utf8.RuneError) | |||
| } | |||
| if c := p.simplify(info(v).category()); c != valid && c != deviation { | |||
| return &labelError{s, "V6"} | |||
| } | |||
| i += sz | |||
| } | |||
| return nil | |||
| } | |||
| const ( | |||
| zwnj = "\u200c" | |||
| zwj = "\u200d" | |||
| ) | |||
| type joinState int8 | |||
| const ( | |||
| stateStart joinState = iota | |||
| stateVirama | |||
| stateBefore | |||
| stateBeforeVirama | |||
| stateAfter | |||
| stateFAIL | |||
| ) | |||
| var joinStates = [][numJoinTypes]joinState{ | |||
| stateStart: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateVirama, | |||
| }, | |||
| stateVirama: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| }, | |||
| stateBefore: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joiningT: stateBefore, | |||
| joinZWNJ: stateAfter, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateBeforeVirama, | |||
| }, | |||
| stateBeforeVirama: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joiningT: stateBefore, | |||
| }, | |||
| stateAfter: { | |||
| joiningL: stateFAIL, | |||
| joiningD: stateBefore, | |||
| joiningT: stateAfter, | |||
| joiningR: stateStart, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateAfter, // no-op as we can't accept joiners here | |||
| }, | |||
| stateFAIL: { | |||
| 0: stateFAIL, | |||
| joiningL: stateFAIL, | |||
| joiningD: stateFAIL, | |||
| joiningT: stateFAIL, | |||
| joiningR: stateFAIL, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateFAIL, | |||
| }, | |||
| } | |||
| // validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are | |||
| // already implicitly satisfied by the overall implementation. | |||
| func (p *Profile) validateLabel(s string) (err error) { | |||
| if s == "" { | |||
| if p.verifyDNSLength { | |||
| return &labelError{s, "A4"} | |||
| } | |||
| return nil | |||
| } | |||
| if !p.validateLabels { | |||
| return nil | |||
| } | |||
| trie := p.trie // p.validateLabels is only set if trie is set. | |||
| if len(s) > 4 && s[2] == '-' && s[3] == '-' { | |||
| return &labelError{s, "V2"} | |||
| } | |||
| if s[0] == '-' || s[len(s)-1] == '-' { | |||
| return &labelError{s, "V3"} | |||
| } | |||
| // TODO: merge the use of this in the trie. | |||
| v, sz := trie.lookupString(s) | |||
| x := info(v) | |||
| if x.isModifier() { | |||
| return &labelError{s, "V5"} | |||
| } | |||
| // Quickly return in the absence of zero-width (non) joiners. | |||
| if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { | |||
| return nil | |||
| } | |||
| st := stateStart | |||
| for i := 0; ; { | |||
| jt := x.joinType() | |||
| if s[i:i+sz] == zwj { | |||
| jt = joinZWJ | |||
| } else if s[i:i+sz] == zwnj { | |||
| jt = joinZWNJ | |||
| } | |||
| st = joinStates[st][jt] | |||
| if x.isViramaModifier() { | |||
| st = joinStates[st][joinVirama] | |||
| } | |||
| if i += sz; i == len(s) { | |||
| break | |||
| } | |||
| v, sz = trie.lookupString(s[i:]) | |||
| x = info(v) | |||
| } | |||
| if st == stateFAIL || st == stateAfter { | |||
| return &labelError{s, "C"} | |||
| } | |||
| return nil | |||
| } | |||
| func ascii(s string) bool { | |||
| for i := 0; i < len(s); i++ { | |||
| if s[i] >= utf8.RuneSelf { | |||
| return false | |||
| } | |||
| } | |||
| return true | |||
| } | |||
| @@ -0,0 +1,682 @@ | |||
| // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. | |||
| // Copyright 2016 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !go1.10 | |||
| // Package idna implements IDNA2008 using the compatibility processing | |||
| // defined by UTS (Unicode Technical Standard) #46, which defines a standard to | |||
| // deal with the transition from IDNA2003. | |||
| // | |||
| // IDNA2008 (Internationalized Domain Names for Applications), is defined in RFC | |||
| // 5890, RFC 5891, RFC 5892, RFC 5893 and RFC 5894. | |||
| // UTS #46 is defined in https://www.unicode.org/reports/tr46. | |||
| // See https://unicode.org/cldr/utility/idna.jsp for a visualization of the | |||
| // differences between these two standards. | |||
| package idna // import "golang.org/x/net/idna" | |||
| import ( | |||
| "fmt" | |||
| "strings" | |||
| "unicode/utf8" | |||
| "golang.org/x/text/secure/bidirule" | |||
| "golang.org/x/text/unicode/norm" | |||
| ) | |||
| // NOTE: Unlike common practice in Go APIs, the functions will return a | |||
| // sanitized domain name in case of errors. Browsers sometimes use a partially | |||
| // evaluated string as lookup. | |||
| // TODO: the current error handling is, in my opinion, the least opinionated. | |||
| // Other strategies are also viable, though: | |||
| // Option 1) Return an empty string in case of error, but allow the user to | |||
| // specify explicitly which errors to ignore. | |||
| // Option 2) Return the partially evaluated string if it is itself a valid | |||
| // string, otherwise return the empty string in case of error. | |||
| // Option 3) Option 1 and 2. | |||
| // Option 4) Always return an empty string for now and implement Option 1 as | |||
| // needed, and document that the return string may not be empty in case of | |||
| // error in the future. | |||
| // I think Option 1 is best, but it is quite opinionated. | |||
| // ToASCII is a wrapper for Punycode.ToASCII. | |||
| func ToASCII(s string) (string, error) { | |||
| return Punycode.process(s, true) | |||
| } | |||
| // ToUnicode is a wrapper for Punycode.ToUnicode. | |||
| func ToUnicode(s string) (string, error) { | |||
| return Punycode.process(s, false) | |||
| } | |||
| // An Option configures a Profile at creation time. | |||
| type Option func(*options) | |||
| // Transitional sets a Profile to use the Transitional mapping as defined in UTS | |||
| // #46. This will cause, for example, "ß" to be mapped to "ss". Using the | |||
| // transitional mapping provides a compromise between IDNA2003 and IDNA2008 | |||
| // compatibility. It is used by most browsers when resolving domain names. This | |||
| // option is only meaningful if combined with MapForLookup. | |||
| func Transitional(transitional bool) Option { | |||
| return func(o *options) { o.transitional = true } | |||
| } | |||
| // VerifyDNSLength sets whether a Profile should fail if any of the IDN parts | |||
| // are longer than allowed by the RFC. | |||
| func VerifyDNSLength(verify bool) Option { | |||
| return func(o *options) { o.verifyDNSLength = verify } | |||
| } | |||
| // RemoveLeadingDots removes leading label separators. Leading runes that map to | |||
| // dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well. | |||
| // | |||
| // This is the behavior suggested by the UTS #46 and is adopted by some | |||
| // browsers. | |||
| func RemoveLeadingDots(remove bool) Option { | |||
| return func(o *options) { o.removeLeadingDots = remove } | |||
| } | |||
| // ValidateLabels sets whether to check the mandatory label validation criteria | |||
| // as defined in Section 5.4 of RFC 5891. This includes testing for correct use | |||
| // of hyphens ('-'), normalization, validity of runes, and the context rules. | |||
| func ValidateLabels(enable bool) Option { | |||
| return func(o *options) { | |||
| // Don't override existing mappings, but set one that at least checks | |||
| // normalization if it is not set. | |||
| if o.mapping == nil && enable { | |||
| o.mapping = normalize | |||
| } | |||
| o.trie = trie | |||
| o.validateLabels = enable | |||
| o.fromPuny = validateFromPunycode | |||
| } | |||
| } | |||
| // StrictDomainName limits the set of permissable ASCII characters to those | |||
| // allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the | |||
| // hyphen). This is set by default for MapForLookup and ValidateForRegistration. | |||
| // | |||
| // This option is useful, for instance, for browsers that allow characters | |||
| // outside this range, for example a '_' (U+005F LOW LINE). See | |||
| // http://www.rfc-editor.org/std/std3.txt for more details This option | |||
| // corresponds to the UseSTD3ASCIIRules option in UTS #46. | |||
| func StrictDomainName(use bool) Option { | |||
| return func(o *options) { | |||
| o.trie = trie | |||
| o.useSTD3Rules = use | |||
| o.fromPuny = validateFromPunycode | |||
| } | |||
| } | |||
| // NOTE: the following options pull in tables. The tables should not be linked | |||
| // in as long as the options are not used. | |||
| // BidiRule enables the Bidi rule as defined in RFC 5893. Any application | |||
| // that relies on proper validation of labels should include this rule. | |||
| func BidiRule() Option { | |||
| return func(o *options) { o.bidirule = bidirule.ValidString } | |||
| } | |||
| // ValidateForRegistration sets validation options to verify that a given IDN is | |||
| // properly formatted for registration as defined by Section 4 of RFC 5891. | |||
| func ValidateForRegistration() Option { | |||
| return func(o *options) { | |||
| o.mapping = validateRegistration | |||
| StrictDomainName(true)(o) | |||
| ValidateLabels(true)(o) | |||
| VerifyDNSLength(true)(o) | |||
| BidiRule()(o) | |||
| } | |||
| } | |||
| // MapForLookup sets validation and mapping options such that a given IDN is | |||
| // transformed for domain name lookup according to the requirements set out in | |||
| // Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894, | |||
| // RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option | |||
| // to add this check. | |||
| // | |||
| // The mappings include normalization and mapping case, width and other | |||
| // compatibility mappings. | |||
| func MapForLookup() Option { | |||
| return func(o *options) { | |||
| o.mapping = validateAndMap | |||
| StrictDomainName(true)(o) | |||
| ValidateLabels(true)(o) | |||
| RemoveLeadingDots(true)(o) | |||
| } | |||
| } | |||
| type options struct { | |||
| transitional bool | |||
| useSTD3Rules bool | |||
| validateLabels bool | |||
| verifyDNSLength bool | |||
| removeLeadingDots bool | |||
| trie *idnaTrie | |||
| // fromPuny calls validation rules when converting A-labels to U-labels. | |||
| fromPuny func(p *Profile, s string) error | |||
| // mapping implements a validation and mapping step as defined in RFC 5895 | |||
| // or UTS 46, tailored to, for example, domain registration or lookup. | |||
| mapping func(p *Profile, s string) (string, error) | |||
| // bidirule, if specified, checks whether s conforms to the Bidi Rule | |||
| // defined in RFC 5893. | |||
| bidirule func(s string) bool | |||
| } | |||
| // A Profile defines the configuration of a IDNA mapper. | |||
| type Profile struct { | |||
| options | |||
| } | |||
| func apply(o *options, opts []Option) { | |||
| for _, f := range opts { | |||
| f(o) | |||
| } | |||
| } | |||
| // New creates a new Profile. | |||
| // | |||
| // With no options, the returned Profile is the most permissive and equals the | |||
| // Punycode Profile. Options can be passed to further restrict the Profile. The | |||
| // MapForLookup and ValidateForRegistration options set a collection of options, | |||
| // for lookup and registration purposes respectively, which can be tailored by | |||
| // adding more fine-grained options, where later options override earlier | |||
| // options. | |||
| func New(o ...Option) *Profile { | |||
| p := &Profile{} | |||
| apply(&p.options, o) | |||
| return p | |||
| } | |||
| // ToASCII converts a domain or domain label to its ASCII form. For example, | |||
| // ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and | |||
| // ToASCII("golang") is "golang". If an error is encountered it will return | |||
| // an error and a (partially) processed result. | |||
| func (p *Profile) ToASCII(s string) (string, error) { | |||
| return p.process(s, true) | |||
| } | |||
| // ToUnicode converts a domain or domain label to its Unicode form. For example, | |||
| // ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and | |||
| // ToUnicode("golang") is "golang". If an error is encountered it will return | |||
| // an error and a (partially) processed result. | |||
| func (p *Profile) ToUnicode(s string) (string, error) { | |||
| pp := *p | |||
| pp.transitional = false | |||
| return pp.process(s, false) | |||
| } | |||
| // String reports a string with a description of the profile for debugging | |||
| // purposes. The string format may change with different versions. | |||
| func (p *Profile) String() string { | |||
| s := "" | |||
| if p.transitional { | |||
| s = "Transitional" | |||
| } else { | |||
| s = "NonTransitional" | |||
| } | |||
| if p.useSTD3Rules { | |||
| s += ":UseSTD3Rules" | |||
| } | |||
| if p.validateLabels { | |||
| s += ":ValidateLabels" | |||
| } | |||
| if p.verifyDNSLength { | |||
| s += ":VerifyDNSLength" | |||
| } | |||
| return s | |||
| } | |||
| var ( | |||
| // Punycode is a Profile that does raw punycode processing with a minimum | |||
| // of validation. | |||
| Punycode *Profile = punycode | |||
| // Lookup is the recommended profile for looking up domain names, according | |||
| // to Section 5 of RFC 5891. The exact configuration of this profile may | |||
| // change over time. | |||
| Lookup *Profile = lookup | |||
| // Display is the recommended profile for displaying domain names. | |||
| // The configuration of this profile may change over time. | |||
| Display *Profile = display | |||
| // Registration is the recommended profile for checking whether a given | |||
| // IDN is valid for registration, according to Section 4 of RFC 5891. | |||
| Registration *Profile = registration | |||
| punycode = &Profile{} | |||
| lookup = &Profile{options{ | |||
| transitional: true, | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| removeLeadingDots: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateAndMap, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| display = &Profile{options{ | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| removeLeadingDots: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateAndMap, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| registration = &Profile{options{ | |||
| useSTD3Rules: true, | |||
| validateLabels: true, | |||
| verifyDNSLength: true, | |||
| trie: trie, | |||
| fromPuny: validateFromPunycode, | |||
| mapping: validateRegistration, | |||
| bidirule: bidirule.ValidString, | |||
| }} | |||
| // TODO: profiles | |||
| // Register: recommended for approving domain names: don't do any mappings | |||
| // but rather reject on invalid input. Bundle or block deviation characters. | |||
| ) | |||
| type labelError struct{ label, code_ string } | |||
| func (e labelError) code() string { return e.code_ } | |||
| func (e labelError) Error() string { | |||
| return fmt.Sprintf("idna: invalid label %q", e.label) | |||
| } | |||
| type runeError rune | |||
| func (e runeError) code() string { return "P1" } | |||
| func (e runeError) Error() string { | |||
| return fmt.Sprintf("idna: disallowed rune %U", e) | |||
| } | |||
| // process implements the algorithm described in section 4 of UTS #46, | |||
| // see https://www.unicode.org/reports/tr46. | |||
| func (p *Profile) process(s string, toASCII bool) (string, error) { | |||
| var err error | |||
| if p.mapping != nil { | |||
| s, err = p.mapping(p, s) | |||
| } | |||
| // Remove leading empty labels. | |||
| if p.removeLeadingDots { | |||
| for ; len(s) > 0 && s[0] == '.'; s = s[1:] { | |||
| } | |||
| } | |||
| // It seems like we should only create this error on ToASCII, but the | |||
| // UTS 46 conformance tests suggests we should always check this. | |||
| if err == nil && p.verifyDNSLength && s == "" { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| labels := labelIter{orig: s} | |||
| for ; !labels.done(); labels.next() { | |||
| label := labels.label() | |||
| if label == "" { | |||
| // Empty labels are not okay. The label iterator skips the last | |||
| // label if it is empty. | |||
| if err == nil && p.verifyDNSLength { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| continue | |||
| } | |||
| if strings.HasPrefix(label, acePrefix) { | |||
| u, err2 := decode(label[len(acePrefix):]) | |||
| if err2 != nil { | |||
| if err == nil { | |||
| err = err2 | |||
| } | |||
| // Spec says keep the old label. | |||
| continue | |||
| } | |||
| labels.set(u) | |||
| if err == nil && p.validateLabels { | |||
| err = p.fromPuny(p, u) | |||
| } | |||
| if err == nil { | |||
| // This should be called on NonTransitional, according to the | |||
| // spec, but that currently does not have any effect. Use the | |||
| // original profile to preserve options. | |||
| err = p.validateLabel(u) | |||
| } | |||
| } else if err == nil { | |||
| err = p.validateLabel(label) | |||
| } | |||
| } | |||
| if toASCII { | |||
| for labels.reset(); !labels.done(); labels.next() { | |||
| label := labels.label() | |||
| if !ascii(label) { | |||
| a, err2 := encode(acePrefix, label) | |||
| if err == nil { | |||
| err = err2 | |||
| } | |||
| label = a | |||
| labels.set(a) | |||
| } | |||
| n := len(label) | |||
| if p.verifyDNSLength && err == nil && (n == 0 || n > 63) { | |||
| err = &labelError{label, "A4"} | |||
| } | |||
| } | |||
| } | |||
| s = labels.result() | |||
| if toASCII && p.verifyDNSLength && err == nil { | |||
| // Compute the length of the domain name minus the root label and its dot. | |||
| n := len(s) | |||
| if n > 0 && s[n-1] == '.' { | |||
| n-- | |||
| } | |||
| if len(s) < 1 || n > 253 { | |||
| err = &labelError{s, "A4"} | |||
| } | |||
| } | |||
| return s, err | |||
| } | |||
| func normalize(p *Profile, s string) (string, error) { | |||
| return norm.NFC.String(s), nil | |||
| } | |||
| func validateRegistration(p *Profile, s string) (string, error) { | |||
| if !norm.NFC.IsNormalString(s) { | |||
| return s, &labelError{s, "V1"} | |||
| } | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| // Copy bytes not copied so far. | |||
| switch p.simplify(info(v).category()) { | |||
| // TODO: handle the NV8 defined in the Unicode idna data set to allow | |||
| // for strict conformance to IDNA2008. | |||
| case valid, deviation: | |||
| case disallowed, mapped, unknown, ignored: | |||
| r, _ := utf8.DecodeRuneInString(s[i:]) | |||
| return s, runeError(r) | |||
| } | |||
| i += sz | |||
| } | |||
| return s, nil | |||
| } | |||
| func validateAndMap(p *Profile, s string) (string, error) { | |||
| var ( | |||
| err error | |||
| b []byte | |||
| k int | |||
| ) | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| start := i | |||
| i += sz | |||
| // Copy bytes not copied so far. | |||
| switch p.simplify(info(v).category()) { | |||
| case valid: | |||
| continue | |||
| case disallowed: | |||
| if err == nil { | |||
| r, _ := utf8.DecodeRuneInString(s[start:]) | |||
| err = runeError(r) | |||
| } | |||
| continue | |||
| case mapped, deviation: | |||
| b = append(b, s[k:start]...) | |||
| b = info(v).appendMapping(b, s[start:i]) | |||
| case ignored: | |||
| b = append(b, s[k:start]...) | |||
| // drop the rune | |||
| case unknown: | |||
| b = append(b, s[k:start]...) | |||
| b = append(b, "\ufffd"...) | |||
| } | |||
| k = i | |||
| } | |||
| if k == 0 { | |||
| // No changes so far. | |||
| s = norm.NFC.String(s) | |||
| } else { | |||
| b = append(b, s[k:]...) | |||
| if norm.NFC.QuickSpan(b) != len(b) { | |||
| b = norm.NFC.Bytes(b) | |||
| } | |||
| // TODO: the punycode converters require strings as input. | |||
| s = string(b) | |||
| } | |||
| return s, err | |||
| } | |||
| // A labelIter allows iterating over domain name labels. | |||
| type labelIter struct { | |||
| orig string | |||
| slice []string | |||
| curStart int | |||
| curEnd int | |||
| i int | |||
| } | |||
| func (l *labelIter) reset() { | |||
| l.curStart = 0 | |||
| l.curEnd = 0 | |||
| l.i = 0 | |||
| } | |||
| func (l *labelIter) done() bool { | |||
| return l.curStart >= len(l.orig) | |||
| } | |||
| func (l *labelIter) result() string { | |||
| if l.slice != nil { | |||
| return strings.Join(l.slice, ".") | |||
| } | |||
| return l.orig | |||
| } | |||
| func (l *labelIter) label() string { | |||
| if l.slice != nil { | |||
| return l.slice[l.i] | |||
| } | |||
| p := strings.IndexByte(l.orig[l.curStart:], '.') | |||
| l.curEnd = l.curStart + p | |||
| if p == -1 { | |||
| l.curEnd = len(l.orig) | |||
| } | |||
| return l.orig[l.curStart:l.curEnd] | |||
| } | |||
| // next sets the value to the next label. It skips the last label if it is empty. | |||
| func (l *labelIter) next() { | |||
| l.i++ | |||
| if l.slice != nil { | |||
| if l.i >= len(l.slice) || l.i == len(l.slice)-1 && l.slice[l.i] == "" { | |||
| l.curStart = len(l.orig) | |||
| } | |||
| } else { | |||
| l.curStart = l.curEnd + 1 | |||
| if l.curStart == len(l.orig)-1 && l.orig[l.curStart] == '.' { | |||
| l.curStart = len(l.orig) | |||
| } | |||
| } | |||
| } | |||
| func (l *labelIter) set(s string) { | |||
| if l.slice == nil { | |||
| l.slice = strings.Split(l.orig, ".") | |||
| } | |||
| l.slice[l.i] = s | |||
| } | |||
| // acePrefix is the ASCII Compatible Encoding prefix. | |||
| const acePrefix = "xn--" | |||
| func (p *Profile) simplify(cat category) category { | |||
| switch cat { | |||
| case disallowedSTD3Mapped: | |||
| if p.useSTD3Rules { | |||
| cat = disallowed | |||
| } else { | |||
| cat = mapped | |||
| } | |||
| case disallowedSTD3Valid: | |||
| if p.useSTD3Rules { | |||
| cat = disallowed | |||
| } else { | |||
| cat = valid | |||
| } | |||
| case deviation: | |||
| if !p.transitional { | |||
| cat = valid | |||
| } | |||
| case validNV8, validXV8: | |||
| // TODO: handle V2008 | |||
| cat = valid | |||
| } | |||
| return cat | |||
| } | |||
| func validateFromPunycode(p *Profile, s string) error { | |||
| if !norm.NFC.IsNormalString(s) { | |||
| return &labelError{s, "V1"} | |||
| } | |||
| for i := 0; i < len(s); { | |||
| v, sz := trie.lookupString(s[i:]) | |||
| if c := p.simplify(info(v).category()); c != valid && c != deviation { | |||
| return &labelError{s, "V6"} | |||
| } | |||
| i += sz | |||
| } | |||
| return nil | |||
| } | |||
| const ( | |||
| zwnj = "\u200c" | |||
| zwj = "\u200d" | |||
| ) | |||
| type joinState int8 | |||
| const ( | |||
| stateStart joinState = iota | |||
| stateVirama | |||
| stateBefore | |||
| stateBeforeVirama | |||
| stateAfter | |||
| stateFAIL | |||
| ) | |||
| var joinStates = [][numJoinTypes]joinState{ | |||
| stateStart: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateVirama, | |||
| }, | |||
| stateVirama: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| }, | |||
| stateBefore: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joiningT: stateBefore, | |||
| joinZWNJ: stateAfter, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateBeforeVirama, | |||
| }, | |||
| stateBeforeVirama: { | |||
| joiningL: stateBefore, | |||
| joiningD: stateBefore, | |||
| joiningT: stateBefore, | |||
| }, | |||
| stateAfter: { | |||
| joiningL: stateFAIL, | |||
| joiningD: stateBefore, | |||
| joiningT: stateAfter, | |||
| joiningR: stateStart, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateAfter, // no-op as we can't accept joiners here | |||
| }, | |||
| stateFAIL: { | |||
| 0: stateFAIL, | |||
| joiningL: stateFAIL, | |||
| joiningD: stateFAIL, | |||
| joiningT: stateFAIL, | |||
| joiningR: stateFAIL, | |||
| joinZWNJ: stateFAIL, | |||
| joinZWJ: stateFAIL, | |||
| joinVirama: stateFAIL, | |||
| }, | |||
| } | |||
| // validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are | |||
| // already implicitly satisfied by the overall implementation. | |||
| func (p *Profile) validateLabel(s string) error { | |||
| if s == "" { | |||
| if p.verifyDNSLength { | |||
| return &labelError{s, "A4"} | |||
| } | |||
| return nil | |||
| } | |||
| if p.bidirule != nil && !p.bidirule(s) { | |||
| return &labelError{s, "B"} | |||
| } | |||
| if !p.validateLabels { | |||
| return nil | |||
| } | |||
| trie := p.trie // p.validateLabels is only set if trie is set. | |||
| if len(s) > 4 && s[2] == '-' && s[3] == '-' { | |||
| return &labelError{s, "V2"} | |||
| } | |||
| if s[0] == '-' || s[len(s)-1] == '-' { | |||
| return &labelError{s, "V3"} | |||
| } | |||
| // TODO: merge the use of this in the trie. | |||
| v, sz := trie.lookupString(s) | |||
| x := info(v) | |||
| if x.isModifier() { | |||
| return &labelError{s, "V5"} | |||
| } | |||
| // Quickly return in the absence of zero-width (non) joiners. | |||
| if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 { | |||
| return nil | |||
| } | |||
| st := stateStart | |||
| for i := 0; ; { | |||
| jt := x.joinType() | |||
| if s[i:i+sz] == zwj { | |||
| jt = joinZWJ | |||
| } else if s[i:i+sz] == zwnj { | |||
| jt = joinZWNJ | |||
| } | |||
| st = joinStates[st][jt] | |||
| if x.isViramaModifier() { | |||
| st = joinStates[st][joinVirama] | |||
| } | |||
| if i += sz; i == len(s) { | |||
| break | |||
| } | |||
| v, sz = trie.lookupString(s[i:]) | |||
| x = info(v) | |||
| } | |||
| if st == stateFAIL || st == stateAfter { | |||
| return &labelError{s, "C"} | |||
| } | |||
| return nil | |||
| } | |||
| func ascii(s string) bool { | |||
| for i := 0; i < len(s); i++ { | |||
| if s[i] >= utf8.RuneSelf { | |||
| return false | |||
| } | |||
| } | |||
| return true | |||
| } | |||
| @@ -0,0 +1,203 @@ | |||
| // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. | |||
| // Copyright 2016 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package idna | |||
| // This file implements the Punycode algorithm from RFC 3492. | |||
| import ( | |||
| "math" | |||
| "strings" | |||
| "unicode/utf8" | |||
| ) | |||
| // These parameter values are specified in section 5. | |||
| // | |||
| // All computation is done with int32s, so that overflow behavior is identical | |||
| // regardless of whether int is 32-bit or 64-bit. | |||
| const ( | |||
| base int32 = 36 | |||
| damp int32 = 700 | |||
| initialBias int32 = 72 | |||
| initialN int32 = 128 | |||
| skew int32 = 38 | |||
| tmax int32 = 26 | |||
| tmin int32 = 1 | |||
| ) | |||
| func punyError(s string) error { return &labelError{s, "A3"} } | |||
| // decode decodes a string as specified in section 6.2. | |||
| func decode(encoded string) (string, error) { | |||
| if encoded == "" { | |||
| return "", nil | |||
| } | |||
| pos := 1 + strings.LastIndex(encoded, "-") | |||
| if pos == 1 { | |||
| return "", punyError(encoded) | |||
| } | |||
| if pos == len(encoded) { | |||
| return encoded[:len(encoded)-1], nil | |||
| } | |||
| output := make([]rune, 0, len(encoded)) | |||
| if pos != 0 { | |||
| for _, r := range encoded[:pos-1] { | |||
| output = append(output, r) | |||
| } | |||
| } | |||
| i, n, bias := int32(0), initialN, initialBias | |||
| for pos < len(encoded) { | |||
| oldI, w := i, int32(1) | |||
| for k := base; ; k += base { | |||
| if pos == len(encoded) { | |||
| return "", punyError(encoded) | |||
| } | |||
| digit, ok := decodeDigit(encoded[pos]) | |||
| if !ok { | |||
| return "", punyError(encoded) | |||
| } | |||
| pos++ | |||
| i += digit * w | |||
| if i < 0 { | |||
| return "", punyError(encoded) | |||
| } | |||
| t := k - bias | |||
| if t < tmin { | |||
| t = tmin | |||
| } else if t > tmax { | |||
| t = tmax | |||
| } | |||
| if digit < t { | |||
| break | |||
| } | |||
| w *= base - t | |||
| if w >= math.MaxInt32/base { | |||
| return "", punyError(encoded) | |||
| } | |||
| } | |||
| x := int32(len(output) + 1) | |||
| bias = adapt(i-oldI, x, oldI == 0) | |||
| n += i / x | |||
| i %= x | |||
| if n > utf8.MaxRune || len(output) >= 1024 { | |||
| return "", punyError(encoded) | |||
| } | |||
| output = append(output, 0) | |||
| copy(output[i+1:], output[i:]) | |||
| output[i] = n | |||
| i++ | |||
| } | |||
| return string(output), nil | |||
| } | |||
| // encode encodes a string as specified in section 6.3 and prepends prefix to | |||
| // the result. | |||
| // | |||
| // The "while h < length(input)" line in the specification becomes "for | |||
| // remaining != 0" in the Go code, because len(s) in Go is in bytes, not runes. | |||
| func encode(prefix, s string) (string, error) { | |||
| output := make([]byte, len(prefix), len(prefix)+1+2*len(s)) | |||
| copy(output, prefix) | |||
| delta, n, bias := int32(0), initialN, initialBias | |||
| b, remaining := int32(0), int32(0) | |||
| for _, r := range s { | |||
| if r < 0x80 { | |||
| b++ | |||
| output = append(output, byte(r)) | |||
| } else { | |||
| remaining++ | |||
| } | |||
| } | |||
| h := b | |||
| if b > 0 { | |||
| output = append(output, '-') | |||
| } | |||
| for remaining != 0 { | |||
| m := int32(0x7fffffff) | |||
| for _, r := range s { | |||
| if m > r && r >= n { | |||
| m = r | |||
| } | |||
| } | |||
| delta += (m - n) * (h + 1) | |||
| if delta < 0 { | |||
| return "", punyError(s) | |||
| } | |||
| n = m | |||
| for _, r := range s { | |||
| if r < n { | |||
| delta++ | |||
| if delta < 0 { | |||
| return "", punyError(s) | |||
| } | |||
| continue | |||
| } | |||
| if r > n { | |||
| continue | |||
| } | |||
| q := delta | |||
| for k := base; ; k += base { | |||
| t := k - bias | |||
| if t < tmin { | |||
| t = tmin | |||
| } else if t > tmax { | |||
| t = tmax | |||
| } | |||
| if q < t { | |||
| break | |||
| } | |||
| output = append(output, encodeDigit(t+(q-t)%(base-t))) | |||
| q = (q - t) / (base - t) | |||
| } | |||
| output = append(output, encodeDigit(q)) | |||
| bias = adapt(delta, h+1, h == b) | |||
| delta = 0 | |||
| h++ | |||
| remaining-- | |||
| } | |||
| delta++ | |||
| n++ | |||
| } | |||
| return string(output), nil | |||
| } | |||
| func decodeDigit(x byte) (digit int32, ok bool) { | |||
| switch { | |||
| case '0' <= x && x <= '9': | |||
| return int32(x - ('0' - 26)), true | |||
| case 'A' <= x && x <= 'Z': | |||
| return int32(x - 'A'), true | |||
| case 'a' <= x && x <= 'z': | |||
| return int32(x - 'a'), true | |||
| } | |||
| return 0, false | |||
| } | |||
| func encodeDigit(digit int32) byte { | |||
| switch { | |||
| case 0 <= digit && digit < 26: | |||
| return byte(digit + 'a') | |||
| case 26 <= digit && digit < 36: | |||
| return byte(digit + ('0' - 26)) | |||
| } | |||
| panic("idna: internal error in punycode encoding") | |||
| } | |||
| // adapt is the bias adaptation function specified in section 6.1. | |||
| func adapt(delta, numPoints int32, firstTime bool) int32 { | |||
| if firstTime { | |||
| delta /= damp | |||
| } else { | |||
| delta /= 2 | |||
| } | |||
| delta += delta / numPoints | |||
| k := int32(0) | |||
| for delta > ((base-tmin)*tmax)/2 { | |||
| delta /= base - tmin | |||
| k += base | |||
| } | |||
| return k + (base-tmin+1)*delta/(delta+skew) | |||
| } | |||
| @@ -0,0 +1,72 @@ | |||
| // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. | |||
| // Copyright 2016 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package idna | |||
| // appendMapping appends the mapping for the respective rune. isMapped must be | |||
| // true. A mapping is a categorization of a rune as defined in UTS #46. | |||
| func (c info) appendMapping(b []byte, s string) []byte { | |||
| index := int(c >> indexShift) | |||
| if c&xorBit == 0 { | |||
| s := mappings[index:] | |||
| return append(b, s[1:s[0]+1]...) | |||
| } | |||
| b = append(b, s...) | |||
| if c&inlineXOR == inlineXOR { | |||
| // TODO: support and handle two-byte inline masks | |||
| b[len(b)-1] ^= byte(index) | |||
| } else { | |||
| for p := len(b) - int(xorData[index]); p < len(b); p++ { | |||
| index++ | |||
| b[p] ^= xorData[index] | |||
| } | |||
| } | |||
| return b | |||
| } | |||
| // Sparse block handling code. | |||
| type valueRange struct { | |||
| value uint16 // header: value:stride | |||
| lo, hi byte // header: lo:n | |||
| } | |||
| type sparseBlocks struct { | |||
| values []valueRange | |||
| offset []uint16 | |||
| } | |||
| var idnaSparse = sparseBlocks{ | |||
| values: idnaSparseValues[:], | |||
| offset: idnaSparseOffset[:], | |||
| } | |||
| // Don't use newIdnaTrie to avoid unconditional linking in of the table. | |||
| var trie = &idnaTrie{} | |||
| // lookup determines the type of block n and looks up the value for b. | |||
| // For n < t.cutoff, the block is a simple lookup table. Otherwise, the block | |||
| // is a list of ranges with an accompanying value. Given a matching range r, | |||
| // the value for b is by r.value + (b - r.lo) * stride. | |||
| func (t *sparseBlocks) lookup(n uint32, b byte) uint16 { | |||
| offset := t.offset[n] | |||
| header := t.values[offset] | |||
| lo := offset + 1 | |||
| hi := lo + uint16(header.lo) | |||
| for lo < hi { | |||
| m := lo + (hi-lo)/2 | |||
| r := t.values[m] | |||
| if r.lo <= b && b <= r.hi { | |||
| return r.value + uint16(b-r.lo)*header.value | |||
| } | |||
| if b < r.lo { | |||
| hi = m | |||
| } else { | |||
| lo = m + 1 | |||
| } | |||
| } | |||
| return 0 | |||
| } | |||
| @@ -0,0 +1,119 @@ | |||
| // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. | |||
| package idna | |||
| // This file contains definitions for interpreting the trie value of the idna | |||
| // trie generated by "go run gen*.go". It is shared by both the generator | |||
| // program and the resultant package. Sharing is achieved by the generator | |||
| // copying gen_trieval.go to trieval.go and changing what's above this comment. | |||
| // info holds information from the IDNA mapping table for a single rune. It is | |||
| // the value returned by a trie lookup. In most cases, all information fits in | |||
| // a 16-bit value. For mappings, this value may contain an index into a slice | |||
| // with the mapped string. Such mappings can consist of the actual mapped value | |||
| // or an XOR pattern to be applied to the bytes of the UTF8 encoding of the | |||
| // input rune. This technique is used by the cases packages and reduces the | |||
| // table size significantly. | |||
| // | |||
| // The per-rune values have the following format: | |||
| // | |||
| // if mapped { | |||
| // if inlinedXOR { | |||
| // 15..13 inline XOR marker | |||
| // 12..11 unused | |||
| // 10..3 inline XOR mask | |||
| // } else { | |||
| // 15..3 index into xor or mapping table | |||
| // } | |||
| // } else { | |||
| // 15..14 unused | |||
| // 13 mayNeedNorm | |||
| // 12..11 attributes | |||
| // 10..8 joining type | |||
| // 7..3 category type | |||
| // } | |||
| // 2 use xor pattern | |||
| // 1..0 mapped category | |||
| // | |||
| // See the definitions below for a more detailed description of the various | |||
| // bits. | |||
| type info uint16 | |||
| const ( | |||
| catSmallMask = 0x3 | |||
| catBigMask = 0xF8 | |||
| indexShift = 3 | |||
| xorBit = 0x4 // interpret the index as an xor pattern | |||
| inlineXOR = 0xE000 // These bits are set if the XOR pattern is inlined. | |||
| joinShift = 8 | |||
| joinMask = 0x07 | |||
| // Attributes | |||
| attributesMask = 0x1800 | |||
| viramaModifier = 0x1800 | |||
| modifier = 0x1000 | |||
| rtl = 0x0800 | |||
| mayNeedNorm = 0x2000 | |||
| ) | |||
| // A category corresponds to a category defined in the IDNA mapping table. | |||
| type category uint16 | |||
| const ( | |||
| unknown category = 0 // not currently defined in unicode. | |||
| mapped category = 1 | |||
| disallowedSTD3Mapped category = 2 | |||
| deviation category = 3 | |||
| ) | |||
| const ( | |||
| valid category = 0x08 | |||
| validNV8 category = 0x18 | |||
| validXV8 category = 0x28 | |||
| disallowed category = 0x40 | |||
| disallowedSTD3Valid category = 0x80 | |||
| ignored category = 0xC0 | |||
| ) | |||
| // join types and additional rune information | |||
| const ( | |||
| joiningL = (iota + 1) | |||
| joiningD | |||
| joiningT | |||
| joiningR | |||
| //the following types are derived during processing | |||
| joinZWJ | |||
| joinZWNJ | |||
| joinVirama | |||
| numJoinTypes | |||
| ) | |||
| func (c info) isMapped() bool { | |||
| return c&0x3 != 0 | |||
| } | |||
| func (c info) category() category { | |||
| small := c & catSmallMask | |||
| if small != 0 { | |||
| return category(small) | |||
| } | |||
| return category(c & catBigMask) | |||
| } | |||
| func (c info) joinType() info { | |||
| if c.isMapped() { | |||
| return 0 | |||
| } | |||
| return (c >> joinShift) & joinMask | |||
| } | |||
| func (c info) isModifier() bool { | |||
| return c&(modifier|catSmallMask) == modifier | |||
| } | |||
| func (c info) isViramaModifier() bool { | |||
| return c&(attributesMask|catSmallMask) == viramaModifier | |||
| } | |||
| @@ -0,0 +1,168 @@ | |||
| // Copyright 2018 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package socks | |||
| import ( | |||
| "context" | |||
| "errors" | |||
| "io" | |||
| "net" | |||
| "strconv" | |||
| "time" | |||
| ) | |||
| var ( | |||
| noDeadline = time.Time{} | |||
| aLongTimeAgo = time.Unix(1, 0) | |||
| ) | |||
| func (d *Dialer) connect(ctx context.Context, c net.Conn, address string) (_ net.Addr, ctxErr error) { | |||
| host, port, err := splitHostPort(address) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| if deadline, ok := ctx.Deadline(); ok && !deadline.IsZero() { | |||
| c.SetDeadline(deadline) | |||
| defer c.SetDeadline(noDeadline) | |||
| } | |||
| if ctx != context.Background() { | |||
| errCh := make(chan error, 1) | |||
| done := make(chan struct{}) | |||
| defer func() { | |||
| close(done) | |||
| if ctxErr == nil { | |||
| ctxErr = <-errCh | |||
| } | |||
| }() | |||
| go func() { | |||
| select { | |||
| case <-ctx.Done(): | |||
| c.SetDeadline(aLongTimeAgo) | |||
| errCh <- ctx.Err() | |||
| case <-done: | |||
| errCh <- nil | |||
| } | |||
| }() | |||
| } | |||
| b := make([]byte, 0, 6+len(host)) // the size here is just an estimate | |||
| b = append(b, Version5) | |||
| if len(d.AuthMethods) == 0 || d.Authenticate == nil { | |||
| b = append(b, 1, byte(AuthMethodNotRequired)) | |||
| } else { | |||
| ams := d.AuthMethods | |||
| if len(ams) > 255 { | |||
| return nil, errors.New("too many authentication methods") | |||
| } | |||
| b = append(b, byte(len(ams))) | |||
| for _, am := range ams { | |||
| b = append(b, byte(am)) | |||
| } | |||
| } | |||
| if _, ctxErr = c.Write(b); ctxErr != nil { | |||
| return | |||
| } | |||
| if _, ctxErr = io.ReadFull(c, b[:2]); ctxErr != nil { | |||
| return | |||
| } | |||
| if b[0] != Version5 { | |||
| return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) | |||
| } | |||
| am := AuthMethod(b[1]) | |||
| if am == AuthMethodNoAcceptableMethods { | |||
| return nil, errors.New("no acceptable authentication methods") | |||
| } | |||
| if d.Authenticate != nil { | |||
| if ctxErr = d.Authenticate(ctx, c, am); ctxErr != nil { | |||
| return | |||
| } | |||
| } | |||
| b = b[:0] | |||
| b = append(b, Version5, byte(d.cmd), 0) | |||
| if ip := net.ParseIP(host); ip != nil { | |||
| if ip4 := ip.To4(); ip4 != nil { | |||
| b = append(b, AddrTypeIPv4) | |||
| b = append(b, ip4...) | |||
| } else if ip6 := ip.To16(); ip6 != nil { | |||
| b = append(b, AddrTypeIPv6) | |||
| b = append(b, ip6...) | |||
| } else { | |||
| return nil, errors.New("unknown address type") | |||
| } | |||
| } else { | |||
| if len(host) > 255 { | |||
| return nil, errors.New("FQDN too long") | |||
| } | |||
| b = append(b, AddrTypeFQDN) | |||
| b = append(b, byte(len(host))) | |||
| b = append(b, host...) | |||
| } | |||
| b = append(b, byte(port>>8), byte(port)) | |||
| if _, ctxErr = c.Write(b); ctxErr != nil { | |||
| return | |||
| } | |||
| if _, ctxErr = io.ReadFull(c, b[:4]); ctxErr != nil { | |||
| return | |||
| } | |||
| if b[0] != Version5 { | |||
| return nil, errors.New("unexpected protocol version " + strconv.Itoa(int(b[0]))) | |||
| } | |||
| if cmdErr := Reply(b[1]); cmdErr != StatusSucceeded { | |||
| return nil, errors.New("unknown error " + cmdErr.String()) | |||
| } | |||
| if b[2] != 0 { | |||
| return nil, errors.New("non-zero reserved field") | |||
| } | |||
| l := 2 | |||
| var a Addr | |||
| switch b[3] { | |||
| case AddrTypeIPv4: | |||
| l += net.IPv4len | |||
| a.IP = make(net.IP, net.IPv4len) | |||
| case AddrTypeIPv6: | |||
| l += net.IPv6len | |||
| a.IP = make(net.IP, net.IPv6len) | |||
| case AddrTypeFQDN: | |||
| if _, err := io.ReadFull(c, b[:1]); err != nil { | |||
| return nil, err | |||
| } | |||
| l += int(b[0]) | |||
| default: | |||
| return nil, errors.New("unknown address type " + strconv.Itoa(int(b[3]))) | |||
| } | |||
| if cap(b) < l { | |||
| b = make([]byte, l) | |||
| } else { | |||
| b = b[:l] | |||
| } | |||
| if _, ctxErr = io.ReadFull(c, b); ctxErr != nil { | |||
| return | |||
| } | |||
| if a.IP != nil { | |||
| copy(a.IP, b) | |||
| } else { | |||
| a.Name = string(b[:len(b)-2]) | |||
| } | |||
| a.Port = int(b[len(b)-2])<<8 | int(b[len(b)-1]) | |||
| return &a, nil | |||
| } | |||
| func splitHostPort(address string) (string, int, error) { | |||
| host, port, err := net.SplitHostPort(address) | |||
| if err != nil { | |||
| return "", 0, err | |||
| } | |||
| portnum, err := strconv.Atoi(port) | |||
| if err != nil { | |||
| return "", 0, err | |||
| } | |||
| if 1 > portnum || portnum > 0xffff { | |||
| return "", 0, errors.New("port number out of range " + port) | |||
| } | |||
| return host, portnum, nil | |||
| } | |||
| @@ -0,0 +1,317 @@ | |||
| // Copyright 2018 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // Package socks provides a SOCKS version 5 client implementation. | |||
| // | |||
| // SOCKS protocol version 5 is defined in RFC 1928. | |||
| // Username/Password authentication for SOCKS version 5 is defined in | |||
| // RFC 1929. | |||
| package socks | |||
| import ( | |||
| "context" | |||
| "errors" | |||
| "io" | |||
| "net" | |||
| "strconv" | |||
| ) | |||
| // A Command represents a SOCKS command. | |||
| type Command int | |||
| func (cmd Command) String() string { | |||
| switch cmd { | |||
| case CmdConnect: | |||
| return "socks connect" | |||
| case cmdBind: | |||
| return "socks bind" | |||
| default: | |||
| return "socks " + strconv.Itoa(int(cmd)) | |||
| } | |||
| } | |||
| // An AuthMethod represents a SOCKS authentication method. | |||
| type AuthMethod int | |||
| // A Reply represents a SOCKS command reply code. | |||
| type Reply int | |||
| func (code Reply) String() string { | |||
| switch code { | |||
| case StatusSucceeded: | |||
| return "succeeded" | |||
| case 0x01: | |||
| return "general SOCKS server failure" | |||
| case 0x02: | |||
| return "connection not allowed by ruleset" | |||
| case 0x03: | |||
| return "network unreachable" | |||
| case 0x04: | |||
| return "host unreachable" | |||
| case 0x05: | |||
| return "connection refused" | |||
| case 0x06: | |||
| return "TTL expired" | |||
| case 0x07: | |||
| return "command not supported" | |||
| case 0x08: | |||
| return "address type not supported" | |||
| default: | |||
| return "unknown code: " + strconv.Itoa(int(code)) | |||
| } | |||
| } | |||
| // Wire protocol constants. | |||
| const ( | |||
| Version5 = 0x05 | |||
| AddrTypeIPv4 = 0x01 | |||
| AddrTypeFQDN = 0x03 | |||
| AddrTypeIPv6 = 0x04 | |||
| CmdConnect Command = 0x01 // establishes an active-open forward proxy connection | |||
| cmdBind Command = 0x02 // establishes a passive-open forward proxy connection | |||
| AuthMethodNotRequired AuthMethod = 0x00 // no authentication required | |||
| AuthMethodUsernamePassword AuthMethod = 0x02 // use username/password | |||
| AuthMethodNoAcceptableMethods AuthMethod = 0xff // no acceptable authentication methods | |||
| StatusSucceeded Reply = 0x00 | |||
| ) | |||
| // An Addr represents a SOCKS-specific address. | |||
| // Either Name or IP is used exclusively. | |||
| type Addr struct { | |||
| Name string // fully-qualified domain name | |||
| IP net.IP | |||
| Port int | |||
| } | |||
| func (a *Addr) Network() string { return "socks" } | |||
| func (a *Addr) String() string { | |||
| if a == nil { | |||
| return "<nil>" | |||
| } | |||
| port := strconv.Itoa(a.Port) | |||
| if a.IP == nil { | |||
| return net.JoinHostPort(a.Name, port) | |||
| } | |||
| return net.JoinHostPort(a.IP.String(), port) | |||
| } | |||
| // A Conn represents a forward proxy connection. | |||
| type Conn struct { | |||
| net.Conn | |||
| boundAddr net.Addr | |||
| } | |||
| // BoundAddr returns the address assigned by the proxy server for | |||
| // connecting to the command target address from the proxy server. | |||
| func (c *Conn) BoundAddr() net.Addr { | |||
| if c == nil { | |||
| return nil | |||
| } | |||
| return c.boundAddr | |||
| } | |||
| // A Dialer holds SOCKS-specific options. | |||
| type Dialer struct { | |||
| cmd Command // either CmdConnect or cmdBind | |||
| proxyNetwork string // network between a proxy server and a client | |||
| proxyAddress string // proxy server address | |||
| // ProxyDial specifies the optional dial function for | |||
| // establishing the transport connection. | |||
| ProxyDial func(context.Context, string, string) (net.Conn, error) | |||
| // AuthMethods specifies the list of request authention | |||
| // methods. | |||
| // If empty, SOCKS client requests only AuthMethodNotRequired. | |||
| AuthMethods []AuthMethod | |||
| // Authenticate specifies the optional authentication | |||
| // function. It must be non-nil when AuthMethods is not empty. | |||
| // It must return an error when the authentication is failed. | |||
| Authenticate func(context.Context, io.ReadWriter, AuthMethod) error | |||
| } | |||
| // DialContext connects to the provided address on the provided | |||
| // network. | |||
| // | |||
| // The returned error value may be a net.OpError. When the Op field of | |||
| // net.OpError contains "socks", the Source field contains a proxy | |||
| // server address and the Addr field contains a command target | |||
| // address. | |||
| // | |||
| // See func Dial of the net package of standard library for a | |||
| // description of the network and address parameters. | |||
| func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { | |||
| if err := d.validateTarget(network, address); err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| if ctx == nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} | |||
| } | |||
| var err error | |||
| var c net.Conn | |||
| if d.ProxyDial != nil { | |||
| c, err = d.ProxyDial(ctx, d.proxyNetwork, d.proxyAddress) | |||
| } else { | |||
| var dd net.Dialer | |||
| c, err = dd.DialContext(ctx, d.proxyNetwork, d.proxyAddress) | |||
| } | |||
| if err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| a, err := d.connect(ctx, c, address) | |||
| if err != nil { | |||
| c.Close() | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| return &Conn{Conn: c, boundAddr: a}, nil | |||
| } | |||
| // DialWithConn initiates a connection from SOCKS server to the target | |||
| // network and address using the connection c that is already | |||
| // connected to the SOCKS server. | |||
| // | |||
| // It returns the connection's local address assigned by the SOCKS | |||
| // server. | |||
| func (d *Dialer) DialWithConn(ctx context.Context, c net.Conn, network, address string) (net.Addr, error) { | |||
| if err := d.validateTarget(network, address); err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| if ctx == nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: errors.New("nil context")} | |||
| } | |||
| a, err := d.connect(ctx, c, address) | |||
| if err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| return a, nil | |||
| } | |||
| // Dial connects to the provided address on the provided network. | |||
| // | |||
| // Unlike DialContext, it returns a raw transport connection instead | |||
| // of a forward proxy connection. | |||
| // | |||
| // Deprecated: Use DialContext or DialWithConn instead. | |||
| func (d *Dialer) Dial(network, address string) (net.Conn, error) { | |||
| if err := d.validateTarget(network, address); err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| var err error | |||
| var c net.Conn | |||
| if d.ProxyDial != nil { | |||
| c, err = d.ProxyDial(context.Background(), d.proxyNetwork, d.proxyAddress) | |||
| } else { | |||
| c, err = net.Dial(d.proxyNetwork, d.proxyAddress) | |||
| } | |||
| if err != nil { | |||
| proxy, dst, _ := d.pathAddrs(address) | |||
| return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err} | |||
| } | |||
| if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil { | |||
| c.Close() | |||
| return nil, err | |||
| } | |||
| return c, nil | |||
| } | |||
| func (d *Dialer) validateTarget(network, address string) error { | |||
| switch network { | |||
| case "tcp", "tcp6", "tcp4": | |||
| default: | |||
| return errors.New("network not implemented") | |||
| } | |||
| switch d.cmd { | |||
| case CmdConnect, cmdBind: | |||
| default: | |||
| return errors.New("command not implemented") | |||
| } | |||
| return nil | |||
| } | |||
| func (d *Dialer) pathAddrs(address string) (proxy, dst net.Addr, err error) { | |||
| for i, s := range []string{d.proxyAddress, address} { | |||
| host, port, err := splitHostPort(s) | |||
| if err != nil { | |||
| return nil, nil, err | |||
| } | |||
| a := &Addr{Port: port} | |||
| a.IP = net.ParseIP(host) | |||
| if a.IP == nil { | |||
| a.Name = host | |||
| } | |||
| if i == 0 { | |||
| proxy = a | |||
| } else { | |||
| dst = a | |||
| } | |||
| } | |||
| return | |||
| } | |||
| // NewDialer returns a new Dialer that dials through the provided | |||
| // proxy server's network and address. | |||
| func NewDialer(network, address string) *Dialer { | |||
| return &Dialer{proxyNetwork: network, proxyAddress: address, cmd: CmdConnect} | |||
| } | |||
| const ( | |||
| authUsernamePasswordVersion = 0x01 | |||
| authStatusSucceeded = 0x00 | |||
| ) | |||
| // UsernamePassword are the credentials for the username/password | |||
| // authentication method. | |||
| type UsernamePassword struct { | |||
| Username string | |||
| Password string | |||
| } | |||
| // Authenticate authenticates a pair of username and password with the | |||
| // proxy server. | |||
| func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, auth AuthMethod) error { | |||
| switch auth { | |||
| case AuthMethodNotRequired: | |||
| return nil | |||
| case AuthMethodUsernamePassword: | |||
| if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) == 0 || len(up.Password) > 255 { | |||
| return errors.New("invalid username/password") | |||
| } | |||
| b := []byte{authUsernamePasswordVersion} | |||
| b = append(b, byte(len(up.Username))) | |||
| b = append(b, up.Username...) | |||
| b = append(b, byte(len(up.Password))) | |||
| b = append(b, up.Password...) | |||
| // TODO(mikio): handle IO deadlines and cancelation if | |||
| // necessary | |||
| if _, err := rw.Write(b); err != nil { | |||
| return err | |||
| } | |||
| if _, err := io.ReadFull(rw, b[:2]); err != nil { | |||
| return err | |||
| } | |||
| if b[0] != authUsernamePasswordVersion { | |||
| return errors.New("invalid username/password version") | |||
| } | |||
| if b[1] != authStatusSucceeded { | |||
| return errors.New("username/password authentication failed") | |||
| } | |||
| return nil | |||
| } | |||
| return errors.New("unsupported authentication method " + strconv.Itoa(int(auth))) | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package proxy | |||
| import ( | |||
| "context" | |||
| "net" | |||
| ) | |||
| // A ContextDialer dials using a context. | |||
| type ContextDialer interface { | |||
| DialContext(ctx context.Context, network, address string) (net.Conn, error) | |||
| } | |||
| // Dial works like DialContext on net.Dialer but using a dialer returned by FromEnvironment. | |||
| // | |||
| // The passed ctx is only used for returning the Conn, not the lifetime of the Conn. | |||
| // | |||
| // Custom dialers (registered via RegisterDialerType) that do not implement ContextDialer | |||
| // can leak a goroutine for as long as it takes the underlying Dialer implementation to timeout. | |||
| // | |||
| // A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. | |||
| func Dial(ctx context.Context, network, address string) (net.Conn, error) { | |||
| d := FromEnvironment() | |||
| if xd, ok := d.(ContextDialer); ok { | |||
| return xd.DialContext(ctx, network, address) | |||
| } | |||
| return dialContext(ctx, d, network, address) | |||
| } | |||
| // WARNING: this can leak a goroutine for as long as the underlying Dialer implementation takes to timeout | |||
| // A Conn returned from a successful Dial after the context has been cancelled will be immediately closed. | |||
| func dialContext(ctx context.Context, d Dialer, network, address string) (net.Conn, error) { | |||
| var ( | |||
| conn net.Conn | |||
| done = make(chan struct{}, 1) | |||
| err error | |||
| ) | |||
| go func() { | |||
| conn, err = d.Dial(network, address) | |||
| close(done) | |||
| if conn != nil && ctx.Err() != nil { | |||
| conn.Close() | |||
| } | |||
| }() | |||
| select { | |||
| case <-ctx.Done(): | |||
| err = ctx.Err() | |||
| case <-done: | |||
| } | |||
| return conn, err | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| // Copyright 2011 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package proxy | |||
| import ( | |||
| "context" | |||
| "net" | |||
| ) | |||
| type direct struct{} | |||
| // Direct implements Dialer by making network connections directly using net.Dial or net.DialContext. | |||
| var Direct = direct{} | |||
| var ( | |||
| _ Dialer = Direct | |||
| _ ContextDialer = Direct | |||
| ) | |||
| // Dial directly invokes net.Dial with the supplied parameters. | |||
| func (direct) Dial(network, addr string) (net.Conn, error) { | |||
| return net.Dial(network, addr) | |||
| } | |||
| // DialContext instantiates a net.Dialer and invokes its DialContext receiver with the supplied parameters. | |||
| func (direct) DialContext(ctx context.Context, network, addr string) (net.Conn, error) { | |||
| var d net.Dialer | |||
| return d.DialContext(ctx, network, addr) | |||
| } | |||
| @@ -0,0 +1,155 @@ | |||
| // Copyright 2011 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package proxy | |||
| import ( | |||
| "context" | |||
| "net" | |||
| "strings" | |||
| ) | |||
| // A PerHost directs connections to a default Dialer unless the host name | |||
| // requested matches one of a number of exceptions. | |||
| type PerHost struct { | |||
| def, bypass Dialer | |||
| bypassNetworks []*net.IPNet | |||
| bypassIPs []net.IP | |||
| bypassZones []string | |||
| bypassHosts []string | |||
| } | |||
| // NewPerHost returns a PerHost Dialer that directs connections to either | |||
| // defaultDialer or bypass, depending on whether the connection matches one of | |||
| // the configured rules. | |||
| func NewPerHost(defaultDialer, bypass Dialer) *PerHost { | |||
| return &PerHost{ | |||
| def: defaultDialer, | |||
| bypass: bypass, | |||
| } | |||
| } | |||
| // Dial connects to the address addr on the given network through either | |||
| // defaultDialer or bypass. | |||
| func (p *PerHost) Dial(network, addr string) (c net.Conn, err error) { | |||
| host, _, err := net.SplitHostPort(addr) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return p.dialerForRequest(host).Dial(network, addr) | |||
| } | |||
| // DialContext connects to the address addr on the given network through either | |||
| // defaultDialer or bypass. | |||
| func (p *PerHost) DialContext(ctx context.Context, network, addr string) (c net.Conn, err error) { | |||
| host, _, err := net.SplitHostPort(addr) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| d := p.dialerForRequest(host) | |||
| if x, ok := d.(ContextDialer); ok { | |||
| return x.DialContext(ctx, network, addr) | |||
| } | |||
| return dialContext(ctx, d, network, addr) | |||
| } | |||
| func (p *PerHost) dialerForRequest(host string) Dialer { | |||
| if ip := net.ParseIP(host); ip != nil { | |||
| for _, net := range p.bypassNetworks { | |||
| if net.Contains(ip) { | |||
| return p.bypass | |||
| } | |||
| } | |||
| for _, bypassIP := range p.bypassIPs { | |||
| if bypassIP.Equal(ip) { | |||
| return p.bypass | |||
| } | |||
| } | |||
| return p.def | |||
| } | |||
| for _, zone := range p.bypassZones { | |||
| if strings.HasSuffix(host, zone) { | |||
| return p.bypass | |||
| } | |||
| if host == zone[1:] { | |||
| // For a zone ".example.com", we match "example.com" | |||
| // too. | |||
| return p.bypass | |||
| } | |||
| } | |||
| for _, bypassHost := range p.bypassHosts { | |||
| if bypassHost == host { | |||
| return p.bypass | |||
| } | |||
| } | |||
| return p.def | |||
| } | |||
| // AddFromString parses a string that contains comma-separated values | |||
| // specifying hosts that should use the bypass proxy. Each value is either an | |||
| // IP address, a CIDR range, a zone (*.example.com) or a host name | |||
| // (localhost). A best effort is made to parse the string and errors are | |||
| // ignored. | |||
| func (p *PerHost) AddFromString(s string) { | |||
| hosts := strings.Split(s, ",") | |||
| for _, host := range hosts { | |||
| host = strings.TrimSpace(host) | |||
| if len(host) == 0 { | |||
| continue | |||
| } | |||
| if strings.Contains(host, "/") { | |||
| // We assume that it's a CIDR address like 127.0.0.0/8 | |||
| if _, net, err := net.ParseCIDR(host); err == nil { | |||
| p.AddNetwork(net) | |||
| } | |||
| continue | |||
| } | |||
| if ip := net.ParseIP(host); ip != nil { | |||
| p.AddIP(ip) | |||
| continue | |||
| } | |||
| if strings.HasPrefix(host, "*.") { | |||
| p.AddZone(host[1:]) | |||
| continue | |||
| } | |||
| p.AddHost(host) | |||
| } | |||
| } | |||
| // AddIP specifies an IP address that will use the bypass proxy. Note that | |||
| // this will only take effect if a literal IP address is dialed. A connection | |||
| // to a named host will never match an IP. | |||
| func (p *PerHost) AddIP(ip net.IP) { | |||
| p.bypassIPs = append(p.bypassIPs, ip) | |||
| } | |||
| // AddNetwork specifies an IP range that will use the bypass proxy. Note that | |||
| // this will only take effect if a literal IP address is dialed. A connection | |||
| // to a named host will never match. | |||
| func (p *PerHost) AddNetwork(net *net.IPNet) { | |||
| p.bypassNetworks = append(p.bypassNetworks, net) | |||
| } | |||
| // AddZone specifies a DNS suffix that will use the bypass proxy. A zone of | |||
| // "example.com" matches "example.com" and all of its subdomains. | |||
| func (p *PerHost) AddZone(zone string) { | |||
| if strings.HasSuffix(zone, ".") { | |||
| zone = zone[:len(zone)-1] | |||
| } | |||
| if !strings.HasPrefix(zone, ".") { | |||
| zone = "." + zone | |||
| } | |||
| p.bypassZones = append(p.bypassZones, zone) | |||
| } | |||
| // AddHost specifies a host name that will use the bypass proxy. | |||
| func (p *PerHost) AddHost(host string) { | |||
| if strings.HasSuffix(host, ".") { | |||
| host = host[:len(host)-1] | |||
| } | |||
| p.bypassHosts = append(p.bypassHosts, host) | |||
| } | |||
| @@ -0,0 +1,149 @@ | |||
| // Copyright 2011 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // Package proxy provides support for a variety of protocols to proxy network | |||
| // data. | |||
| package proxy // import "golang.org/x/net/proxy" | |||
| import ( | |||
| "errors" | |||
| "net" | |||
| "net/url" | |||
| "os" | |||
| "sync" | |||
| ) | |||
| // A Dialer is a means to establish a connection. | |||
| // Custom dialers should also implement ContextDialer. | |||
| type Dialer interface { | |||
| // Dial connects to the given address via the proxy. | |||
| Dial(network, addr string) (c net.Conn, err error) | |||
| } | |||
| // Auth contains authentication parameters that specific Dialers may require. | |||
| type Auth struct { | |||
| User, Password string | |||
| } | |||
| // FromEnvironment returns the dialer specified by the proxy-related | |||
| // variables in the environment and makes underlying connections | |||
| // directly. | |||
| func FromEnvironment() Dialer { | |||
| return FromEnvironmentUsing(Direct) | |||
| } | |||
| // FromEnvironmentUsing returns the dialer specify by the proxy-related | |||
| // variables in the environment and makes underlying connections | |||
| // using the provided forwarding Dialer (for instance, a *net.Dialer | |||
| // with desired configuration). | |||
| func FromEnvironmentUsing(forward Dialer) Dialer { | |||
| allProxy := allProxyEnv.Get() | |||
| if len(allProxy) == 0 { | |||
| return forward | |||
| } | |||
| proxyURL, err := url.Parse(allProxy) | |||
| if err != nil { | |||
| return forward | |||
| } | |||
| proxy, err := FromURL(proxyURL, forward) | |||
| if err != nil { | |||
| return forward | |||
| } | |||
| noProxy := noProxyEnv.Get() | |||
| if len(noProxy) == 0 { | |||
| return proxy | |||
| } | |||
| perHost := NewPerHost(proxy, forward) | |||
| perHost.AddFromString(noProxy) | |||
| return perHost | |||
| } | |||
| // proxySchemes is a map from URL schemes to a function that creates a Dialer | |||
| // from a URL with such a scheme. | |||
| var proxySchemes map[string]func(*url.URL, Dialer) (Dialer, error) | |||
| // RegisterDialerType takes a URL scheme and a function to generate Dialers from | |||
| // a URL with that scheme and a forwarding Dialer. Registered schemes are used | |||
| // by FromURL. | |||
| func RegisterDialerType(scheme string, f func(*url.URL, Dialer) (Dialer, error)) { | |||
| if proxySchemes == nil { | |||
| proxySchemes = make(map[string]func(*url.URL, Dialer) (Dialer, error)) | |||
| } | |||
| proxySchemes[scheme] = f | |||
| } | |||
| // FromURL returns a Dialer given a URL specification and an underlying | |||
| // Dialer for it to make network requests. | |||
| func FromURL(u *url.URL, forward Dialer) (Dialer, error) { | |||
| var auth *Auth | |||
| if u.User != nil { | |||
| auth = new(Auth) | |||
| auth.User = u.User.Username() | |||
| if p, ok := u.User.Password(); ok { | |||
| auth.Password = p | |||
| } | |||
| } | |||
| switch u.Scheme { | |||
| case "socks5", "socks5h": | |||
| addr := u.Hostname() | |||
| port := u.Port() | |||
| if port == "" { | |||
| port = "1080" | |||
| } | |||
| return SOCKS5("tcp", net.JoinHostPort(addr, port), auth, forward) | |||
| } | |||
| // If the scheme doesn't match any of the built-in schemes, see if it | |||
| // was registered by another package. | |||
| if proxySchemes != nil { | |||
| if f, ok := proxySchemes[u.Scheme]; ok { | |||
| return f(u, forward) | |||
| } | |||
| } | |||
| return nil, errors.New("proxy: unknown scheme: " + u.Scheme) | |||
| } | |||
| var ( | |||
| allProxyEnv = &envOnce{ | |||
| names: []string{"ALL_PROXY", "all_proxy"}, | |||
| } | |||
| noProxyEnv = &envOnce{ | |||
| names: []string{"NO_PROXY", "no_proxy"}, | |||
| } | |||
| ) | |||
| // envOnce looks up an environment variable (optionally by multiple | |||
| // names) once. It mitigates expensive lookups on some platforms | |||
| // (e.g. Windows). | |||
| // (Borrowed from net/http/transport.go) | |||
| type envOnce struct { | |||
| names []string | |||
| once sync.Once | |||
| val string | |||
| } | |||
| func (e *envOnce) Get() string { | |||
| e.once.Do(e.init) | |||
| return e.val | |||
| } | |||
| func (e *envOnce) init() { | |||
| for _, n := range e.names { | |||
| e.val = os.Getenv(n) | |||
| if e.val != "" { | |||
| return | |||
| } | |||
| } | |||
| } | |||
| // reset is used by tests | |||
| func (e *envOnce) reset() { | |||
| e.once = sync.Once{} | |||
| e.val = "" | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| // Copyright 2011 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| package proxy | |||
| import ( | |||
| "context" | |||
| "net" | |||
| "golang.org/x/net/internal/socks" | |||
| ) | |||
| // SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given | |||
| // address with an optional username and password. | |||
| // See RFC 1928 and RFC 1929. | |||
| func SOCKS5(network, address string, auth *Auth, forward Dialer) (Dialer, error) { | |||
| d := socks.NewDialer(network, address) | |||
| if forward != nil { | |||
| if f, ok := forward.(ContextDialer); ok { | |||
| d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { | |||
| return f.DialContext(ctx, network, address) | |||
| } | |||
| } else { | |||
| d.ProxyDial = func(ctx context.Context, network string, address string) (net.Conn, error) { | |||
| return dialContext(ctx, forward, network, address) | |||
| } | |||
| } | |||
| } | |||
| if auth != nil { | |||
| up := socks.UsernamePassword{ | |||
| Username: auth.User, | |||
| Password: auth.Password, | |||
| } | |||
| d.AuthMethods = []socks.AuthMethod{ | |||
| socks.AuthMethodNotRequired, | |||
| socks.AuthMethodUsernamePassword, | |||
| } | |||
| d.Authenticate = up.Authenticate | |||
| } | |||
| return d, nil | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| // Copyright 2018 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !gccgo | |||
| #include "textflag.h" | |||
| // | |||
| // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go | |||
| // | |||
| TEXT ·syscall6(SB),NOSPLIT,$0-88 | |||
| JMP syscall·syscall6(SB) | |||
| TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 | |||
| JMP syscall·rawSyscall6(SB) | |||
| @@ -6,8 +6,6 @@ | |||
| package cpu | |||
| import "golang.org/x/sys/unix" | |||
| const cacheLineSize = 128 | |||
| const ( | |||
| @@ -18,7 +16,7 @@ const ( | |||
| ) | |||
| func init() { | |||
| impl := unix.Getsystemcfg(_SC_IMPL) | |||
| impl := getsystemcfg(_SC_IMPL) | |||
| if impl&_IMPL_POWER8 != 0 { | |||
| PPC64.IsPOWER8 = true | |||
| } | |||
| @@ -28,3 +26,9 @@ func init() { | |||
| Initialized = true | |||
| } | |||
| func getsystemcfg(label int) (n uint64) { | |||
| r0, _ := callgetsystemcfg(label) | |||
| n = uint64(r0) | |||
| return | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // Minimal copy of x/sys/unix so the cpu package can make a | |||
| // system call on AIX without depending on x/sys/unix. | |||
| // (See golang.org/issue/32102) | |||
| // +build aix,ppc64 | |||
| // +build !gccgo | |||
| package cpu | |||
| import ( | |||
| "syscall" | |||
| "unsafe" | |||
| ) | |||
| //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" | |||
| //go:linkname libc_getsystemcfg libc_getsystemcfg | |||
| type syscallFunc uintptr | |||
| var libc_getsystemcfg syscallFunc | |||
| type errno = syscall.Errno | |||
| // Implemented in runtime/syscall_aix.go. | |||
| func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) | |||
| func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) | |||
| func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) | |||
| return | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build riscv64,!gccgo | |||
| #include "textflag.h" | |||
| // | |||
| // System calls for linux/riscv64. | |||
| // | |||
| // Where available, just jump to package syscall's implementation of | |||
| // these functions. | |||
| TEXT ·Syscall(SB),NOSPLIT,$0-56 | |||
| JMP syscall·Syscall(SB) | |||
| TEXT ·Syscall6(SB),NOSPLIT,$0-80 | |||
| JMP syscall·Syscall6(SB) | |||
| TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 | |||
| CALL runtime·entersyscall(SB) | |||
| MOV a1+8(FP), A0 | |||
| MOV a2+16(FP), A1 | |||
| MOV a3+24(FP), A2 | |||
| MOV $0, A3 | |||
| MOV $0, A4 | |||
| MOV $0, A5 | |||
| MOV $0, A6 | |||
| MOV trap+0(FP), A7 // syscall entry | |||
| ECALL | |||
| MOV A0, r1+32(FP) // r1 | |||
| MOV A1, r2+40(FP) // r2 | |||
| CALL runtime·exitsyscall(SB) | |||
| RET | |||
| TEXT ·RawSyscall(SB),NOSPLIT,$0-56 | |||
| JMP syscall·RawSyscall(SB) | |||
| TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 | |||
| JMP syscall·RawSyscall6(SB) | |||
| TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 | |||
| MOV a1+8(FP), A0 | |||
| MOV a2+16(FP), A1 | |||
| MOV a3+24(FP), A2 | |||
| MOV ZERO, A3 | |||
| MOV ZERO, A4 | |||
| MOV ZERO, A5 | |||
| MOV trap+0(FP), A7 // syscall entry | |||
| ECALL | |||
| MOV A0, r1+32(FP) | |||
| MOV A1, r2+40(FP) | |||
| RET | |||
| @@ -0,0 +1,29 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build !gccgo | |||
| #include "textflag.h" | |||
| // | |||
| // System call support for arm64, OpenBSD | |||
| // | |||
| // Just jump to package syscall's implementation for all these functions. | |||
| // The runtime may know about them. | |||
| TEXT ·Syscall(SB),NOSPLIT,$0-56 | |||
| JMP syscall·Syscall(SB) | |||
| TEXT ·Syscall6(SB),NOSPLIT,$0-80 | |||
| JMP syscall·Syscall6(SB) | |||
| TEXT ·Syscall9(SB),NOSPLIT,$0-104 | |||
| JMP syscall·Syscall9(SB) | |||
| TEXT ·RawSyscall(SB),NOSPLIT,$0-56 | |||
| JMP syscall·RawSyscall(SB) | |||
| TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 | |||
| JMP syscall·RawSyscall6(SB) | |||
| @@ -105,25 +105,25 @@ dragonfly_amd64) | |||
| freebsd_386) | |||
| mkerrors="$mkerrors -m32" | |||
| mksyscall="go run mksyscall.go -l32" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| freebsd_amd64) | |||
| mkerrors="$mkerrors -m64" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| freebsd_arm) | |||
| mkerrors="$mkerrors" | |||
| mksyscall="go run mksyscall.go -l32 -arm" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" | |||
| # Let the type of C char be signed for making the bare syscall | |||
| # API consistent across platforms. | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" | |||
| ;; | |||
| freebsd_arm64) | |||
| mkerrors="$mkerrors -m64" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" | |||
| mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| netbsd_386) | |||
| @@ -146,24 +146,39 @@ netbsd_arm) | |||
| # API consistent across platforms. | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" | |||
| ;; | |||
| netbsd_arm64) | |||
| mkerrors="$mkerrors -m64" | |||
| mksyscall="go run mksyscall.go -netbsd" | |||
| mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| openbsd_386) | |||
| mkerrors="$mkerrors -m32" | |||
| mksyscall="go run mksyscall.go -l32 -openbsd" | |||
| mksysctl="./mksysctl_openbsd.pl" | |||
| mksysctl="go run mksysctl_openbsd.go" | |||
| mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| openbsd_amd64) | |||
| mkerrors="$mkerrors -m64" | |||
| mksyscall="go run mksyscall.go -openbsd" | |||
| mksysctl="./mksysctl_openbsd.pl" | |||
| mksysctl="go run mksysctl_openbsd.go" | |||
| mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs" | |||
| ;; | |||
| openbsd_arm) | |||
| mkerrors="$mkerrors" | |||
| mksyscall="go run mksyscall.go -l32 -openbsd -arm" | |||
| mksysctl="./mksysctl_openbsd.pl" | |||
| mksysctl="go run mksysctl_openbsd.go" | |||
| mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" | |||
| # Let the type of C char be signed for making the bare syscall | |||
| # API consistent across platforms. | |||
| mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" | |||
| ;; | |||
| openbsd_arm64) | |||
| mkerrors="$mkerrors -m64" | |||
| mksyscall="go run mksyscall.go -openbsd" | |||
| mksysctl="go run mksysctl_openbsd.go" | |||
| mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" | |||
| # Let the type of C char be signed for making the bare syscall | |||
| # API consistent across platforms. | |||
| @@ -182,6 +182,7 @@ struct ltchars { | |||
| #include <sys/signalfd.h> | |||
| #include <sys/socket.h> | |||
| #include <sys/xattr.h> | |||
| #include <linux/bpf.h> | |||
| #include <linux/errqueue.h> | |||
| #include <linux/if.h> | |||
| #include <linux/if_alg.h> | |||
| @@ -222,6 +223,7 @@ struct ltchars { | |||
| #include <linux/hdreg.h> | |||
| #include <linux/rtc.h> | |||
| #include <linux/if_xdp.h> | |||
| #include <linux/cryptouser.h> | |||
| #include <mtd/ubi-user.h> | |||
| #include <net/route.h> | |||
| @@ -432,7 +434,7 @@ ccflags="$@" | |||
| $2 ~ /^TC[IO](ON|OFF)$/ || | |||
| $2 ~ /^IN_/ || | |||
| $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || | |||
| $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || | |||
| $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || | |||
| $2 ~ /^TP_STATUS_/ || | |||
| $2 ~ /^FALLOC_/ || | |||
| $2 == "ICMPV6_FILTER" || | |||
| @@ -465,7 +467,7 @@ ccflags="$@" | |||
| $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || | |||
| $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || | |||
| $2 ~ /^CLONE_[A-Z_]+/ || | |||
| $2 !~ /^(BPF_TIMEVAL)$/ && | |||
| $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && | |||
| $2 ~ /^(BPF|DLT)_/ || | |||
| $2 ~ /^(CLOCK|TIMER)_/ || | |||
| $2 ~ /^CAN_/ || | |||
| @@ -499,6 +501,7 @@ ccflags="$@" | |||
| $2 ~ /^NFN/ || | |||
| $2 ~ /^XDP_/ || | |||
| $2 ~ /^(HDIO|WIN|SMART)_/ || | |||
| $2 ~ /^CRYPTO_/ || | |||
| $2 !~ "WMESGLEN" && | |||
| $2 ~ /^W[A-Z0-9]+$/ || | |||
| $2 ~/^PPPIOC/ || | |||
| @@ -42,6 +42,13 @@ func main() { | |||
| log.Fatal(err) | |||
| } | |||
| if goos == "aix" { | |||
| // Replace type of Atim, Mtim and Ctim by Timespec in Stat_t | |||
| // to avoid having both StTimespec and Timespec. | |||
| sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`) | |||
| b = sttimespec.ReplaceAll(b, []byte("Timespec")) | |||
| } | |||
| // Intentionally export __val fields in Fsid and Sigset_t | |||
| valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`) | |||
| b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}")) | |||
| @@ -96,6 +103,15 @@ func main() { | |||
| cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`) | |||
| b = cgoCommandRegex.ReplaceAll(b, []byte(replacement)) | |||
| // Rename Stat_t time fields | |||
| if goos == "freebsd" && goarch == "386" { | |||
| // Hide Stat_t.[AMCB]tim_ext fields | |||
| renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`) | |||
| b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_")) | |||
| } | |||
| renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`) | |||
| b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}")) | |||
| // gofmt | |||
| b, err = format.Source(b) | |||
| if err != nil { | |||
| @@ -214,6 +214,11 @@ func main() { | |||
| } | |||
| if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" { | |||
| if sysname == "select" { | |||
| // select is a keyword of Go. Its name is | |||
| // changed to c_select. | |||
| cExtern += "#define c_select select\n" | |||
| } | |||
| // Imports of system calls from libc | |||
| cExtern += fmt.Sprintf("%s %s", cRettype, sysname) | |||
| cIn := strings.Join(cIn, ", ") | |||
| @@ -328,7 +333,13 @@ func main() { | |||
| } else { | |||
| call += "" | |||
| } | |||
| call += fmt.Sprintf("C.%s(%s)", sysname, arglist) | |||
| if sysname == "select" { | |||
| // select is a keyword of Go. Its name is | |||
| // changed to c_select. | |||
| call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist) | |||
| } else { | |||
| call += fmt.Sprintf("C.%s(%s)", sysname, arglist) | |||
| } | |||
| // Assign return values. | |||
| body := "" | |||
| @@ -282,6 +282,11 @@ func main() { | |||
| if !onlyCommon { | |||
| // GCCGO Prototype Generation | |||
| // Imports of system calls from libc | |||
| if sysname == "select" { | |||
| // select is a keyword of Go. Its name is | |||
| // changed to c_select. | |||
| cExtern += "#define c_select select\n" | |||
| } | |||
| cExtern += fmt.Sprintf("%s %s", cRettype, sysname) | |||
| cIn := strings.Join(cIn, ", ") | |||
| cExtern += fmt.Sprintf("(%s);\n", cIn) | |||
| @@ -490,7 +495,14 @@ func main() { | |||
| // GCCGO function generation | |||
| argsgccgolist := strings.Join(argsgccgo, ", ") | |||
| callgccgo := fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) | |||
| var callgccgo string | |||
| if sysname == "select" { | |||
| // select is a keyword of Go. Its name is | |||
| // changed to c_select. | |||
| callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist) | |||
| } else { | |||
| callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) | |||
| } | |||
| textgccgo += callProto | |||
| textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo) | |||
| textgccgo += "\te1 = syscall.GetErrno()\n" | |||
| @@ -0,0 +1,355 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build ignore | |||
| // Parse the header files for OpenBSD and generate a Go usable sysctl MIB. | |||
| // | |||
| // Build a MIB with each entry being an array containing the level, type and | |||
| // a hash that will contain additional entries if the current entry is a node. | |||
| // We then walk this MIB and create a flattened sysctl name to OID hash. | |||
| package main | |||
| import ( | |||
| "bufio" | |||
| "fmt" | |||
| "os" | |||
| "path/filepath" | |||
| "regexp" | |||
| "sort" | |||
| "strings" | |||
| ) | |||
| var ( | |||
| goos, goarch string | |||
| ) | |||
| // cmdLine returns this programs's commandline arguments. | |||
| func cmdLine() string { | |||
| return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ") | |||
| } | |||
| // buildTags returns build tags. | |||
| func buildTags() string { | |||
| return fmt.Sprintf("%s,%s", goarch, goos) | |||
| } | |||
| // reMatch performs regular expression match and stores the substring slice to value pointed by m. | |||
| func reMatch(re *regexp.Regexp, str string, m *[]string) bool { | |||
| *m = re.FindStringSubmatch(str) | |||
| if *m != nil { | |||
| return true | |||
| } | |||
| return false | |||
| } | |||
| type nodeElement struct { | |||
| n int | |||
| t string | |||
| pE *map[string]nodeElement | |||
| } | |||
| var ( | |||
| debugEnabled bool | |||
| mib map[string]nodeElement | |||
| node *map[string]nodeElement | |||
| nodeMap map[string]string | |||
| sysCtl []string | |||
| ) | |||
| var ( | |||
| ctlNames1RE = regexp.MustCompile(`^#define\s+(CTL_NAMES)\s+{`) | |||
| ctlNames2RE = regexp.MustCompile(`^#define\s+(CTL_(.*)_NAMES)\s+{`) | |||
| ctlNames3RE = regexp.MustCompile(`^#define\s+((.*)CTL_NAMES)\s+{`) | |||
| netInetRE = regexp.MustCompile(`^netinet/`) | |||
| netInet6RE = regexp.MustCompile(`^netinet6/`) | |||
| netRE = regexp.MustCompile(`^net/`) | |||
| bracesRE = regexp.MustCompile(`{.*}`) | |||
| ctlTypeRE = regexp.MustCompile(`{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}`) | |||
| fsNetKernRE = regexp.MustCompile(`^(fs|net|kern)_`) | |||
| ) | |||
| func debug(s string) { | |||
| if debugEnabled { | |||
| fmt.Fprintln(os.Stderr, s) | |||
| } | |||
| } | |||
| // Walk the MIB and build a sysctl name to OID mapping. | |||
| func buildSysctl(pNode *map[string]nodeElement, name string, oid []int) { | |||
| lNode := pNode // local copy of pointer to node | |||
| var keys []string | |||
| for k := range *lNode { | |||
| keys = append(keys, k) | |||
| } | |||
| sort.Strings(keys) | |||
| for _, key := range keys { | |||
| nodename := name | |||
| if name != "" { | |||
| nodename += "." | |||
| } | |||
| nodename += key | |||
| nodeoid := append(oid, (*pNode)[key].n) | |||
| if (*pNode)[key].t == `CTLTYPE_NODE` { | |||
| if _, ok := nodeMap[nodename]; ok { | |||
| lNode = &mib | |||
| ctlName := nodeMap[nodename] | |||
| for _, part := range strings.Split(ctlName, ".") { | |||
| lNode = ((*lNode)[part]).pE | |||
| } | |||
| } else { | |||
| lNode = (*pNode)[key].pE | |||
| } | |||
| buildSysctl(lNode, nodename, nodeoid) | |||
| } else if (*pNode)[key].t != "" { | |||
| oidStr := []string{} | |||
| for j := range nodeoid { | |||
| oidStr = append(oidStr, fmt.Sprintf("%d", nodeoid[j])) | |||
| } | |||
| text := "\t{ \"" + nodename + "\", []_C_int{ " + strings.Join(oidStr, ", ") + " } }, \n" | |||
| sysCtl = append(sysCtl, text) | |||
| } | |||
| } | |||
| } | |||
| func main() { | |||
| // Get the OS (using GOOS_TARGET if it exist) | |||
| goos = os.Getenv("GOOS_TARGET") | |||
| if goos == "" { | |||
| goos = os.Getenv("GOOS") | |||
| } | |||
| // Get the architecture (using GOARCH_TARGET if it exists) | |||
| goarch = os.Getenv("GOARCH_TARGET") | |||
| if goarch == "" { | |||
| goarch = os.Getenv("GOARCH") | |||
| } | |||
| // Check if GOOS and GOARCH environment variables are defined | |||
| if goarch == "" || goos == "" { | |||
| fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n") | |||
| os.Exit(1) | |||
| } | |||
| mib = make(map[string]nodeElement) | |||
| headers := [...]string{ | |||
| `sys/sysctl.h`, | |||
| `sys/socket.h`, | |||
| `sys/tty.h`, | |||
| `sys/malloc.h`, | |||
| `sys/mount.h`, | |||
| `sys/namei.h`, | |||
| `sys/sem.h`, | |||
| `sys/shm.h`, | |||
| `sys/vmmeter.h`, | |||
| `uvm/uvmexp.h`, | |||
| `uvm/uvm_param.h`, | |||
| `uvm/uvm_swap_encrypt.h`, | |||
| `ddb/db_var.h`, | |||
| `net/if.h`, | |||
| `net/if_pfsync.h`, | |||
| `net/pipex.h`, | |||
| `netinet/in.h`, | |||
| `netinet/icmp_var.h`, | |||
| `netinet/igmp_var.h`, | |||
| `netinet/ip_ah.h`, | |||
| `netinet/ip_carp.h`, | |||
| `netinet/ip_divert.h`, | |||
| `netinet/ip_esp.h`, | |||
| `netinet/ip_ether.h`, | |||
| `netinet/ip_gre.h`, | |||
| `netinet/ip_ipcomp.h`, | |||
| `netinet/ip_ipip.h`, | |||
| `netinet/pim_var.h`, | |||
| `netinet/tcp_var.h`, | |||
| `netinet/udp_var.h`, | |||
| `netinet6/in6.h`, | |||
| `netinet6/ip6_divert.h`, | |||
| `netinet6/pim6_var.h`, | |||
| `netinet/icmp6.h`, | |||
| `netmpls/mpls.h`, | |||
| } | |||
| ctls := [...]string{ | |||
| `kern`, | |||
| `vm`, | |||
| `fs`, | |||
| `net`, | |||
| //debug /* Special handling required */ | |||
| `hw`, | |||
| //machdep /* Arch specific */ | |||
| `user`, | |||
| `ddb`, | |||
| //vfs /* Special handling required */ | |||
| `fs.posix`, | |||
| `kern.forkstat`, | |||
| `kern.intrcnt`, | |||
| `kern.malloc`, | |||
| `kern.nchstats`, | |||
| `kern.seminfo`, | |||
| `kern.shminfo`, | |||
| `kern.timecounter`, | |||
| `kern.tty`, | |||
| `kern.watchdog`, | |||
| `net.bpf`, | |||
| `net.ifq`, | |||
| `net.inet`, | |||
| `net.inet.ah`, | |||
| `net.inet.carp`, | |||
| `net.inet.divert`, | |||
| `net.inet.esp`, | |||
| `net.inet.etherip`, | |||
| `net.inet.gre`, | |||
| `net.inet.icmp`, | |||
| `net.inet.igmp`, | |||
| `net.inet.ip`, | |||
| `net.inet.ip.ifq`, | |||
| `net.inet.ipcomp`, | |||
| `net.inet.ipip`, | |||
| `net.inet.mobileip`, | |||
| `net.inet.pfsync`, | |||
| `net.inet.pim`, | |||
| `net.inet.tcp`, | |||
| `net.inet.udp`, | |||
| `net.inet6`, | |||
| `net.inet6.divert`, | |||
| `net.inet6.ip6`, | |||
| `net.inet6.icmp6`, | |||
| `net.inet6.pim6`, | |||
| `net.inet6.tcp6`, | |||
| `net.inet6.udp6`, | |||
| `net.mpls`, | |||
| `net.mpls.ifq`, | |||
| `net.key`, | |||
| `net.pflow`, | |||
| `net.pfsync`, | |||
| `net.pipex`, | |||
| `net.rt`, | |||
| `vm.swapencrypt`, | |||
| //vfsgenctl /* Special handling required */ | |||
| } | |||
| // Node name "fixups" | |||
| ctlMap := map[string]string{ | |||
| "ipproto": "net.inet", | |||
| "net.inet.ipproto": "net.inet", | |||
| "net.inet6.ipv6proto": "net.inet6", | |||
| "net.inet6.ipv6": "net.inet6.ip6", | |||
| "net.inet.icmpv6": "net.inet6.icmp6", | |||
| "net.inet6.divert6": "net.inet6.divert", | |||
| "net.inet6.tcp6": "net.inet.tcp", | |||
| "net.inet6.udp6": "net.inet.udp", | |||
| "mpls": "net.mpls", | |||
| "swpenc": "vm.swapencrypt", | |||
| } | |||
| // Node mappings | |||
| nodeMap = map[string]string{ | |||
| "net.inet.ip.ifq": "net.ifq", | |||
| "net.inet.pfsync": "net.pfsync", | |||
| "net.mpls.ifq": "net.ifq", | |||
| } | |||
| mCtls := make(map[string]bool) | |||
| for _, ctl := range ctls { | |||
| mCtls[ctl] = true | |||
| } | |||
| for _, header := range headers { | |||
| debug("Processing " + header) | |||
| file, err := os.Open(filepath.Join("/usr/include", header)) | |||
| if err != nil { | |||
| fmt.Fprintf(os.Stderr, "%v\n", err) | |||
| os.Exit(1) | |||
| } | |||
| s := bufio.NewScanner(file) | |||
| for s.Scan() { | |||
| var sub []string | |||
| if reMatch(ctlNames1RE, s.Text(), &sub) || | |||
| reMatch(ctlNames2RE, s.Text(), &sub) || | |||
| reMatch(ctlNames3RE, s.Text(), &sub) { | |||
| if sub[1] == `CTL_NAMES` { | |||
| // Top level. | |||
| node = &mib | |||
| } else { | |||
| // Node. | |||
| nodename := strings.ToLower(sub[2]) | |||
| ctlName := "" | |||
| if reMatch(netInetRE, header, &sub) { | |||
| ctlName = "net.inet." + nodename | |||
| } else if reMatch(netInet6RE, header, &sub) { | |||
| ctlName = "net.inet6." + nodename | |||
| } else if reMatch(netRE, header, &sub) { | |||
| ctlName = "net." + nodename | |||
| } else { | |||
| ctlName = nodename | |||
| ctlName = fsNetKernRE.ReplaceAllString(ctlName, `$1.`) | |||
| } | |||
| if val, ok := ctlMap[ctlName]; ok { | |||
| ctlName = val | |||
| } | |||
| if _, ok := mCtls[ctlName]; !ok { | |||
| debug("Ignoring " + ctlName + "...") | |||
| continue | |||
| } | |||
| // Walk down from the top of the MIB. | |||
| node = &mib | |||
| for _, part := range strings.Split(ctlName, ".") { | |||
| if _, ok := (*node)[part]; !ok { | |||
| debug("Missing node " + part) | |||
| (*node)[part] = nodeElement{n: 0, t: "", pE: &map[string]nodeElement{}} | |||
| } | |||
| node = (*node)[part].pE | |||
| } | |||
| } | |||
| // Populate current node with entries. | |||
| i := -1 | |||
| for !strings.HasPrefix(s.Text(), "}") { | |||
| s.Scan() | |||
| if reMatch(bracesRE, s.Text(), &sub) { | |||
| i++ | |||
| } | |||
| if !reMatch(ctlTypeRE, s.Text(), &sub) { | |||
| continue | |||
| } | |||
| (*node)[sub[1]] = nodeElement{n: i, t: sub[2], pE: &map[string]nodeElement{}} | |||
| } | |||
| } | |||
| } | |||
| err = s.Err() | |||
| if err != nil { | |||
| fmt.Fprintf(os.Stderr, "%v\n", err) | |||
| os.Exit(1) | |||
| } | |||
| file.Close() | |||
| } | |||
| buildSysctl(&mib, "", []int{}) | |||
| sort.Strings(sysCtl) | |||
| text := strings.Join(sysCtl, "") | |||
| fmt.Printf(srcTemplate, cmdLine(), buildTags(), text) | |||
| } | |||
| const srcTemplate = `// %s | |||
| // Code generated by the command above; DO NOT EDIT. | |||
| // +build %s | |||
| package unix | |||
| type mibentry struct { | |||
| ctlname string | |||
| ctloid []_C_int | |||
| } | |||
| var sysctlMib = []mibentry { | |||
| %s | |||
| } | |||
| ` | |||
| @@ -1,265 +0,0 @@ | |||
| #!/usr/bin/env perl | |||
| # Copyright 2011 The Go Authors. All rights reserved. | |||
| # Use of this source code is governed by a BSD-style | |||
| # license that can be found in the LICENSE file. | |||
| # | |||
| # Parse the header files for OpenBSD and generate a Go usable sysctl MIB. | |||
| # | |||
| # Build a MIB with each entry being an array containing the level, type and | |||
| # a hash that will contain additional entries if the current entry is a node. | |||
| # We then walk this MIB and create a flattened sysctl name to OID hash. | |||
| # | |||
| use strict; | |||
| if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { | |||
| print STDERR "GOARCH or GOOS not defined in environment\n"; | |||
| exit 1; | |||
| } | |||
| my $debug = 0; | |||
| my %ctls = (); | |||
| my @headers = qw ( | |||
| sys/sysctl.h | |||
| sys/socket.h | |||
| sys/tty.h | |||
| sys/malloc.h | |||
| sys/mount.h | |||
| sys/namei.h | |||
| sys/sem.h | |||
| sys/shm.h | |||
| sys/vmmeter.h | |||
| uvm/uvmexp.h | |||
| uvm/uvm_param.h | |||
| uvm/uvm_swap_encrypt.h | |||
| ddb/db_var.h | |||
| net/if.h | |||
| net/if_pfsync.h | |||
| net/pipex.h | |||
| netinet/in.h | |||
| netinet/icmp_var.h | |||
| netinet/igmp_var.h | |||
| netinet/ip_ah.h | |||
| netinet/ip_carp.h | |||
| netinet/ip_divert.h | |||
| netinet/ip_esp.h | |||
| netinet/ip_ether.h | |||
| netinet/ip_gre.h | |||
| netinet/ip_ipcomp.h | |||
| netinet/ip_ipip.h | |||
| netinet/pim_var.h | |||
| netinet/tcp_var.h | |||
| netinet/udp_var.h | |||
| netinet6/in6.h | |||
| netinet6/ip6_divert.h | |||
| netinet6/pim6_var.h | |||
| netinet/icmp6.h | |||
| netmpls/mpls.h | |||
| ); | |||
| my @ctls = qw ( | |||
| kern | |||
| vm | |||
| fs | |||
| net | |||
| #debug # Special handling required | |||
| hw | |||
| #machdep # Arch specific | |||
| user | |||
| ddb | |||
| #vfs # Special handling required | |||
| fs.posix | |||
| kern.forkstat | |||
| kern.intrcnt | |||
| kern.malloc | |||
| kern.nchstats | |||
| kern.seminfo | |||
| kern.shminfo | |||
| kern.timecounter | |||
| kern.tty | |||
| kern.watchdog | |||
| net.bpf | |||
| net.ifq | |||
| net.inet | |||
| net.inet.ah | |||
| net.inet.carp | |||
| net.inet.divert | |||
| net.inet.esp | |||
| net.inet.etherip | |||
| net.inet.gre | |||
| net.inet.icmp | |||
| net.inet.igmp | |||
| net.inet.ip | |||
| net.inet.ip.ifq | |||
| net.inet.ipcomp | |||
| net.inet.ipip | |||
| net.inet.mobileip | |||
| net.inet.pfsync | |||
| net.inet.pim | |||
| net.inet.tcp | |||
| net.inet.udp | |||
| net.inet6 | |||
| net.inet6.divert | |||
| net.inet6.ip6 | |||
| net.inet6.icmp6 | |||
| net.inet6.pim6 | |||
| net.inet6.tcp6 | |||
| net.inet6.udp6 | |||
| net.mpls | |||
| net.mpls.ifq | |||
| net.key | |||
| net.pflow | |||
| net.pfsync | |||
| net.pipex | |||
| net.rt | |||
| vm.swapencrypt | |||
| #vfsgenctl # Special handling required | |||
| ); | |||
| # Node name "fixups" | |||
| my %ctl_map = ( | |||
| "ipproto" => "net.inet", | |||
| "net.inet.ipproto" => "net.inet", | |||
| "net.inet6.ipv6proto" => "net.inet6", | |||
| "net.inet6.ipv6" => "net.inet6.ip6", | |||
| "net.inet.icmpv6" => "net.inet6.icmp6", | |||
| "net.inet6.divert6" => "net.inet6.divert", | |||
| "net.inet6.tcp6" => "net.inet.tcp", | |||
| "net.inet6.udp6" => "net.inet.udp", | |||
| "mpls" => "net.mpls", | |||
| "swpenc" => "vm.swapencrypt" | |||
| ); | |||
| # Node mappings | |||
| my %node_map = ( | |||
| "net.inet.ip.ifq" => "net.ifq", | |||
| "net.inet.pfsync" => "net.pfsync", | |||
| "net.mpls.ifq" => "net.ifq" | |||
| ); | |||
| my $ctlname; | |||
| my %mib = (); | |||
| my %sysctl = (); | |||
| my $node; | |||
| sub debug() { | |||
| print STDERR "$_[0]\n" if $debug; | |||
| } | |||
| # Walk the MIB and build a sysctl name to OID mapping. | |||
| sub build_sysctl() { | |||
| my ($node, $name, $oid) = @_; | |||
| my %node = %{$node}; | |||
| my @oid = @{$oid}; | |||
| foreach my $key (sort keys %node) { | |||
| my @node = @{$node{$key}}; | |||
| my $nodename = $name.($name ne '' ? '.' : '').$key; | |||
| my @nodeoid = (@oid, $node[0]); | |||
| if ($node[1] eq 'CTLTYPE_NODE') { | |||
| if (exists $node_map{$nodename}) { | |||
| $node = \%mib; | |||
| $ctlname = $node_map{$nodename}; | |||
| foreach my $part (split /\./, $ctlname) { | |||
| $node = \%{@{$$node{$part}}[2]}; | |||
| } | |||
| } else { | |||
| $node = $node[2]; | |||
| } | |||
| &build_sysctl($node, $nodename, \@nodeoid); | |||
| } elsif ($node[1] ne '') { | |||
| $sysctl{$nodename} = \@nodeoid; | |||
| } | |||
| } | |||
| } | |||
| foreach my $ctl (@ctls) { | |||
| $ctls{$ctl} = $ctl; | |||
| } | |||
| # Build MIB | |||
| foreach my $header (@headers) { | |||
| &debug("Processing $header..."); | |||
| open HEADER, "/usr/include/$header" || | |||
| print STDERR "Failed to open $header\n"; | |||
| while (<HEADER>) { | |||
| if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ || | |||
| $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ || | |||
| $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) { | |||
| if ($1 eq 'CTL_NAMES') { | |||
| # Top level. | |||
| $node = \%mib; | |||
| } else { | |||
| # Node. | |||
| my $nodename = lc($2); | |||
| if ($header =~ /^netinet\//) { | |||
| $ctlname = "net.inet.$nodename"; | |||
| } elsif ($header =~ /^netinet6\//) { | |||
| $ctlname = "net.inet6.$nodename"; | |||
| } elsif ($header =~ /^net\//) { | |||
| $ctlname = "net.$nodename"; | |||
| } else { | |||
| $ctlname = "$nodename"; | |||
| $ctlname =~ s/^(fs|net|kern)_/$1\./; | |||
| } | |||
| if (exists $ctl_map{$ctlname}) { | |||
| $ctlname = $ctl_map{$ctlname}; | |||
| } | |||
| if (not exists $ctls{$ctlname}) { | |||
| &debug("Ignoring $ctlname..."); | |||
| next; | |||
| } | |||
| # Walk down from the top of the MIB. | |||
| $node = \%mib; | |||
| foreach my $part (split /\./, $ctlname) { | |||
| if (not exists $$node{$part}) { | |||
| &debug("Missing node $part"); | |||
| $$node{$part} = [ 0, '', {} ]; | |||
| } | |||
| $node = \%{@{$$node{$part}}[2]}; | |||
| } | |||
| } | |||
| # Populate current node with entries. | |||
| my $i = -1; | |||
| while (defined($_) && $_ !~ /^}/) { | |||
| $_ = <HEADER>; | |||
| $i++ if $_ =~ /{.*}/; | |||
| next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/; | |||
| $$node{$1} = [ $i, $2, {} ]; | |||
| } | |||
| } | |||
| } | |||
| close HEADER; | |||
| } | |||
| &build_sysctl(\%mib, "", []); | |||
| print <<EOF; | |||
| // mksysctl_openbsd.pl | |||
| // Code generated by the command above; DO NOT EDIT. | |||
| // +build $ENV{'GOARCH'},$ENV{'GOOS'} | |||
| package unix; | |||
| type mibentry struct { | |||
| ctlname string | |||
| ctloid []_C_int | |||
| } | |||
| var sysctlMib = []mibentry { | |||
| EOF | |||
| foreach my $name (sort keys %sysctl) { | |||
| my @oid = @{$sysctl{$name}}; | |||
| print "\t{ \"$name\", []_C_int{ ", join(', ', @oid), " } }, \n"; | |||
| } | |||
| print <<EOF; | |||
| } | |||
| EOF | |||
| @@ -139,7 +139,7 @@ func main() { | |||
| text += format(name, num, proto) | |||
| } | |||
| case "freebsd": | |||
| if t.Match(`^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$`) { | |||
| if t.Match(`^([0-9]+)\s+\S+\s+(?:(?:NO)?STD|COMPAT10)\s+({ \S+\s+(\w+).*)$`) { | |||
| num, proto := t.sub[1], t.sub[2] | |||
| name := fmt.Sprintf("SYS_%s", t.sub[3]) | |||
| text += format(name, num, proto) | |||
| @@ -2,9 +2,6 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build openbsd | |||
| // +build 386 amd64 arm | |||
| package unix | |||
| import ( | |||
| @@ -18,10 +18,13 @@ func cmsgAlignOf(salen int) int { | |||
| salign := SizeofPtr | |||
| switch runtime.GOOS { | |||
| case "darwin", "dragonfly", "solaris": | |||
| // NOTE: It seems like 64-bit Darwin, DragonFly BSD and | |||
| // Solaris kernels still require 32-bit aligned access to | |||
| // network subsystem. | |||
| case "aix": | |||
| // There is no alignment on AIX. | |||
| salign = 1 | |||
| case "darwin", "dragonfly", "solaris", "illumos": | |||
| // NOTE: It seems like 64-bit Darwin, DragonFly BSD, | |||
| // illumos, and Solaris kernels still require 32-bit | |||
| // aligned access to network subsystem. | |||
| if SizeofPtr == 8 { | |||
| salign = 4 | |||
| } | |||
| @@ -50,5 +50,4 @@ func BytePtrFromString(s string) (*byte, error) { | |||
| } | |||
| // Single-word zero for use when we need a valid pointer to 0 bytes. | |||
| // See mkunix.pl. | |||
| var _zero uintptr | |||
| @@ -444,8 +444,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
| //sysnb Times(tms *Tms) (ticks uintptr, err error) | |||
| //sysnb Umask(mask int) (oldmask int) | |||
| //sysnb Uname(buf *Utsname) (err error) | |||
| //TODO umount | |||
| // //sys Unmount(target string, flags int) (err error) = umount | |||
| //sys Unlink(path string) (err error) | |||
| //sys Unlinkat(dirfd int, path string, flags int) (err error) | |||
| //sys Ustat(dev int, ubuf *Ustat_t) (err error) | |||
| @@ -456,8 +454,8 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
| //sys Dup2(oldfd int, newfd int) (err error) | |||
| //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64 | |||
| //sys Fchown(fd int, uid int, gid int) (err error) | |||
| //sys Fstat(fd int, stat *Stat_t) (err error) | |||
| //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat | |||
| //sys fstat(fd int, stat *Stat_t) (err error) | |||
| //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat | |||
| //sys Fstatfs(fd int, buf *Statfs_t) (err error) | |||
| //sys Ftruncate(fd int, length int64) (err error) | |||
| //sysnb Getegid() (egid int) | |||
| @@ -466,18 +464,17 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
| //sysnb Getuid() (uid int) | |||
| //sys Lchown(path string, uid int, gid int) (err error) | |||
| //sys Listen(s int, n int) (err error) | |||
| //sys Lstat(path string, stat *Stat_t) (err error) | |||
| //sys lstat(path string, stat *Stat_t) (err error) | |||
| //sys Pause() (err error) | |||
| //sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64 | |||
| //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64 | |||
| //TODO Select | |||
| // //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) | |||
| //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) | |||
| //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) | |||
| //sysnb Setregid(rgid int, egid int) (err error) | |||
| //sysnb Setreuid(ruid int, euid int) (err error) | |||
| //sys Shutdown(fd int, how int) (err error) | |||
| //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) | |||
| //sys Stat(path string, stat *Stat_t) (err error) | |||
| //sys stat(path string, statptr *Stat_t) (err error) | |||
| //sys Statfs(path string, buf *Statfs_t) (err error) | |||
| //sys Truncate(path string, length int64) (err error) | |||
| @@ -493,8 +490,10 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) { | |||
| //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) | |||
| //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) | |||
| //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) | |||
| //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) | |||
| //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) | |||
| // In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used. | |||
| //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg | |||
| //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg | |||
| //sys munmap(addr uintptr, length uintptr) (err error) | |||
| @@ -547,3 +546,12 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { | |||
| //sys Utime(path string, buf *Utimbuf) (err error) | |||
| //sys Getsystemcfg(label int) (n uint64) | |||
| //sys umount(target string) (err error) | |||
| func Unmount(target string, flags int) (err error) { | |||
| if flags != 0 { | |||
| // AIX doesn't have any flags for umount. | |||
| return ENOSYS | |||
| } | |||
| return umount(target) | |||
| } | |||
| @@ -32,3 +32,19 @@ func (msghdr *Msghdr) SetControllen(length int) { | |||
| func (cmsg *Cmsghdr) SetLen(length int) { | |||
| cmsg.Len = uint32(length) | |||
| } | |||
| func Fstat(fd int, stat *Stat_t) error { | |||
| return fstat(fd, stat) | |||
| } | |||
| func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { | |||
| return fstatat(dirfd, path, stat, flags) | |||
| } | |||
| func Lstat(path string, stat *Stat_t) error { | |||
| return lstat(path, stat) | |||
| } | |||
| func Stat(path string, statptr *Stat_t) error { | |||
| return stat(path, statptr) | |||
| } | |||
| @@ -32,3 +32,50 @@ func (msghdr *Msghdr) SetControllen(length int) { | |||
| func (cmsg *Cmsghdr) SetLen(length int) { | |||
| cmsg.Len = uint32(length) | |||
| } | |||
| // In order to only have Timespec structure, type of Stat_t's fields | |||
| // Atim, Mtim and Ctim is changed from StTimespec to Timespec during | |||
| // ztypes generation. | |||
| // On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an | |||
| // int32, so the fields' value must be modified. | |||
| func fixStatTimFields(stat *Stat_t) { | |||
| stat.Atim.Nsec >>= 32 | |||
| stat.Mtim.Nsec >>= 32 | |||
| stat.Ctim.Nsec >>= 32 | |||
| } | |||
| func Fstat(fd int, stat *Stat_t) error { | |||
| err := fstat(fd, stat) | |||
| if err != nil { | |||
| return err | |||
| } | |||
| fixStatTimFields(stat) | |||
| return nil | |||
| } | |||
| func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { | |||
| err := fstatat(dirfd, path, stat, flags) | |||
| if err != nil { | |||
| return err | |||
| } | |||
| fixStatTimFields(stat) | |||
| return nil | |||
| } | |||
| func Lstat(path string, stat *Stat_t) error { | |||
| err := lstat(path, stat) | |||
| if err != nil { | |||
| return err | |||
| } | |||
| fixStatTimFields(stat) | |||
| return nil | |||
| } | |||
| func Stat(path string, statptr *Stat_t) error { | |||
| err := stat(path, statptr) | |||
| if err != nil { | |||
| return err | |||
| } | |||
| fixStatTimFields(statptr) | |||
| return nil | |||
| } | |||
| @@ -362,7 +362,21 @@ func Getdents(fd int, buf []byte) (n int, err error) { | |||
| func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| if supportsABI(_ino64First) { | |||
| return getdirentries_freebsd12(fd, buf, basep) | |||
| if unsafe.Sizeof(*basep) == 8 { | |||
| return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep))) | |||
| } | |||
| // The freebsd12 syscall needs a 64-bit base. On 32-bit machines | |||
| // we can't just use the basep passed in. See #32498. | |||
| var base uint64 = uint64(*basep) | |||
| n, err = getdirentries_freebsd12(fd, buf, &base) | |||
| *basep = uintptr(base) | |||
| if base>>32 != 0 { | |||
| // We can't stuff the base back into a uintptr, so any | |||
| // future calls would be suspect. Generate an error. | |||
| // EIO is allowed by getdirentries. | |||
| err = EIO | |||
| } | |||
| return | |||
| } | |||
| // The old syscall entries are smaller than the new. Use 1/4 of the original | |||
| @@ -404,22 +418,22 @@ func roundup(x, y int) int { | |||
| func (s *Stat_t) convertFrom(old *stat_freebsd11_t) { | |||
| *s = Stat_t{ | |||
| Dev: uint64(old.Dev), | |||
| Ino: uint64(old.Ino), | |||
| Nlink: uint64(old.Nlink), | |||
| Mode: old.Mode, | |||
| Uid: old.Uid, | |||
| Gid: old.Gid, | |||
| Rdev: uint64(old.Rdev), | |||
| Atim: old.Atim, | |||
| Mtim: old.Mtim, | |||
| Ctim: old.Ctim, | |||
| Birthtim: old.Birthtim, | |||
| Size: old.Size, | |||
| Blocks: old.Blocks, | |||
| Blksize: old.Blksize, | |||
| Flags: old.Flags, | |||
| Gen: uint64(old.Gen), | |||
| Dev: uint64(old.Dev), | |||
| Ino: uint64(old.Ino), | |||
| Nlink: uint64(old.Nlink), | |||
| Mode: old.Mode, | |||
| Uid: old.Uid, | |||
| Gid: old.Gid, | |||
| Rdev: uint64(old.Rdev), | |||
| Atim: old.Atim, | |||
| Mtim: old.Mtim, | |||
| Ctim: old.Ctim, | |||
| Btim: old.Btim, | |||
| Size: old.Size, | |||
| Blocks: old.Blocks, | |||
| Blksize: old.Blksize, | |||
| Flags: old.Flags, | |||
| Gen: uint64(old.Gen), | |||
| } | |||
| } | |||
| @@ -555,7 +569,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e | |||
| //sys Fsync(fd int) (err error) | |||
| //sys Ftruncate(fd int, length int64) (err error) | |||
| //sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) | |||
| //sys getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) | |||
| //sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) | |||
| //sys Getdtablesize() (size int) | |||
| //sysnb Getegid() (egid int) | |||
| //sysnb Geteuid() (uid int) | |||
| @@ -109,6 +109,12 @@ func IoctlGetInt(fd int, req uint) (int, error) { | |||
| return value, err | |||
| } | |||
| func IoctlGetUint32(fd int, req uint) (uint32, error) { | |||
| var value uint32 | |||
| err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
| return value, err | |||
| } | |||
| func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { | |||
| var value Winsize | |||
| err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) | |||
| @@ -1531,9 +1537,13 @@ func Setgid(uid int) (err error) { | |||
| return EOPNOTSUPP | |||
| } | |||
| func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { | |||
| return signalfd(fd, sigmask, _C__NSIG/8, flags) | |||
| } | |||
| //sys Setpriority(which int, who int, prio int) (err error) | |||
| //sys Setxattr(path string, attr string, data []byte, flags int) (err error) | |||
| //sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4 | |||
| //sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4 | |||
| //sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) | |||
| //sys Sync() | |||
| //sys Syncfs(fd int) (err error) | |||
| @@ -1662,6 +1672,82 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { | |||
| return EACCES | |||
| } | |||
| //sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT | |||
| //sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT | |||
| // fileHandle is the argument to nameToHandleAt and openByHandleAt. We | |||
| // originally tried to generate it via unix/linux/types.go with "type | |||
| // fileHandle C.struct_file_handle" but that generated empty structs | |||
| // for mips64 and mips64le. Instead, hard code it for now (it's the | |||
| // same everywhere else) until the mips64 generator issue is fixed. | |||
| type fileHandle struct { | |||
| Bytes uint32 | |||
| Type int32 | |||
| } | |||
| // FileHandle represents the C struct file_handle used by | |||
| // name_to_handle_at (see NameToHandleAt) and open_by_handle_at (see | |||
| // OpenByHandleAt). | |||
| type FileHandle struct { | |||
| *fileHandle | |||
| } | |||
| // NewFileHandle constructs a FileHandle. | |||
| func NewFileHandle(handleType int32, handle []byte) FileHandle { | |||
| const hdrSize = unsafe.Sizeof(fileHandle{}) | |||
| buf := make([]byte, hdrSize+uintptr(len(handle))) | |||
| copy(buf[hdrSize:], handle) | |||
| fh := (*fileHandle)(unsafe.Pointer(&buf[0])) | |||
| fh.Type = handleType | |||
| fh.Bytes = uint32(len(handle)) | |||
| return FileHandle{fh} | |||
| } | |||
| func (fh *FileHandle) Size() int { return int(fh.fileHandle.Bytes) } | |||
| func (fh *FileHandle) Type() int32 { return fh.fileHandle.Type } | |||
| func (fh *FileHandle) Bytes() []byte { | |||
| n := fh.Size() | |||
| if n == 0 { | |||
| return nil | |||
| } | |||
| return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n] | |||
| } | |||
| // NameToHandleAt wraps the name_to_handle_at system call; it obtains | |||
| // a handle for a path name. | |||
| func NameToHandleAt(dirfd int, path string, flags int) (handle FileHandle, mountID int, err error) { | |||
| var mid _C_int | |||
| // Try first with a small buffer, assuming the handle will | |||
| // only be 32 bytes. | |||
| size := uint32(32 + unsafe.Sizeof(fileHandle{})) | |||
| didResize := false | |||
| for { | |||
| buf := make([]byte, size) | |||
| fh := (*fileHandle)(unsafe.Pointer(&buf[0])) | |||
| fh.Bytes = size - uint32(unsafe.Sizeof(fileHandle{})) | |||
| err = nameToHandleAt(dirfd, path, fh, &mid, flags) | |||
| if err == EOVERFLOW { | |||
| if didResize { | |||
| // We shouldn't need to resize more than once | |||
| return | |||
| } | |||
| didResize = true | |||
| size = fh.Bytes + uint32(unsafe.Sizeof(fileHandle{})) | |||
| continue | |||
| } | |||
| if err != nil { | |||
| return | |||
| } | |||
| return FileHandle{fh}, int(mid), nil | |||
| } | |||
| } | |||
| // OpenByHandleAt wraps the open_by_handle_at system call; it opens a | |||
| // file via a handle as previously returned by NameToHandleAt. | |||
| func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err error) { | |||
| return openByHandleAt(mountFD, handle.fileHandle, flags) | |||
| } | |||
| /* | |||
| * Unimplemented | |||
| */ | |||
| @@ -272,3 +272,16 @@ func SyncFileRange(fd int, off int64, n int64, flags int) error { | |||
| // order of their arguments. | |||
| return armSyncFileRange(fd, flags, off, n) | |||
| } | |||
| //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) | |||
| func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { | |||
| cmdlineLen := len(cmdline) | |||
| if cmdlineLen > 0 { | |||
| // Account for the additional NULL byte added by | |||
| // BytePtrFromString in kexecFileLoad. The kexec_file_load | |||
| // syscall expects a NULL-terminated string. | |||
| cmdlineLen++ | |||
| } | |||
| return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) | |||
| } | |||
| @@ -120,9 +120,30 @@ func Pipe(p []int) (err error) { | |||
| return | |||
| } | |||
| //sys getdents(fd int, buf []byte) (n int, err error) | |||
| //sys Getdents(fd int, buf []byte) (n int, err error) | |||
| func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| return getdents(fd, buf) | |||
| n, err = Getdents(fd, buf) | |||
| if err != nil || basep == nil { | |||
| return | |||
| } | |||
| var off int64 | |||
| off, err = Seek(fd, 0, 1 /* SEEK_CUR */) | |||
| if err != nil { | |||
| *basep = ^uintptr(0) | |||
| return | |||
| } | |||
| *basep = uintptr(off) | |||
| if unsafe.Sizeof(*basep) == 8 { | |||
| return | |||
| } | |||
| if off>>4 != 0 { | |||
| // We can't stuff the offset back into a uintptr, so any | |||
| // future calls would be suspect. Generate an error. | |||
| // EIO is allowed by getdirentries. | |||
| err = EIO | |||
| } | |||
| return | |||
| } | |||
| const ImplementsGetwd = true | |||
| @@ -89,9 +89,30 @@ func Pipe(p []int) (err error) { | |||
| return | |||
| } | |||
| //sys getdents(fd int, buf []byte) (n int, err error) | |||
| //sys Getdents(fd int, buf []byte) (n int, err error) | |||
| func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| return getdents(fd, buf) | |||
| n, err = Getdents(fd, buf) | |||
| if err != nil || basep == nil { | |||
| return | |||
| } | |||
| var off int64 | |||
| off, err = Seek(fd, 0, 1 /* SEEK_CUR */) | |||
| if err != nil { | |||
| *basep = ^uintptr(0) | |||
| return | |||
| } | |||
| *basep = uintptr(off) | |||
| if unsafe.Sizeof(*basep) == 8 { | |||
| return | |||
| } | |||
| if off>>4 != 0 { | |||
| // We can't stuff the offset back into a uintptr, so any | |||
| // future calls would be suspect. Generate an error. | |||
| // EIO was allowed by getdirentries. | |||
| err = EIO | |||
| } | |||
| return | |||
| } | |||
| const ImplementsGetwd = true | |||
| @@ -0,0 +1,37 @@ | |||
| // Copyright 2019 The Go Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build arm64,openbsd | |||
| package unix | |||
| func setTimespec(sec, nsec int64) Timespec { | |||
| return Timespec{Sec: sec, Nsec: nsec} | |||
| } | |||
| func setTimeval(sec, usec int64) Timeval { | |||
| return Timeval{Sec: sec, Usec: usec} | |||
| } | |||
| func SetKevent(k *Kevent_t, fd, mode, flags int) { | |||
| k.Ident = uint64(fd) | |||
| k.Filter = int16(mode) | |||
| k.Flags = uint16(flags) | |||
| } | |||
| func (iov *Iovec) SetLen(length int) { | |||
| iov.Len = uint64(length) | |||
| } | |||
| func (msghdr *Msghdr) SetControllen(length int) { | |||
| msghdr.Controllen = uint32(length) | |||
| } | |||
| func (cmsg *Cmsghdr) SetLen(length int) { | |||
| cmsg.Len = uint32(length) | |||
| } | |||
| // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions | |||
| // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. | |||
| const SYS___SYSCTL = SYS_SYSCTL | |||
| @@ -351,7 +351,11 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) { | |||
| } | |||
| func SetsockoptString(fd, level, opt int, s string) (err error) { | |||
| return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s))) | |||
| var p unsafe.Pointer | |||
| if len(s) > 0 { | |||
| p = unsafe.Pointer(&[]byte(s)[0]) | |||
| } | |||
| return setsockopt(fd, level, opt, p, uintptr(len(s))) | |||
| } | |||
| func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { | |||
| @@ -87,8 +87,6 @@ type Mode_t C.mode_t | |||
| type Timespec C.struct_timespec | |||
| type StTimespec C.struct_st_timespec | |||
| type Timeval C.struct_timeval | |||
| type Timeval32 C.struct_timeval32 | |||
| @@ -133,6 +131,8 @@ type RawSockaddrInet6 C.struct_sockaddr_in6 | |||
| type RawSockaddrUnix C.struct_sockaddr_un | |||
| type RawSockaddrDatalink C.struct_sockaddr_dl | |||
| type RawSockaddr C.struct_sockaddr | |||
| type RawSockaddrAny C.struct_sockaddr_any | |||
| @@ -156,17 +156,18 @@ type Linger C.struct_linger | |||
| type Msghdr C.struct_msghdr | |||
| const ( | |||
| SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in | |||
| SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 | |||
| SizeofSockaddrAny = C.sizeof_struct_sockaddr_any | |||
| SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un | |||
| SizeofLinger = C.sizeof_struct_linger | |||
| SizeofIPMreq = C.sizeof_struct_ip_mreq | |||
| SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq | |||
| SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo | |||
| SizeofMsghdr = C.sizeof_struct_msghdr | |||
| SizeofCmsghdr = C.sizeof_struct_cmsghdr | |||
| SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter | |||
| SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in | |||
| SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 | |||
| SizeofSockaddrAny = C.sizeof_struct_sockaddr_any | |||
| SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un | |||
| SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl | |||
| SizeofLinger = C.sizeof_struct_linger | |||
| SizeofIPMreq = C.sizeof_struct_ip_mreq | |||
| SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq | |||
| SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo | |||
| SizeofMsghdr = C.sizeof_struct_msghdr | |||
| SizeofCmsghdr = C.sizeof_struct_cmsghdr | |||
| SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter | |||
| ) | |||
| // Routing and interface messages | |||
| @@ -2,8 +2,6 @@ | |||
| // Use of this source code is governed by a BSD-style | |||
| // license that can be found in the LICENSE file. | |||
| // +build openbsd | |||
| package unix | |||
| import ( | |||
| @@ -926,6 +926,8 @@ const ( | |||
| TCSETSF = 0x5404 | |||
| TCSETSW = 0x5403 | |||
| TCXONC = 0x540b | |||
| TIMER_ABSTIME = 0x3e7 | |||
| TIMER_MAX = 0x20 | |||
| TIOC = 0x5400 | |||
| TIOCCBRK = 0x2000747a | |||
| TIOCCDTR = 0x20007478 | |||
| @@ -3,7 +3,7 @@ | |||
| // +build ppc64,aix | |||
| // Created by cgo -godefs - DO NOT EDIT | |||
| // Code generated by cmd/cgo -godefs; DO NOT EDIT. | |||
| // cgo -godefs -- -maix64 _const.go | |||
| package unix | |||
| @@ -926,6 +926,8 @@ const ( | |||
| TCSETSF = 0x5404 | |||
| TCSETSW = 0x5403 | |||
| TCXONC = 0x540b | |||
| TIMER_ABSTIME = 0x3e7 | |||
| TIMER_MAX = 0x20 | |||
| TIOC = 0x5400 | |||
| TIOCCBRK = 0x2000747a | |||
| TIOCCDTR = 0x20007478 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1052,6 +1136,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1487,6 +1580,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1957,6 +2051,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2005,6 +2100,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2016,9 +2113,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2111,6 +2216,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2312,8 +2419,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2462,6 +2571,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1052,6 +1136,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1487,6 +1580,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1958,6 +2052,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2006,6 +2101,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2017,9 +2114,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2112,6 +2217,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2313,8 +2420,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2462,6 +2571,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1964,6 +2058,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2012,6 +2107,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2023,9 +2120,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2118,6 +2223,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2319,8 +2426,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2468,6 +2577,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -499,6 +573,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -507,8 +582,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -522,6 +601,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -530,6 +613,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1053,6 +1137,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1488,6 +1581,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1948,6 +2042,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -1996,6 +2091,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2007,9 +2104,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2103,6 +2208,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2304,8 +2411,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2453,6 +2562,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x40000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1957,6 +2051,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x20 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2005,6 +2100,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x1004 | |||
| SO_RCVTIMEO = 0x1006 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x1006 | |||
| SO_REUSEADDR = 0x4 | |||
| SO_REUSEPORT = 0x200 | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2016,10 +2113,18 @@ const ( | |||
| SO_SNDBUFFORCE = 0x1f | |||
| SO_SNDLOWAT = 0x1003 | |||
| SO_SNDTIMEO = 0x1005 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x1005 | |||
| SO_STYLE = 0x1008 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x1008 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2111,6 +2216,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2314,8 +2421,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2464,6 +2573,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x40000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1957,6 +2051,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x20 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2005,6 +2100,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x1004 | |||
| SO_RCVTIMEO = 0x1006 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x1006 | |||
| SO_REUSEADDR = 0x4 | |||
| SO_REUSEPORT = 0x200 | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2016,10 +2113,18 @@ const ( | |||
| SO_SNDBUFFORCE = 0x1f | |||
| SO_SNDLOWAT = 0x1003 | |||
| SO_SNDTIMEO = 0x1005 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x1005 | |||
| SO_STYLE = 0x1008 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x1008 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2111,6 +2216,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2314,8 +2421,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2464,6 +2573,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x40000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1957,6 +2051,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x20 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2005,6 +2100,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x1004 | |||
| SO_RCVTIMEO = 0x1006 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x1006 | |||
| SO_REUSEADDR = 0x4 | |||
| SO_REUSEPORT = 0x200 | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2016,10 +2113,18 @@ const ( | |||
| SO_SNDBUFFORCE = 0x1f | |||
| SO_SNDLOWAT = 0x1003 | |||
| SO_SNDTIMEO = 0x1005 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x1005 | |||
| SO_STYLE = 0x1008 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x1008 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2111,6 +2216,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2314,8 +2421,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2464,6 +2573,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x40000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1957,6 +2051,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x20 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2005,6 +2100,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x1004 | |||
| SO_RCVTIMEO = 0x1006 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x1006 | |||
| SO_REUSEADDR = 0x4 | |||
| SO_REUSEPORT = 0x200 | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2016,10 +2113,18 @@ const ( | |||
| SO_SNDBUFFORCE = 0x1f | |||
| SO_SNDLOWAT = 0x1003 | |||
| SO_SNDTIMEO = 0x1005 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x1005 | |||
| SO_STYLE = 0x1008 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x1008 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2111,6 +2216,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2314,8 +2421,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2464,6 +2573,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x3000 | |||
| CREAD = 0x800 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x100 | |||
| CS7 = 0x200 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1049,6 +1133,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x20000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x2000 | |||
| MCL_FUTURE = 0x4000 | |||
| MCL_ONFAULT = 0x8000 | |||
| @@ -1487,6 +1580,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -2015,6 +2109,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2063,6 +2158,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x10 | |||
| SO_RCVTIMEO = 0x12 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x12 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2074,9 +2171,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x11 | |||
| SO_SNDTIMEO = 0x13 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x13 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2167,6 +2272,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2374,8 +2481,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2523,6 +2632,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x3000 | |||
| CREAD = 0x800 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x100 | |||
| CS7 = 0x200 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1049,6 +1133,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x20000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x2000 | |||
| MCL_FUTURE = 0x4000 | |||
| MCL_ONFAULT = 0x8000 | |||
| @@ -1487,6 +1580,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -2015,6 +2109,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2063,6 +2158,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x10 | |||
| SO_RCVTIMEO = 0x12 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x12 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2074,9 +2171,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x11 | |||
| SO_SNDTIMEO = 0x13 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x13 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2167,6 +2272,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2374,8 +2481,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2523,6 +2632,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -1945,6 +2039,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -1993,6 +2088,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2004,9 +2101,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2099,6 +2204,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2300,8 +2407,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2449,6 +2558,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -197,10 +197,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -208,8 +257,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -223,20 +280,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -320,6 +390,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -497,6 +571,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -505,8 +580,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -520,6 +599,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -528,6 +611,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1050,6 +1134,15 @@ const ( | |||
| MAP_STACK = 0x20000 | |||
| MAP_SYNC = 0x80000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x1 | |||
| MCL_FUTURE = 0x2 | |||
| MCL_ONFAULT = 0x4 | |||
| @@ -1485,6 +1578,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -2018,6 +2112,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x33 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x34 | |||
| SO_BINDTODEVICE = 0x19 | |||
| SO_BINDTOIFINDEX = 0x3e | |||
| SO_BPF_EXTENSIONS = 0x30 | |||
| SO_BROADCAST = 0x6 | |||
| SO_BSDCOMPAT = 0xe | |||
| @@ -2066,6 +2161,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x21 | |||
| SO_RCVLOWAT = 0x12 | |||
| SO_RCVTIMEO = 0x14 | |||
| SO_RCVTIMEO_NEW = 0x42 | |||
| SO_RCVTIMEO_OLD = 0x14 | |||
| SO_REUSEADDR = 0x2 | |||
| SO_REUSEPORT = 0xf | |||
| SO_RXQ_OVFL = 0x28 | |||
| @@ -2077,9 +2174,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x20 | |||
| SO_SNDLOWAT = 0x13 | |||
| SO_SNDTIMEO = 0x15 | |||
| SO_SNDTIMEO_NEW = 0x43 | |||
| SO_SNDTIMEO_OLD = 0x15 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x25 | |||
| SO_TIMESTAMPING_NEW = 0x41 | |||
| SO_TIMESTAMPING_OLD = 0x25 | |||
| SO_TIMESTAMPNS = 0x23 | |||
| SO_TIMESTAMPNS_NEW = 0x40 | |||
| SO_TIMESTAMPNS_OLD = 0x23 | |||
| SO_TIMESTAMP_NEW = 0x3f | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3d | |||
| SO_TYPE = 0x3 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2172,6 +2277,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2373,8 +2480,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x40986f00 | |||
| UBI_IOCRMVOL = 0x40046f01 | |||
| UBI_IOCRNVOL = 0x51106f03 | |||
| UBI_IOCRPEB = 0x40046f04 | |||
| UBI_IOCRSVOL = 0x400c6f02 | |||
| UBI_IOCSETVOLPROP = 0x40104f06 | |||
| UBI_IOCSPEB = 0x40046f05 | |||
| UBI_IOCVOLCRBLK = 0x40804f07 | |||
| UBI_IOCVOLRMBLK = 0x4f08 | |||
| UBI_IOCVOLUP = 0x40084f00 | |||
| @@ -2522,6 +2631,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -200,10 +200,59 @@ const ( | |||
| BPF_ABS = 0x20 | |||
| BPF_ADD = 0x0 | |||
| BPF_ALU = 0x4 | |||
| BPF_ALU64 = 0x7 | |||
| BPF_AND = 0x50 | |||
| BPF_ANY = 0x0 | |||
| BPF_ARSH = 0xc0 | |||
| BPF_B = 0x10 | |||
| BPF_BUILD_ID_SIZE = 0x14 | |||
| BPF_CALL = 0x80 | |||
| BPF_DEVCG_ACC_MKNOD = 0x1 | |||
| BPF_DEVCG_ACC_READ = 0x2 | |||
| BPF_DEVCG_ACC_WRITE = 0x4 | |||
| BPF_DEVCG_DEV_BLOCK = 0x1 | |||
| BPF_DEVCG_DEV_CHAR = 0x2 | |||
| BPF_DIV = 0x30 | |||
| BPF_DW = 0x18 | |||
| BPF_END = 0xd0 | |||
| BPF_EXIST = 0x2 | |||
| BPF_EXIT = 0x90 | |||
| BPF_FROM_BE = 0x8 | |||
| BPF_FROM_LE = 0x0 | |||
| BPF_FS_MAGIC = 0xcafe4a11 | |||
| BPF_F_ALLOW_MULTI = 0x2 | |||
| BPF_F_ALLOW_OVERRIDE = 0x1 | |||
| BPF_F_ANY_ALIGNMENT = 0x2 | |||
| BPF_F_CTXLEN_MASK = 0xfffff00000000 | |||
| BPF_F_CURRENT_CPU = 0xffffffff | |||
| BPF_F_CURRENT_NETNS = -0x1 | |||
| BPF_F_DONT_FRAGMENT = 0x4 | |||
| BPF_F_FAST_STACK_CMP = 0x200 | |||
| BPF_F_HDR_FIELD_MASK = 0xf | |||
| BPF_F_INDEX_MASK = 0xffffffff | |||
| BPF_F_INGRESS = 0x1 | |||
| BPF_F_INVALIDATE_HASH = 0x2 | |||
| BPF_F_LOCK = 0x4 | |||
| BPF_F_MARK_ENFORCE = 0x40 | |||
| BPF_F_MARK_MANGLED_0 = 0x20 | |||
| BPF_F_NO_COMMON_LRU = 0x2 | |||
| BPF_F_NO_PREALLOC = 0x1 | |||
| BPF_F_NUMA_NODE = 0x4 | |||
| BPF_F_PSEUDO_HDR = 0x10 | |||
| BPF_F_QUERY_EFFECTIVE = 0x1 | |||
| BPF_F_RDONLY = 0x8 | |||
| BPF_F_RECOMPUTE_CSUM = 0x1 | |||
| BPF_F_REUSE_STACKID = 0x400 | |||
| BPF_F_SEQ_NUMBER = 0x8 | |||
| BPF_F_SKIP_FIELD_MASK = 0xff | |||
| BPF_F_STACK_BUILD_ID = 0x20 | |||
| BPF_F_STRICT_ALIGNMENT = 0x1 | |||
| BPF_F_TUNINFO_IPV6 = 0x1 | |||
| BPF_F_USER_BUILD_ID = 0x800 | |||
| BPF_F_USER_STACK = 0x100 | |||
| BPF_F_WRONLY = 0x10 | |||
| BPF_F_ZERO_CSUM_TX = 0x2 | |||
| BPF_F_ZERO_SEED = 0x40 | |||
| BPF_H = 0x8 | |||
| BPF_IMM = 0x0 | |||
| BPF_IND = 0x40 | |||
| @@ -211,8 +260,16 @@ const ( | |||
| BPF_JEQ = 0x10 | |||
| BPF_JGE = 0x30 | |||
| BPF_JGT = 0x20 | |||
| BPF_JLE = 0xb0 | |||
| BPF_JLT = 0xa0 | |||
| BPF_JMP = 0x5 | |||
| BPF_JMP32 = 0x6 | |||
| BPF_JNE = 0x50 | |||
| BPF_JSET = 0x40 | |||
| BPF_JSGE = 0x70 | |||
| BPF_JSGT = 0x60 | |||
| BPF_JSLE = 0xd0 | |||
| BPF_JSLT = 0xc0 | |||
| BPF_K = 0x0 | |||
| BPF_LD = 0x0 | |||
| BPF_LDX = 0x1 | |||
| @@ -226,20 +283,33 @@ const ( | |||
| BPF_MINOR_VERSION = 0x1 | |||
| BPF_MISC = 0x7 | |||
| BPF_MOD = 0x90 | |||
| BPF_MOV = 0xb0 | |||
| BPF_MSH = 0xa0 | |||
| BPF_MUL = 0x20 | |||
| BPF_NEG = 0x80 | |||
| BPF_NET_OFF = -0x100000 | |||
| BPF_NOEXIST = 0x1 | |||
| BPF_OBJ_NAME_LEN = 0x10 | |||
| BPF_OR = 0x40 | |||
| BPF_PSEUDO_CALL = 0x1 | |||
| BPF_PSEUDO_MAP_FD = 0x1 | |||
| BPF_RET = 0x6 | |||
| BPF_RSH = 0x70 | |||
| BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 | |||
| BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 | |||
| BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 | |||
| BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 | |||
| BPF_ST = 0x2 | |||
| BPF_STX = 0x3 | |||
| BPF_SUB = 0x10 | |||
| BPF_TAG_SIZE = 0x8 | |||
| BPF_TAX = 0x0 | |||
| BPF_TO_BE = 0x8 | |||
| BPF_TO_LE = 0x0 | |||
| BPF_TXA = 0x80 | |||
| BPF_W = 0x0 | |||
| BPF_X = 0x8 | |||
| BPF_XADD = 0xc0 | |||
| BPF_XOR = 0xa0 | |||
| BRKINT = 0x2 | |||
| BS0 = 0x0 | |||
| @@ -323,6 +393,10 @@ const ( | |||
| CRDLY = 0x600 | |||
| CREAD = 0x80 | |||
| CRTSCTS = 0x80000000 | |||
| CRYPTO_MAX_NAME = 0x40 | |||
| CRYPTO_MSG_MAX = 0x15 | |||
| CRYPTO_NR_MSGTYPES = 0x6 | |||
| CRYPTO_REPORT_MAXSIZE = 0x160 | |||
| CS5 = 0x0 | |||
| CS6 = 0x10 | |||
| CS7 = 0x20 | |||
| @@ -501,6 +575,7 @@ const ( | |||
| FAN_ALL_MARK_FLAGS = 0xff | |||
| FAN_ALL_OUTGOING_EVENTS = 0x3403b | |||
| FAN_ALL_PERM_EVENTS = 0x30000 | |||
| FAN_ATTRIB = 0x4 | |||
| FAN_AUDIT = 0x10 | |||
| FAN_CLASS_CONTENT = 0x4 | |||
| FAN_CLASS_NOTIF = 0x0 | |||
| @@ -509,8 +584,12 @@ const ( | |||
| FAN_CLOSE = 0x18 | |||
| FAN_CLOSE_NOWRITE = 0x10 | |||
| FAN_CLOSE_WRITE = 0x8 | |||
| FAN_CREATE = 0x100 | |||
| FAN_DELETE = 0x200 | |||
| FAN_DELETE_SELF = 0x400 | |||
| FAN_DENY = 0x2 | |||
| FAN_ENABLE_AUDIT = 0x40 | |||
| FAN_EVENT_INFO_TYPE_FID = 0x1 | |||
| FAN_EVENT_METADATA_LEN = 0x18 | |||
| FAN_EVENT_ON_CHILD = 0x8000000 | |||
| FAN_MARK_ADD = 0x1 | |||
| @@ -524,6 +603,10 @@ const ( | |||
| FAN_MARK_ONLYDIR = 0x8 | |||
| FAN_MARK_REMOVE = 0x2 | |||
| FAN_MODIFY = 0x2 | |||
| FAN_MOVE = 0xc0 | |||
| FAN_MOVED_FROM = 0x40 | |||
| FAN_MOVED_TO = 0x80 | |||
| FAN_MOVE_SELF = 0x800 | |||
| FAN_NOFD = -0x1 | |||
| FAN_NONBLOCK = 0x2 | |||
| FAN_ONDIR = 0x40000000 | |||
| @@ -532,6 +615,7 @@ const ( | |||
| FAN_OPEN_EXEC_PERM = 0x40000 | |||
| FAN_OPEN_PERM = 0x10000 | |||
| FAN_Q_OVERFLOW = 0x4000 | |||
| FAN_REPORT_FID = 0x200 | |||
| FAN_REPORT_TID = 0x100 | |||
| FAN_UNLIMITED_MARKS = 0x20 | |||
| FAN_UNLIMITED_QUEUE = 0x10 | |||
| @@ -1054,6 +1138,15 @@ const ( | |||
| MAP_SHARED_VALIDATE = 0x3 | |||
| MAP_STACK = 0x20000 | |||
| MAP_TYPE = 0xf | |||
| MCAST_BLOCK_SOURCE = 0x2b | |||
| MCAST_EXCLUDE = 0x0 | |||
| MCAST_INCLUDE = 0x1 | |||
| MCAST_JOIN_GROUP = 0x2a | |||
| MCAST_JOIN_SOURCE_GROUP = 0x2e | |||
| MCAST_LEAVE_GROUP = 0x2d | |||
| MCAST_LEAVE_SOURCE_GROUP = 0x2f | |||
| MCAST_MSFILTER = 0x30 | |||
| MCAST_UNBLOCK_SOURCE = 0x2c | |||
| MCL_CURRENT = 0x2000 | |||
| MCL_FUTURE = 0x4000 | |||
| MCL_ONFAULT = 0x8000 | |||
| @@ -1489,6 +1582,7 @@ const ( | |||
| PR_SET_TSC = 0x1a | |||
| PR_SET_UNALIGN = 0x6 | |||
| PR_SPEC_DISABLE = 0x4 | |||
| PR_SPEC_DISABLE_NOEXEC = 0x10 | |||
| PR_SPEC_ENABLE = 0x2 | |||
| PR_SPEC_FORCE_DISABLE = 0x8 | |||
| PR_SPEC_INDIRECT_BRANCH = 0x1 | |||
| @@ -2010,6 +2104,7 @@ const ( | |||
| SO_ATTACH_REUSEPORT_CBPF = 0x35 | |||
| SO_ATTACH_REUSEPORT_EBPF = 0x36 | |||
| SO_BINDTODEVICE = 0xd | |||
| SO_BINDTOIFINDEX = 0x41 | |||
| SO_BPF_EXTENSIONS = 0x32 | |||
| SO_BROADCAST = 0x20 | |||
| SO_BSDCOMPAT = 0x400 | |||
| @@ -2058,6 +2153,8 @@ const ( | |||
| SO_RCVBUFFORCE = 0x100b | |||
| SO_RCVLOWAT = 0x800 | |||
| SO_RCVTIMEO = 0x2000 | |||
| SO_RCVTIMEO_NEW = 0x44 | |||
| SO_RCVTIMEO_OLD = 0x2000 | |||
| SO_REUSEADDR = 0x4 | |||
| SO_REUSEPORT = 0x200 | |||
| SO_RXQ_OVFL = 0x24 | |||
| @@ -2069,9 +2166,17 @@ const ( | |||
| SO_SNDBUFFORCE = 0x100a | |||
| SO_SNDLOWAT = 0x1000 | |||
| SO_SNDTIMEO = 0x4000 | |||
| SO_SNDTIMEO_NEW = 0x45 | |||
| SO_SNDTIMEO_OLD = 0x4000 | |||
| SO_TIMESTAMP = 0x1d | |||
| SO_TIMESTAMPING = 0x23 | |||
| SO_TIMESTAMPING_NEW = 0x43 | |||
| SO_TIMESTAMPING_OLD = 0x23 | |||
| SO_TIMESTAMPNS = 0x21 | |||
| SO_TIMESTAMPNS_NEW = 0x42 | |||
| SO_TIMESTAMPNS_OLD = 0x21 | |||
| SO_TIMESTAMP_NEW = 0x46 | |||
| SO_TIMESTAMP_OLD = 0x1d | |||
| SO_TXTIME = 0x3f | |||
| SO_TYPE = 0x1008 | |||
| SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 | |||
| @@ -2163,6 +2268,8 @@ const ( | |||
| TCOFLUSH = 0x1 | |||
| TCOOFF = 0x0 | |||
| TCOON = 0x1 | |||
| TCP_BPF_IW = 0x3e9 | |||
| TCP_BPF_SNDCWND_CLAMP = 0x3ea | |||
| TCP_CC_INFO = 0x1a | |||
| TCP_CM_INQ = 0x24 | |||
| TCP_CONGESTION = 0xd | |||
| @@ -2362,8 +2469,10 @@ const ( | |||
| UBI_IOCMKVOL = 0x80986f00 | |||
| UBI_IOCRMVOL = 0x80046f01 | |||
| UBI_IOCRNVOL = 0x91106f03 | |||
| UBI_IOCRPEB = 0x80046f04 | |||
| UBI_IOCRSVOL = 0x800c6f02 | |||
| UBI_IOCSETVOLPROP = 0x80104f06 | |||
| UBI_IOCSPEB = 0x80046f05 | |||
| UBI_IOCVOLCRBLK = 0x80804f07 | |||
| UBI_IOCVOLRMBLK = 0x20004f08 | |||
| UBI_IOCVOLUP = 0x80084f00 | |||
| @@ -2511,6 +2620,7 @@ const ( | |||
| XDP_FLAGS_SKB_MODE = 0x2 | |||
| XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 | |||
| XDP_MMAP_OFFSETS = 0x1 | |||
| XDP_PACKET_HEADROOM = 0x100 | |||
| XDP_PGOFF_RX_RING = 0x0 | |||
| XDP_PGOFF_TX_RING = 0x80000000 | |||
| XDP_RX_RING = 0x2 | |||
| @@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t); | |||
| int pause(); | |||
| int pread64(int, uintptr_t, size_t, long long); | |||
| int pwrite64(int, uintptr_t, size_t, long long); | |||
| #define c_select select | |||
| int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); | |||
| int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); | |||
| int setregid(int, int); | |||
| int setreuid(int, int); | |||
| @@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t); | |||
| int getsockname(int, uintptr_t, uintptr_t); | |||
| int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); | |||
| int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); | |||
| int recvmsg(int, uintptr_t, int); | |||
| int sendmsg(int, uintptr_t, int); | |||
| int nrecvmsg(int, uintptr_t, int); | |||
| int nsendmsg(int, uintptr_t, int); | |||
| int munmap(uintptr_t, uintptr_t); | |||
| int madvise(uintptr_t, size_t, int); | |||
| int mprotect(uintptr_t, size_t, int); | |||
| @@ -118,6 +120,8 @@ int poll(uintptr_t, int, int); | |||
| int gettimeofday(uintptr_t, uintptr_t); | |||
| int time(uintptr_t); | |||
| int utime(uintptr_t, uintptr_t); | |||
| unsigned long long getsystemcfg(int); | |||
| int umount(uintptr_t); | |||
| int getrlimit64(int, uintptr_t); | |||
| int setrlimit64(int, uintptr_t); | |||
| long long lseek64(int, long long, int); | |||
| @@ -855,7 +859,7 @@ func Fchown(fd int, uid int, gid int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Fstat(fd int, stat *Stat_t) (err error) { | |||
| func fstat(fd int, stat *Stat_t) (err error) { | |||
| r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| @@ -865,7 +869,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { | |||
| func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { | |||
| _p0 := uintptr(unsafe.Pointer(C.CString(path))) | |||
| r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags)) | |||
| if r0 == -1 && er != nil { | |||
| @@ -949,7 +953,7 @@ func Listen(s int, n int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Lstat(path string, stat *Stat_t) (err error) { | |||
| func lstat(path string, stat *Stat_t) (err error) { | |||
| _p0 := uintptr(unsafe.Pointer(C.CString(path))) | |||
| r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) | |||
| if r0 == -1 && er != nil { | |||
| @@ -1004,6 +1008,17 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { | |||
| r0, er := C.c_select(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout)))) | |||
| n = int(r0) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { | |||
| r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask)))) | |||
| n = int(r0) | |||
| @@ -1056,9 +1071,9 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Stat(path string, stat *Stat_t) (err error) { | |||
| func stat(path string, statptr *Stat_t) (err error) { | |||
| _p0 := uintptr(unsafe.Pointer(C.CString(path))) | |||
| r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) | |||
| r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(statptr)))) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| } | |||
| @@ -1225,7 +1240,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| r0, er := C.recvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) | |||
| r0, er := C.nrecvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) | |||
| n = int(r0) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| @@ -1236,7 +1251,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| r0, er := C.sendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) | |||
| r0, er := C.nsendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) | |||
| n = int(r0) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| @@ -1409,6 +1424,25 @@ func Utime(path string, buf *Utimbuf) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Getsystemcfg(label int) (n uint64) { | |||
| r0, _ := C.getsystemcfg(C.int(label)) | |||
| n = uint64(r0) | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func umount(target string) (err error) { | |||
| _p0 := uintptr(unsafe.Pointer(C.CString(target))) | |||
| r0, er := C.umount(C.uintptr_t(_p0)) | |||
| if r0 == -1 && er != nil { | |||
| err = er | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Getrlimit(resource int, rlim *Rlimit) (err error) { | |||
| r0, er := C.getrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) | |||
| if r0 == -1 && er != nil { | |||
| @@ -803,7 +803,7 @@ func Fchown(fd int, uid int, gid int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Fstat(fd int, stat *Stat_t) (err error) { | |||
| func fstat(fd int, stat *Stat_t) (err error) { | |||
| _, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat))) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| @@ -813,7 +813,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { | |||
| func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(path) | |||
| if err != nil { | |||
| @@ -905,7 +905,7 @@ func Listen(s int, n int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Lstat(path string, stat *Stat_t) (err error) { | |||
| func lstat(path string, stat *Stat_t) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(path) | |||
| if err != nil { | |||
| @@ -960,6 +960,17 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { | |||
| r0, e1 := callselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout))) | |||
| n = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { | |||
| r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) | |||
| n = int(r0) | |||
| @@ -1012,13 +1023,13 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Stat(path string, stat *Stat_t) (err error) { | |||
| func stat(path string, statptr *Stat_t) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(path) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat))) | |||
| _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statptr))) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| @@ -1189,7 +1200,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| r0, e1 := callrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) | |||
| r0, e1 := callnrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) | |||
| n = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| @@ -1200,7 +1211,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { | |||
| r0, e1 := callsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) | |||
| r0, e1 := callnsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) | |||
| n = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| @@ -1375,6 +1386,21 @@ func Getsystemcfg(label int) (n uint64) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func umount(target string) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(target) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, e1 := callumount(uintptr(unsafe.Pointer(_p0))) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Getrlimit(resource int, rlim *Rlimit) (err error) { | |||
| _, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim))) | |||
| if e1 != 0 { | |||
| @@ -85,6 +85,7 @@ import ( | |||
| //go:cgo_import_dynamic libc_pause pause "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_pread64 pread64 "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_pwrite64 pwrite64 "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_select select "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_pselect pselect "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_setregid setregid "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_setreuid setreuid "libc.a/shr_64.o" | |||
| @@ -105,8 +106,8 @@ import ( | |||
| //go:cgo_import_dynamic libc_getsockname getsockname "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_recvfrom recvfrom "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_sendto sendto "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_recvmsg recvmsg "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_sendmsg sendmsg "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_nrecvmsg nrecvmsg "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_nsendmsg nsendmsg "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_madvise madvise "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_mprotect mprotect "libc.a/shr_64.o" | |||
| @@ -121,6 +122,7 @@ import ( | |||
| //go:cgo_import_dynamic libc_time time "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_utime utime "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o" | |||
| //go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o" | |||
| @@ -201,6 +203,7 @@ import ( | |||
| //go:linkname libc_pause libc_pause | |||
| //go:linkname libc_pread64 libc_pread64 | |||
| //go:linkname libc_pwrite64 libc_pwrite64 | |||
| //go:linkname libc_select libc_select | |||
| //go:linkname libc_pselect libc_pselect | |||
| //go:linkname libc_setregid libc_setregid | |||
| //go:linkname libc_setreuid libc_setreuid | |||
| @@ -221,8 +224,8 @@ import ( | |||
| //go:linkname libc_getsockname libc_getsockname | |||
| //go:linkname libc_recvfrom libc_recvfrom | |||
| //go:linkname libc_sendto libc_sendto | |||
| //go:linkname libc_recvmsg libc_recvmsg | |||
| //go:linkname libc_sendmsg libc_sendmsg | |||
| //go:linkname libc_nrecvmsg libc_nrecvmsg | |||
| //go:linkname libc_nsendmsg libc_nsendmsg | |||
| //go:linkname libc_munmap libc_munmap | |||
| //go:linkname libc_madvise libc_madvise | |||
| //go:linkname libc_mprotect libc_mprotect | |||
| @@ -237,6 +240,7 @@ import ( | |||
| //go:linkname libc_time libc_time | |||
| //go:linkname libc_utime libc_utime | |||
| //go:linkname libc_getsystemcfg libc_getsystemcfg | |||
| //go:linkname libc_umount libc_umount | |||
| //go:linkname libc_getrlimit libc_getrlimit | |||
| //go:linkname libc_setrlimit libc_setrlimit | |||
| //go:linkname libc_lseek libc_lseek | |||
| @@ -320,6 +324,7 @@ var ( | |||
| libc_pause, | |||
| libc_pread64, | |||
| libc_pwrite64, | |||
| libc_select, | |||
| libc_pselect, | |||
| libc_setregid, | |||
| libc_setreuid, | |||
| @@ -340,8 +345,8 @@ var ( | |||
| libc_getsockname, | |||
| libc_recvfrom, | |||
| libc_sendto, | |||
| libc_recvmsg, | |||
| libc_sendmsg, | |||
| libc_nrecvmsg, | |||
| libc_nsendmsg, | |||
| libc_munmap, | |||
| libc_madvise, | |||
| libc_mprotect, | |||
| @@ -356,6 +361,7 @@ var ( | |||
| libc_time, | |||
| libc_utime, | |||
| libc_getsystemcfg, | |||
| libc_umount, | |||
| libc_getrlimit, | |||
| libc_setrlimit, | |||
| libc_lseek, | |||
| @@ -893,6 +899,13 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_select)), 5, uintptr(nfd), r, w, e, timeout, 0) | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pselect)), 6, uintptr(nfd), r, w, e, timeout, sigmask) | |||
| return | |||
| @@ -928,8 +941,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, stat, 0, 0, 0, 0) | |||
| func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, statptr, 0, 0, 0, 0) | |||
| return | |||
| } | |||
| @@ -1033,15 +1046,15 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_recvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) | |||
| func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nrecvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) | |||
| func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nsendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) | |||
| return | |||
| } | |||
| @@ -1145,6 +1158,13 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_umount)), 1, _p0, 0, 0, 0, 0, 0) | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { | |||
| r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) | |||
| return | |||
| @@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t); | |||
| int pause(); | |||
| int pread64(int, uintptr_t, size_t, long long); | |||
| int pwrite64(int, uintptr_t, size_t, long long); | |||
| #define c_select select | |||
| int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); | |||
| int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); | |||
| int setregid(int, int); | |||
| int setreuid(int, int); | |||
| @@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t); | |||
| int getsockname(int, uintptr_t, uintptr_t); | |||
| int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); | |||
| int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); | |||
| int recvmsg(int, uintptr_t, int); | |||
| int sendmsg(int, uintptr_t, int); | |||
| int nrecvmsg(int, uintptr_t, int); | |||
| int nsendmsg(int, uintptr_t, int); | |||
| int munmap(uintptr_t, uintptr_t); | |||
| int madvise(uintptr_t, size_t, int); | |||
| int mprotect(uintptr_t, size_t, int); | |||
| @@ -119,6 +121,7 @@ int gettimeofday(uintptr_t, uintptr_t); | |||
| int time(uintptr_t); | |||
| int utime(uintptr_t, uintptr_t); | |||
| unsigned long long getsystemcfg(int); | |||
| int umount(uintptr_t); | |||
| int getrlimit(int, uintptr_t); | |||
| int setrlimit(int, uintptr_t); | |||
| long long lseek(int, long long, int); | |||
| @@ -732,6 +735,14 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.c_select(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout))) | |||
| e1 = syscall.GetErrno() | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.pselect(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout), C.uintptr_t(sigmask))) | |||
| e1 = syscall.GetErrno() | |||
| @@ -772,8 +783,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(stat))) | |||
| func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(statptr))) | |||
| e1 = syscall.GetErrno() | |||
| return | |||
| } | |||
| @@ -892,16 +903,16 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.recvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) | |||
| func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.nrecvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) | |||
| e1 = syscall.GetErrno() | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.sendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) | |||
| func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.nsendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) | |||
| e1 = syscall.GetErrno() | |||
| return | |||
| } | |||
| @@ -1020,6 +1031,14 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.umount(C.uintptr_t(_p0))) | |||
| e1 = syscall.GetErrno() | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { | |||
| r1 = uintptr(C.getrlimit(C.int(resource), C.uintptr_t(rlim))) | |||
| e1 = syscall.GetErrno() | |||
| @@ -1019,7 +1019,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { | |||
| var _p0 unsafe.Pointer | |||
| if len(buf) > 0 { | |||
| _p0 = unsafe.Pointer(&buf[0]) | |||
| @@ -1019,7 +1019,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { | |||
| var _p0 unsafe.Pointer | |||
| if len(buf) > 0 { | |||
| _p0 = unsafe.Pointer(&buf[0]) | |||
| @@ -1019,7 +1019,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { | |||
| var _p0 unsafe.Pointer | |||
| if len(buf) > 0 { | |||
| _p0 = unsafe.Pointer(&buf[0]) | |||
| @@ -1019,7 +1019,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { | |||
| func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { | |||
| var _p0 unsafe.Pointer | |||
| if len(buf) > 0 { | |||
| _p0 = unsafe.Pointer(&buf[0]) | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func pipe(p *[2]_C_int) (err error) { | |||
| _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) | |||
| if e1 != 0 { | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Dup2(oldfd int, newfd int) (err error) { | |||
| _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) | |||
| if e1 != 0 { | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func pipe(p *[2]_C_int) (err error) { | |||
| _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) | |||
| if e1 != 0 { | |||
| @@ -2340,3 +2370,18 @@ func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(cmdline) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { | |||
| var _p0 unsafe.Pointer | |||
| if len(events) > 0 { | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Dup2(oldfd int, newfd int) (err error) { | |||
| _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) | |||
| if e1 != 0 { | |||
| @@ -1381,8 +1381,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Signalfd(fd int, mask *Sigset_t, flags int) { | |||
| SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) | |||
| func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { | |||
| r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) | |||
| newfd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| @@ -1679,6 +1683,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { | |||
| var _p0 *byte | |||
| _p0, err = BytePtrFromString(pathname) | |||
| if err != nil { | |||
| return | |||
| } | |||
| _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { | |||
| r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) | |||
| fd = int(r0) | |||
| if e1 != 0 { | |||
| err = errnoErr(e1) | |||
| } | |||
| return | |||
| } | |||
| // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT | |||
| func Dup2(oldfd int, newfd int) (err error) { | |||
| _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) | |||
| if e1 != 0 { | |||