connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Geoffrey Van Landeghem <geoffrey.vl@gmail.com>
Cc: connman@lists.linux.dev, wagi@monom.org
Subject: Re: autoip address set/reset loop
Date: Wed, 23 Nov 2022 15:10:15 +0000	[thread overview]
Message-ID: <Y34315YvyR6DOyWn@donbot> (raw)
In-Reply-To: <9af7ed7a-be9b-962a-bcfd-8b482d45a65f@gmail.com>

On Wed, Nov 23, 2022 at 03:56:42PM +0100, Geoffrey Van Landeghem wrote:
> Subject: Re: autoip address set/reset loop
> 
> Here is the patch:
> 
> From b7750b925714572cba12275e6da49b8b70cd3fbb Mon Sep 17 00:00:00 2001
> From: Geoffrey Van Landeghem <geoffrey.vl@gmail.com>
> Date: Tue, 22 Nov 2022 19:50:12 +0100
> Subject: [PATCH] ipconfig: revert not adding invalid gateway routes
> 
> ---
>  src/ipconfig.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/ipconfig.c b/src/ipconfig.c
> index 74215e1d..875819a0 100644
> --- a/src/ipconfig.c
> +++ b/src/ipconfig.c
> @@ -1183,13 +1183,17 @@ int __connman_ipconfig_gateway_add(struct connman_ipconfig *ipconfig)
>  
>  	DBG("");
>  
> -	if (!ipconfig->address || !ipconfig->address->gateway)
> +	if (!ipconfig->address)
>  		return -EINVAL;
>  
>  	service = __connman_service_lookup_from_index(ipconfig->index);
>  	if (!service)
>  		return -EINVAL;
>  
> +	/*
> +	 * Gateway is allowed to be NULL here, see
> +	 * __connman_connection_gateway_add()
> +	 */
>  	DBG("type %d gw %s peer %s", ipconfig->type,
>  		ipconfig->address->gateway, ipconfig->address->peer);

If gateway can be null you need to make sure the argument to DBG() is
non-null.  While glibc handles null for %s other C libraries may crash.

  reply	other threads:[~2022-11-23 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 14:56 autoip address set/reset loop Geoffrey Van Landeghem
2022-11-23 15:10 ` John Keeping [this message]
2022-11-23 16:46 ` Daniel Wagner
  -- strict thread matches above, loose matches on Subject: below --
2022-11-23 17:12 Geoffrey Van Landeghem
2022-11-23 17:36 ` Daniel Wagner
2022-11-23 18:27   ` Geoffrey Van Landeghem
2022-11-24 11:45     ` Daniel Wagner
2022-11-24 16:34       ` Geoffrey Van Landeghem
2022-11-24 17:30         ` Daniel Wagner
2022-11-23 16:03 Geoffrey Van Landeghem
2022-11-18 10:55 Geoffrey Van Landeghem
2022-11-22 18:35 ` Geoffrey Van Landeghem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y34315YvyR6DOyWn@donbot \
    --to=john@metanate.com \
    --cc=connman@lists.linux.dev \
    --cc=geoffrey.vl@gmail.com \
    --cc=wagi@monom.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).