Most of our code base uses space after comma but not before; fix the remaining uses before adding a syntax check. * src/nwfilter/nwfilter_ebiptables_driver.c: Consistently use commas. * src/nwfilter/nwfilter_gentech_driver.c: Likewise. * src/nwfilter/nwfilter_learnipaddr.c: Likewise. * src/conf/nwfilter_conf.c: Likewise. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/nwfilter_conf.c | 92 ++++++++++++++++--------------- src/nwfilter/nwfilter_ebiptables_driver.c | 40 +++++++------- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 2 +- 4 files changed, 70 insertions(+), 66 deletions(-) diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 4c48411..793cb0e 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -135,7 +135,7 @@ static const struct int_map chain_priorities[] = { INTMAP_ENTRY(NWFILTER_VLAN_FILTER_PRI, "vlan"), INTMAP_ENTRY(NWFILTER_IPV4_FILTER_PRI, "ipv4"), INTMAP_ENTRY(NWFILTER_IPV6_FILTER_PRI, "ipv6"), - INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp"), + INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI, "arp"), INTMAP_ENTRY(NWFILTER_RARP_FILTER_PRI, "rarp"), INTMAP_ENTRY_LAST, }; @@ -462,11 +462,11 @@ struct _virXMLAttr2Struct static const struct int_map macProtoMap[] = { - INTMAP_ENTRY(ETHERTYPE_ARP , "arp"), + INTMAP_ENTRY(ETHERTYPE_ARP, "arp"), INTMAP_ENTRY(ETHERTYPE_REVARP, "rarp"), - INTMAP_ENTRY(ETHERTYPE_IP , "ipv4"), - INTMAP_ENTRY(ETHERTYPE_IPV6 , "ipv6"), - INTMAP_ENTRY(ETHERTYPE_VLAN , "vlan"), + INTMAP_ENTRY(ETHERTYPE_IP, "ipv4"), + INTMAP_ENTRY(ETHERTYPE_IPV6, "ipv6"), + INTMAP_ENTRY(ETHERTYPE_VLAN, "vlan"), INTMAP_ENTRY_LAST }; @@ -772,11 +772,11 @@ dscpValidator(enum attrDatatype datatype, union data *val, static const struct int_map stateMatchMap[] = { - INTMAP_ENTRY(RULE_FLAG_STATE_NEW , "NEW"), - INTMAP_ENTRY(RULE_FLAG_STATE_ESTABLISHED , "ESTABLISHED"), - INTMAP_ENTRY(RULE_FLAG_STATE_RELATED , "RELATED"), - INTMAP_ENTRY(RULE_FLAG_STATE_INVALID , "INVALID"), - INTMAP_ENTRY(RULE_FLAG_STATE_NONE , "NONE"), + INTMAP_ENTRY(RULE_FLAG_STATE_NEW, "NEW"), + INTMAP_ENTRY(RULE_FLAG_STATE_ESTABLISHED, "ESTABLISHED"), + INTMAP_ENTRY(RULE_FLAG_STATE_RELATED, "RELATED"), + INTMAP_ENTRY(RULE_FLAG_STATE_INVALID, "INVALID"), + INTMAP_ENTRY(RULE_FLAG_STATE_NONE, "NONE"), INTMAP_ENTRY_LAST, }; @@ -901,14 +901,14 @@ stateFormatter(virBufferPtr buf, static const struct int_map tcpFlags[] = { - INTMAP_ENTRY(0x1 , "FIN"), - INTMAP_ENTRY(0x2 , "SYN"), - INTMAP_ENTRY(0x4 , "RST"), - INTMAP_ENTRY(0x8 , "PSH"), + INTMAP_ENTRY(0x1, "FIN"), + INTMAP_ENTRY(0x2, "SYN"), + INTMAP_ENTRY(0x4, "RST"), + INTMAP_ENTRY(0x8, "PSH"), INTMAP_ENTRY(0x10, "ACK"), INTMAP_ENTRY(0x20, "URG"), INTMAP_ENTRY(0x3F, "ALL"), - INTMAP_ENTRY(0x0 , "NONE"), + INTMAP_ENTRY(0x0, "NONE"), INTMAP_ENTRY_LAST }; @@ -931,7 +931,7 @@ tcpFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val, *sep = '\0'; - if (parseStringItems(tcpFlags, s_mask , &mask , ',') == 0 && + if (parseStringItems(tcpFlags, s_mask, &mask, ',') == 0 && parseStringItems(tcpFlags, s_flags, &flags, ',') == 0) { item->u.tcpFlags.mask = mask & 0x3f; item->u.tcpFlags.flags = flags & 0x3f; @@ -1075,22 +1075,26 @@ ipsetFlagsFormatter(virBufferPtr buf, {\ .name = SRCMACADDR,\ .datatype = DATATYPE_MACADDR,\ - .dataIdx = offsetof(virNWFilterRuleDef,p.STRUCT.ethHdr.dataSrcMACAddr),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataSrcMACAddr),\ },\ {\ .name = SRCMACMASK,\ .datatype = DATATYPE_MACMASK,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataSrcMACMask),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataSrcMACMask),\ },\ {\ .name = DSTMACADDR,\ .datatype = DATATYPE_MACADDR,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataDstMACAddr),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataDstMACAddr),\ },\ {\ .name = DSTMACMASK,\ .datatype = DATATYPE_MACMASK,\ - .dataIdx = offsetof(virNWFilterRuleDef, p.STRUCT.ethHdr.dataDstMACMask),\ + .dataIdx = offsetof(virNWFilterRuleDef,\ + p.STRUCT.ethHdr.dataDstMACMask),\ } @@ -1742,30 +1746,30 @@ struct _virAttributes { static const virAttributes virAttr[] = { - PROTOCOL_ENTRY("arp" , arpAttributes , VIR_NWFILTER_RULE_PROTOCOL_ARP), - PROTOCOL_ENTRY("rarp" , arpAttributes , VIR_NWFILTER_RULE_PROTOCOL_RARP), - PROTOCOL_ENTRY("mac" , macAttributes , VIR_NWFILTER_RULE_PROTOCOL_MAC), - PROTOCOL_ENTRY("vlan" , vlanAttributes , VIR_NWFILTER_RULE_PROTOCOL_VLAN), - PROTOCOL_ENTRY("stp" , stpAttributes , VIR_NWFILTER_RULE_PROTOCOL_STP), - PROTOCOL_ENTRY("ip" , ipAttributes , VIR_NWFILTER_RULE_PROTOCOL_IP), - PROTOCOL_ENTRY("ipv6" , ipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_IPV6), - PROTOCOL_ENTRY("tcp" , tcpAttributes , VIR_NWFILTER_RULE_PROTOCOL_TCP), - PROTOCOL_ENTRY("udp" , udpAttributes , VIR_NWFILTER_RULE_PROTOCOL_UDP), + PROTOCOL_ENTRY("arp", arpAttributes, VIR_NWFILTER_RULE_PROTOCOL_ARP), + PROTOCOL_ENTRY("rarp", arpAttributes, VIR_NWFILTER_RULE_PROTOCOL_RARP), + PROTOCOL_ENTRY("mac", macAttributes, VIR_NWFILTER_RULE_PROTOCOL_MAC), + PROTOCOL_ENTRY("vlan", vlanAttributes, VIR_NWFILTER_RULE_PROTOCOL_VLAN), + PROTOCOL_ENTRY("stp", stpAttributes, VIR_NWFILTER_RULE_PROTOCOL_STP), + PROTOCOL_ENTRY("ip", ipAttributes, VIR_NWFILTER_RULE_PROTOCOL_IP), + PROTOCOL_ENTRY("ipv6", ipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_IPV6), + PROTOCOL_ENTRY("tcp", tcpAttributes, VIR_NWFILTER_RULE_PROTOCOL_TCP), + PROTOCOL_ENTRY("udp", udpAttributes, VIR_NWFILTER_RULE_PROTOCOL_UDP), PROTOCOL_ENTRY("udplite", udpliteAttributes, VIR_NWFILTER_RULE_PROTOCOL_UDPLITE), - PROTOCOL_ENTRY("esp" , espAttributes , VIR_NWFILTER_RULE_PROTOCOL_ESP), - PROTOCOL_ENTRY("ah" , ahAttributes , VIR_NWFILTER_RULE_PROTOCOL_AH), - PROTOCOL_ENTRY("sctp" , sctpAttributes , VIR_NWFILTER_RULE_PROTOCOL_SCTP), - PROTOCOL_ENTRY("icmp" , icmpAttributes , VIR_NWFILTER_RULE_PROTOCOL_ICMP), - PROTOCOL_ENTRY("all" , allAttributes , VIR_NWFILTER_RULE_PROTOCOL_ALL), - PROTOCOL_ENTRY("igmp" , igmpAttributes , VIR_NWFILTER_RULE_PROTOCOL_IGMP), - PROTOCOL_ENTRY("tcp-ipv6" , tcpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6), - PROTOCOL_ENTRY("udp-ipv6" , udpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6), + PROTOCOL_ENTRY("esp", espAttributes, VIR_NWFILTER_RULE_PROTOCOL_ESP), + PROTOCOL_ENTRY("ah", ahAttributes, VIR_NWFILTER_RULE_PROTOCOL_AH), + PROTOCOL_ENTRY("sctp", sctpAttributes, VIR_NWFILTER_RULE_PROTOCOL_SCTP), + PROTOCOL_ENTRY("icmp", icmpAttributes, VIR_NWFILTER_RULE_PROTOCOL_ICMP), + PROTOCOL_ENTRY("all", allAttributes, VIR_NWFILTER_RULE_PROTOCOL_ALL), + PROTOCOL_ENTRY("igmp", igmpAttributes, VIR_NWFILTER_RULE_PROTOCOL_IGMP), + PROTOCOL_ENTRY("tcp-ipv6", tcpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6), + PROTOCOL_ENTRY("udp-ipv6", udpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6), PROTOCOL_ENTRY("udplite-ipv6", udpliteipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_UDPLITEoIPV6), - PROTOCOL_ENTRY("esp-ipv6" , espipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6), - PROTOCOL_ENTRY("ah-ipv6" , ahipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6), - PROTOCOL_ENTRY("sctp-ipv6" , sctpipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6), - PROTOCOL_ENTRY("icmpv6" , icmpv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ICMPV6), - PROTOCOL_ENTRY("all-ipv6" , allipv6Attributes , VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6), + PROTOCOL_ENTRY("esp-ipv6", espipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6), + PROTOCOL_ENTRY("ah-ipv6", ahipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6), + PROTOCOL_ENTRY("sctp-ipv6", sctpipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6), + PROTOCOL_ENTRY("icmpv6", icmpv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ICMPV6), + PROTOCOL_ENTRY("all-ipv6", allipv6Attributes, VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6), PROTOCOL_ENTRY_LAST }; @@ -1779,7 +1783,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node, char *prop; bool found = false; enum attrDatatype datatype, att_datatypes; - enum virNWFilterEntryItemFlags *flags ,match_flag = 0, flags_set = 0; + enum virNWFilterEntryItemFlags *flags, match_flag = 0, flags_set = 0; nwItemDesc *item; int int_val; unsigned int uint_val; @@ -3428,7 +3432,7 @@ virNWFilterDefFormat(const virNWFilterDef *def) virBufferAddLit(&buf, ">\n"); virUUIDFormat(def->uuid, uuid); - virBufferAsprintf(&buf," <uuid>%s</uuid>\n", uuid); + virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", uuid); for (i = 0; i < def->nentries; i++) { xml = virNWFilterEntryFormat(def->filterEntries[i]); diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 4962ddd..dc651a2 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -236,14 +236,14 @@ enum l3_proto_idx { * for prefix matching. */ static const struct ushort_map l3_protocols[] = { - USHORTMAP_ENTRY_IDX(L3_PROTO_IPV4_IDX, ETHERTYPE_IP , "ipv4"), - USHORTMAP_ENTRY_IDX(L3_PROTO_IPV6_IDX, ETHERTYPE_IPV6 , "ipv6"), - USHORTMAP_ENTRY_IDX(L3_PROTO_ARP_IDX , ETHERTYPE_ARP , "arp"), + USHORTMAP_ENTRY_IDX(L3_PROTO_IPV4_IDX, ETHERTYPE_IP, "ipv4"), + USHORTMAP_ENTRY_IDX(L3_PROTO_IPV6_IDX, ETHERTYPE_IPV6, "ipv6"), + USHORTMAP_ENTRY_IDX(L3_PROTO_ARP_IDX, ETHERTYPE_ARP, "arp"), USHORTMAP_ENTRY_IDX(L3_PROTO_RARP_IDX, ETHERTYPE_REVARP, "rarp"), - USHORTMAP_ENTRY_IDX(L2_PROTO_VLAN_IDX, ETHERTYPE_VLAN , "vlan"), - USHORTMAP_ENTRY_IDX(L2_PROTO_STP_IDX, 0 , "stp"), - USHORTMAP_ENTRY_IDX(L2_PROTO_MAC_IDX, 0 , "mac"), - USHORTMAP_ENTRY_IDX(L3_PROTO_LAST_IDX, 0 , NULL), + USHORTMAP_ENTRY_IDX(L2_PROTO_VLAN_IDX, ETHERTYPE_VLAN, "vlan"), + USHORTMAP_ENTRY_IDX(L2_PROTO_STP_IDX, 0, "stp"), + USHORTMAP_ENTRY_IDX(L2_PROTO_MAC_IDX, 0, "mac"), + USHORTMAP_ENTRY_IDX(L3_PROTO_LAST_IDX, 0, NULL), }; @@ -471,7 +471,7 @@ printCommentVar(virBufferPtr dest, const char *buf) else virBufferAddChar(dest, buf[i]); } - virBufferAddLit(dest,"'" CMD_SEPARATOR); + virBufferAddLit(dest, "'" CMD_SEPARATOR); } @@ -623,13 +623,13 @@ static int iptablesCreateBaseChains(virBufferPtr buf) "$IPT -N " VIRT_IN_POST_CHAIN CMD_SEPARATOR "$IPT -N " HOST_IN_CHAIN CMD_SEPARATOR); iptablesLinkIPTablesBaseChain(buf, - VIRT_IN_CHAIN , "FORWARD", 1, 1); + VIRT_IN_CHAIN, "FORWARD", 1, 1); iptablesLinkIPTablesBaseChain(buf, - VIRT_OUT_CHAIN , "FORWARD", 2, 1); + VIRT_OUT_CHAIN, "FORWARD", 2, 1); iptablesLinkIPTablesBaseChain(buf, VIRT_IN_POST_CHAIN, "FORWARD", 3, 1); iptablesLinkIPTablesBaseChain(buf, - HOST_IN_CHAIN , "INPUT" , 1, 1); + HOST_IN_CHAIN, "INPUT", 1, 1); return 0; } @@ -782,8 +782,8 @@ iptablesLinkTmpRootChains(virBufferPtr buf, const char *ifname) { iptablesLinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname, 1); - iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname, 1); - iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname, 1); + iptablesLinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname, 1); + iptablesLinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname, 1); return 0; } @@ -896,8 +896,8 @@ iptablesUnlinkRootChains(virBufferPtr buf, const char *ifname) { iptablesUnlinkRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname); - iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname); - iptablesUnlinkRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname); + iptablesUnlinkRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname); + iptablesUnlinkRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname); return 0; } @@ -908,8 +908,8 @@ iptablesUnlinkTmpRootChains(virBufferPtr buf, const char *ifname) { iptablesUnlinkTmpRootChain(buf, VIRT_OUT_CHAIN, 'F', 0, ifname); - iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN , 'F', 1, ifname); - iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN , 'H', 1, ifname); + iptablesUnlinkTmpRootChain(buf, VIRT_IN_CHAIN, 'F', 1, ifname); + iptablesUnlinkTmpRootChain(buf, HOST_IN_CHAIN, 'H', 1, ifname); return 0; } @@ -3355,7 +3355,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname, ebtablesCreateTmpRootChain(&buf, 1, ifname, 1); ebtablesCreateTmpRootChain(&buf, 0, ifname, 1); - PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); + PRINT_ROOT_CHAIN(chain_in, CHAINPREFIX_HOST_IN_TEMP, ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); virBufferAsprintf(&buf, @@ -3487,7 +3487,7 @@ ebtablesApplyDropAllRules(const char *ifname) ebtablesCreateTmpRootChain(&buf, 1, ifname, 1); ebtablesCreateTmpRootChain(&buf, 0, ifname, 1); - PRINT_ROOT_CHAIN(chain_in , CHAINPREFIX_HOST_IN_TEMP , ifname); + PRINT_ROOT_CHAIN(chain_in, CHAINPREFIX_HOST_IN_TEMP, ifname); PRINT_ROOT_CHAIN(chain_out, CHAINPREFIX_HOST_OUT_TEMP, ifname); virBufferAsprintf(&buf, @@ -3759,7 +3759,7 @@ ebiptablesApplyNewRules(const char *ifname, /* create needed chains */ if ((virHashSize(chains_in_set) > 0 && - ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_in_set , 1, + ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_in_set, 1, &ebtChains, &nEbtChains) < 0) || (virHashSize(chains_out_set) > 0 && ebtablesCreateTmpRootAndSubChains(&buf, ifname, chains_out_set, 0, diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index c1dcdfe..89913cf8 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -591,7 +591,7 @@ virNWFilterRuleInstancesToArray(int nEntries, void ***ptrs, int *nptrs) { - size_t i,j; + size_t i, j; *nptrs = 0; diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 4fc851e..00f9992 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -636,7 +636,7 @@ learnIPAddressThread(void *arg) memset(&req->thread, 0x0, sizeof(req->thread)); - VIR_DEBUG("pcap thread terminating for interface %s\n",req->ifname); + VIR_DEBUG("pcap thread terminating for interface %s\n", req->ifname); virNWFilterUnlockIface(req->ifname); -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list