@@ -473,6 +473,7 @@ impl fmt::Display for IpAddr {
473
473
*/
474
474
475
475
#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
476
+ #[ repr( transparent) ]
476
477
pub struct Ipv4Addr ( pub libc:: in_addr) ;
477
478
478
479
impl Ipv4Addr {
@@ -522,6 +523,7 @@ impl fmt::Display for Ipv4Addr {
522
523
*/
523
524
524
525
#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
526
+ #[ repr( transparent) ]
525
527
pub struct Ipv6Addr ( pub libc:: in6_addr) ;
526
528
527
529
// Note that IPv6 addresses are stored in big endian order on all architectures.
@@ -1062,7 +1064,8 @@ pub mod netlink {
1062
1064
use std:: { fmt, mem} ;
1063
1065
1064
1066
#[ derive( Copy , Clone , Debug , Eq , Hash , PartialEq ) ]
1065
- pub struct NetlinkAddr ( pub sockaddr_nl ) ;
1067
+ #[ repr( transparent) ]
1068
+ pub struct NetlinkAddr ( pub ( in super :: super ) sockaddr_nl ) ;
1066
1069
1067
1070
impl NetlinkAddr {
1068
1071
pub fn new ( pid : u32 , groups : u32 ) -> NetlinkAddr {
@@ -1099,7 +1102,8 @@ pub mod alg {
1099
1102
use std:: ffi:: CStr ;
1100
1103
1101
1104
#[ derive( Copy , Clone ) ]
1102
- pub struct AlgAddr ( pub sockaddr_alg ) ;
1105
+ #[ repr( transparent) ]
1106
+ pub struct AlgAddr ( pub ( in super :: super ) sockaddr_alg ) ;
1103
1107
1104
1108
// , PartialEq, Eq, Debug, Hash
1105
1109
impl PartialEq for AlgAddr {
@@ -1179,9 +1183,9 @@ pub mod sys_control {
1179
1183
1180
1184
ioctl_readwrite!( ctl_info, CTL_IOC_MAGIC , CTL_IOC_INFO , ctl_ioc_info) ;
1181
1185
1182
- #[ repr( C ) ]
1183
1186
#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
1184
- pub struct SysControlAddr ( pub libc:: sockaddr_ctl) ;
1187
+ #[ repr( transparent) ]
1188
+ pub struct SysControlAddr ( pub ( in super :: super ) libc:: sockaddr_ctl) ;
1185
1189
1186
1190
impl SysControlAddr {
1187
1191
pub const fn new( id: u32 , unit: u32 ) -> SysControlAddr {
@@ -1238,7 +1242,8 @@ mod datalink {
1238
1242
1239
1243
/// Hardware Address
1240
1244
#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
1241
- pub struct LinkAddr ( pub libc:: sockaddr_ll) ;
1245
+ #[ repr( transparent) ]
1246
+ pub struct LinkAddr ( pub ( in super :: super ) libc:: sockaddr_ll) ;
1242
1247
1243
1248
impl LinkAddr {
1244
1249
/// Always AF_PACKET
@@ -1315,7 +1320,8 @@ mod datalink {
1315
1320
1316
1321
/// Hardware Address
1317
1322
#[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
1318
- pub struct LinkAddr ( pub libc:: sockaddr_dl) ;
1323
+ #[ repr( transparent) ]
1324
+ pub struct LinkAddr ( pub ( in super :: super ) libc:: sockaddr_dl) ;
1319
1325
1320
1326
impl LinkAddr {
1321
1327
/// Total length of sockaddr
@@ -1408,7 +1414,8 @@ pub mod vsock {
1408
1414
use std:: hash:: { Hash , Hasher } ;
1409
1415
1410
1416
#[ derive( Copy , Clone ) ]
1411
- pub struct VsockAddr ( pub sockaddr_vm ) ;
1417
+ #[ repr( transparent) ]
1418
+ pub struct VsockAddr ( pub ( in super :: super ) sockaddr_vm ) ;
1412
1419
1413
1420
impl PartialEq for VsockAddr {
1414
1421
fn eq ( & self , other : & Self ) -> bool {
0 commit comments