Skip to content

Commit

Permalink
Save current progress
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinpeters committed Jun 16, 2024
1 parent 4e5cea9 commit 2ac9af7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ ioctl_readwrite!(pf_begin_addrs, b'D', 51, pfvar::pfioc_pooladdr);
// DIOCADDADDR
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
ioctl_readwrite!(pf_add_addr, b'D', 52, pfvar::pfioc_pooladdr);


// DIOCGETRULESETS
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
ioctl_readwrite!(pf_get_rulesets, b'D', 58, pfvar::pfioc_ruleset);
// DIOCGETRULESET
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
ioctl_readwrite!(pf_get_ruleset, b'D', 59, pfvar::pfioc_ruleset);
// DIOCXBEGIN
ioctl_readwrite!(pf_begin_trans, b'D', 81, pfvar::pfioc_trans);
// DIOCXCOMMIT
Expand All @@ -74,5 +78,5 @@ ioctl_readwrite!(pf_commit_trans, b'D', 82, pfvar::pfioc_trans);
// DIOCXEND
// Required by OpenBSD to release the ticket obtained by the DIOCGETRULES command.
// TODO: Switch to openbsd before push
#[cfg(any(target_os = "macos"))]
#[cfg(any(target_os = "openbsd"))]
ioctl_readwrite!(pf_end_trans, b'D', 100, pfvar::u_int32_t);
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl PfCtl {
}
}
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))] {
let mut pfioc_rule = unsafe { mem::zeroed::<ffi::pfvar::pfioc_rule>() };
let mut pfioc_ruleset = unsafe { mem::zeroed::<ffi::pfvar::pfioc_ruleset>() };
ioctl_guard!(ffi::pf_get_rules(self.fd(), &mut pfioc_rule))?;
pfioc_rule.rule.action = ffi::pfvar::PF_GET_NONE as u8;
ioctl_guard!(ffi::pf_get_rule(self.fd(), &mut pfioc_rule))?;
Expand Down

0 comments on commit 2ac9af7

Please sign in to comment.