@@ -7,6 +7,7 @@ pub type __rlimit_resource_t = c_uint;
7
7
pub type Lmid_t = c_long ;
8
8
pub type regoff_t = c_int ;
9
9
pub type __kernel_rwf_t = c_int ;
10
+ pub type __be16 = crate :: __u16 ;
10
11
11
12
cfg_if ! {
12
13
if #[ cfg( doc) ] {
@@ -466,6 +467,15 @@ s_no_extra_traits! {
466
467
__pad: [ c_char; 4 ] ,
467
468
__glibc_reserved: [ c_char; 32 ] ,
468
469
}
470
+
471
+ // linux/if_ether.h
472
+
473
+ #[ repr( C , packed) ]
474
+ pub struct ethhdr {
475
+ pub h_dest: [ c_uchar; crate :: ETH_ALEN as usize ] ,
476
+ pub h_source: [ c_uchar; crate :: ETH_ALEN as usize ] ,
477
+ pub h_proto: crate :: __be16,
478
+ }
469
479
}
470
480
471
481
// Internal, for casts to access union fields
@@ -675,6 +685,33 @@ cfg_if! {
675
685
}
676
686
}
677
687
}
688
+
689
+ impl Eq for ethhdr { }
690
+
691
+ impl PartialEq for ethhdr {
692
+ fn eq( & self , other: & ethhdr) -> bool {
693
+ self . h_dest
694
+ . iter( )
695
+ . zip( other. h_dest. iter( ) )
696
+ . all( |( a, b) | a == b)
697
+ && self
698
+ . h_source
699
+ . iter( )
700
+ . zip( other. h_source. iter( ) )
701
+ . all( |( a, b) | a == b)
702
+ && self . h_proto == other. h_proto
703
+ }
704
+ }
705
+
706
+ impl fmt:: Debug for ethhdr {
707
+ fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
708
+ f. debug_struct( "ethhdr" )
709
+ . field( "h_dest" , & self . h_dest)
710
+ . field( "h_source" , & self . h_source)
711
+ . field( "h_proto" , & { self . h_proto } )
712
+ . finish( )
713
+ }
714
+ }
678
715
}
679
716
}
680
717
0 commit comments