@@ -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) ] {
@@ -437,6 +438,15 @@ s_no_extra_traits! {
437
438
__pad: [ c_char; 4 ] ,
438
439
__glibc_reserved: [ c_char; 32 ] ,
439
440
}
441
+
442
+ // linux/if_ether.h
443
+
444
+ #[ repr( C , packed) ]
445
+ pub struct ethhdr {
446
+ pub h_dest: [ c_uchar; crate :: ETH_ALEN as usize ] ,
447
+ pub h_source: [ c_uchar; crate :: ETH_ALEN as usize ] ,
448
+ pub h_proto: crate :: __be16,
449
+ }
440
450
}
441
451
442
452
// Internal, for casts to access union fields
@@ -646,6 +656,33 @@ cfg_if! {
646
656
}
647
657
}
648
658
}
659
+
660
+ impl Eq for ethhdr { }
661
+
662
+ impl PartialEq for ethhdr {
663
+ fn eq( & self , other: & ethhdr) -> bool {
664
+ self . h_dest
665
+ . iter( )
666
+ . zip( other. h_dest. iter( ) )
667
+ . all( |( a, b) | a == b)
668
+ && self
669
+ . h_source
670
+ . iter( )
671
+ . zip( other. h_source. iter( ) )
672
+ . all( |( a, b) | a == b)
673
+ && self . h_proto == other. h_proto
674
+ }
675
+ }
676
+
677
+ impl fmt:: Debug for ethhdr {
678
+ fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
679
+ f. debug_struct( "ethhdr" )
680
+ . field( "h_dest" , & self . h_dest)
681
+ . field( "h_source" , & self . h_source)
682
+ . field( "h_proto" , & { self . h_proto } )
683
+ . finish( )
684
+ }
685
+ }
649
686
}
650
687
}
651
688
0 commit comments