[PATCH v3 06/12] net-lwip: add dns command

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Jun 6 18:02:47 CEST 2024


[...]

> >> +
> >> +       if (!ipaddr) {
> >> +               printf("DNS: host not found\n");
> >> +               host_ipaddr.addr = 0;
> >> +               return;
> >> +       }
> >> +
> >> +       if (var)
> >> +               env_set(var, ipstr);
> >
> > Do we need this? Won't this set <dns_name> == ipaddr?
>
> No, the syntax of the dns command is: 'dns hostname [env_var]' so one can
> pretty much give any variable name to receive the IP address.
>
> > If we do not need it repurpose the void *arg and get rid of the global 'done'
>
> I could probably use a struct to get rid of the globals. Let me see what I can do.

Yea just pass a struct with char* and a bool * and you should be fine

Thanks
/Ilias
>
> >> +
> >> +       printf("%s\n", ipstr);
> >> +}
> >> +
> >> +int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> >> +{
> >> +       bool has_server = false;
> >> +       ip_addr_t ipaddr;
> >> +       ip_addr_t ns;
> >> +       char *nsenv;
> >> +       char *name;
> >> +       char *var;
> >> +       int ret;
> >
> > [...]
> >
> > Thanks
> > /Ilias


More information about the U-Boot mailing list