@@ -1072,15 +1072,16 @@ impl<'b, 'c, 'e> InterfaceInner<'b, 'c, 'e> {
10721072 }
10731073
10741074 /// Checks if an incoming packet has a broadcast address for the interfaces
1075- /// first ip address
1075+ /// associated ipv4 addresses.
1076+ #[ cfg( feature = "proto-ipv4" ) ]
10761077 fn is_subnet_broadcast ( & self , address : IpAddress ) -> bool {
10771078 match address {
1078- #[ cfg( feature = "proto-ipv4" ) ]
10791079 IpAddress :: Ipv4 ( addr) => {
10801080 self . ip_addrs . iter ( )
10811081 . filter_map ( |own_cidr| match own_cidr {
10821082 IpCidr :: Ipv4 ( own_ip) => Some ( own_ip. broadcast ( ) ?) ,
1083- _ => None
1083+ #[ cfg( feature = "proto-ipv6" ) ]
1084+ IpCidr :: Ipv6 ( _) => None
10841085 } )
10851086 . any ( |broadcast_address| addr == broadcast_address)
10861087 } ,
@@ -1716,9 +1717,9 @@ mod test {
17161717 #[ cfg( feature = "proto-ipv4" ) ]
17171718 use crate :: wire:: { ArpOperation , ArpPacket , ArpRepr } ;
17181719 use crate :: wire:: { EthernetAddress , EthernetFrame , EthernetProtocol } ;
1719- use crate :: wire:: { IpAddress , IpCidr , IpProtocol , IpRepr , Ipv4Cidr } ;
1720+ use crate :: wire:: { IpAddress , IpCidr , IpProtocol , IpRepr } ;
17201721 #[ cfg( feature = "proto-ipv4" ) ]
1721- use crate :: wire:: { Ipv4Address , Ipv4Repr } ;
1722+ use crate :: wire:: { Ipv4Address , Ipv4Repr , Ipv4Cidr } ;
17221723 #[ cfg( feature = "proto-igmp" ) ]
17231724 use crate :: wire:: Ipv4Packet ;
17241725 #[ cfg( feature = "proto-ipv4" ) ]
@@ -1899,6 +1900,7 @@ mod test {
18991900 }
19001901
19011902 #[ test]
1903+ #[ cfg( feature = "proto-ipv4" ) ]
19021904 fn test_local_subnet_broadcasts ( ) {
19031905 let ( mut iface, _) = create_loopback ( ) ;
19041906 iface. update_ip_addrs ( |addrs| {
0 commit comments