[17/30] resolv: Remove unnecessary res_isourserver_p call from send_dg

Message ID 0166a598b85d22bb17ae3cda350cf93795f0f8fe.1625755446.git.fweimer@redhat.com
State Committed
Commit ee3639e0fe61a3692adf660e04f9e6d56475ff52
Headers
Series nss_dns move into libc |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer July 8, 2021, 3:04 p.m. UTC
  As the comment indicates, the check is unnecessary due to the way the
UDP socket is set up.
---
 resolv/res_send.c | 6 ------
 1 file changed, 6 deletions(-)
  

Comments

Carlos O'Donell July 15, 2021, 5:01 a.m. UTC | #1
On 7/8/21 11:04 AM, Florian Weimer via Libc-alpha wrote:
> As the comment indicates, the check is unnecessary due to the way the
> UDP socket is set up.

OK for glibc 2.34.

Tested without regression on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  resolv/res_send.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/resolv/res_send.c b/resolv/res_send.c
> index 77d6835e1a..b6139c7d62 100644
> --- a/resolv/res_send.c
> +++ b/resolv/res_send.c
> @@ -1343,12 +1343,6 @@ send_dg(res_state statp,
>  			return close_and_return_error (statp, resplen2);
>  		}
>  
> -		/* Paranoia check.  Due to the connected UDP socket,
> -		   the kernel has already filtered invalid addresses
> -		   for us.  */
> -		if (!res_ourserver_p(statp, &from))
> -		  goto wait;

OK.

> -
>  		/* Check for the correct header layout and a matching
>  		   question.  */
>  		int matching_query = 0; /* Default to no matching query.  */
>
  

Patch

diff --git a/resolv/res_send.c b/resolv/res_send.c
index 77d6835e1a..b6139c7d62 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1343,12 +1343,6 @@  send_dg(res_state statp,
 			return close_and_return_error (statp, resplen2);
 		}
 
-		/* Paranoia check.  Due to the connected UDP socket,
-		   the kernel has already filtered invalid addresses
-		   for us.  */
-		if (!res_ourserver_p(statp, &from))
-		  goto wait;
-
 		/* Check for the correct header layout and a matching
 		   question.  */
 		int matching_query = 0; /* Default to no matching query.  */