@@ -17,7 +17,7 @@ use nftables::stmt;
1717use rand:: distributions:: Alphanumeric ;
1818use rand:: Rng ;
1919use rtnetlink:: { IpVersion , RouteMessageBuilder } ;
20- use std:: net:: IpAddr ;
20+ use std:: net:: { Ipv4Addr , Ipv6Addr } ;
2121use std:: time:: Duration ;
2222use tokio:: select;
2323use tokio:: time:: sleep;
@@ -107,17 +107,17 @@ async fn test_redirect_to_ip() -> anyhow::Result<()> {
107107 assert ! ( ip_rules. contains( & ip_rule_exp) ) ;
108108
109109 let mut ip_routes_exp = [
110- RouteMessageBuilder :: < IpAddr > :: new ( )
110+ RouteMessageBuilder :: < Ipv4Addr > :: new ( )
111111 . table_id ( table_index)
112- . destination_prefix ( "172.20.0.0" . parse ( ) ?, 16 ) ?
112+ . destination_prefix ( "172.20.0.0" . parse ( ) ?, 16 )
113113 . output_interface ( dummy_index)
114- . gateway ( "10.128.128.1" . parse ( ) ?) ?
114+ . gateway ( "10.128.128.1" . parse ( ) ?)
115115 . build ( ) ,
116- RouteMessageBuilder :: < IpAddr > :: new ( )
116+ RouteMessageBuilder :: < Ipv4Addr > :: new ( )
117117 . table_id ( table_index)
118- . destination_prefix ( "172.21.0.0" . parse ( ) ?, 16 ) ?
118+ . destination_prefix ( "172.21.0.0" . parse ( ) ?, 16 )
119119 . output_interface ( dummy_index)
120- . gateway ( "10.128.128.1" . parse ( ) ?) ?
120+ . gateway ( "10.128.128.1" . parse ( ) ?)
121121 . build ( ) ,
122122 ] ;
123123 ip_routes_exp. iter_mut ( ) . for_each ( route_msg_normalize) ;
@@ -169,17 +169,17 @@ async fn test_redirect_to_ipv6() -> anyhow::Result<()> {
169169 assert ! ( ip_rules. contains( & ip_rule_exp) ) ;
170170
171171 let mut ip_routes_exp = [
172- RouteMessageBuilder :: < IpAddr > :: new ( )
172+ RouteMessageBuilder :: < Ipv6Addr > :: new ( )
173173 . table_id ( table_index)
174- . destination_prefix ( "fc00::" . parse ( ) ?, 16 ) ?
174+ . destination_prefix ( "fc00::" . parse ( ) ?, 16 )
175175 . output_interface ( dummy_index)
176- . gateway ( "fc64::ffff" . parse ( ) ?) ?
176+ . gateway ( "fc64::ffff" . parse ( ) ?)
177177 . build ( ) ,
178- RouteMessageBuilder :: < IpAddr > :: new ( )
178+ RouteMessageBuilder :: < Ipv6Addr > :: new ( )
179179 . table_id ( table_index)
180- . destination_prefix ( "fc65:6565::" . parse ( ) ?, 32 ) ?
180+ . destination_prefix ( "fc65:6565::" . parse ( ) ?, 32 )
181181 . output_interface ( dummy_index)
182- . gateway ( "fc64::2333" . parse ( ) ?) ?
182+ . gateway ( "fc64::2333" . parse ( ) ?)
183183 . build ( ) ,
184184 ] ;
185185 ip_routes_exp. iter_mut ( ) . for_each ( route_msg_normalize) ;
@@ -188,6 +188,17 @@ async fn test_redirect_to_ipv6() -> anyhow::Result<()> {
188188 Ok ( ( ) )
189189}
190190
191+ #[ apply( test_local!) ]
192+ async fn test_random_114514 ( ) -> anyhow:: Result < ( ) > {
193+ let ( conn, handle, _) = rtnetlink:: new_connection ( ) ?;
194+ tokio:: spawn ( conn) ;
195+ let ip_routes = get_ip_route ( & handle, IpVersion :: V4 , 254 ) . await ?;
196+
197+ println ! ( "{ip_routes:?}" ) ;
198+
199+ Ok ( ( ) )
200+ }
201+
191202// TODO: test IPv4 with IPv6 nexthop
192203// TODO: test IPv6 offset
193204
0 commit comments