Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
̍EYc@sddlZddlZddlZddlmZddlmZddlmZddlZd„Z	e	ƒZ
ejjd„ƒZ
ejjd„ƒZejjd„ƒZejjd	„ƒZd
efd„ƒYZdefd
„ƒYZdefd„ƒYZdS(iÿÿÿÿN(t	lockutils(tprocessutils(tprivsepcCs"tjjtjƒddƒd S(s-Grab the name of the binary we're running in.iÿÿÿÿii(tostpathtbasenametinspecttstack(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytget_binary_name&scCstjddddƒS(Ns
iptables-saves-ctattemptsi(Rtexecute(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt
iptables_save-s	cCstjddddƒS(Nsip6tables-saves-cR	i(RR
(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytip6tables_save3s	cCstjddddd|ƒS(Nsiptables-restores-cR	it
process_input(RR
(tinput((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytiptables_restore9s	cCstjddddd|ƒS(Nsip6tables-restores-cR	iR
(RR
(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytip6tables_restore@s	tIptablesRulecBs8eZdZeed„Zd„Zd„Zd„ZRS(srAn iptables rule.

    You shouldn't need to use this class directly, it's only used by
    IptablesManager.

    cCs(||_||_||_||_dS(N(tchaintruletwrapttop(tselfRRRR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt__init__Os			cCsF|j|jkoE|j|jkoE|j|jkoE|j|jkS(N(RRRR(Rtother((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt__eq__UscCs||kS(N((RR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt__ne__[scCs9|jrdt|jf}n	|j}d||jfS(Ns%s-%ss[0:0] -A %s %s(Rtbinary_nameRR(RR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt__repr__^s		(	t__name__t
__module__t__doc__tTruetFalseRRRR(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRGs
		t
IptablesTablecBsweZdZd„Zed„Zed„Zed„Zeed„Z	d„Z
eed„Zd„Zed	„Z
RS(
sAn iptables table.cCsCg|_g|_tƒ|_tƒ|_tƒ|_t|_dS(N(trulestremove_rulestsettchainstunwrapped_chainst
remove_chainsR tdirty(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRjs		cCs$|r||jkS||jkSdS(N(R&R'(RtnameR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt	has_chainrs
cCs6|r|jj|ƒn|jj|ƒt|_dS(s¸Adds a named chain to the table.

        The chain name is wrapped to be unique for the component creating
        it, so different components of Nova can safely create identically
        named chains without interfering with one another.

        At the moment, its wrapped name is <binary name>-<chain name>,
        so if nova-compute creates a chain named 'OUTPUT', it'll actually
        end up named 'nova-compute-OUTPUT'.

        N(R&taddR'R R)(RR*R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt	add_chainxscCsZ|r|j}n	|j}||kr+dSt|_|sM|jj|ƒn|j|ƒ|s—|jg|jD]}|j	|krq|^qq7_ng|jD]}|j	|kr¡|^q¡|_|rÞdt
|f}n
d|f}|s(|jg|jD]}||jkr|^q7_ng|jD]}||jkr2|^q2|_dS(s×Remove named chain.

        This removal "cascades". All rule in the chain are removed, as are
        all rules in other chains that jump to it.

        If the chain is not found, this is merely logged.

        Ns-j %s-%ss-j %s(R&R'R R)R(R,tremoveR$R#RRR(RR*Rt	chain_settrtjump_snippet((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytremove_chainŠs&			
7.
 cCs´|r.||jkr.ttdƒ|ƒ‚nd|kradjt|j|jdƒƒƒ}nt||||ƒ}||jkr°|jj	t||||ƒƒt
|_ndS(s=Add a rule to the table.

        This is just like what you'd feed to iptables, just without
        the '-A <chain name>' bit at the start.

        However, if you need to jump to one of your wrapped chains,
        prepend its name with a '$' which will ensure the wrapping
        is applied correctly.

        sUnknown chain: %rt$t N(R&t
ValueErrort_tjointmapt_wrap_target_chaintsplitRR#tappendR R)(RRRRRtrule_obj((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytadd_rule°s'cCs%|jdƒr!dt|dfS|S(NR3s%s-%si(t
startswithR(Rts((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyR9ÆscCslyT|jjt||||ƒƒ|sJ|jjt||||ƒƒnt|_Wntk
rgnXdS(sÎRemove a rule from a chain.

        Note: The rule must be exactly identical to the one that was added.
        You cannot switch arguments around like you can with the iptables
        CLI tool.

        N(R#R.RR$R;R R)R5(RRRRR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytremove_ruleËs"

cCs–t|tjƒr$tj|ƒ}nt|jƒ}g|jD]!}|jt|ƒƒs=|^q=|_|t|jƒ}|dkr’t	|_
n|S(s Remove all rules matching regex.i(t
isinstancetsixtstring_typestretcompiletlenR#tmatchtstrR R)(Rtregext	num_rulesR0tremoved((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytremove_rules_regexÛs4cCsqg|jD]*}|j|kr
|j|kr
|^q
}|rLt|_nx|D]}|jj|ƒqSWdS(sRemove all rules from a chain.N(R#RRR R)R.(RRRRt
chained_rules((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytempty_chainæs*
(RRRRR R+R-R2R!R=R9R@RLRN(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyR"gs	&		tIptablesManagercBsƒeZdZed
d
dd
d„Zd„Zd„Zd„Zd„Z	e
jddeƒd	„ƒZ
d
„Zd„Zd„ZRS(sšWrapper for iptables.

    See IptablesTable for some usage docs

    A number of chains are set up to begin with.

    First, nova-filter-top. It's added at the top of FORWARD and OUTPUT. Its
    name is not wrapped, so it's shared between the various nova workers. It's
    intended for rules that need to live at the top of the FORWARD and OUTPUT
    chains. It's in both the ipv4 and ipv6 set of tables.

    For ipv4 and ipv6, the built-in INPUT, OUTPUT, and FORWARD filter chains
    are wrapped, meaning that the "real" INPUT chain has a rule that jumps to
    the wrapped INPUT chain, etc. Additionally, there's a wrapped chain named
    "local" which is jumped to from nova-filter-top.

    For ipv4, the built-in PREROUTING, OUTPUT, and POSTROUTING nat chains are
    wrapped in the same was as the built-in filter chains. Additionally,
    there's a snat chain that is applied after the POSTROUTING chain.

    tDROPcCs¥||_||_||_||_|p0dg|_itƒd6tƒd6tƒd6|_itƒd6|_t|_	xœ|j|jgD]ˆ}|dj
ddtƒ|djdddtd	tƒ|djd
ddtd	tƒ|dj
dƒ|djdddtƒqŒWiid
d
dgd6dd
dgd6dgd6d6id
d
dgd6d6}x¥|D]}|dkr‹|j}n|dkr£|j}nxdt
j||ƒD]O\}	}
x@|
D]8}||	j
|ƒ||	j|d|fdtƒqÊWq·WqmW|jdj
ddtƒ|jdjdddtƒ|jdj
dƒ|jdjdddtƒ|jdj
dƒ|jdjddƒdS(Ntalltfiltertnattmanglesnova-filter-topRtFORWARDs-j nova-filter-topRtOUTPUTtlocals	-j $localtINPUTt
PREROUTINGtPOSTROUTINGiis-j $%ssnova-postrouting-bottoms-j nova-postrouting-bottomtsnats-j $snats
float-snats-j $float-snat(tuse_ipv6tiptables_top_regextiptables_bottom_regextiptables_drop_actiontforward_bridge_interfaceR"tipv4tipv6R!tiptables_apply_deferredR-R=R RBt	iteritems(RR\R]R^R_R`ttablestbuiltin_chainst
ip_versionttableR&R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRsR				

	


 
cCs
t|_dS(N(R Rc(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytdefer_apply_onHscCst|_|jƒdS(N(R!Rctapply(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytdefer_apply_offKs	cCsdx'tj|jƒD]}|jrtSqW|jr`x*tj|jƒD]}|jrFtSqFWntS(N(RBt
itervaluesRaR)R R\RbR!(RRh((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyR)Os			cCs*|jr
dS|jƒr&|jƒndS(N(RcR)t_apply(R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRjYs	s
nova-iptablestexternalcCsítt|jfg}|jr:|tt|jfg7}nx¬|D]¤\}}}|ƒ\}}|jdƒ}xatj	|ƒD]P\}}	|j
||ƒ\}
}|j||
|!|	|ƒ||
|+t|	_
q~W|dj|ƒƒqAWdS(sApply the current in-memory set of iptables rules.

        This will blow away any rules left over from previous runs of the
        same component of Nova, and replace them with our current set of
        rules. This happens atomically, thanks to iptables-restore.

        s
N(RRRaR\RRRbR:RBRdt_find_tablet
_modify_rulesR!R)R7(RR?tsavetrestoreRet
all_tablest_errt	all_linest
table_nameRhtstarttend((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRm_s		
cCskt|ƒdkrdSy|jd|ƒd}Wntk
rEdSX||jdƒ|d}||fS(	Niis*%sitCOMMITi(ii(ii(RFtindexR5(RtlinesRvRwRx((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRovs
csU|j}t|jƒ}|j‰|j}|j‰|sXdd|ddg}|}ng|D]}t|kr_|^q_}	g}
g}|jrtj	|jƒ}g|	D]}|j
|ƒr«|^q«}
x?|
D]7}g|	D]$}|jƒ|jƒkrà|^qà}	qÓW|
}
n|jr¥tj	|jƒ}g|	D]}|j
|ƒr9|^q9}
x?|
D]7}g|	D]$}|jƒ|jƒkrn|^qn}	qaW|
}nt
}d}xNt|	ƒD]@\}}|së|jdƒrþt}qþq¾|jdƒs¾Pq¾q¾W|sd}n|
}g}x|D]ý}t|ƒ}|jr|jdƒrg|jd	d
ƒd
}ng|	D]$}|jƒ|jƒkrn|^qn}g|	D]$}|jƒ|jƒkrŸ|^qŸ}	|rît|ƒd}t|ƒ}nt|ƒ}|jƒ||g7}q$||g7}q$W||7}t|	ƒ}	||	||+g|D]}d|f^qO|	||+g|D]}d
t|f^qv|	||+|	jdƒ}||	||+tƒ‰‡fd†}‡‡fd†}t|	ƒ}	|	jƒt||	ƒ}	t||	ƒ}	t|	ƒ}	|	jƒˆjƒxˆD]}ˆj|ƒq:W|	S(Ns#Generated by novat*Rys#Completed by novait:it[t]iiÿÿÿÿs:%s - [0:0]s:%s-%s - [0:0]csY|jdƒr(|jddƒd}n|jƒ}|ˆkrDtSˆj|ƒtSdS(NR~Ri(R>R:tstripR!R,R (tline(t
seen_lines(sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt_weed_out_duplicatesås
cs|jdƒrr|jdƒd}|jdƒd}|jƒ}x¾ˆD]#}||krHˆj|ƒtSqHWn|jdƒr|jddƒd}|jƒ}x\ˆD]Q}t|ƒ}|jddƒd}|jƒ}||krªˆj|ƒtSqªWntS(NR}is- [iR~RR4(R>R:R€R.R!RHR (RRRtrule_str(R(R$(sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt_weed_out_removesðs&



(R'tsortedR&R(R#R$RR]RDREtsearchR€R^R!t	enumerateR>R RHRR:tlistRzR%treverseRRtclearR.(Rt
current_linesRhRvR'R&R#t
fake_tableRt
new_filtert	top_rulestbottom_rulesRIttemp_filterR„R?tseen_chainstrules_indexRt	our_rulest	bot_rulest
dup_filtertdupR*tcommit_indexRƒR…((R(R$R‚sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyRp‚sœ				
		
	(

(		(

(		
	
$
$


$'
	 



cCsñ|j}d|kr3dd|fdd|fgSg}xT|jD]I}|rC|jdd||ffƒ|jdd||ffƒqCqCW|jdd||ffƒ|jdd||jffƒ|jdd||jffƒ|S(NRQRUs-i %s -j ACCEPTs-o %s -j ACCEPTs-i %s -o %s -j ACCEPTs-i %s -j %ss-o %s -j %s(R`R;R_(Rtbridget
interfacesR#tiface((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pytget_gateway_ruless"	
N(RRRR!tNoneRRiRkR)RjRtsynchronizedR RmRoRpRœ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyROðs?			
			œ(RRRDtoslo_concurrencyRRtvif_plug_linux_bridgeRRBRRtvif_plugt
entrypointRRRRtobjectRR"RO(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/vif_plug_linux_bridge/iptables.pyt<module>s		 ‰