File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 2020class FFI :
2121 libc = ffi .open ('libc.so.6' )
2222
23+ lchown = libc .func ('i' , 'lchown' , 'sII' )
24+
2325 IN_CREATE = 0x00000100
2426 IN_DELETE = 0x00000200
2527
@@ -79,6 +81,9 @@ def connect_hostapd_socket(interface):
7981 local_address = '/var/run/hapt-%s-%d' % (interface , time .time () % 86400 )
8082 sock = socket .socket (socket .AF_UNIX , socket .SOCK_DGRAM )
8183 sock .bind (encode_socket_address (local_address ))
84+ # Make our local socket owned by the `network` group, so that hostapd (running as non-root) is allowed to send messages to it
85+ # See: https://github.com/openwrt/openwrt/blob/master/package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch
86+ FFI .lchown (local_address , 101 , 101 )
8287 sock .connect (encode_socket_address (remote_address ))
8388 sock .send ('ATTACH' )
8489 response = sock .recv (1024 )
You can’t perform that action at this time.
0 commit comments