Skip to content

Commit 22e4dcf

Browse files
committed
Auto merge of #1033 - SmilingNavern:add_packet_mreq, r=alexcrichton
Add if_packet.h headers Some structs for implementing af_packet(7)
2 parents 460fb13 + 5446faa commit 22e4dcf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/unix/notbsd/linux/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,13 @@ s! {
229229
pad: [::c_long; 4],
230230
}
231231

232+
pub struct packet_mreq {
233+
pub mr_ifindex: ::c_int,
234+
pub mr_type: ::c_ushort,
235+
pub mr_alen: ::c_ushort,
236+
pub mr_address: [::c_uchar; 8],
237+
}
238+
232239
pub struct cpu_set_t {
233240
#[cfg(all(target_pointer_width = "32",
234241
not(target_arch = "x86_64")))]
@@ -1300,6 +1307,15 @@ pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0;
13001307
pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1;
13011308
pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2;
13021309

1310+
// linux/if_packet.h
1311+
pub const PACKET_ADD_MEMBERSHIP: ::c_int = 1;
1312+
pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
1313+
1314+
pub const PACKET_MR_MULTICAST: ::c_int = 0;
1315+
pub const PACKET_MR_PROMISC: ::c_int = 1;
1316+
pub const PACKET_MR_ALLMULTI: ::c_int = 2;
1317+
pub const PACKET_MR_UNICAST: ::c_int = 3;
1318+
13031319
// linux/netfilter.h
13041320
pub const NF_DROP: ::c_int = 0;
13051321
pub const NF_ACCEPT: ::c_int = 1;

0 commit comments

Comments
 (0)