Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/nwfilter/nwfilter_dhcpsnoop.c | 67 +++++++++++------------
src/nwfilter/nwfilter_driver.c | 18 +++---
src/nwfilter/nwfilter_ebiptables_driver.c | 16 +++---
src/nwfilter/nwfilter_gentech_driver.c | 19 +++----
src/nwfilter/nwfilter_learnipaddr.c | 9 ++-
5 files changed, 60 insertions(+), 69 deletions(-)
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 20afc1b2d4..3dc0b777e9 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -485,8 +485,7 @@ virNWFilterSnoopReqNew(const char *ifkey)
if (ifkey == NULL || strlen(ifkey) != VIR_IFKEY_LEN - 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterSnoopReqNew called with invalid "
- "key \"%s\" (%zu)"),
+ _("virNWFilterSnoopReqNew called with invalid key
\"%1$s\" (%2$zu)"),
NULLSTR_EMPTY(ifkey),
ifkey ? strlen(ifkey) : 0);
return NULL;
@@ -955,26 +954,26 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
pcap_set_immediate_mode(handle, 1) < 0 ||
pcap_activate(handle) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("setup of pcap handle failed: %s"),
+ _("setup of pcap handle failed: %1$s"),
pcap_geterr(handle));
goto cleanup;
}
if (pcap_compile(handle, &fp, ext_filter, 1, PCAP_NETMASK_UNKNOWN) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("pcap_compile: %s"), pcap_geterr(handle));
+ _("pcap_compile: %1$s"), pcap_geterr(handle));
goto cleanup;
}
if (pcap_setfilter(handle, &fp) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("pcap_setfilter: %s"), pcap_geterr(handle));
+ _("pcap_setfilter: %1$s"), pcap_geterr(handle));
goto cleanup_freecode;
}
if (pcap_setdirection(handle, dir) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("pcap_setdirection: %s"),
+ _("pcap_setdirection: %1$s"),
pcap_geterr(handle));
goto cleanup_freecode;
}
@@ -1004,8 +1003,8 @@ static void virNWFilterDHCPDecodeWorker(void *jobdata, void
*opaque)
req->jobCompletionStatus = -1;
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Instantiation of rules failed on "
- "interface '%s'"),
req->binding->portdevname);
+ _("Instantiation of rules failed on interface
'%1$s'"),
+ req->binding->portdevname);
}
ignore_value(!!g_atomic_int_dec_and_test(job->qCtr));
}
@@ -1306,7 +1305,7 @@ virNWFilterDHCPSnoopThread(void *req0)
/* protect req->binding->portdevname */
VIR_WITH_MUTEX_LOCK_GUARD(&req->lock) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("interface '%s' failing;
reopening"),
+ _("interface '%1$s' failing;
reopening"),
req->binding->portdevname);
if (req->binding->portdevname)
pcapConf[i].handle =
@@ -1359,8 +1358,8 @@ virNWFilterDHCPSnoopThread(void *req0)
pcapConf[i].dir,
&pcapConf[i].qCtr) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Job submission failed on "
- "interface '%s'"),
req->binding->portdevname);
+ _("Job submission failed on interface
'%1$s'"),
+ req->binding->portdevname);
error = true;
break;
}
@@ -1468,8 +1467,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriver *techdriver,
req->binding->portdevname,
req->ifkey) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterDHCPSnoopReq ifname map failed"
- " on interface \"%s\" key
\"%s\""), binding->portdevname,
+ _("virNWFilterDHCPSnoopReq ifname map failed on interface
\"%1$s\" key \"%2$s\""),
+ binding->portdevname,
ifkey);
goto exit_snoopunlock;
}
@@ -1477,8 +1476,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriver *techdriver,
if (isnewreq &&
virHashAddEntry(virNWFilterSnoopState.snoopReqs, ifkey, req) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterDHCPSnoopReq req add failed on"
- " interface \"%s\" ifkey \"%s\""),
binding->portdevname,
+ _("virNWFilterDHCPSnoopReq req add failed on interface
\"%1$s\" ifkey \"%2$s\""),
+ binding->portdevname,
ifkey);
goto exit_rem_ifnametokey;
}
@@ -1489,8 +1488,8 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriver *techdriver,
if (virThreadCreateFull(&thread, false, virNWFilterDHCPSnoopThread,
"dhcp-snoop", false, req) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterDHCPSnoopReq virThreadCreate "
- "failed on interface '%s'"),
binding->portdevname);
+ _("virNWFilterDHCPSnoopReq virThreadCreate failed on
interface '%1$s'"),
+ binding->portdevname);
goto exit_snoopreq_unlock;
}
@@ -1501,15 +1500,15 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriver *techdriver,
req->threadkey = virNWFilterSnoopActivate(req);
if (!req->threadkey) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Activation of snoop request failed on "
- "interface '%s'"),
req->binding->portdevname);
+ _("Activation of snoop request failed on interface
'%1$s'"),
+ req->binding->portdevname);
goto exit_snoopreq_unlock;
}
if (virNWFilterSnoopReqRestore(req) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Restoring of leases failed on "
- "interface '%s'"),
req->binding->portdevname);
+ _("Restoring of leases failed on interface
'%1$s'"),
+ req->binding->portdevname);
goto exit_snoop_cancel;
}
@@ -1677,17 +1676,17 @@ virNWFilterSnoopLeaseFileRefresh(void)
int tfd;
if (g_mkdir_with_parents(LEASEFILE_DIR, 0700) < 0) {
- virReportError(errno, _("mkdir(\"%s\")"), LEASEFILE_DIR);
+ virReportError(errno, _("mkdir(\"%1$s\")"), LEASEFILE_DIR);
return;
}
if (unlink(TMPLEASEFILE) < 0 && errno != ENOENT)
- virReportSystemError(errno, _("unlink(\"%s\")"),
TMPLEASEFILE);
+ virReportSystemError(errno, _("unlink(\"%1$s\")"),
TMPLEASEFILE);
/* lease file loaded, delete old one */
tfd = open(TMPLEASEFILE, O_CREAT|O_RDWR|O_TRUNC|O_EXCL, 0644);
if (tfd < 0) {
- virReportSystemError(errno, _("open(\"%s\")"),
TMPLEASEFILE);
+ virReportSystemError(errno, _("open(\"%1$s\")"),
TMPLEASEFILE);
return;
}
@@ -1701,13 +1700,13 @@ virNWFilterSnoopLeaseFileRefresh(void)
}
if (VIR_CLOSE(tfd) < 0) {
- virReportSystemError(errno, _("unable to close %s"), TMPLEASEFILE);
+ virReportSystemError(errno, _("unable to close %1$s"), TMPLEASEFILE);
/* assuming the old lease file is still better, skip the renaming */
goto cleanup;
}
if (rename(TMPLEASEFILE, LEASEFILE) < 0) {
- virReportSystemError(errno, _("rename(\"%s\",
\"%s\")"),
+ virReportSystemError(errno, _("rename(\"%1$s\",
\"%2$s\")"),
TMPLEASEFILE, LEASEFILE);
unlink(TMPLEASEFILE);
}
@@ -1737,8 +1736,8 @@ virNWFilterSnoopLeaseFileLoad(void)
if (line[strlen(line)-1] != '\n') {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterSnoopLeaseFileLoad lease file "
- "line %d corrupt"), ln);
+ _("virNWFilterSnoopLeaseFileLoad lease file line %1$d
corrupt"),
+ ln);
break;
}
ln++;
@@ -1746,8 +1745,8 @@ virNWFilterSnoopLeaseFileLoad(void)
if (sscanf(line, "%llu %54s %15s %15s",
&timeout, ifkey, ipstr, srvstr) < 4) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterSnoopLeaseFileLoad lease file "
- "line %d corrupt"), ln);
+ _("virNWFilterSnoopLeaseFileLoad lease file line %1$d
corrupt"),
+ ln);
break;
}
ipl.timeout = timeout;
@@ -1764,15 +1763,15 @@ virNWFilterSnoopLeaseFileLoad(void)
if (tmp < 0) {
virNWFilterSnoopReqPut(req);
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("virNWFilterSnoopLeaseFileLoad req add"
- " failed on interface \"%s\""),
ifkey);
+ _("virNWFilterSnoopLeaseFileLoad req add failed on
interface \"%1$s\""),
+ ifkey);
continue;
}
}
if (virSocketAddrParseIPv4(&ipl.ipAddress, ipstr) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("line %d corrupt ipaddr \"%s\""),
+ _("line %1$d corrupt ipaddr \"%2$s\""),
ln, ipstr);
virNWFilterSnoopReqPut(req);
continue;
@@ -1917,7 +1916,7 @@ virNWFilterDHCPSnoopEnd(const char *ifname)
req = virNWFilterSnoopReqGetByIFKey(ifkey);
if (!req) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("ifkey \"%s\" has no req"), ifkey);
+ _("ifkey \"%1$s\" has no req"), ifkey);
return;
}
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 3803850e26..09719edd75 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -248,7 +248,7 @@ nwfilterStateInitialize(bool privileged,
driver->stateDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter");
if (g_mkdir_with_parents(driver->stateDir, S_IRWXU) < 0) {
- virReportSystemError(errno, _("cannot create state directory
'%s'"),
+ virReportSystemError(errno, _("cannot create state directory
'%1$s'"),
driver->stateDir);
goto error;
}
@@ -282,7 +282,7 @@ nwfilterStateInitialize(bool privileged,
driver->configDir = g_strdup(SYSCONFDIR "/libvirt/nwfilter");
if (g_mkdir_with_parents(driver->configDir, S_IRWXU) < 0) {
- virReportSystemError(errno, _("cannot create config directory
'%s'"),
+ virReportSystemError(errno, _("cannot create config directory
'%1$s'"),
driver->configDir);
goto error;
}
@@ -290,7 +290,7 @@ nwfilterStateInitialize(bool privileged,
driver->bindingDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter-binding");
if (g_mkdir_with_parents(driver->bindingDir, S_IRWXU) < 0) {
- virReportSystemError(errno, _("cannot create config directory
'%s'"),
+ virReportSystemError(errno, _("cannot create config directory
'%1$s'"),
driver->bindingDir);
goto error;
}
@@ -359,7 +359,7 @@ nwfilterConnectOpen(virConnectPtr conn,
if (STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected nwfilter URI path '%s', try
nwfilter:///system"),
+ _("unexpected nwfilter URI path '%1$s', try
nwfilter:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
@@ -405,7 +405,7 @@ nwfilterObjFromNWFilter(const unsigned char *uuid)
if (!(obj = virNWFilterObjListFindByUUID(driver->nwfilters, uuid))) {
virUUIDFormat(uuid, uuidstr);
virReportError(VIR_ERR_NO_NWFILTER,
- _("no nwfilter with matching uuid '%s'"),
uuidstr);
+ _("no nwfilter with matching uuid '%1$s'"),
uuidstr);
}
return obj;
}
@@ -452,7 +452,7 @@ nwfilterLookupByName(virConnectPtr conn,
if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER,
- _("no nwfilter with matching name '%s'"),
name);
+ _("no nwfilter with matching name '%1$s'"),
name);
return NULL;
}
def = virNWFilterObjGetDef(obj);
@@ -661,7 +661,7 @@ nwfilterBindingLookupByPortDev(virConnectPtr conn,
portdev);
if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER_BINDING,
- _("no nwfilter binding for port dev '%s'"),
portdev);
+ _("no nwfilter binding for port dev '%1$s'"),
portdev);
goto cleanup;
}
@@ -706,7 +706,7 @@ nwfilterBindingGetXMLDesc(virNWFilterBindingPtr binding,
binding->portdev);
if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER_BINDING,
- _("no nwfilter binding for port dev '%s'"),
binding->portdev);
+ _("no nwfilter binding for port dev '%1$s'"),
binding->portdev);
goto cleanup;
}
@@ -790,7 +790,7 @@ nwfilterBindingDelete(virNWFilterBindingPtr binding)
obj = virNWFilterBindingObjListFindByPortDev(driver->bindings,
binding->portdev);
if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER_BINDING,
- _("no nwfilter binding for port dev '%s'"),
binding->portdev);
+ _("no nwfilter binding for port dev '%1$s'"),
binding->portdev);
return -1;
}
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c
b/src/nwfilter/nwfilter_ebiptables_driver.c
index 24c0db5bde..99a74a60e5 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -153,8 +153,8 @@ printVar(virNWFilterVarCombIter *vars,
varName = virNWFilterVarAccessGetVarName(item->varAccess);
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Buffer too small to print variable "
- "'%s' into"), varName);
+ _("Buffer too small to print variable '%1$s'
into"),
+ varName);
return -1;
}
@@ -295,7 +295,7 @@ _printDataType(virNWFilterVarCombIter *vars,
case DATATYPE_STRINGCOPY:
case DATATYPE_BOOLEAN:
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot print data type %x"), item->datatype);
+ _("Cannot print data type %1$x"), item->datatype);
return -1;
case DATATYPE_LAST:
default:
@@ -1441,7 +1441,7 @@ _iptablesCreateRuleInstance(virFirewall *fw,
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected protocol %d"),
+ _("Unexpected protocol %1$d"),
rule->prtclType);
return -1;
}
@@ -1846,8 +1846,7 @@ ebtablesCreateRuleInstance(virFirewall *fw,
if (reverse &&
HAS_ENTRY_ITEM(&rule->p.stpHdrFilter.ethHdr.dataSrcMACAddr)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("STP filtering in %s direction with "
- "source MAC address set is not supported"),
+ _("STP filtering in %1$s direction with source MAC
address set is not supported"),
virNWFilterRuleDirectionTypeToString(
VIR_NWFILTER_RULE_DIRECTION_INOUT));
return -1;
@@ -2351,7 +2350,7 @@ ebtablesCreateRuleInstance(virFirewall *fw,
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected rule protocol %d"),
+ _("Unexpected rule protocol %1$d"),
rule->prtclType);
return -1;
}
@@ -3126,8 +3125,7 @@ iptablesCheckBridgeNFCallEnabled(bool isIPv6)
if (buffer[0] == '0') {
char msg[256];
g_snprintf(msg, sizeof(msg),
- _("To enable ip%stables filtering for the VM do
"
- "'echo 1 > %s'"),
+ _("To enable ip%1$stables filtering for the VM do
'echo 1 > %2$s'"),
isIPv6 ? "6" : "",
pathname);
VIR_WARN("%s", msg);
diff --git a/src/nwfilter/nwfilter_gentech_driver.c
b/src/nwfilter/nwfilter_gentech_driver.c
index 979b13fa2c..72e24e2f08 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -514,8 +514,7 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdriver,
} else {
rc = -1;
virReportError(VIR_ERR_PARSE_FAILED,
- _("filter '%s' "
- "learning value '%s' invalid."),
+ _("filter '%1$s' learning value
'%2$s' invalid."),
filter->name, learning);
goto error;
}
@@ -576,8 +575,8 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdriver,
buf = virNWFilterPrintVars(missing_vars, ", ", false, reportIP);
if (buf) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot instantiate filter due to unresolvable "
- "variables or unavailable list elements: %s"), buf);
+ _("Cannot instantiate filter due to unresolvable variables or
unavailable list elements: %1$s"),
+ buf);
}
rc = -1;
@@ -632,8 +631,7 @@ virNWFilterInstantiateFilterUpdate(virNWFilterDriverState *driver,
if (!techdriver) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get access to ACL tech "
- "driver '%s'"),
+ _("Could not get access to ACL tech driver
'%1$s'"),
drvname);
return -1;
}
@@ -779,8 +777,7 @@ virNWFilterRollbackUpdateFilter(virNWFilterBindingDef *binding)
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get access to ACL tech "
- "driver '%s'"),
+ _("Could not get access to ACL tech driver
'%1$s'"),
drvname);
return -1;
}
@@ -805,8 +802,7 @@ virNWFilterTearOldFilter(virNWFilterBindingDef *binding)
techdriver = virNWFilterTechDriverForName(drvname);
if (!techdriver) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get access to ACL tech "
- "driver '%s'"),
+ _("Could not get access to ACL tech driver
'%1$s'"),
drvname);
return -1;
}
@@ -830,8 +826,7 @@ _virNWFilterTeardownFilter(const char *ifname)
if (!techdriver) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not get access to ACL tech "
- "driver '%s'"),
+ _("Could not get access to ACL tech driver
'%1$s'"),
drvname);
return -1;
}
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 0f3042a893..90e9a21a4e 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -155,7 +155,7 @@ virNWFilterLockIface(const char *ifname)
if (virStrcpyStatic(ifaceLock->ifname, ifname) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("interface name %s does not fit into
buffer"),
+ _("interface name %1$s does not fit into
buffer"),
ifaceLock->ifname);
g_free(ifaceLock);
return -1;
@@ -607,8 +607,8 @@ learnIPAddressThread(void *arg)
if ((inetaddr = virSocketAddrFormat(&sa)) != NULL) {
if (virNWFilterIPAddrMapAddIPAddr(req->binding->portdevname, inetaddr)
< 0) {
- VIR_ERROR(_("Failed to add IP address %s to IP address "
- "cache for interface %s"), inetaddr,
req->binding->portdevname);
+ VIR_ERROR(_("Failed to add IP address %1$s to IP address cache for
interface %2$s"),
+ inetaddr, req->binding->portdevname);
}
ret = virNWFilterInstantiateFilterLate(req->driver,
@@ -620,8 +620,7 @@ learnIPAddressThread(void *arg)
} else {
if (showError)
virReportSystemError(req->status,
- _("encountered an error on interface %s "
- "index %d"),
+ _("encountered an error on interface %1$s index
%2$d"),
req->binding->portdevname, req->ifindex);
techdriver->applyDropAllRules(req->binding->portdevname);
--
2.39.2