From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: Re: [PATCH] xl: improve vif2 parsing Date: Mon, 23 Aug 2010 00:55:03 +0200 Message-ID: <4C71AAC7.6000209@amd.com> References: <4C6E6E84.5020704@amd.com> <4C6E6F20.3090405@amd.com> <19566.43593.652375.534036@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060304020702020505080007" Return-path: In-Reply-To: <19566.43593.652375.534036@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: xen-devel , Keir Fraser , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org --------------060304020702020505080007 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Ian Jackson wrote: > Andre Przywara writes ("[Xen-devel] [PATCH] xl: improve vif2 parsing"): >> No, I didn't want to leave this as an exercise to the reader, I am just >> spoiled by git send-email, so forgot to attach the patch. Sorry! > > This looks nice to me but it doesn't apply to xen-unstable staging > tip. Can you take a look and either rebase or see if you can see what > the problem is ? (Perhaps it has been mangled by your mailer.) No, it just interfered and thus depended on the bug-fix I sent one mail earlier. So, please, first apply "[PATCH] xl: fix strtok() call in vif2 parsing", then try the patch again. This worked for me on top of staging:22054. I think the former bug-fix should be applied in every case, but I attach the non-dependent version of the patch for the sake of completeness. But this one still carries the old bug! Regards, Andre. Signed-off-by: Andre Przywara -- Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 448-3567-12 --------------060304020702020505080007 Content-Type: text/plain; name="xl-improve-vif2-parsing_buggy_context.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xl-improve-vif2-parsing_buggy_context.patch" diff -r 81503caeb439 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Sun Aug 22 09:53:51 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Mon Aug 23 00:43:22 2010 +0200 @@ -884,28 +884,33 @@ init_net2_info(net2, d_config->num_vif2s); for (p = strtok(buf2, ","); p; p = strtok(buf2, ",")) { + char* val; while (isblank(*p)) p++; - if (!strncmp("front_mac=", p, 10)) { - libxl_strtomac(p + 10, net2->front_mac); - } else if (!strncmp("back_mac=", p, 9)) { - libxl_strtomac(p + 9, net2->back_mac); - } else if (!strncmp("backend=", p, 8)) { - domain_qualifier_to_domid(p + 8, &net2->backend_domid, 0); - } else if (!strncmp("trusted=", p, 8)) { - net2->trusted = (*(p + 8) == '1'); - } else if (!strncmp("back_trusted=", p, 13)) { - net2->back_trusted = (*(p + 13) == '1'); - } else if (!strncmp("bridge=", p, 7)) { - net2->bridge = strdup(p + 13); - } else if (!strncmp("filter_mac=", p, 11)) { - net2->filter_mac = (*(p + 11) == '1'); - } else if (!strncmp("front_filter_mac=", p, 17)) { - net2->front_filter_mac = (*(p + 17) == '1'); - } else if (!strncmp("pdev=", p, 5)) { - net2->pdev = strtoul(p + 5, NULL, 10); - } else if (!strncmp("max_bypasses=", p, 13)) { - net2->max_bypasses = strtoul(p + 13, NULL, 10); + val = strchr(p, '='); + if (val == NULL) + continue; + *val++ = 0; + if (!strcmp("front_mac", p)) { + libxl_strtomac(val, net2->front_mac); + } else if (!strcmp("back_mac", p)) { + libxl_strtomac(val, net2->back_mac); + } else if (!strcmp("backend", p)) { + domain_qualifier_to_domid(val, &net2->backend_domid, 0); + } else if (!strcmp("trusted", p)) { + net2->trusted = (*val == '1'); + } else if (!strcmp("back_trusted", p)) { + net2->back_trusted = (*val == '1'); + } else if (!strcmp("bridge", p)) { + net2->bridge = strdup(val); + } else if (!strcmp("filter_mac", p)) { + net2->filter_mac = (*val == '1'); + } else if (!strcmp("front_filter_mac", p)) { + net2->front_filter_mac = (*val == '1'); + } else if (!strcmp("pdev", p)) { + net2->pdev = strtoul(val, NULL, 10); + } else if (!strcmp("max_bypasses", p)) { + net2->max_bypasses = strtoul(val, NULL, 10); } } free(buf2); --------------060304020702020505080007 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060304020702020505080007--