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

Re: [PATCH v12 10/17] net: dgram: make dgram_dst generic



On 10/20/22 13:17, Philippe Mathieu-Daudé wrote:
On 20/10/22 11:16, Laurent Vivier wrote:
dgram_dst is a sockaddr_in structure. To be able to use it with
unix socket, use a pointer to a generic sockaddr structure.

Rename it dest_addr, and store socket length in dest_len.

Signed-off-by: Laurent Vivier <lvivier@xxxxxxxxxx>
Reviewed-by: Stefano Brivio <sbrivio@xxxxxxxxxx>
Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
---
  net/dgram.c | 82 ++++++++++++++++++++++++++++++++++-------------------
  1 file changed, 53 insertions(+), 29 deletions(-)

  static NetClientInfo net_dgram_socket_info = {
@@ -260,7 +263,7 @@ static NetDgramState *net_dgram_fd_init(NetClientState 
*peer,
                                          SocketAddress *mcast,
                                          Error **errp)
  {
-    struct sockaddr_in saddr;
+    struct sockaddr_in *saddr = NULL;

Preferrably g_autofree.

No, because saddr pointer is copied to s->dest_addr.

...
@@ -339,21 +342,24 @@ static int net_dgram_mcast_init(NetClientState *peer,
  {
      NetDgramState *s;
      int fd, ret;
-    struct sockaddr_in saddr;
+    struct sockaddr_in *saddr;

Preferrably:

   g_autofree struct sockaddr_in *saddr = NULL.

The same here.

Thanks,
Laurent




 


Rackspace

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