PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php:1) in /home/u866776246/domains/wisatalogung.com/public_html/uploads/produk/1775157541_x.php on line 131
]KfpEfddlZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZmZddlmZddlmZdd lmZmZmZmZmZmZmZmZmZmZm Z dd l!m"Z"m#Z#m$Z$dd l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSdd lTmUZUdd lVmWZWddlXmYZYddlZm[Z[ddl\m]Z]m^Z^m_Z_ddl`maZaddlbmcZcddldmeZeddlfmgZgddlhmiZiddljmkZlddljmmZmddlnmoZompZpddlqmrZrmsZsmtZtddlumvZvmwZwddlxmyZyddlzm{Z{m|Z|ddl}m~Z~mZddlmZmZdd lmZd!ZejeZd"Zd#ZGd$d%ZGd&d'ee^ZGd(d)eee_ZGd*d+eegZGd,d-ee]ZdS).N)partial)chain)AF_INETAF_INET6 AF_UNSPEC)config)AF_MPLS basestring) AF_BRIDGE)LAB_API) NLM_F_ACK NLM_F_APPEND NLM_F_ATOMIC NLM_F_CREATE NLM_F_DUMP NLM_F_ECHO NLM_F_EXCL NLM_F_REPLACE NLM_F_REQUEST NLM_F_ROOT NLMSG_ERROR)NetlinkDumpInterrupted NetlinkError SkipInode). RTM_DELADDR RTM_DELLINKRTM_DELLINKPROP RTM_DELNEIGH RTM_DELQDISC RTM_DELROUTE RTM_DELRULE RTM_DELTCLASSRTM_DELTFILTER RTM_GETADDR RTM_GETLINK RTM_GETNEIGHRTM_GETNEIGHTBL RTM_GETNSID RTM_GETQDISC RTM_GETROUTE RTM_GETRULE RTM_GETSTATS RTM_GETTCLASSRTM_GETTFILTER RTM_NEWADDR RTM_NEWLINKRTM_NEWLINKPROP RTM_NEWNEIGH RTM_NEWNETNS RTM_NEWNSID RTM_NEWQDISC RTM_NEWROUTE RTM_NEWRULE RTM_NEWTCLASSRTM_NEWTFILTER RTM_SETLINKRTMGRP_IPV4_IFADDRRTMGRP_IPV4_ROUTERTMGRP_IPV4_RULERTMGRP_IPV6_IFADDRRTMGRP_IPV6_ROUTERTMGRP_IPV6_RULE RTMGRP_LINKRTMGRP_MPLS_ROUTE RTMGRP_NEIGH TC_H_ROOTndmsgrt_protort_scopert_type)fibmsg) ifaddrmsg)ifinfmsg) ifstatsmsg)ChaoticIPRSocket IPBatchSocket IPRSocket)ndtmsg)nsidmsg)nsinfmsg) RawIPRSocket)rtmsg)plugins)tcmsg)AddressFieldFilterAddressIPRouteFilter)BridgeFieldFilterBridgeIPRouteFilterBridgePortFieldFilter)LinkFieldFilterLinkIPRouteFilter)RequestProcessor)NeighbourFieldFilterNeighbourIPRouteFilter)RouteFieldFilterRouteIPRouteFilter)RuleFieldFilterRuleIPRouteFilter)default_routesc|d|vr|d|fSi}d|vr|d|d<||fS)Nmatchfamily)pop)kwarg new_kwargs I/opt/alt/python311/lib/python3.11/site-packages/pyroute2/iproute/linux.pyget_dump_filterrousU%yy!!5(( u  "'))H"5"5Ih ict|tr*d|dD\}}|dz|z}|S)Nc6g|]}t|r|nddS)0)int.0xs rn z$transform_handle..s*NNNq#1oaa#r22NNNrp:rt) isinstancer split)handlemajorminors rntransform_handlersJ&*%%*NNFLL.filter_messagess"^T^T;U;;<<z,RTNL_API.make_request_type..s"qtT%<%'>????{3'75'@AAAAw<<III)  rpNc#K|jddkrd|j|j|j|jgi}nt |j|jt|jdgtt|jtgtt|jtgt|jgtt|jtgtt|jtgt t|jt"gt$t|jtgt(t|jtgi }|D])\}}|||n|jzr|D]}|D]}|V*dS)a; Dump network objects. On OpenBSD: * get_links() * get_addr() * get_neighbours() * get_routes() On Linux: * get_links() * get_addr() * get_neighbours() * get_vlans() * dump FDB * IPv4 and IPv6 rules rOpenBSDrer)rjN)uname get_linksget_addrget_neighbours get_routesrA get_vlansrfdbr;rr>rrCr<r?rBr r= get_rulesr@itemsgroups)rr groups_mapgroupmethodsmethodrs rnrz RTNL_API.dumps6 :a=I % %NM'O JJNNDHf-- #WT]7%K%K%K$L"WT]8%L%L%L$Mt23!GDOG$L$L$L#M!GDOH$M$M$M#N!GDOG$L$L$L#M 74>'#J#J#J"K 74>(#K#K#K"LJ)..00 " "NE7&"4$+F "%""F%vxx""! " " "rp 皙?c .tj}t}||ztjkrM ||fi|}|r|Stj|n#t$rYnwxYw||ztjkMt )a Run `method` with a positional argument `command` and keyword arguments `**spec` every `interval` seconds, but not more than `timeout`, until it returns a result which doesn't evaluate to `False`. Example: .. code-block:: python # create a bridge interface and wait for it: # spec = { 'ifname': 'br0', 'kind': 'bridge', 'state': 'up', 'br_stp_state': 1, } ipr.link('add', **spec) ret = ipr.poll(ipr.link, 'dump', **spec) assert ret[0].get('ifname') == 'br0' assert ret[0].get('state') == 'up' assert ret[0].get(('linkinfo', 'data', 'br_stp_state')) == 1 )timersleepr TimeoutError)rrrtimeoutintervalspecctimerets rnpollz RTNL_API.pollWs4 gggo ++ fW----J 8$$$$)     go ++nns A A A,+A,ct}t|d<||t}t |Sfd|DS)z\ Get all queue disciplines for all interfaces or for specified one. rjNc,g|]}|dk|Sindex)rwrxrs rnryz'RTNL_API.get_qdiscs..s':::!ajE&9&9A&9&9&9rp)rVr nlm_requestr)r)rrrrs ` rn get_qdiscszRTNL_API.get_qdiscssW gg!H sL11 =:: ::::s::: :rprct}t|d<||d<t||d<t||d<t||t S)zI Get filters for specified interface, handle and parent. rjrr}parent)rVrrrrr.)rrr}rrs rn get_filterszRTNL_API.get_filterss_gg!H G (00H (00H T%%c>::;;;rpct}t|d<||d<t||tS)z6 Get classes for specified interface. rjr)rVrrrr-)rrrs rn get_classeszRTNL_API.get_classess=gg!H G T%%c=99:::rpc bt|\}}|dtd|S)z: Dump available vlan info on bridge ports r)rjext_maskri)rolinkr )rrlrs rnrzRTNL_API.get_vlanss:-U33 Uyy 9q    rpcg}|pdg}|ddkrdg}|ddkrd}nd}|D].}|dkr||d<||j|fi|/|S)aY Get network interfaces. By default returns all interfaces. Arguments vector can contain interface indices or a special keyword 'all':: ip.get_links() ip.get_links('all') ip.get_links(1, 2, 3) interfaces = [1, 2, 3] ip.get_links(*interfaces) rrrrr)extendr)rrrlresultlinkscmdrs rnrzRTNL_API.get_linkss  8u  CE 8q==CCC 3 3Eqyy!&g MM)$)C11511 2 2 2 2 rpc 6|d||p|S)a Dump ARP cache records. The `family` keyword sets the family for the request: e.g. `AF_INET` or `AF_INET6` for arp cache, `AF_BRIDGE` for fdb. If other keyword arguments not empty, they are used as filter. Also, one can explicitly set filter as a function with the `match` parameter. Examples:: # get neighbours on the 3rd link: ip.get_neighbours(ifindex=3) # get a particular record by dst: ip.get_neighbours(dst='172.16.0.1') # get fdb records: ip.get_neighbours(AF_BRIDGE) # and filter them by a function: ip.get_neighbours(AF_BRIDGE, match=lambda x: x['state'] == 2) rrjri)neighrrjrirls rnrzRTNL_API.get_neighbourss 4zz&u~zFFFrpcxt}||d<t||tS)z& Get neighbour tables rj)rPrrr')rrjrs rn get_ntableszRTNL_API.get_ntabless4hhH T%%c?;;<<E:JJ Jrpcztj|tj}tj|j}||fS)z3Open a file (read only) and return its (fd, inode).)osopenO_RDONLYfstatst_ino)pathfdinodes rn open_filezRTNL_API.open_fileAs1WT2; ' ' #E{rpc.tj|dS)z9Close a file that was previously opened with open_file().N)rclose)rs rn close_filezRTNL_API.close_fileHs  rpc(tjS)z&Return the PID of the current process.)rgetpidrrprnget_pidzRTNL_API.get_pidMsy{{rpcDtj|||Sr)rKifinforegister_link_kind)rrpkgmodules rnrzRTNL_API.register_link_kindRs11$VDDDrpc@tj|Sr)rKrunregister_link_kind)rkinds rnrzRTNL_API.unregister_link_kindUs33D999rpc>tjSr)rKrlist_link_kind)rs rnr zRTNL_API.list_link_kindXs--///rpct}d|d<d}t}t} ||\}}||d<|d|vrt||dd|fg|d< ||t tD]}|d|d<n#t$rYnwxYwd|fg|d<n&#t$r}t|j d}~wwxYw |dkr| |n!#|dkr| |wwxYwt|d d <|j|d d <d |d <|S)Nnetnsidrr NETNSA_FDattrs NETNSA_NSID NSINFO_PATHheadertypetargetr3event)rRrQrraddrr(rget_attr ExceptionOSErrorerrnorr3r) rrregistryitemnsfdinforres rn _dump_one_nszRTNL_API._dump_one_ns^szz$Yyyii & NN400MT5!DMG}((kk! LLg ' ' ' )$/0CL  ,,S+}MMD'+mmM&B&BDO    +T23DMM % % %AG$$ $ % axx%%%axx%%%%!-Xv#';Xx &W  sNAC" L  b 1 2 2 2  " L  !5{ C D D D##CmDD  A =11 ! +@ A A    trpFc#nKt}i}|D]P}|d}|7||vrg||<|||dQg}|jD]+}||||,|r(||||D][} |D]E} | d=|| dgD]}| dd|f | VFL#t$rYXwxYwdS)z A prototype method to list available netns and associated interfaces. A bit weird to have it here and not under `pyroute2.netns`, but it uses RTNL to get all the info. IFLA_LINK_NETNSIDN IFLA_IFNAMErrr NSINFO_PEER) setrrrrr'r*rr) r list_procrpeerspeerrviewsrviewrs rnget_netns_infozRTNL_API.get_netns_infos55NN$$ D DDmm$788G"%''%'E'Ng%%dmmM&B&BCCCO 9 9D LLh77 8 8 8 8  4 LL22 3 3 3  D   DW !& $y/2 > >DDW ,,mT-BCCCCJJJJ       sAD%% D21D2cnt}||dkr|ddn|dd|f||dd|f||dd|f||ttt zS)zAssigns an id to a peer netns using RTM_NEWNSID query. The kernel chooses an unique id if nsid is omitted. This corresponds to the "ip netns set" command. Nrr)rr rr,r)rQrrr4rr )rr/r1rrs rn set_netnsidzRTNL_API.set_netnsids ii <4!88 L   ; < < < < L   5 6 6 6 ? L  s 3 4 4 4 > L  b 1 2 2 2[-)2KLLLrpct}||d<||tttzt }||S|d|i|S)z$ Get default routes rj)msg_type msg_flagsparserNtable)rTrr*rrrfr)rrjrGrroutess rnget_default_routeszRTNL_API.get_default_routesshggH !! ! =0! "   =M''%(8&AA Arpc |rDt|hdkr/ |jdi|D] }|dgcSdS#t$rgcYSwxYwd||p|DS)aA Lookup interface index (indeces) by first level NLA value. Example:: ip.link_lookup(address="52:54:00:9d:4e:3d") ip.link_lookup(ifname="lo") ip.link_lookup(operstate="UP") Please note, that link_lookup() returns list, not one value. >rifnamealtnamerrcg|] }|d Srr)rwrs rnryz(RTNL_API.link_lookup...s)"&W rp)riN)r)r:rrr)rrirlrs rn link_lookupzRTNL_API.link_lookups  SZZ"@"@"@@@ %DI55u55++D M?***++     *...u~.*N*N s5 AAcg}|j|i|D]9}||tt||:|S)z Flush routes -- purge route records from a table. Arguments are the same as for `get_routes()` routine. Actually, this routine implements a pipe from `get_routes()` to `nlm_request()`. rDrE)rputr rr)rrrlrrs rn flush_routeszRTNL_API.flush_routes8s[$T_d4e44  E HHU\]H K K K JJu     rpcttz}g}|j|i|D]4}||t|||5|S)a Flush IP addresses. Examples:: # flush all addresses on the interface with index 2: ipr.flush_addr(index=2) # flush all addresses with IFA_LABEL='eth0': ipr.flush_addr(label='eth0') rP)rrrrQrr)rrrlrrrs rn flush_addrzRTNL_API.flush_addrEse},!DM41511  D HHTK5H A A A JJt     rpcttz}g}|j|i|D]4}||t|||5|S)a Flush rules. Please keep in mind, that by default the function operates on **all** rules of **all** families. To work only on IPv4 rules, one should explicitly specify `family=AF_INET`. Examples:: # flush all IPv4 rule with priorities above 5 and below 32000 ipr.flush_rules(family=AF_INET, priority=lambda x: 5 < x < 32000) # flush all IPv6 rules that point to table 250: ipr.flush_rules(family=socket.AF_INET6, table=250) rP)rrrrQr!r)rrrlrrrs rn flush_ruleszRTNL_API.flush_rulesXse},"DND2E22  D HHTK5H A A A JJt     rpc &|dkrJt}|dd|d<d|d<|D] }||||<|j|fi|S|dvrd|vr|}n|dd}td ftd fd}|||\}}t }|dd|d<t|d <t||  t| } |d  d d | d idf| |||} |||| } |jr"|t zt kst#| } | S)aO Set bridge port parameters. Example:: idx = ip.link_lookup(ifname='eth0') ip.brport("set", index=idx, unicast_flood=0, cost=200) ip.brport("show", index=idx) Possible keywords are NLA names for the `protinfo_bridge` class, without the prefix and in lower letters. r:rr bridge_slaver rshowriNrrjcontextprimer IFLA_PROTINFOirP)rrkrr%rrKrr r^ apply_filterr[finalizerrrrrr) rrrl linkkwargrrirrErprotinfors rnbrportzRTNL_API.brportss e  I!&7A!6!6Ig  .If  , ,!&s #49W22 22 2 ' ' 'gU.B.BEEIIgt,,E!&) &)   $55g{KK)jjyy!,,G !H U% 8 8 8 \/88 9 9 XZZ  G  w(9:F C   sW JJ  &&uc22C   i*&< &J&J**C rpc tdftdfd}t|d<tt |g|d<|||\}}t |j||ffi|S)a' Vlan filters is another approach to support vlans in Linux. Before vlan filters were introduced, there was only one way to bridge vlans: one had to create vlan interfaces and then add them as ports:: +------+ +----------+ net --> | eth0 | <--> | eth0.500 | <---+ +------+ +----------+ | v +------+ +-----+ net --> | eth1 | | br0 | +------+ +-----+ ^ +------+ +----------+ | net --> | eth2 | <--> | eth2.500 | <---+ +------+ +----------+ It means that one has to create as many bridges, as there were vlans. Vlan filters allow to bridge together underlying interfaces and create vlans already on the bridge:: # v500 label shows which interfaces have vlan filter +------+ v500 net --> | eth0 | <-------+ +------+ | v +------+ +-----+ +---------+ net --> | eth1 | <--> | br0 |<-->| br0v500 | +------+ +-----+ +---------+ ^ +------+ v500 | net --> | eth2 | <-------+ +------+ In this example vlan 500 will be allowed only on ports `eth0` and `eth2`, though all three eth nics are bridged. Some example code:: # create bridge ip.link("add", ifname="br0", kind="bridge") # attach a port ip.link("set", index=ip.link_lookup(ifname="eth0")[0], master=ip.link_lookup(ifname="br0")[0]) # set vlan filter ip.vlan_filter("add", index=ip.link_lookup(ifname="eth0")[0], vlan_info={"vid": 500}) # create vlan interface on the bridge ip.link("add", ifname="br0v500", kind="vlan", link=ip.link_lookup(ifname="br0")[0], vlan_id=500) # set all UP ip.link("set", index=ip.link_lookup(ifname="br0")[0], state="up") ip.link("set", index=ip.link_lookup(ifname="br0v500")[0], state="up") ip.link("set", index=ip.link_lookup(ifname="eth0")[0], state="up") # set IP address ip.addr("add", index=ip.link_lookup(ifname="br0v500")[0], address="172.16.5.2", mask=24) Now all the traffic to the network 172.16.5.2/24 will go to vlan 500 only via ports that have such vlan filter. Required arguments for `vlan_filter()`: `index` and `vlan_info`. Vlan info dict:: ip.vlan_filter('add', index=, vlan_info = {'vid': , 'pvid': , 'flags': int or list} More details: * kernel:Documentation/networking/switchdev.txt * pyroute2.netlink.rtnl.ifinfmsg:... vlan_info Setting PVID or specifying a range will specify the approprate flags. One can specify `flags` as int or as a list of flag names: * `master` == 0x1 * `pvid` == 0x2 * `untagged` == 0x4 * `range_begin` == 0x8 * `range_end` == 0x10 * `brentry` == 0x20 E.g.:: {'vid': 20, 'pvid': true } # is equal to {'vid': 20, 'flags': ['pvid', 'untagged']} # is equal to {'vid': 20, 'flags': 6} # range {'vid': '100-199'} Required arguments for `vlan_filter()`: `index` and `vlan_tunnel_info`. Vlan tunnel info dict:: ip.vlan_filter('add', index=, vlan_tunnel_info = {'vid': , 'id': } vlan_tunnel_info appears to only use the 'range_begin' and 'range_end' flags from vlan_info. Specifying a range will automatically send the needed flags. Example:: {'vid': 20, 'id: 20} {'vid': '200-299', 'id': '200-299'} The above directives can be combined as in the example:: ip.vlan_filter('add', index=7, vlan_info={'vid': 600}, vlan_tunnel_info={'vid': 600, 'id': 600}) Commands: **add** Add vlan filter to a bridge port. Example:: ip.vlan_filter("add", index=2, vlan_info={"vid": 200}) **del** Remove vlan filter from a bridge port. Example:: ip.vlan_filter("del", index=2, vlan_info={"vid": 200}) r)rdelrj kwarg_filter)r:rr rYrZrrr)rrrlrrs rn vlan_filterzRTNL_API.vlan_filtersH ''  $h     ( (! n  11';GG%YTY/99599:::rpc d}|dkrt|\}}t|d<d|vr|d|d<|dvr|ddtjdzs|ddtjdz|d<|ddtjd tjd zzs |dxxtjd zcc<|d dtjd tjd zzs,|d dtjd z|d <|||d<|j|fi|S)a Bridge forwarding database management. More details: * kernel:Documentation/networking/switchdev.txt * pyroute2.netlink.rtnl.ndmsg **add** Add a new FDB record. Works in the same way as ARP cache management, but some additional NLAs can be used:: # simple FDB record # ip.fdb('add', ifindex=ip.link_lookup(ifname='br0')[0], lladdr='00:11:22:33:44:55', dst='10.0.0.1') # specify vlan # NB: vlan should exist on the device, use # `vlan_filter()` # ip.fdb('add', ifindex=ip.link_lookup(ifname='br0')[0], lladdr='00:11:22:33:44:55', dst='10.0.0.1', vlan=200) # specify vxlan id and port # NB: works only for vxlan devices, use # `link("add", kind="vxlan", ...)` # # if port is not specified, the default one is used # by the kernel. # # if vni (vxlan id) is equal to the device vni, # the kernel doesn't report it back # ip.fdb('add', ifindex=ip.link_lookup(ifname='vx500')[0] lladdr='00:11:22:33:44:55', dst='10.0.0.1', port=5678, vni=600) # or specify src_vni for a vlan-aware vxlan device ip.fdb('add', ifindex=ip.link_lookup(ifname='vx500')[0] lladdr='00:11:22:33:44:55', dst='10.0.0.1', port=5678, src_vni=600) **append** Append a new FDB record. The same syntax as for **add**. **del** Remove an existing FDB record. The same syntax as for **add**. **dump** Dump all the FDB records. If any `**kwarg` is provided, results will be filtered:: # dump all the records ip.fdb('dump') # show only specific lladdr, dst, vlan etc. ip.fdb('dump', lladdr='00:11:22:33:44:55') ip.fdb('dump', dst='10.0.0.1') ip.fdb('dump', vlan=200) Nrrjnudstate)rrerrnoarp permanent reachablerrmasterri)ror rkrrEstatesrr)rrrlrs rnrz RTNL_API.fdbUsqZ f  !0!7!7 K#h E>>"YYu--E'N / / / IIgq ! !EL$9 9 0#YYw22U\'5JJE'N99Wa(( [)EL,EE <g%,{";;99Wa(( F#ek(&;; M"'7A!6!6V9L!Lg  "(E'Ntz'++U+++rpc &tdftdftdftdftdftdftdftdftdftdfd }d }tj}|dkrt |\}}t || tt| }| ||\}}|j D]A} |dkr|j r | d d kr| | d d || d <B|D]X\} } tj| } || r| |d | | gY||||} |dkr|r||| } |jr"|t*zt*kst-| } | S)a= Neighbours operations, same as `ip neigh` or `bridge fdb` **add** Add a neighbour record, e.g.:: from pyroute2 import IPRoute from pyroute2.netlink.rtnl import ndmsg # add a permanent record on veth0 idx = ip.link_lookup(ifname='veth0')[0] ip.neigh('add', dst='172.16.45.1', lladdr='00:11:22:33:44:55', ifindex=idx, state=ndmsg.states['permanent']) **set** Set an existing record or create a new one, if it doesn't exist. The same as above, but the command is "set":: ip.neigh('set', dst='172.16.45.1', lladdr='00:11:22:33:44:55', ifindex=idx, state=ndmsg.states['permanent']) **change** Change an existing record. If the record doesn't exist, fail. **del** Delete an existing record. **dump** Dump all the records in the NDB:: ip.neigh('dump') **get** Get specific record (dst and ifindex are mandatory). Available only on recent kernel:: ip.neigh('get', dst='172.16.45.1', ifindex=idx) rrrrrrr) rr:rrreremovedeleterrrNr[rifindexrrP)r2rr&rEror^r_r_r`r`rfields strict_checkrkrname2nla valid_nlarrrrrr)rrrlrrrrequestrDrEfieldrrnlars rnrzRTNL_API.neighs#n!(+ ),$i0#X. %(#U+#U+!6* %(#X.    kmm f  !0!7!7 K U% 8 8 8 \.00 1 1 \099 : : XZZ  #44WkJJ)Z 5 5E6!!%"!H ))#KKa!44CaMM!--// 2 2JC+&&s++C}}S!! 2e&7G ##S%L111sXKK f   &&{C88C   i*&< &J&J**C rpc tdftdftdftdftdftdftdftdft dft dfd }d}i}t }|dkrt|\}}|rz|dr |d}ntt|g}t|| }|D]}| || |||\} } |jD]'} || d d || d <(|D][\} } t%|| }||r| |d || g\||| | }|dkr|t/|t0rbt||  t td }|||}|jr"| t6zt6kst9|}|S) u-) Link operations. Keywords to set up ifinfmsg fields: * index -- interface index * family -- AF_BRIDGE for bridge operations, otherwise 0 * flags -- device flags * change -- change mask All other keywords will be translated to NLA names, e.g. `mtu -> IFLA_MTU`, `af_spec -> IFLA_AF_SPEC` etc. You can provide a complete NLA structure or let filters do it for you. E.g., these pairs show equal statements:: # set device MTU ip.link("set", index=x, mtu=1000) ip.link("set", index=x, IFLA_MTU=1000) # add vlan device ip.link("add", ifname="test", kind="dummy") ip.link("add", ifname="test", IFLA_LINKINFO={'attrs': [['IFLA_INFO_KIND', 'dummy']]}) Filters are implemented in the `pyroute2.iproute.req` module. You can contribute your own if you miss shortcuts. Commands: **add** To create an interface, one should specify the interface kind:: ip.link("add", ifname="test", kind="dummy") The kind can be any of those supported by kernel. It can be `dummy`, `bridge`, `bond` etc. On modern kernels one can specify even interface index:: ip.link("add", ifname="br-test", kind="bridge", index=2345) Specific type notes: ► geneve Create GENEVE tunnel:: ip.link("add", ifname="genx", kind="geneve", geneve_id=42, geneve_remote="172.16.0.101") Support for GENEVE over IPv6 is also included; use `geneve_remote6` to configure a remote IPv6 address. ► gre Create GRE tunnel:: ip.link("add", ifname="grex", kind="gre", gre_local="172.16.0.1", gre_remote="172.16.0.101", gre_ttl=16) The keyed GRE requires explicit iflags/oflags specification:: ip.link("add", ifname="grex", kind="gre", gre_local="172.16.0.1", gre_remote="172.16.0.101", gre_ttl=16, gre_ikey=10, gre_okey=10, gre_iflags=32, gre_oflags=32) Support for GRE over IPv6 is also included; use `kind=ip6gre` and `ip6gre_` as the prefix for its values. ► ipip Create ipip tunnel:: ip.link("add", ifname="tun1", kind="ipip", ipip_local="172.16.0.1", ipip_remote="172.16.0.101", ipip_ttl=16) Support for sit and ip6tnl is also included; use `kind=sit` and `sit_` as prefix for sit tunnels, and `kind=ip6tnl` and `ip6tnl_` prefix for ip6tnl tunnels. ► macvlan Macvlan interfaces act like VLANs within OS. The macvlan driver provides an ability to add several MAC addresses on one interface, where every MAC address is reflected with a virtual interface in the system. In some setups macvlan interfaces can replace bridge interfaces, providing more simple and at the same time high-performance solution:: ip.link("add", ifname="mvlan0", kind="macvlan", link=ip.link_lookup(ifname="em1")[0], macvlan_mode="private").commit() Several macvlan modes are available: "private", "vepa", "bridge", "passthru". Ususally the default is "vepa". ► macvtap Almost the same as macvlan, but creates also a character tap device:: ip.link("add", ifname="mvtap0", kind="macvtap", link=ip.link_lookup(ifname="em1")[0], macvtap_mode="vepa").commit() Will create a device file `"/dev/tap%s" % index` ► tuntap Possible `tuntap` keywords: * `mode` — "tun" or "tap" * `uid` — integer * `gid` — integer * `ifr` — dict of tuntap flags (see ifinfmsg:... tuntap_data) Create a tap interface:: ip.link("add", ifname="tap0", kind="tuntap", mode="tap") Tun/tap interfaces are created using `ioctl()`, but the library provides a transparent way to manage them using netlink API. ► veth To properly create `veth` interface, one should specify `peer` also, since `veth` interfaces are created in pairs:: # simple call ip.link("add", ifname="v1p0", kind="veth", peer="v1p1") # set up specific veth peer attributes ip.link("add", ifname="v1p0", kind="veth", peer={"ifname": "v1p1", "net_ns_fd": "test_netns"}) ► vlan VLAN interfaces require additional parameters, `vlan_id` and `link`, where `link` is a master interface to create VLAN on:: ip.link("add", ifname="v100", kind="vlan", link=ip.link_lookup(ifname="eth0")[0], vlan_id=100) There is a possibility to create also 802.1ad interfaces:: # create external vlan 802.1ad, s-tag ip.link("add", ifname="v100s", kind="vlan", link=ip.link_lookup(ifname="eth0")[0], vlan_id=100, vlan_protocol=0x88a8) # create internal vlan 802.1q, c-tag ip.link("add", ifname="v200c", kind="vlan", link=ip.link_lookup(ifname="v100s")[0], vlan_id=200, vlan_protocol=0x8100) ► vrf VRF interfaces (see linux/Documentation/networking/vrf.txt):: ip.link("add", ifname="vrf-foo", kind="vrf", vrf_table=42) ► vxlan VXLAN interfaces are like VLAN ones, but require a bit more parameters:: ip.link("add", ifname="vx101", kind="vxlan", vxlan_link=ip.link_lookup(ifname="eth0")[0], vxlan_id=101, vxlan_group='239.1.1.1', vxlan_ttl=16) All possible vxlan parameters are listed in the module `pyroute2.netlink.rtnl.ifinfmsg:... vxlan_data`. ► ipoib IPoIB driver provides an ability to create several ip interfaces on one interface. IPoIB interfaces requires the following parameter: `link` : The master interface to create IPoIB on. The following parameters can also be provided: * `pkey`- Inifiniband partition key the ip interface is associated with * `mode`- Underlying infiniband transport mode. One of: ['datagram' ,'connected'] * `umcast`- If set(1), multicast group membership for this interface is handled by user space. Example:: ip.link("add", ifname="ipoib1", kind="ipoib", link=ip.link_lookup(ifname="ib0")[0], pkey=10) **set** Set interface attributes:: # get interface index x = ip.link_lookup(ifname="eth0")[0] # put link down ip.link("set", index=x, state="down") # rename and set MAC addr ip.link("set", index=x, address="00:11:22:33:44:55", name="bala") # set MTU and TX queue length ip.link("set", index=x, mtu=1000, txqlen=2000) # bring link up ip.link("set", index=x, state="up") Seting bridge or tunnel attributes require `kind` to be specified in order to properly encode `IFLA_LINKINFO`:: ip.link("set", index=x, kind="bridge", br_forward_delay=2000) ip.link("set", index=x, kind="gre", gre_local="10.0.0.1", gre_remote="10.1.0.103") Keyword "state" is reserved. State can be "up" or "down", it is a shortcut:: state="up": flags=1, mask=1 state="down": flags=0, mask=0 SR-IOV virtual function setup:: # get PF index x = ip.link_lookup(ifname="eth0")[0] # setup macaddr ip.link("set", index=x, # PF index vf={"vf": 0, # VF index "mac": "00:11:22:33:44:55"}) # address # setup vlan ip.link("set", index=x, # PF index vf={"vf": 0, # VF index "vlan": 100}) # the simplest case # setup QinQ ip.link("set", index=x, # PF index vf={"vf": 0, # VF index "vlan": [{"vlan": 100, # vlan id "proto": 0x88a8}, # 802.1ad {"vlan": 200, # vlan id "proto": 0x8100}]}) # 802.1q **update** Almost the same as `set`, except it uses different flags and message type. Mostly does the same, but in some cases differs. If you're not sure what to use, use `set`. **del** Destroy the interface:: ip.link("del", index=ip.link_lookup(ifname="dummy0")[0]) **dump** Dump info for all interfaces **get** Get specific interface info:: ip.link("get", index=ip.link_lookup(ifname="br0")[0]) Get extended attributes like SR-IOV setup:: ip.link("get", index=3, ext_mask=1) rrrrr) r:updaterre property_add property_delrqrrrrNrfr[rrrP)r0r:rr1rr%rKrorr\r]r^r_r`rrtrkrrrvrwrrr{rrrrr)rrrlrrrxrfiltersrfilterrDrEryrrrzrs rnrz RTNL_API.link,sZ  '"H-*',h7,e4"E*"E* &)'    jj f  !0!7!7 K  yy(( J/*,,.?.H.HI&uEBBBG" . .$$W----      "44WkJJ)Z 5 5E#KKa!44CaMM"--// 2 2JCs))$$S))C}}S!! 2e&7G ##S%L111sXKK f  !8+t,, $[ LLL!\/"3"344!\"3F";";<<XZZ  &&{C88C   i*&< &J&J**C rpcx|dvrgS|r?tjdttd|}||d|vrtjdtt dft dft dft dft dftd fd }d }t}|d krt|\}}t||  t t|}|||\} } |jD]3} | d dkr%|| d d || d <4|D]M\} } tj| }||r| |d|| gN||| | d}|d kr||||}|jr"| t2zt2kst5|}|S)a Address operations * command -- add, delete, replace, dump * index -- device index * address -- IPv4 or IPv6 address * mask -- address mask * family -- socket.AF_INET for IPv4 or socket.AF_INET6 for IPv6 * scope -- the address scope, see /etc/iproute2/rt_scopes * kwarg -- dictionary, any ifaddrmsg field or NLA Later the method signature will be changed to:: def addr(self, command, match=None, **kwarg): # the method body So only keyword arguments (except of the command) will be accepted. The reason for this change is an unification of API. Example:: idx = 62 ip.addr('add', index=idx, address='10.0.0.1', mask=24) ip.addr('add', index=idx, address='10.0.0.2', mask=24) With more NLAs:: # explicitly set broadcast address ip.addr('add', index=idx, address='10.0.0.3', broadcast='10.0.0.255', prefixlen=24) # make the secondary address visible to ifconfig: add label ip.addr('add', index=idx, address='10.0.0.4', broadcast='10.0.0.255', prefixlen=24, label='eth0:1') Configure p2p address on an interface:: ip.addr('add', index=idx, address='10.1.1.2', mask=24, local='10.1.1.1') )rr:zMpositional arguments for IPRoute.addr() are deprecated, use keyword arguments)raddress prefixlenrjscoperimaskz2usage of mask is deprecated, use prefixlen insteadrrrr)rrerqrrrrNr[rrrc0|ddtkS)Nrr)r)rxs rnrzRTNL_API.addr..s( F 3{ Brp)rDrE terminate)warningswarnDeprecationWarningzipr|r/rr$rJror^r_rWrXr`rrtrkrrvrwrrrrrr)rrrrlconverted_argvrrrrxrDrEryrrrzrs rnrz RTNL_API.addrsw` n $ $I  ) M("    !MN LL ( ( ( U?? MD"     *'"E*"E*#Y/ &)    kk f  !0!7!7 K U% 8 8 8 \,.. / / \.w77 8 8 XZZ  #44WkJJ)Z 9 9EQx7"" ' E!Ha 8 8E!H "--// 2 2JC$S))C}}S!! 2e&7G ##S%L111 BB    f  !8&&{C88C   i*&< &J&J**C rpc |dkrdS|dkrtS|dkr/tj|}|t|dr|jSdStdft dft dft dftd ftd ft dftdft d ft d ftdftdftd ftd fd }|d krh|d krd D}t|tttfr"ttfd|DS||\}}t#} t%|}dD]&} | |vr || t%|| || <'|| d<|| d<d|vr |d| d<|dd} |tvrt|}|dt)|dd | d<t|dr|| ||r;|t tfvr||} n4||} n|dt0| d<|| dd|g| | dd| gt| ||S)a "Swiss knife" for traffic control. With the method you can add, delete or modify qdiscs, classes and filters. * command -- add or delete qdisc, class, filter. * kind -- a string identifier -- "sfq", "htb", "u32" and so on. * handle -- integer or string Command can be one of ("add", "del", "add-class", "del-class", "add-filter", "del-filter") (see `commands` dict in the code). Handle notice: traditional iproute2 notation, like "1:0", actually represents two parts in one four-bytes integer:: 1:0 -> 0x10000 1:1 -> 0x10001 ff:0 -> 0xff0000 ffff:1 -> 0xffff0001 Target notice: if your target is a class/qdisc that applies an algorithm that can only apply to upstream traffic profile, but your keys variable explicitly references a match that is only relevant for upstream traffic, the kernel will reject the filter. Unless you're dealing with devices like IMQs For pyroute2 tc() you can use both forms: integer like 0xffff0000 or string like 'ffff:0000'. By default, handle is 0, so you can add simple classless queues w/o need to specify handle. Ingress queue causes handle to be 0xffff0000. So, to set up sfq queue on interface 1, the function call will be like that:: ip = IPRoute() ip.tc("add", "sfq", 1) Instead of string commands ("add", "del"...), you can use also module constants, `RTM_NEWQDISC`, `RTM_DELQDISC` and so on:: ip = IPRoute() flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL ip.tc((RTM_NEWQDISC, flags), "sfq", 1) It should be noted that "change", "change-class" and "change-filter" work like "replace", "replace-class" and "replace-filter", except they will fail if the node doesn't exist (while it would have been created by "replace"). This is not the same behaviour as with "tc" where "change" can be used to modify the value of some options while leaving the others unchanged. However, as not all entities support this operation, we believe the "change" commands as implemented here are more useful. Also available "modules" (returns tc plugins dict) and "help" commands:: help(ip.tc("modules")["htb"]) print(ip.tc("help", "htb")) r:Nmoduleshelp__doc__zNo help availablerrrr)rrerqrrrrz add-classz del-classz change-classz replace-classz add-filterz del-filterz change-filterzreplace-filterrerc6g|]}|ddk|dS)rrerrvs rnryzRTNL_API.tc..~s,#$AgJ!OOAgJOOOrpc3FK|]}d|VdS)rerN)tc)rwrxrs rn zRTNL_API.tc..s3#K#KDGGEG$;$;#K#K#K#K#K#Krp)rrdefaultrr}roptsrfix_msgrTCA_KIND TCA_OPTIONSrP) tc_pluginsrrrr5rr8r"r9r#rr{rrr:rrrVrrkgetattrrget_class_parametersget_parametersrDrr) rrr rr}rlprrrrrs ` rnrz RTNL_API.tc"s$z e   F i    f  t$$A}I!6!6}y **!(+ %(#U+#U+#X.$i0'2'/*H5+Y7)84)51,h7-y9  e  zz(,(8(8%$s!344 NE#K#K#K#KU#K#K#KLMMM//EEgg!&))3 < = 4.10):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6", "mode": "encap", "segs": "2000::5,2000::6", }, ) Create SEG6 tunnel inline mode (kernel >= 4.10):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6", "mode": "inline", "segs": ["2000::5", "2000::6"], }, ) Create SEG6 tunnel inline mode with hmac (kernel >= 4.10):: ipr.route( "add", dst="2001:0:0:22::2/128", oif=idx, encap={ "type": "seg6", "mode": "inline", "segs": "2000::5,2000::6,2000::7,2000::8", "hmac": 0xf, }, ) Create SEG6 tunnel with ip4ip6 encapsulation (kernel >= 4.14):: ipr.route( "add", dst="172.16.0.0/24", oif=idx, encap={ "type": "seg6", "mode": "encap", "segs": "2000::5,2000::6", }, ) Create SEG6LOCAL tunnel End.DX4 action (kernel >= 4.14):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6local", "action": "End.DX4", "nh4": "172.16.0.10", }, ) Create SEG6LOCAL tunnel End.DT6 action (kernel >= 4.14):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6local", "action": "End.DT6", "table": "10", }, ) Create SEG6LOCAL tunnel End.DT4 action (kernel >= 5.11):: # $ sudo modprobe vrf # $ sudo sysctl -w net.vrf.strict_mode=1 ipr.link( "add", ifname="vrf-foo", kind="vrf", vrf_table=10, ) ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6local", "action": "End.DT4", "vrf_table": 10, }, ) Create SEG6LOCAL tunnel End.DT46 action (kernel >= 5.14):: # $ sudo modprobe vrf # $ sudo sysctl -w net.vrf.strict_mode=1 ip.link('add', ifname='vrf-foo', kind='vrf', vrf_table=10) ip.route('add', dst='2001:0:0:10::2/128', oif=idx, encap={'type': 'seg6local', 'action': 'End.DT46', 'vrf_table': 10}) Create SEG6LOCAL tunnel End.B6 action (kernel >= 4.14):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6local", "action": "End.B6", "srh": {"segs": "2000::5,2000::6"}, }, ) Create SEG6LOCAL tunnel End.B6 action with hmac (kernel >= 4.14):: ipr.route( "add", dst="2001:0:0:10::2/128", oif=idx, encap={ "type": "seg6local", "action": "End.B6", "srh": { "segs": "2000::5,2000::6", "hmac": 0xf, }, }, ) **change**, **replace**, **append** Commands `change`, `replace` and `append` have the same meanings as in ip-route(8): `change` modifies only existing route, while `replace` creates a new one, if there is no such route yet. `append` allows to create an IPv6 multipath route. **del** Remove the route. The same syntax as for **add**. **get** Get route by spec. **dump** Dump all routes. )rr:rrrprotostaticrunicastrirYNcallbackr[rrrrrrr) rr:rrrrerqrrrrZrrGrgrrjruniversedst_lenrrsrc_lentosrunspecr)rnewdstvia multipathoifRTA_DSTr RTA_GATEWAYrerz)rDrErF) add_defaults)rrkr^r_rarbr`r6r r*rrTrurrGrHrFr rrvrrlenfindrrr{rrrr)rrrlrirrxrrrrGrrzhoprattrrs rnrzRTNL_API.routes^ C C C"YYw99EXE'N!IIfi88EIE&M %  G/?$?$?EEIIgt,,E99Z.. U% 8 8 8 \*,, - - \,W55 6 6 XZZ  !(+ ),$i0#X.#X. %(#U+#U+ %(!6*!6*    11';GG%gg   :IIgs++E$)SLL55cCL (G44H yy(:*>??G 9d33Kuyy7K7KI9a00IYYua((E yy!,,G ii(9::F yy(8*<==G G x=G # #U|| # #JJJIIcNNN & &C.%%Cic Sz%G ##S%*$5666x=Y$444k))c%*oo.A.A#Cjm # 4 4$)&&D#Aw-77(,Aw||C'8'8A'='=%-H)0!$H !& 8 'UX    3%&& $U%@@@!\"2"F"F"FGG!\"4V"<"<==XZZ  &&uc22C   ej&8J&F&F**C rpc |dkrdSd|vr |dkr|}n|dd}t||tt |}t dftdftdftdftdfd}| ||\}}t}| d d }|d kr|nd |d <d D]} || d || <g|d<|D]X} |tkr |j r| dvrtj | } || #|d| || gY||||} |rt!|t"rbt||tt d}||| } |jr"|t(zt(kst+| } | S)u6 Rule operations - command — add, delete - table — 0 < table id < 253 - priority — 0 < rule's priority < 32766 - action — type of rule, default 'FR_ACT_NOP' (see fibmsg.py) - rtscope — routing scope, default RT_SCOPE_UNIVERSE `(RT_SCOPE_UNIVERSE|RT_SCOPE_SITE| RT_SCOPE_LINK|RT_SCOPE_HOST|RT_SCOPE_NOWHERE)` - family — rule's family (socket.AF_INET (default) or socket.AF_INET6) - src — IP source for Source Based (Policy Based) routing's rule - dst — IP for Destination Based (Policy Based) routing's rule - src_len — Mask for Source Based (Policy Based) routing's rule - dst_len — Mask for Destination Based (Policy Based) routing's rule - iifname — Input interface for Interface Based (Policy Based) routing's rule - oifname — Output interface for Interface Based (Policy Based) routing's rule - uid_range — Range of user identifiers, a string like "1000:1234" - dport_range — Range of destination ports, a string like "80-120" - sport_range — Range of source ports, as a string like "80-120" All packets route via table 10:: # 32000: from all lookup 10 # ... ip.rule('add', table=10, priority=32000) Default action:: # 32001: from all lookup 11 unreachable # ... iproute.rule('add', table=11, priority=32001, action='FR_ACT_UNREACHABLE') Use source address to choose a routing table:: # 32004: from 10.64.75.141 lookup 14 # ... iproute.rule('add', table=14, priority=32004, src='10.64.75.141') Use dst address to choose a routing table:: # 32005: from 10.64.75.141/24 lookup 15 # ... iproute.rule('add', table=15, priority=32005, dst='10.64.75.141', dst_len=24) Match fwmark:: # 32006: from 10.64.75.141 fwmark 0xa lookup 15 # ... iproute.rule('add', table=15, priority=32006, dst='10.64.75.141', fwmark=10) r:Nrirr[rr)rrerqrrrrGrrr)rjrractionrrr)ripriorityrP)rkr^r_rcrdr`r7r!r+rrIrrurvrrr{rrrrr) rrrlrirxrrrrGrrzrs rnrz RTNL_API.rule0 sfL e   F %  Gv$5$5EEIIgt,,E U% 8 8 8 \/++ , , \+G44 5 5 XZZ  *'"E*"E* &)   //EEhh GQ'' % uu#G M + +C{{3**CHHG  9 9C+%%$*;%////#&&Cs|'G ##S'#,$7888sWFF  3%&& $U%@@@!\/"3"344!\"3F";";<<XZZ  &&uc22C   ej&8J&F&F**C rpc |dkrd|vr|}n|dd}tdftdfd}|||\}}t}|dd|d<|dd |d<|||| }||||}|jr"|tztkst|}|S) z" Stats prototype. rriNr)rr filter_maskrsrrP) rkr,rrLrrrrrr)rrrlrirrrrs rnstatszRTNL_API.stats s v  G5$8$8EEIIgt,,E"6* %(  //EEll"YY}b99M9a00IsWFF  &&uc22C   ej&8J&F&F**C rpr)rr)rrr)r)rN)NNN)NNNN)F)Nrr)3__name__ __module__ __qualname__rrrrrrrrrrrrrrrrrr staticmethodrrrrrr r!r'r*r5r@rB DEFAULT_TABLErIrNrRrTrVrcrgrrrrrrrr __classcell__)rs@rnrrs##J 3 3 3 3 3 L L L   "BBBL8"8"8"8"t$$$$T ; ; ; ; < < < <;;;;   &>%.TGGGG8"+====(tFFFF: )     KKKK:\ \\EEEE:::000 &&&P   60000dMMMM6)2BBBB&B   &6///bo;o;o;bh,h,h,\gggRCCCJ ooobAOAOAOAOFIIIV {{{zrprceZdZdZdS)IPBatcha Netlink requests compiler. Does not send any requests, but instead stores them in the internal binary buffer. The contents of the buffer can be used to send batch requests, to test custom netlink parsers and so on. Uses `RTNL_API` and provides all the same API as normal `IPRoute` objects:: # create the batch compiler ipb = IPBatch() # compile requests into the internal buffer ipb.link("add", index=550, ifname="test", kind="dummy") ipb.link("set", index=550, state="up") ipb.addr("add", index=550, address="10.0.0.2", mask=24) # save the buffer data = ipb.batch # reset the buffer ipb.reset() ... # send the buffer IPRoute().sendto(data, (0, 0)) Nrrrrrrprnrr s2 DrprceZdZdZdS)IPRoutezO Regular ordinary utility class, see RTNL API for the list of methods. Nrrrprnrr  DrprceZdZdZdS) RawIPRoutezx The same as `IPRoute`, but does not use the netlink proxy. Thus it can not manage e.g. tun/tap interfaces. Nrrrprnrr s  DrprceZdZdZdS)ChaoticIPRoutezL IPRoute interface for chaotic tests - raising exceptions randomly. Nrrrprnrr rrpr)loggingrrr functoolsr itertoolsrsocketrrrpyroute2rpyroute2.commonr r pyroute2.configr pyroute2.labr pyroute2.netlinkr rrrrrrrrrrpyroute2.netlink.exceptionsrrrpyroute2.netlink.rtnlrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHpyroute2.netlink.rtnl.fibmsgrIpyroute2.netlink.rtnl.ifaddrmsgrJpyroute2.netlink.rtnl.ifinfmsgrK pyroute2.netlink.rtnl.ifstatsmsgrLpyroute2.netlink.rtnl.iprsocketrMrNrOpyroute2.netlink.rtnl.ndtmsgrPpyroute2.netlink.rtnl.nsidmsgrQpyroute2.netlink.rtnl.nsinfmsgrR pyroute2.netlink.rtnl.riprsocketrSpyroute2.netlink.rtnl.rtmsgrTpyroute2.netlink.rtnl.tcmsgrUrrVpyroute2.requests.addressrWrXpyroute2.requests.bridgerYrZr[pyroute2.requests.linkr\r]pyroute2.requests.mainr^pyroute2.requests.neighbourr_r`pyroute2.requests.routerarbpyroute2.requests.rulercrdparsersrfr getLoggerrlogrorrrrrrrrprnrsR //////////////////%%%%%%                            ////////////////////////////////////////////////////////////////////////////////////////////////`0/////555555333333777777 0/////111111333333999999------======------NNNNNNNN FEEEEEEE333333IHHHHHHHEEEEEEEE###### g!!   A%A%A%A%A%A%A%A%LJ     h    :     gx        <        X/     rp