mirror of https://gitee.com/openkylin/libvirt.git
Indent top-level labels by one space in src/nwfilter/
This commit is contained in:
parent
c97cfce291
commit
5d8315975e
|
@ -498,7 +498,7 @@ virNWFilterSnoopIPLeaseInstallRule(virNWFilterSnoopIPLeasePtr ipl,
|
|||
req->filtername,
|
||||
req->vars);
|
||||
|
||||
exit_snooprequnlock:
|
||||
exit_snooprequnlock:
|
||||
virNWFilterSnoopReqUnlock(req);
|
||||
|
||||
VIR_FREE(ipaddr);
|
||||
|
@ -605,10 +605,10 @@ virNWFilterSnoopReqNew(const char *ifkey)
|
|||
|
||||
return req;
|
||||
|
||||
err_destroy_mutex:
|
||||
err_destroy_mutex:
|
||||
virMutexDestroy(&req->lock);
|
||||
|
||||
err_free_req:
|
||||
err_free_req:
|
||||
VIR_FREE(req);
|
||||
|
||||
return NULL;
|
||||
|
@ -786,7 +786,7 @@ virNWFilterSnoopReqLeaseAdd(virNWFilterSnoopReqPtr req,
|
|||
|
||||
virAtomicIntInc(&virNWFilterSnoopState.nLeases);
|
||||
|
||||
exit:
|
||||
exit:
|
||||
if (update_leasefile)
|
||||
virNWFilterSnoopLeaseFileSave(pl);
|
||||
|
||||
|
@ -897,12 +897,12 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
|
|||
|
||||
}
|
||||
|
||||
skip_instantiate:
|
||||
skip_instantiate:
|
||||
VIR_FREE(ipl);
|
||||
|
||||
virAtomicIntDecAndTest(&virNWFilterSnoopState.nLeases);
|
||||
|
||||
lease_not_found:
|
||||
lease_not_found:
|
||||
VIR_FREE(ipstr);
|
||||
|
||||
virNWFilterSnoopReqUnlock(req);
|
||||
|
@ -960,7 +960,7 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len,
|
|||
oind += pd->d_opts[oind + 1] + 2;
|
||||
}
|
||||
return 0;
|
||||
malformed:
|
||||
malformed:
|
||||
VIR_WARN("got lost in the options!");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1149,11 +1149,11 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
|
|||
|
||||
return handle;
|
||||
|
||||
cleanup_freecode:
|
||||
cleanup_freecode:
|
||||
pcap_freecode(&fp);
|
||||
cleanup:
|
||||
cleanup:
|
||||
pcap_close(handle);
|
||||
cleanup_nohandle:
|
||||
cleanup_nohandle:
|
||||
VIR_FREE(ext_filter);
|
||||
|
||||
return NULL;
|
||||
|
@ -1562,7 +1562,7 @@ virNWFilterDHCPSnoopThread(void *req0)
|
|||
virNWFilterSnoopReqUnlock(req);
|
||||
virNWFilterSnoopUnlock();
|
||||
|
||||
exit:
|
||||
exit:
|
||||
virThreadPoolFree(worker);
|
||||
|
||||
virNWFilterSnoopReqPut(req);
|
||||
|
@ -1731,15 +1731,15 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
|||
|
||||
return 0;
|
||||
|
||||
exit_snoop_cancel:
|
||||
exit_snoop_cancel:
|
||||
virNWFilterSnoopCancel(&req->threadkey);
|
||||
exit_snoopreq_unlock:
|
||||
exit_snoopreq_unlock:
|
||||
virNWFilterSnoopReqUnlock(req);
|
||||
exit_rem_ifnametokey:
|
||||
exit_rem_ifnametokey:
|
||||
virHashRemoveEntry(virNWFilterSnoopState.ifnameToKey, ifname);
|
||||
exit_snoopunlock:
|
||||
exit_snoopunlock:
|
||||
virNWFilterSnoopUnlock();
|
||||
exit_snoopreqput:
|
||||
exit_snoopreqput:
|
||||
if (!threadPuts)
|
||||
virNWFilterSnoopReqPut(req);
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ virNWFilterSnoopLeaseFileWrite(int lfd, const char *ifkey,
|
|||
|
||||
ignore_value(fsync(lfd));
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
VIR_FREE(lbuf);
|
||||
VIR_FREE(dhcpstr);
|
||||
VIR_FREE(ipstr);
|
||||
|
@ -1831,7 +1831,7 @@ virNWFilterSnoopLeaseFileSave(virNWFilterSnoopIPLeasePtr ipl)
|
|||
virAtomicIntGet(&virNWFilterSnoopState.nLeases) * 20)
|
||||
virNWFilterSnoopLeaseFileLoad(); /* load & refresh lease file */
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virNWFilterSnoopUnlock();
|
||||
}
|
||||
|
||||
|
@ -1935,7 +1935,7 @@ virNWFilterSnoopLeaseFileRefresh(void)
|
|||
}
|
||||
virAtomicIntSet(&virNWFilterSnoopState.wLeases, 0);
|
||||
|
||||
skip_rename:
|
||||
skip_rename:
|
||||
virNWFilterSnoopLeaseFileOpen();
|
||||
}
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ virNWFilterDHCPSnoopInit(void)
|
|||
|
||||
return 0;
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virHashFree(virNWFilterSnoopState.ifnameToKey);
|
||||
virNWFilterSnoopState.ifnameToKey = NULL;
|
||||
|
||||
|
@ -2182,7 +2182,7 @@ virNWFilterDHCPSnoopEnd(const char *ifname)
|
|||
virNWFilterSnoopLeaseFileLoad();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
virNWFilterSnoopUnlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -245,23 +245,23 @@ nwfilterStateInitialize(bool privileged,
|
|||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
error:
|
||||
VIR_FREE(base);
|
||||
nwfilterDriverUnlock(driverState);
|
||||
nwfilterStateCleanup();
|
||||
|
||||
return -1;
|
||||
|
||||
err_techdrivers_shutdown:
|
||||
err_techdrivers_shutdown:
|
||||
virNWFilterTechDriversShutdown();
|
||||
err_dhcpsnoop_shutdown:
|
||||
err_dhcpsnoop_shutdown:
|
||||
virNWFilterDHCPSnoopShutdown();
|
||||
err_exit_learnshutdown:
|
||||
err_exit_learnshutdown:
|
||||
virNWFilterLearnShutdown();
|
||||
err_exit_ipaddrmapshutdown:
|
||||
err_exit_ipaddrmapshutdown:
|
||||
virNWFilterIPAddrMapShutdown();
|
||||
|
||||
err_free_driverstate:
|
||||
err_free_driverstate:
|
||||
VIR_FREE(driverState);
|
||||
|
||||
return -1;
|
||||
|
@ -378,7 +378,7 @@ nwfilterLookupByUUID(virConnectPtr conn,
|
|||
|
||||
ret = virGetNWFilter(conn, nwfilter->def->name, nwfilter->def->uuid);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if (nwfilter)
|
||||
virNWFilterObjUnlock(nwfilter);
|
||||
return ret;
|
||||
|
@ -408,7 +408,7 @@ nwfilterLookupByName(virConnectPtr conn,
|
|||
|
||||
ret = virGetNWFilter(conn, nwfilter->def->name, nwfilter->def->uuid);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if (nwfilter)
|
||||
virNWFilterObjUnlock(nwfilter);
|
||||
return ret;
|
||||
|
@ -588,7 +588,7 @@ nwfilterDefineXML(virConnectPtr conn,
|
|||
|
||||
ret = virGetNWFilter(conn, nwfilter->def->name, nwfilter->def->uuid);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
virNWFilterDefFree(def);
|
||||
if (nwfilter)
|
||||
virNWFilterObjUnlock(nwfilter);
|
||||
|
@ -637,7 +637,7 @@ nwfilterUndefine(virNWFilterPtr obj)
|
|||
nwfilter = NULL;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if (nwfilter)
|
||||
virNWFilterObjUnlock(nwfilter);
|
||||
|
||||
|
@ -673,7 +673,7 @@ nwfilterGetXMLDesc(virNWFilterPtr obj,
|
|||
|
||||
ret = virNWFilterDefFormat(nwfilter->def);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
if (nwfilter)
|
||||
virNWFilterObjUnlock(nwfilter);
|
||||
return ret;
|
||||
|
|
|
@ -978,7 +978,7 @@ iptablesHandleSrcMacAddr(virBufferPtr buf,
|
|||
|
||||
return 0;
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virBufferFreeAndReset(buf);
|
||||
|
||||
return -1;
|
||||
|
@ -1174,7 +1174,7 @@ iptablesHandleIpHdr(virBufferPtr buf,
|
|||
|
||||
return 0;
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virBufferFreeAndReset(buf);
|
||||
virBufferFreeAndReset(afterStateMatch);
|
||||
|
||||
|
@ -1246,7 +1246,7 @@ iptablesHandlePortData(virBufferPtr buf,
|
|||
|
||||
return 0;
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1741,14 +1741,14 @@ _iptablesCreateRuleInstance(bool directionIn,
|
|||
(isIPv6) ? RT_IP6TABLES : RT_IPTABLES);
|
||||
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virBufferFreeAndReset(&buf);
|
||||
virBufferFreeAndReset(&prefix);
|
||||
virBufferFreeAndReset(&afterStateMatch);
|
||||
|
||||
return -1;
|
||||
|
||||
exit_no_error:
|
||||
exit_no_error:
|
||||
virBufferFreeAndReset(&buf);
|
||||
virBufferFreeAndReset(&prefix);
|
||||
virBufferFreeAndReset(&afterStateMatch);
|
||||
|
@ -2628,7 +2628,7 @@ ebtablesCreateRuleInstance(char chainPrefix,
|
|||
rule->priority,
|
||||
RT_EBTABLES);
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virBufferFreeAndReset(&buf);
|
||||
|
||||
return -1;
|
||||
|
@ -3281,7 +3281,7 @@ ebtablesApplyBasicRules(const char *ifname,
|
|||
|
||||
return 0;
|
||||
|
||||
tear_down_tmpebchains:
|
||||
tear_down_tmpebchains:
|
||||
ebtablesCleanAll(ifname);
|
||||
|
||||
virReportError(VIR_ERR_BUILD_FIREWALL,
|
||||
|
@ -3429,7 +3429,7 @@ ebtablesApplyDHCPOnlyRules(const char *ifname,
|
|||
|
||||
return 0;
|
||||
|
||||
tear_down_tmpebchains:
|
||||
tear_down_tmpebchains:
|
||||
ebtablesCleanAll(ifname);
|
||||
|
||||
virReportError(VIR_ERR_BUILD_FIREWALL,
|
||||
|
@ -3499,7 +3499,7 @@ ebtablesApplyDropAllRules(const char *ifname)
|
|||
|
||||
return 0;
|
||||
|
||||
tear_down_tmpebchains:
|
||||
tear_down_tmpebchains:
|
||||
ebtablesCleanAll(ifname);
|
||||
|
||||
virReportError(VIR_ERR_BUILD_FIREWALL,
|
||||
|
@ -3565,7 +3565,7 @@ ebiptablesRuleOrderSort(const void *a, const void *b)
|
|||
if (root_b) {
|
||||
return 1; /* b before a */
|
||||
}
|
||||
normal:
|
||||
normal:
|
||||
/* priorities are limited to range [-1000, 1000] */
|
||||
return insta->priority - instb->priority;
|
||||
}
|
||||
|
@ -3911,7 +3911,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||
|
||||
return 0;
|
||||
|
||||
tear_down_ebsubchains_and_unlink:
|
||||
tear_down_ebsubchains_and_unlink:
|
||||
if (ebtables_cmd_path) {
|
||||
NWFILTER_SET_EBTABLES_SHELLVAR(&buf);
|
||||
|
||||
|
@ -3919,7 +3919,7 @@ tear_down_ebsubchains_and_unlink:
|
|||
ebtablesUnlinkTmpRootChain(&buf, false, ifname);
|
||||
}
|
||||
|
||||
tear_down_tmpip6tchains:
|
||||
tear_down_tmpip6tchains:
|
||||
if (haveIp6tables) {
|
||||
NWFILTER_SET_IP6TABLES_SHELLVAR(&buf);
|
||||
|
||||
|
@ -3927,7 +3927,7 @@ tear_down_tmpip6tchains:
|
|||
iptablesRemoveTmpRootChains(&buf, ifname);
|
||||
}
|
||||
|
||||
tear_down_tmpiptchains:
|
||||
tear_down_tmpiptchains:
|
||||
if (haveIptables) {
|
||||
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
||||
|
||||
|
@ -3935,7 +3935,7 @@ tear_down_tmpiptchains:
|
|||
iptablesRemoveTmpRootChains(&buf, ifname);
|
||||
}
|
||||
|
||||
tear_down_tmpebchains:
|
||||
tear_down_tmpebchains:
|
||||
if (ebtables_cmd_path) {
|
||||
NWFILTER_SET_EBTABLES_SHELLVAR(&buf);
|
||||
|
||||
|
@ -3953,7 +3953,7 @@ tear_down_tmpebchains:
|
|||
errmsg ? ": " : "",
|
||||
errmsg ? errmsg : "");
|
||||
|
||||
exit_free_sets:
|
||||
exit_free_sets:
|
||||
virHashFree(chains_in_set);
|
||||
virHashFree(chains_out_set);
|
||||
|
||||
|
@ -4083,7 +4083,7 @@ ebiptablesRemoveRules(const char *ifname ATTRIBUTE_UNUSED,
|
|||
|
||||
rc = 0;
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -4209,7 +4209,7 @@ ebiptablesDriverInitWithFirewallD(void)
|
|||
}
|
||||
}
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
VIR_FREE(firewall_cmd_path);
|
||||
VIR_FREE(output);
|
||||
|
||||
|
@ -4365,7 +4365,7 @@ ebiptablesDriverProbeStateMatch(void)
|
|||
m_state_in_str = m_state_in_str_new;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
VIR_FREE(cmdout);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
|
|||
|
||||
return res;
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virNWFilterHashTableFree(res);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
|||
virNWFilterUnlockIface(ifname);
|
||||
}
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
|
||||
for (j = 0; j < nEntries; j++)
|
||||
virNWFilterRuleInstFree(insts[j]);
|
||||
|
@ -780,7 +780,7 @@ err_exit:
|
|||
|
||||
return rc;
|
||||
|
||||
err_unresolvable_vars:
|
||||
err_unresolvable_vars:
|
||||
|
||||
buf = virNWFilterPrintVars(missing_vars->hashTable, ", ", false, reportIP);
|
||||
if (buf) {
|
||||
|
@ -906,10 +906,10 @@ __virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
|||
|
||||
virNWFilterHashTableFree(vars);
|
||||
|
||||
err_exit_vars1:
|
||||
err_exit_vars1:
|
||||
virNWFilterHashTableFree(vars1);
|
||||
|
||||
err_exit:
|
||||
err_exit:
|
||||
virNWFilterObjUnlock(obj);
|
||||
|
||||
VIR_FREE(str_ipaddr);
|
||||
|
@ -961,7 +961,7 @@ _virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
|
|||
false,
|
||||
foundNewFilter);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
virMutexUnlock(&updateMutex);
|
||||
|
||||
return rc;
|
||||
|
|
|
@ -761,13 +761,13 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
|||
|
||||
return 0;
|
||||
|
||||
err_dereg_req:
|
||||
err_dereg_req:
|
||||
virNWFilterDeregisterLearnReq(ifindex);
|
||||
err_free_ht:
|
||||
err_free_ht:
|
||||
virNWFilterHashTableFree(ht);
|
||||
err_free_req:
|
||||
err_free_req:
|
||||
virNWFilterIPAddrLearnReqFree(req);
|
||||
err_no_req:
|
||||
err_no_req:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue