Skip to contentSkip to conversation

slirp: Give error message if hostfwd_add/remove for unrecognized vlan/stack

PATCH In review Peter Maydell 2 participants 5 messages Jun 16, 2014 – Jul 18, 2014 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slirp: Give error message if hostfwd_add/remove for unrecognized vlan/stack

If the user specified a (vlan ID, slirp stack name) tuple in a monitor hostfwd_add/remove command and we can't find it, give the user an error message rather than silently doing nothing.

This brings this error case in slirp_lookup() into line with the other two.

---
 net/slirp.c | 1 +
 1 file changed, 1 insertion(+)
net/slirp.c +1 -0
index 8fddc03..647039e 100644
@@ -282,6 +282,7 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,
         NetClientState *nc;
         nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
         if (!nc) {
+            monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n");
             return NULL;
         }
         if (strcmp(nc->model, "user")) {
Signature · 1 line
1.9.2
#1 lore raw
Quoted 25 lines · Peter Maydell

If the user specified a (vlan ID, slirp stack name) tuple in a monitor hostfwd_add/remove command and we can't find it, give the user an error message rather than silently doing nothing.

This brings this error case in slirp_lookup() into line with the other two.

---
 net/slirp.c | 1 +
 1 file changed, 1 insertion(+)
net/slirp.c +1 -1
index 8fddc03..647039e 100644
@@ -282,6 +282,7 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,
         NetClientState *nc;
         nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
         if (!nc) {
+            monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n");
             return NULL;
         }
         if (strcmp(nc->model, "user")) {
--
Quoted 1 line

1.9.2

Ping! (and cc trivial).

thanks
-- PMM

#2 lore raw
Quoted 13 lines · Peter Maydell
Quoted 12 lines · Peter Maydell

If the user specified a (vlan ID, slirp stack name) tuple in a monitor hostfwd_add/remove command and we can't find it, give the user an error message rather than silently doing nothing.

This brings this error case in slirp_lookup() into line with the other two.

---
 net/slirp.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines
Quoted 13 lines
net/slirp.c +1 -1
index 8fddc03..647039e 100644
@@ -282,6 +282,7 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,
         NetClientState *nc;
         nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
         if (!nc) {
+            monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n");
             return NULL;
         }
         if (strcmp(nc->model, "user")) {
--
Quoted 1 line

1.9.2

Ping! (and cc trivial).

Ping again...

thanks
-- PMM

Reviewed-by
#3 lore raw
Quoted 14 lines · Peter Maydell
Quoted 13 lines · Peter Maydell
Quoted 12 lines · Peter Maydell

If the user specified a (vlan ID, slirp stack name) tuple in a monitor hostfwd_add/remove command and we can't find it, give the user an error message rather than silently doing nothing.

This brings this error case in slirp_lookup() into line with the other two.

---
 net/slirp.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
net/slirp.c +0 -0
index 8fddc03..647039e 100644
Quoted 8 lines

net/slirp.c static SlirpState *slirp_lookup(Monitor *mon, const char *vlan, · line 288

Quoted 8 lines
net/slirp.c +1 -0
@@ -282,6 +282,7 @@ static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,
         NetClientState *nc;
         nc = net_hub_find_client_by_name(strtol(vlan, NULL, 0), stack);
         if (!nc) {
+            monitor_printf(mon, "unrecognized (vlan-id, stackname) pair\n");
             return NULL;
         }
         if (strcmp(nc->model, "user")) {

Peter, I returned from vacation yesterday, so I weren't able to process -trivial queue before, and due to the time constraints we have before 2.1, I'm not sure it is a good idea to make a pull request for the -trivial tree. I'll pick this one up but it might be better to apply this directly.

Thanks,

/mjt

#4 lore raw
Quoted 7 lines · Michael Tokarev
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Peter Maydell
Quoted 4 lines · Peter Maydell

If the user specified a (vlan ID, slirp stack name) tuple in a monitor hostfwd_add/remove command and we can't find it, give the user an error message rather than silently doing nothing.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

This brings this error case in slirp_lookup() into line with the other two.

Peter, I returned from vacation yesterday, so I weren't able to process -trivial queue before, and due to the time constraints we have before 2.1, I'm not sure it is a good idea to make a pull request for the -trivial tree. I'll pick this one up but it might be better to apply this directly.

At this point and given the slirp code has been like this for a long time, I think it's probably best to let it go til 2.2.

thanks
-- PMM