mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Michael Olbrich <m.olbrich@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] net: ifup: pass hostname and linuxdevname to linux with DHCP
Date: Tue, 2 May 2023 11:44:54 +0200	[thread overview]
Message-ID: <20230502094454.GY13543@pengutronix.de> (raw)
In-Reply-To: <20230426084659.4002852-1-m.olbrich@pengutronix.de>

On Wed, Apr 26, 2023 at 10:46:59AM +0200, Michael Olbrich wrote:
> Barebox always uses the hostname in the DHCP request. To configure
> kernel networking, use the long ip= syntax for DHCP and set the hostname
> as well. This way, Barebox and Linux use the same hostname in the DHCP
> request.
> Also set the device if linuxdevname is configured. This is already done
> for static configurations. Do the same for DHCP.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
>  net/ifup.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Nice. I didn't know one can pass more parameters with ip=dhcp.

Applied, thanks

Sascha

> 
> diff --git a/net/ifup.c b/net/ifup.c
> index 1870f7401714..18ab1363c748 100644
> --- a/net/ifup.c
> +++ b/net/ifup.c
> @@ -159,8 +159,8 @@ out:
>  
>  static void set_linux_bootarg(struct eth_device *edev)
>  {
> +	char *bootarg;
>  	if (edev->global_mode == ETH_MODE_STATIC) {
> -		char *bootarg;
>  		IPaddr_t serverip;
>  		IPaddr_t gateway;
>  
> @@ -176,7 +176,11 @@ static void set_linux_bootarg(struct eth_device *edev)
>  		dev_set_param(&edev->dev, "linux.bootargs", bootarg);
>  		free(bootarg);
>  	} else if (edev->global_mode == ETH_MODE_DHCP) {
> -		dev_set_param(&edev->dev, "linux.bootargs", "ip=dhcp");
> +		bootarg = basprintf("ip=::::%s:%s:dhcp",
> +				barebox_get_hostname(),
> +				edev->linuxdevname ? edev->linuxdevname : "");
> +		dev_set_param(&edev->dev, "linux.bootargs", bootarg);
> +		free(bootarg);
>  	}
>  }
>  
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2023-05-02  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  8:46 Michael Olbrich
2023-05-02  9:44 ` Sascha Hauer [this message]

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=20230502094454.GY13543@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.olbrich@pengutronix.de \
    /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