[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd
From: |
Tom Rini |
Subject: |
Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd |
Date: |
Mon, 14 Aug 2023 11:29:40 -0400 |
On Mon, Aug 14, 2023 at 09:18:19PM +0600, Maxim Uvarov wrote:
> On Mon, 14 Aug 2023 at 20:21, Ilias Apalodimas <ilias.apalodimas@linaro.org>
> wrote:
>
> > On Mon, Aug 14, 2023 at 07:32:43PM +0600, Maxim Uvarov wrote:
> > > Implement function for dhcp command with lwIP variant. Usage and output
> > is
> > > the same as the original command. This code called by compatibility code
> > > between U-Boot and lwIP.
> >
> > Same as the dns command
> >
> > >
> > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> > > ---
> > > include/net/lwip.h | 10 +++++++
> > > net/lwip/Makefile | 1 +
> > > net/lwip/apps/dhcp/lwip-dhcp.c | 51 ++++++++++++++++++++++++++++++++++
> > > 3 files changed, 62 insertions(+)
> > > create mode 100644 net/lwip/apps/dhcp/lwip-dhcp.c
> > >
> > > diff --git a/include/net/lwip.h b/include/net/lwip.h
> > > index c83b5c8231..2f035280eb 100644
> > > --- a/include/net/lwip.h
> > > +++ b/include/net/lwip.h
> > > @@ -15,3 +15,13 @@ int do_lwip_dns(struct cmd_tbl *cmdtp, int flag, int
> > argc,
> > > * Other value < 0, if error
> > > */
> > > int ulwip_dns(char *name, char *varname);
> > > +
> > > +/*
> > > +* This function creates the DHCP request to obtain IP address. If DHCP
> > server
> >
> > Sphinx needs something more, please check the existing functions
> >
> > > +* returns file name, this file will be downloaded with tftp. After this
> > > +* function you need to invoke the polling loop to process network
> > communication.
> > > +*
> > > +* Return: 0 if success
> > > +* Other value < 0, if error
> > > +*/
> > > +int ulwip_dhcp(void);
> > > diff --git a/net/lwip/Makefile b/net/lwip/Makefile
> > > index 6d2c00605b..59323fb325 100644
> > > --- a/net/lwip/Makefile
> > > +
> > > +static struct dhcp dhcp;
> > > +
> > > +static int ulwip_dhcp_tmo(void)
> > > +{
> > > + switch (dhcp.state) {
> > > + case DHCP_STATE_BOUND:
> > > + env_set("bootfile", dhcp.boot_file_name);
> > > + env_set("ipaddr", ip4addr_ntoa(&dhcp.offered_ip_addr));
> > > + env_set("netmask", ip4addr_ntoa(&dhcp.offered_sn_mask));
> > > + env_set("serverip", ip4addr_ntoa(&dhcp.server_ip_addr));
> > > + printf("DHCP client bound to address %s\n",
> > ip4addr_ntoa(&dhcp.offered_ip_addr));
> > > + break;
> > > + default:
> > > + return -1;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +int ulwip_dhcp(void)
> > > +{
> > > + int err;
> > > + struct netif *netif;
> > > +
> > > + ulwip_set_tmo(ulwip_dhcp_tmo);
> > > + netif = netif_get_by_index(1);
> >
> > What's (1)?
> >
> >
> Only one lwip netif is registered. 1 - here is the index of netif. I don't
> think that there is any definition for that...
>
And there's only ever going to be one interface (even if we have ipv4
and ipv60 ? If so, define it to something please, thanks.
--
Tom
signature.asc
Description: PGP signature
- Re: [lwip-devel] [PATCHv6 03/14] net/lwip: implement dns cmd, (continued)
[lwip-devel] [PATCHv6 05/14] net/lwip: implement tftp cmd, Maxim Uvarov, 2023/08/14
[lwip-devel] [PATCHv6 06/14] net/lwip: implement wget cmd, Maxim Uvarov, 2023/08/14
[lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Maxim Uvarov, 2023/08/14
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Ilias Apalodimas, 2023/08/14
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Maxim Uvarov, 2023/08/14
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd,
Tom Rini <=
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Maxim Uvarov, 2023/08/17
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Peter Robinson, 2023/08/17
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Maxim Uvarov, 2023/08/17
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Tom Rini, 2023/08/17
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Maxim Uvarov, 2023/08/18
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Peter Robinson, 2023/08/18
- Re: [lwip-devel] [PATCHv6 04/14] net/lwip: implement dhcp cmd, Tom Rini, 2023/08/18
[lwip-devel] [PATCHv6 07/14] net/lwip: implement ping cmd, Maxim Uvarov, 2023/08/14