qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 48/65] slirp: rename exec_list


From: Samuel Thibault
Subject: [Qemu-devel] [PULL 48/65] slirp: rename exec_list
Date: Mon, 14 Jan 2019 23:52:49 +0100

From: Marc-André Lureau <address@hidden>

This list is not only used to handle command to execute on guest
connection, it can also redirect to an arbitrary object, such as a
chardev. Let's rename the struct and the field to "guestfwd".

Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
---
 slirp/misc.c      |  6 +++---
 slirp/misc.h      |  6 +++---
 slirp/slirp.c     | 18 +++++++++---------
 slirp/slirp.h     |  2 +-
 slirp/tcp_input.c |  6 +++---
 slirp/tcp_subr.c  |  4 ++--
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/slirp/misc.c b/slirp/misc.c
index 2d092624d3..526cefa0f1 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -36,10 +36,10 @@ remque(void *a)
   element->qh_rlink = NULL;
 }
 
-int add_exec(struct ex_list **ex_ptr, void *chardev, const char *cmdline,
+int add_exec(struct gfwd_list **ex_ptr, void *chardev, const char *cmdline,
              struct in_addr addr, int port)
 {
-       struct ex_list *tmp_ptr;
+       struct gfwd_list *tmp_ptr;
 
        /* First, check if the port is "bound" */
        for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) {
@@ -49,7 +49,7 @@ int add_exec(struct ex_list **ex_ptr, void *chardev, const 
char *cmdline,
        }
 
        tmp_ptr = *ex_ptr;
-       *ex_ptr = g_new0(struct ex_list, 1);
+       *ex_ptr = g_new0(struct gfwd_list, 1);
        (*ex_ptr)->ex_fport = port;
        (*ex_ptr)->ex_addr = addr;
        if (chardev) {
diff --git a/slirp/misc.h b/slirp/misc.h
index 0bc5e74bc5..1df707c052 100644
--- a/slirp/misc.h
+++ b/slirp/misc.h
@@ -8,12 +8,12 @@
 #ifndef MISC_H
 #define MISC_H
 
-struct ex_list {
+struct gfwd_list {
        void *ex_chardev;
        struct in_addr ex_addr;         /* Server address */
        int ex_fport;                   /* Port to telnet to */
        char *ex_exec;                  /* Command line of what to exec */
-       struct ex_list *ex_next;
+       struct gfwd_list *ex_next;
 };
 
 #define EMU_NONE 0x0
@@ -51,7 +51,7 @@ struct slirp_quehead {
 
 void slirp_insque(void *, void *);
 void slirp_remque(void *);
-int add_exec(struct ex_list **, void *, const char *, struct in_addr, int);
+int add_exec(struct gfwd_list **, void *, const char *, struct in_addr, int);
 int fork_exec(struct socket *so, const char *ex);
 
 #endif
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 591dd1fcb4..e860750f72 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -345,9 +345,9 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct 
in_addr vnetwork,
 
 void slirp_cleanup(Slirp *slirp)
 {
-    struct ex_list *e, *next;
+    struct gfwd_list *e, *next;
 
-    for (e = slirp->exec_list; e; e = next) {
+    for (e = slirp->guestfwd_list; e; e = next) {
         next = e->ex_next;
         g_free(e->ex_exec);
         g_free(e);
@@ -760,7 +760,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int 
pkt_len)
     struct ethhdr *reh = (struct ethhdr *)arp_reply;
     struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN);
     int ar_op;
-    struct ex_list *ex_ptr;
+    struct gfwd_list *ex_ptr;
 
     if (!slirp->in_enabled) {
         return;
@@ -780,7 +780,7 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int 
pkt_len)
             if (ah->ar_tip == slirp->vnameserver_addr.s_addr ||
                 ah->ar_tip == slirp->vhost_addr.s_addr)
                 goto arp_ok;
-            for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
+            for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = 
ex_ptr->ex_next) {
                 if (ex_ptr->ex_addr.s_addr == ah->ar_tip)
                     goto arp_ok;
             }
@@ -1052,7 +1052,7 @@ int slirp_add_exec(Slirp *slirp, void *chardev, const 
char *cmdline,
         return -1;
     }
 
-    return add_exec(&slirp->exec_list, chardev, cmdline, *guest_addr,
+    return add_exec(&slirp->guestfwd_list, chardev, cmdline, *guest_addr,
                     htons(guest_port));
 }
 
@@ -1423,9 +1423,9 @@ static const VMStateDescription vmstate_slirp = {
 static void slirp_state_save(QEMUFile *f, void *opaque)
 {
     Slirp *slirp = opaque;
-    struct ex_list *ex_ptr;
+    struct gfwd_list *ex_ptr;
 
-    for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next)
+    for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next)
         if (ex_ptr->ex_chardev) {
             struct socket *so;
             so = slirp_find_ctl_socket(slirp, ex_ptr->ex_addr,
@@ -1445,7 +1445,7 @@ static void slirp_state_save(QEMUFile *f, void *opaque)
 static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)
 {
     Slirp *slirp = opaque;
-    struct ex_list *ex_ptr;
+    struct gfwd_list *ex_ptr;
 
     while (qemu_get_byte(f)) {
         int ret;
@@ -1460,7 +1460,7 @@ static int slirp_state_load(QEMUFile *f, void *opaque, 
int version_id)
             slirp->vnetwork_addr.s_addr) {
             return -EINVAL;
         }
-        for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
+        for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
             if (ex_ptr->ex_chardev &&
                 so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr &&
                 so->so_fport == ex_ptr->ex_fport) {
diff --git a/slirp/slirp.h b/slirp/slirp.h
index fdf397256b..9aa245715d 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -147,7 +147,7 @@ struct Slirp {
     char client_hostname[33];
 
     int restricted;
-    struct ex_list *exec_list;
+    struct gfwd_list *guestfwd_list;
 
     /* mbuf states */
     struct quehead m_freelist;
diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index c4d7abf1fa..f1cddce992 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -211,7 +211,7 @@ tcp_input(struct mbuf *m, int iphlen, struct socket *inso, 
unsigned short af)
        struct sockaddr_storage lhost, fhost;
        struct sockaddr_in *lhost4, *fhost4;
        struct sockaddr_in6 *lhost6, *fhost6;
-    struct ex_list *ex_ptr;
+    struct gfwd_list *ex_ptr;
     Slirp *slirp;
 
        DEBUG_CALL("tcp_input");
@@ -394,7 +394,7 @@ findso:
              * for non-hostfwd connections. These should be dropped, unless it
              * happens to be a guestfwd.
              */
-            for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
+            for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = 
ex_ptr->ex_next) {
                 if (ex_ptr->ex_fport == ti->ti_dport &&
                     ti->ti_dst.s_addr == ex_ptr->ex_addr.s_addr) {
                     break;
@@ -616,7 +616,7 @@ findso:
            if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr &&
                so->so_faddr.s_addr != slirp->vnameserver_addr.s_addr) {
                /* May be an add exec */
-               for (ex_ptr = slirp->exec_list; ex_ptr;
+               for (ex_ptr = slirp->guestfwd_list; ex_ptr;
                     ex_ptr = ex_ptr->ex_next) {
                  if(ex_ptr->ex_fport == so->so_fport &&
                     so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 00cee73163..3b14684107 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -949,14 +949,14 @@ int tcp_ctl(struct socket *so)
 {
     Slirp *slirp = so->slirp;
     struct sbuf *sb = &so->so_snd;
-    struct ex_list *ex_ptr;
+    struct gfwd_list *ex_ptr;
 
     DEBUG_CALL("tcp_ctl");
     DEBUG_ARG("so = %p", so);
 
     if (so->so_faddr.s_addr != slirp->vhost_addr.s_addr) {
         /* Check if it's pty_exec */
-        for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
+        for (ex_ptr = slirp->guestfwd_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {
             if (ex_ptr->ex_fport == so->so_fport &&
                 so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr) {
                 if (ex_ptr->ex_chardev) {
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]