Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly type fcntl.ioctl function #754

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ task:
freebsd_instance:
matrix:
#image: freebsd-11-2-release-amd64
image: freebsd-12-0-release-amd64
image: freebsd-12-1-release-amd64
pip_cache:
folder: ~/.cache/pip
fingerprint_script: cat requirements*
Expand All @@ -16,6 +16,8 @@ task:
zfs set compression=lz4 "ioc-test-`uname -r`"
install_script:
- mount -t fdescfs null /dev/fd
- pkg bootstrap
- pkg update -f
- pkg install -y git
- make install-dev
test_script:
Expand Down
7 changes: 6 additions & 1 deletion libioc/helpers_ioctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ def get_sockio_ioctl(nic_name: str, ioctl: SOCKIO_IOCTLS) -> bytes:
"""Query a sockio ioctl for a given NIC."""
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) as sock:
ifconf = struct.pack('256s', nic_name.encode("UTF-8")[:15])
return bytes(fcntl.ioctl(sock.fileno(), ioctl.value, ifconf))
return bytes(fcntl.ioctl(
sock.fileno(),
int(ioctl.value),
bytes(ifconf),
True
))


def get_interface_ip4_address(nic_name: str) -> ipaddress.IPv4Address:
Expand Down