[PATCH 1/1] net: add support to parse the NIS domain for the dhcp options

Tom Rini trini at konsulko.com
Fri Apr 12 21:58:47 CEST 2024


On Mon, Apr 01, 2024 at 12:13:19PM -0700, Charles Hardin wrote:

> There is code in the bootp parsing for NIS domain and add the
> same support for the dhcp options as well. This allows the same
> usage of the data when the dhcp command is used in the boot
> command.
> 
> Signed-off-by: Charles Hardin <ckhardin at gmail.com>
> ---
>  net/bootp.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/net/bootp.c b/net/bootp.c
> index 6800290963..046caf3685 100644
> --- a/net/bootp.c
> +++ b/net/bootp.c
> @@ -883,6 +883,14 @@ static void dhcp_process_options(uchar *popt, uchar *end)
>  			break;
>  		case 28:	/* Ignore Broadcast Address Option */
>  			break;
> +		case 40:	/* NIS Domain name */
> +			if (net_nis_domain[0] == 0) {
> +				size = truncate_sz("NIS Domain Name",
> +					sizeof(net_nis_domain), size);
> +				memcpy(&net_nis_domain, ext + 2, size);
> +				net_nis_domain[size] = 0;
> +			}
> +			break;
>  #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER)
>  		case 42:	/* NTP server IP */
>  			net_copy_ip(&net_ntp_server, (popt + 2));

This fails to build:
net/bootp.c: In function 'dhcp_process_options':
net/bootp.c:890:57: error: 'ext' undeclared (first use in this function)
  890 |                                 memcpy(&net_nis_domain, ext + 2, size);
      |                                                         ^~~
net/bootp.c:890:57: note: each undeclared identifier is reported only once for each function it appears in

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240412/834b3939/attachment.sig>


More information about the U-Boot mailing list