[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LIBLWIP PATCH] liblwip: Fetch ip_addr, net mask and gw address



Hi Sharan,

This patch is overlapping with another pending patch [1] that will be
needed for netfront. We need to coordinate on this one somehow.

[1] https://patchwork.unikraft.org/patch/734711/

Cheers,
Costin

On 10/7/19 1:00 PM, Sharan Santhanam wrote:
> The patch implements the operation to fetch the ipv4 address, net
> mask and ipv4 gateway address from the uk_netdev library.
> 
> Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
> ---
>  init.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/init.c b/init.c
> index 1447a2c..7d27f65 100644
> --- a/init.c
> +++ b/init.c
> @@ -45,6 +45,7 @@
>  #endif /* CONFIG_LWIP_NOTHREADS */
>  #include "netif/uknetdev.h"
>  #include <uk/init.h>
> +#include <arpa/inet.h>
>  
>  #if LWIP_NETIF_EXT_STATUS_CALLBACK && CONFIG_LWIP_NETIF_STATUS_PRINT
>  #include <stdio.h>
> @@ -184,6 +185,8 @@ static int liblwip_init(void)
>                          devid);
>  
>  #if LWIP_IPV4
> +             const char *addr;
> +             int rc;
>               ip4_arg   = NULL;
>               mask4_arg = NULL;
>               gw4_arg   = NULL;
> @@ -205,6 +208,34 @@ static int liblwip_init(void)
>                *  gw_arg = &gw;
>                */
>  
> +             addr = uk_netdev_einfo_get(dev, UK_NETDEV_IPV4_ADDR_STR);
> +             if (addr) {
> +                     rc = inet_pton(AF_INET, addr, &ip4);
> +                     if (rc <= 0)
> +                             uk_pr_warn("Failed to convert the ip 
> address:%s\n",
> +                                             addr);
> +                     else {
> +                             addr = uk_netdev_einfo_get(dev, 
> UK_NETDEV_IPV4_MASK_STR);
> +                             rc = inet_pton(AF_INET, addr, &mask4);
> +                             if (rc <= 0)
> +                                     uk_pr_warn("Failed to convert the ip 
> address:%s\n",
> +                                                     addr);
> +                             else {
> +                                     ip4_arg = &ip4;
> +                                     mask4_arg = &mask4;
> +                             }
> +                     }
> +             }
> +             addr = uk_netdev_einfo_get(dev, UK_NETDEV_IPV4_GW_STR);
> +             if (addr) {
> +                     rc = inet_pton(AF_INET, addr, &gw4);
> +                     if (rc <= 0)
> +                             uk_pr_warn("Failed to convert the ip 
> address:%s\n",
> +                                             addr);
> +                     else
> +                             gw4_arg = &gw4;
> +             }
> +
>               nf = uknetdev_addif(dev, ip4_arg, mask4_arg, gw4_arg);
>  #else /* LWIP_IPV4 */
>               /*
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.