File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -1513,10 +1513,12 @@ impl<'a> Socket<'a> {
1513
1513
return false ;
1514
1514
}
1515
1515
1516
- // If we're still listening for SYNs and the packet has an ACK, it cannot
1517
- // be destined to this socket, but another one may well listen on the same
1518
- // local endpoint.
1519
- if self . state == State :: Listen && repr. ack_number . is_some ( ) {
1516
+ // If we're still listening for SYNs and the packet has an ACK or a RST,
1517
+ // it cannot be destined to this socket, but another one may well listen
1518
+ // on the same local endpoint.
1519
+ if self . state == State :: Listen
1520
+ && ( repr. ack_number . is_some ( ) || repr. control == TcpControl :: Rst )
1521
+ {
1520
1522
return false ;
1521
1523
}
1522
1524
@@ -3284,15 +3286,13 @@ mod test {
3284
3286
#[ test]
3285
3287
fn test_listen_rst ( ) {
3286
3288
let mut s = socket_listen ( ) ;
3287
- send ! (
3288
- s,
3289
- TcpRepr {
3290
- control: TcpControl :: Rst ,
3291
- seq_number: REMOTE_SEQ ,
3292
- ack_number: None ,
3293
- ..SEND_TEMPL
3294
- }
3295
- ) ;
3289
+ let tcp_repr = TcpRepr {
3290
+ control : TcpControl :: Rst ,
3291
+ seq_number : REMOTE_SEQ ,
3292
+ ack_number : None ,
3293
+ ..SEND_TEMPL
3294
+ } ;
3295
+ assert ! ( !s. socket. accepts( & mut s. cx, & SEND_IP_TEMPL , & tcp_repr) ) ;
3296
3296
assert_eq ! ( s. state, State :: Listen ) ;
3297
3297
}
3298
3298
You can’t perform that action at this time.
0 commit comments