File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -104,11 +104,13 @@ impl <T: ClientConnection> Client<T> {
104
104
105
105
let client_query = self . get_dns_query ( ) ;
106
106
let conn: & T = & self . get_conn ( ) ;
107
- let _ip_addr = conn. get_ip ( ) ;
107
+ let ip_addr = conn. get_ip ( ) ;
108
108
109
109
let dns_response: DnsMessage = match conn. send ( client_query) {
110
- Ok ( response_message) => {
111
- //let response_ip = get_sender_ip(&response_message)?;
110
+ Ok ( ( response_message, ip) ) => {
111
+ if ip != ip_addr {
112
+ return Err ( ClientError :: Message ( "The ip address of the server is not the same as the one in the connection." ) ) ?;
113
+ }
112
114
match DnsMessage :: from_bytes ( & response_message) {
113
115
Ok ( dns_message) => dns_message,
114
116
Err ( _) => return Err ( ClientError :: FormatError ( "The name server was unable to interpret the query." ) ) ?,
You can’t perform that action at this time.
0 commit comments