12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619 |
- /* BGP VTY interface.
- Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
- This file is part of GNU Zebra.
- GNU Zebra is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
- GNU Zebra is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Zebra; see the file COPYING. If not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
- #include <zebra.h>
- #include "command.h"
- #include "prefix.h"
- #include "plist.h"
- #include "buffer.h"
- #include "linklist.h"
- #include "stream.h"
- #include "thread.h"
- #include "log.h"
- #include "memory.h"
- #include "hash.h"
- #include "filter.h"
- #include "bgpd/bgpd.h"
- #include "bgpd/bgp_advertise.h"
- #include "bgpd/bgp_attr.h"
- #include "bgpd/bgp_aspath.h"
- #include "bgpd/bgp_community.h"
- #include "bgpd/bgp_ecommunity.h"
- #include "bgpd/bgp_lcommunity.h"
- #include "bgpd/bgp_damp.h"
- #include "bgpd/bgp_debug.h"
- #include "bgpd/bgp_fsm.h"
- #include "bgpd/bgp_mplsvpn.h"
- #include "bgpd/bgp_nexthop.h"
- #include "bgpd/bgp_open.h"
- #include "bgpd/bgp_regex.h"
- #include "bgpd/bgp_route.h"
- #include "bgpd/bgp_zebra.h"
- #include "bgpd/bgp_table.h"
- #include "bgpd/bgp_vty.h"
- #include "bgpd/bgp_mpath.h"
- /* Utility function to get address family from current node. */
- afi_t
- bgp_node_afi (struct vty *vty)
- {
- afi_t afi;
- switch (vty->node)
- {
- case BGP_IPV6_NODE:
- case BGP_IPV6M_NODE:
- case BGP_VPNV6_NODE:
- case BGP_ENCAPV6_NODE:
- afi = AFI_IP6;
- break;
- default:
- afi = AFI_IP;
- break;
- }
- return afi;
- }
- /* Utility function to get subsequent address family from current
- node. */
- safi_t
- bgp_node_safi (struct vty *vty)
- {
- safi_t safi;
- switch (vty->node)
- {
- case BGP_ENCAP_NODE:
- case BGP_ENCAPV6_NODE:
- safi = SAFI_ENCAP;
- break;
- case BGP_VPNV4_NODE:
- case BGP_VPNV6_NODE:
- safi = SAFI_MPLS_VPN;
- break;
- case BGP_IPV4M_NODE:
- case BGP_IPV6M_NODE:
- safi = SAFI_MULTICAST;
- break;
- default:
- safi = SAFI_UNICAST;
- break;
- }
- return safi;
- }
- int
- bgp_parse_afi(const char *str, afi_t *afi)
- {
- if (!strcmp(str, "ipv4")) {
- *afi = AFI_IP;
- return 0;
- }
- if (!strcmp(str, "ipv6")) {
- *afi = AFI_IP6;
- return 0;
- }
- return -1;
- }
- int
- bgp_parse_safi(const char *str, safi_t *safi)
- {
- if (!strcmp(str, "encap")) {
- *safi = SAFI_ENCAP;
- return 0;
- }
- if (!strcmp(str, "multicast")) {
- *safi = SAFI_MULTICAST;
- return 0;
- }
- if (!strcmp(str, "unicast")) {
- *safi = SAFI_UNICAST;
- return 0;
- }
- if (!strcmp(str, "vpn")) {
- *safi = SAFI_MPLS_VPN;
- return 0;
- }
- return -1;
- }
- static int
- peer_address_self_check (union sockunion *su)
- {
- struct interface *ifp = NULL;
- if (su->sa.sa_family == AF_INET)
- ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
- else if (su->sa.sa_family == AF_INET6)
- ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
- if (ifp)
- return 1;
- return 0;
- }
- /* Utility function for looking up peer from VTY. */
- static struct peer *
- peer_lookup_vty (struct vty *vty, const char *ip_str)
- {
- int ret;
- struct bgp *bgp;
- union sockunion su;
- struct peer *peer;
- bgp = vty->index;
- ret = str2sockunion (ip_str, &su);
- if (ret < 0)
- {
- vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
- return NULL;
- }
- peer = peer_lookup (bgp, &su);
- if (! peer)
- {
- vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
- return NULL;
- }
- return peer;
- }
- /* Utility function for looking up peer or peer group. */
- static struct peer *
- peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
- {
- int ret;
- struct bgp *bgp;
- union sockunion su;
- struct peer *peer;
- struct peer_group *group;
- bgp = vty->index;
- ret = str2sockunion (peer_str, &su);
- if (ret == 0)
- {
- peer = peer_lookup (bgp, &su);
- if (peer)
- return peer;
- }
- else
- {
- group = peer_group_lookup (bgp, peer_str);
- if (group)
- return group->conf;
- }
- vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
- VTY_NEWLINE);
- return NULL;
- }
- static int
- bgp_vty_return (struct vty *vty, int ret)
- {
- const char *str = NULL;
- switch (ret)
- {
- case BGP_ERR_INVALID_VALUE:
- str = "Invalid value";
- break;
- case BGP_ERR_INVALID_FLAG:
- str = "Invalid flag";
- break;
- case BGP_ERR_PEER_INACTIVE:
- str = "Activate the neighbor for the address family first";
- break;
- case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
- str = "Invalid command for a peer-group member";
- break;
- case BGP_ERR_PEER_GROUP_SHUTDOWN:
- str = "Peer-group has been shutdown. Activate the peer-group first";
- break;
- case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
- str = "This peer is a peer-group member. Please change peer-group configuration";
- break;
- case BGP_ERR_PEER_FLAG_CONFLICT:
- str = "Can't set override-capability and strict-capability-match at the same time";
- break;
- case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
- str = "No activate for peergroup can be given only if peer-group has no members";
- break;
- case BGP_ERR_PEER_BELONGS_TO_GROUP:
- str = "No activate for an individual peer-group member is invalid";
- break;
- case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
- str = "Activate the peer-group for the address family first";
- break;
- case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
- str = "Specify remote-as or peer-group remote AS first";
- break;
- case BGP_ERR_PEER_GROUP_CANT_CHANGE:
- str = "Cannot change the peer-group. Deconfigure first";
- break;
- case BGP_ERR_PEER_GROUP_MISMATCH:
- str = "Cannot have different peer-group for the neighbor";
- break;
- case BGP_ERR_PEER_FILTER_CONFLICT:
- str = "Prefix/distribute list can not co-exist";
- break;
- case BGP_ERR_NOT_INTERNAL_PEER:
- str = "Invalid command. Not an internal neighbor";
- break;
- case BGP_ERR_REMOVE_PRIVATE_AS:
- str = "Private AS cannot be removed for IBGP peers";
- break;
- case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
- str = "Local-AS allowed only for EBGP peers";
- break;
- case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
- str = "Cannot have local-as same as BGP AS number";
- break;
- case BGP_ERR_TCPSIG_FAILED:
- str = "Error while applying TCP-Sig to session(s)";
- break;
- case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
- str = "ebgp-multihop and ttl-security cannot be configured together";
- break;
- case BGP_ERR_NO_IBGP_WITH_TTLHACK:
- str = "ttl-security only allowed for EBGP peers";
- break;
- }
- if (str)
- {
- vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- /* BGP global configuration. */
- DEFUN (bgp_multiple_instance_func,
- bgp_multiple_instance_cmd,
- "bgp multiple-instance",
- BGP_STR
- "Enable bgp multiple instance\n")
- {
- bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_multiple_instance,
- no_bgp_multiple_instance_cmd,
- "no bgp multiple-instance",
- NO_STR
- BGP_STR
- "BGP multiple instance\n")
- {
- int ret;
- ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
- if (ret < 0)
- {
- vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- DEFUN (bgp_config_type,
- bgp_config_type_cmd,
- "bgp config-type (cisco|zebra)",
- BGP_STR
- "Configuration type\n"
- "cisco\n"
- "zebra\n")
- {
- if (strncmp (argv[0], "c", 1) == 0)
- bgp_option_set (BGP_OPT_CONFIG_CISCO);
- else
- bgp_option_unset (BGP_OPT_CONFIG_CISCO);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_config_type,
- no_bgp_config_type_cmd,
- "no bgp config-type",
- NO_STR
- BGP_STR
- "Display configuration type\n")
- {
- bgp_option_unset (BGP_OPT_CONFIG_CISCO);
- return CMD_SUCCESS;
- }
- DEFUN (no_synchronization,
- no_synchronization_cmd,
- "no synchronization",
- NO_STR
- "Perform IGP synchronization\n")
- {
- return CMD_SUCCESS;
- }
- DEFUN (no_auto_summary,
- no_auto_summary_cmd,
- "no auto-summary",
- NO_STR
- "Enable automatic network number summarization\n")
- {
- return CMD_SUCCESS;
- }
- DEFUN_DEPRECATED (neighbor_version,
- neighbor_version_cmd,
- NEIGHBOR_CMD "version (4|4-)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Set the BGP version to match a neighbor\n"
- "Neighbor's BGP version\n")
- {
- return CMD_SUCCESS;
- }
- /* "router bgp" commands. */
- DEFUN (router_bgp,
- router_bgp_cmd,
- "router bgp " CMD_AS_RANGE,
- ROUTER_STR
- BGP_STR
- AS_STR)
- {
- int ret;
- as_t as;
- struct bgp *bgp;
- const char *name = NULL;
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
- if (argc == 2)
- name = argv[1];
- ret = bgp_get (&bgp, &as, name);
- switch (ret)
- {
- case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
- vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- case BGP_ERR_AS_MISMATCH:
- vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
- return CMD_WARNING;
- case BGP_ERR_INSTANCE_MISMATCH:
- vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
- vty_out (vty, "BGP instance is already running; AS is %u%s",
- as, VTY_NEWLINE);
- return CMD_WARNING;
- }
- vty->node = BGP_NODE;
- vty->index = bgp;
- return CMD_SUCCESS;
- }
- ALIAS (router_bgp,
- router_bgp_view_cmd,
- "router bgp " CMD_AS_RANGE " view WORD",
- ROUTER_STR
- BGP_STR
- AS_STR
- "BGP view\n"
- "view name\n")
- /* "no router bgp" commands. */
- DEFUN (no_router_bgp,
- no_router_bgp_cmd,
- "no router bgp " CMD_AS_RANGE,
- NO_STR
- ROUTER_STR
- BGP_STR
- AS_STR)
- {
- as_t as;
- struct bgp *bgp;
- const char *name = NULL;
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
- if (argc == 2)
- name = argv[1];
- /* Lookup bgp structure. */
- bgp = bgp_lookup (as, name);
- if (! bgp)
- {
- vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_delete (bgp);
- return CMD_SUCCESS;
- }
- ALIAS (no_router_bgp,
- no_router_bgp_view_cmd,
- "no router bgp " CMD_AS_RANGE " view WORD",
- NO_STR
- ROUTER_STR
- BGP_STR
- AS_STR
- "BGP view\n"
- "view name\n")
- /* BGP router-id. */
- DEFUN (bgp_router_id,
- bgp_router_id_cmd,
- "bgp router-id A.B.C.D",
- BGP_STR
- "Override configured router identifier\n"
- "Manually configured router identifier\n")
- {
- int ret;
- struct in_addr id;
- struct bgp *bgp;
- bgp = vty->index;
- ret = inet_aton (argv[0], &id);
- if (! ret)
- {
- vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_router_id_static_set (bgp, id);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_router_id,
- no_bgp_router_id_cmd,
- "no bgp router-id",
- NO_STR
- BGP_STR
- "Override configured router identifier\n")
- {
- int ret;
- struct in_addr id;
- struct bgp *bgp;
- bgp = vty->index;
- if (argc == 1)
- {
- ret = inet_aton (argv[0], &id);
- if (! ret)
- {
- vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
- {
- vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- id.s_addr = 0;
- bgp_router_id_static_set (bgp, id);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_router_id,
- no_bgp_router_id_val_cmd,
- "no bgp router-id A.B.C.D",
- NO_STR
- BGP_STR
- "Override configured router identifier\n"
- "Manually configured router identifier\n")
- /* BGP Cluster ID. */
- DEFUN (bgp_cluster_id,
- bgp_cluster_id_cmd,
- "bgp cluster-id A.B.C.D",
- BGP_STR
- "Configure Route-Reflector Cluster-id\n"
- "Route-Reflector Cluster-id in IP address format\n")
- {
- int ret;
- struct bgp *bgp;
- struct in_addr cluster;
- bgp = vty->index;
- ret = inet_aton (argv[0], &cluster);
- if (! ret)
- {
- vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_cluster_id_set (bgp, &cluster);
- return CMD_SUCCESS;
- }
- ALIAS (bgp_cluster_id,
- bgp_cluster_id32_cmd,
- "bgp cluster-id <1-4294967295>",
- BGP_STR
- "Configure Route-Reflector Cluster-id\n"
- "Route-Reflector Cluster-id as 32 bit quantity\n")
- DEFUN (no_bgp_cluster_id,
- no_bgp_cluster_id_cmd,
- "no bgp cluster-id",
- NO_STR
- BGP_STR
- "Configure Route-Reflector Cluster-id\n")
- {
- int ret;
- struct bgp *bgp;
- struct in_addr cluster;
- bgp = vty->index;
- if (argc == 1)
- {
- ret = inet_aton (argv[0], &cluster);
- if (! ret)
- {
- vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- bgp_cluster_id_unset (bgp);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_cluster_id,
- no_bgp_cluster_id_arg_cmd,
- "no bgp cluster-id A.B.C.D",
- NO_STR
- BGP_STR
- "Configure Route-Reflector Cluster-id\n"
- "Route-Reflector Cluster-id in IP address format\n")
- DEFUN (bgp_confederation_identifier,
- bgp_confederation_identifier_cmd,
- "bgp confederation identifier " CMD_AS_RANGE,
- "BGP specific commands\n"
- "AS confederation parameters\n"
- "AS number\n"
- "Set routing domain confederation AS\n")
- {
- struct bgp *bgp;
- as_t as;
- bgp = vty->index;
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
- bgp_confederation_id_set (bgp, as);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_confederation_identifier,
- no_bgp_confederation_identifier_cmd,
- "no bgp confederation identifier",
- NO_STR
- "BGP specific commands\n"
- "AS confederation parameters\n"
- "AS number\n")
- {
- struct bgp *bgp;
- as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
- bgp = vty->index;
- if (argc == 1)
- VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
- bgp_confederation_id_unset (bgp);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_confederation_identifier,
- no_bgp_confederation_identifier_arg_cmd,
- "no bgp confederation identifier " CMD_AS_RANGE,
- NO_STR
- "BGP specific commands\n"
- "AS confederation parameters\n"
- "AS number\n"
- "Set routing domain confederation AS\n")
- DEFUN (bgp_confederation_peers,
- bgp_confederation_peers_cmd,
- "bgp confederation peers ." CMD_AS_RANGE,
- "BGP specific commands\n"
- "AS confederation parameters\n"
- "Peer ASs in BGP confederation\n"
- AS_STR)
- {
- struct bgp *bgp;
- as_t as;
- int i;
- bgp = vty->index;
- for (i = 0; i < argc; i++)
- {
- VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
- if (bgp->as == as)
- {
- vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
- VTY_NEWLINE);
- continue;
- }
- bgp_confederation_peers_add (bgp, as);
- }
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_confederation_peers,
- no_bgp_confederation_peers_cmd,
- "no bgp confederation peers ." CMD_AS_RANGE,
- NO_STR
- "BGP specific commands\n"
- "AS confederation parameters\n"
- "Peer ASs in BGP confederation\n"
- AS_STR)
- {
- struct bgp *bgp;
- as_t as;
- int i;
- bgp = vty->index;
- for (i = 0; i < argc; i++)
- {
- VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
- bgp_confederation_peers_remove (bgp, as);
- }
- return CMD_SUCCESS;
- }
- /* Maximum-paths configuration */
- DEFUN (bgp_maxpaths,
- bgp_maxpaths_cmd,
- "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
- "Forward packets over multiple paths\n"
- "Number of paths\n")
- {
- struct bgp *bgp;
- u_int16_t maxpaths;
- int ret;
- bgp = vty->index;
- VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
- ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
- BGP_PEER_EBGP, maxpaths);
- if (ret < 0)
- {
- vty_out (vty,
- "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
- maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- DEFUN (bgp_maxpaths_ibgp,
- bgp_maxpaths_ibgp_cmd,
- "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
- "Forward packets over multiple paths\n"
- "iBGP-multipath\n"
- "Number of paths\n")
- {
- struct bgp *bgp;
- u_int16_t maxpaths;
- int ret;
- bgp = vty->index;
- VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
- ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
- BGP_PEER_IBGP, maxpaths);
- if (ret < 0)
- {
- vty_out (vty,
- "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
- maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_maxpaths,
- no_bgp_maxpaths_cmd,
- "no maximum-paths",
- NO_STR
- "Forward packets over multiple paths\n"
- "Number of paths\n")
- {
- struct bgp *bgp;
- int ret;
- bgp = vty->index;
- ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
- BGP_PEER_EBGP);
- if (ret < 0)
- {
- vty_out (vty,
- "%% Failed to unset maximum-paths for afi %u, safi %u%s",
- bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_maxpaths,
- no_bgp_maxpaths_arg_cmd,
- "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
- NO_STR
- "Forward packets over multiple paths\n"
- "Number of paths\n")
- DEFUN (no_bgp_maxpaths_ibgp,
- no_bgp_maxpaths_ibgp_cmd,
- "no maximum-paths ibgp",
- NO_STR
- "Forward packets over multiple paths\n"
- "iBGP-multipath\n"
- "Number of paths\n")
- {
- struct bgp *bgp;
- int ret;
- bgp = vty->index;
- ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
- BGP_PEER_IBGP);
- if (ret < 0)
- {
- vty_out (vty,
- "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
- bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_maxpaths_ibgp,
- no_bgp_maxpaths_ibgp_arg_cmd,
- "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
- NO_STR
- "Forward packets over multiple paths\n"
- "iBGP-multipath\n"
- "Number of paths\n")
- int
- bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi, int *write)
- {
- if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
- {
- bgp_config_write_family_header (vty, afi, safi, write);
- vty_out (vty, " maximum-paths %d%s",
- bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
- }
- if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
- {
- bgp_config_write_family_header (vty, afi, safi, write);
- vty_out (vty, " maximum-paths ibgp %d%s",
- bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
- }
- return 0;
- }
- /* BGP timers. */
- DEFUN (bgp_timers,
- bgp_timers_cmd,
- "timers bgp <0-65535> <0-65535>",
- "Adjust routing timers\n"
- "BGP timers\n"
- "Keepalive interval\n"
- "Holdtime\n")
- {
- struct bgp *bgp;
- unsigned long keepalive = 0;
- unsigned long holdtime = 0;
- bgp = vty->index;
- VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
- VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
- /* Holdtime value check. */
- if (holdtime < 3 && holdtime != 0)
- {
- vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_timers_set (bgp, keepalive, holdtime);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_timers,
- no_bgp_timers_cmd,
- "no timers bgp",
- NO_STR
- "Adjust routing timers\n"
- "BGP timers\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_timers_unset (bgp);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_timers,
- no_bgp_timers_arg_cmd,
- "no timers bgp <0-65535> <0-65535>",
- NO_STR
- "Adjust routing timers\n"
- "BGP timers\n"
- "Keepalive interval\n"
- "Holdtime\n")
- DEFUN (bgp_client_to_client_reflection,
- bgp_client_to_client_reflection_cmd,
- "bgp client-to-client reflection",
- "BGP specific commands\n"
- "Configure client to client route reflection\n"
- "reflection of routes allowed\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_client_to_client_reflection,
- no_bgp_client_to_client_reflection_cmd,
- "no bgp client-to-client reflection",
- NO_STR
- "BGP specific commands\n"
- "Configure client to client route reflection\n"
- "reflection of routes allowed\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
- return CMD_SUCCESS;
- }
- /* "bgp always-compare-med" configuration. */
- DEFUN (bgp_always_compare_med,
- bgp_always_compare_med_cmd,
- "bgp always-compare-med",
- "BGP specific commands\n"
- "Allow comparing MED from different neighbors\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_always_compare_med,
- no_bgp_always_compare_med_cmd,
- "no bgp always-compare-med",
- NO_STR
- "BGP specific commands\n"
- "Allow comparing MED from different neighbors\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
- return CMD_SUCCESS;
- }
- /* "bgp deterministic-med" configuration. */
- DEFUN (bgp_deterministic_med,
- bgp_deterministic_med_cmd,
- "bgp deterministic-med",
- "BGP specific commands\n"
- "Pick the best-MED path among paths advertised from the neighboring AS\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_deterministic_med,
- no_bgp_deterministic_med_cmd,
- "no bgp deterministic-med",
- NO_STR
- "BGP specific commands\n"
- "Pick the best-MED path among paths advertised from the neighboring AS\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
- return CMD_SUCCESS;
- }
- /* "bgp graceful-restart" configuration. */
- DEFUN (bgp_graceful_restart,
- bgp_graceful_restart_cmd,
- "bgp graceful-restart",
- "BGP specific commands\n"
- "Graceful restart capability parameters\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_graceful_restart,
- no_bgp_graceful_restart_cmd,
- "no bgp graceful-restart",
- NO_STR
- "BGP specific commands\n"
- "Graceful restart capability parameters\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
- return CMD_SUCCESS;
- }
- DEFUN (bgp_graceful_restart_stalepath_time,
- bgp_graceful_restart_stalepath_time_cmd,
- "bgp graceful-restart stalepath-time <1-3600>",
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the max time to hold onto restarting peer's stale paths\n"
- "Delay value (seconds)\n")
- {
- struct bgp *bgp;
- u_int32_t stalepath;
- bgp = vty->index;
- if (! bgp)
- return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
- bgp->stalepath_time = stalepath;
- return CMD_SUCCESS;
- }
- DEFUN (bgp_graceful_restart_restart_time,
- bgp_graceful_restart_restart_time_cmd,
- "bgp graceful-restart restart-time <1-3600>",
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the time to wait to delete stale routes before a BGP open message is received\n"
- "Delay value (seconds)\n")
- {
- struct bgp *bgp;
- u_int32_t restart;
- bgp = vty->index;
- if (! bgp)
- return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
- bgp->restart_time = restart;
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_graceful_restart_stalepath_time,
- no_bgp_graceful_restart_stalepath_time_cmd,
- "no bgp graceful-restart stalepath-time",
- NO_STR
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the max time to hold onto restarting peer's stale paths\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- if (! bgp)
- return CMD_WARNING;
- bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_graceful_restart_restart_time,
- no_bgp_graceful_restart_restart_time_cmd,
- "no bgp graceful-restart restart-time",
- NO_STR
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the time to wait to delete stale routes before a BGP open message is received\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- if (! bgp)
- return CMD_WARNING;
- bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_graceful_restart_stalepath_time,
- no_bgp_graceful_restart_stalepath_time_val_cmd,
- "no bgp graceful-restart stalepath-time <1-3600>",
- NO_STR
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the max time to hold onto restarting peer's stale paths\n"
- "Delay value (seconds)\n")
- ALIAS (no_bgp_graceful_restart_restart_time,
- no_bgp_graceful_restart_restart_time_val_cmd,
- "no bgp graceful-restart restart-time <1-3600>",
- NO_STR
- "BGP specific commands\n"
- "Graceful restart capability parameters\n"
- "Set the time to wait to delete stale routes before a BGP open message is received\n"
- "Delay value (seconds)\n")
- /* "bgp fast-external-failover" configuration. */
- DEFUN (bgp_fast_external_failover,
- bgp_fast_external_failover_cmd,
- "bgp fast-external-failover",
- BGP_STR
- "Immediately reset session if a link to a directly connected external peer goes down\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_fast_external_failover,
- no_bgp_fast_external_failover_cmd,
- "no bgp fast-external-failover",
- NO_STR
- BGP_STR
- "Immediately reset session if a link to a directly connected external peer goes down\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
- return CMD_SUCCESS;
- }
- /* "bgp enforce-first-as" configuration. */
- DEFUN (bgp_enforce_first_as,
- bgp_enforce_first_as_cmd,
- "bgp enforce-first-as",
- BGP_STR
- "Enforce the first AS for EBGP routes\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_enforce_first_as,
- no_bgp_enforce_first_as_cmd,
- "no bgp enforce-first-as",
- NO_STR
- BGP_STR
- "Enforce the first AS for EBGP routes\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
- return CMD_SUCCESS;
- }
- /* "bgp bestpath compare-routerid" configuration. */
- DEFUN (bgp_bestpath_compare_router_id,
- bgp_bestpath_compare_router_id_cmd,
- "bgp bestpath compare-routerid",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "Compare router-id for identical EBGP paths\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_bestpath_compare_router_id,
- no_bgp_bestpath_compare_router_id_cmd,
- "no bgp bestpath compare-routerid",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "Compare router-id for identical EBGP paths\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
- return CMD_SUCCESS;
- }
- /* "bgp bestpath as-path ignore" configuration. */
- DEFUN (bgp_bestpath_aspath_ignore,
- bgp_bestpath_aspath_ignore_cmd,
- "bgp bestpath as-path ignore",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Ignore as-path length in selecting a route\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_bestpath_aspath_ignore,
- no_bgp_bestpath_aspath_ignore_cmd,
- "no bgp bestpath as-path ignore",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Ignore as-path length in selecting a route\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
- return CMD_SUCCESS;
- }
- /* "bgp bestpath as-path confed" configuration. */
- DEFUN (bgp_bestpath_aspath_confed,
- bgp_bestpath_aspath_confed_cmd,
- "bgp bestpath as-path confed",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Compare path lengths including confederation sets & sequences in selecting a route\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_bestpath_aspath_confed,
- no_bgp_bestpath_aspath_confed_cmd,
- "no bgp bestpath as-path confed",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Compare path lengths including confederation sets & sequences in selecting a route\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
- return CMD_SUCCESS;
- }
- /* "bgp bestpath as-path multipath-relax" configuration. */
- DEFUN (bgp_bestpath_aspath_multipath_relax,
- bgp_bestpath_aspath_multipath_relax_cmd,
- "bgp bestpath as-path multipath-relax",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Allow load sharing across routes that have different AS paths (but same length)\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_bestpath_aspath_multipath_relax,
- no_bgp_bestpath_aspath_multipath_relax_cmd,
- "no bgp bestpath as-path multipath-relax",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "AS-path attribute\n"
- "Allow load sharing across routes that have different AS paths (but same length)\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
- return CMD_SUCCESS;
- }
- /* "bgp log-neighbor-changes" configuration. */
- DEFUN (bgp_log_neighbor_changes,
- bgp_log_neighbor_changes_cmd,
- "bgp log-neighbor-changes",
- "BGP specific commands\n"
- "Log neighbor up/down and reset reason\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_log_neighbor_changes,
- no_bgp_log_neighbor_changes_cmd,
- "no bgp log-neighbor-changes",
- NO_STR
- "BGP specific commands\n"
- "Log neighbor up/down and reset reason\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
- return CMD_SUCCESS;
- }
- /* "bgp bestpath med" configuration. */
- DEFUN (bgp_bestpath_med,
- bgp_bestpath_med_cmd,
- "bgp bestpath med (confed|missing-as-worst)",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Compare MED among confederation paths\n"
- "Treat missing MED as the least preferred one\n")
- {
- struct bgp *bgp;
-
- bgp = vty->index;
- if (strncmp (argv[0], "confed", 1) == 0)
- bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
- else
- bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
- return CMD_SUCCESS;
- }
- DEFUN (bgp_bestpath_med2,
- bgp_bestpath_med2_cmd,
- "bgp bestpath med confed missing-as-worst",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Compare MED among confederation paths\n"
- "Treat missing MED as the least preferred one\n")
- {
- struct bgp *bgp;
-
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
- bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
- return CMD_SUCCESS;
- }
- ALIAS (bgp_bestpath_med2,
- bgp_bestpath_med3_cmd,
- "bgp bestpath med missing-as-worst confed",
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Treat missing MED as the least preferred one\n"
- "Compare MED among confederation paths\n")
- DEFUN (no_bgp_bestpath_med,
- no_bgp_bestpath_med_cmd,
- "no bgp bestpath med (confed|missing-as-worst)",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Compare MED among confederation paths\n"
- "Treat missing MED as the least preferred one\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
-
- if (strncmp (argv[0], "confed", 1) == 0)
- bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
- else
- bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_bestpath_med2,
- no_bgp_bestpath_med2_cmd,
- "no bgp bestpath med confed missing-as-worst",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Compare MED among confederation paths\n"
- "Treat missing MED as the least preferred one\n")
- {
- struct bgp *bgp;
-
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
- bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_bestpath_med2,
- no_bgp_bestpath_med3_cmd,
- "no bgp bestpath med missing-as-worst confed",
- NO_STR
- "BGP specific commands\n"
- "Change the default bestpath selection\n"
- "MED attribute\n"
- "Treat missing MED as the least preferred one\n"
- "Compare MED among confederation paths\n")
- /* "no bgp default ipv4-unicast". */
- DEFUN (no_bgp_default_ipv4_unicast,
- no_bgp_default_ipv4_unicast_cmd,
- "no bgp default ipv4-unicast",
- NO_STR
- "BGP specific commands\n"
- "Configure BGP defaults\n"
- "Activate ipv4-unicast for a peer by default\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
- return CMD_SUCCESS;
- }
- DEFUN (bgp_default_ipv4_unicast,
- bgp_default_ipv4_unicast_cmd,
- "bgp default ipv4-unicast",
- "BGP specific commands\n"
- "Configure BGP defaults\n"
- "Activate ipv4-unicast for a peer by default\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
- return CMD_SUCCESS;
- }
- /* "bgp import-check" configuration. */
- DEFUN (bgp_network_import_check,
- bgp_network_import_check_cmd,
- "bgp network import-check",
- "BGP specific commands\n"
- "BGP network command\n"
- "Check BGP network route exists in IGP\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_network_import_check,
- no_bgp_network_import_check_cmd,
- "no bgp network import-check",
- NO_STR
- "BGP specific commands\n"
- "BGP network command\n"
- "Check BGP network route exists in IGP\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
- return CMD_SUCCESS;
- }
- DEFUN (bgp_default_local_preference,
- bgp_default_local_preference_cmd,
- "bgp default local-preference <0-4294967295>",
- "BGP specific commands\n"
- "Configure BGP defaults\n"
- "local preference (higher=more preferred)\n"
- "Configure default local preference value\n")
- {
- struct bgp *bgp;
- u_int32_t local_pref;
- bgp = vty->index;
- VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
- bgp_default_local_preference_set (bgp, local_pref);
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_default_local_preference,
- no_bgp_default_local_preference_cmd,
- "no bgp default local-preference",
- NO_STR
- "BGP specific commands\n"
- "Configure BGP defaults\n"
- "local preference (higher=more preferred)\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- bgp_default_local_preference_unset (bgp);
- return CMD_SUCCESS;
- }
- ALIAS (no_bgp_default_local_preference,
- no_bgp_default_local_preference_val_cmd,
- "no bgp default local-preference <0-4294967295>",
- NO_STR
- "BGP specific commands\n"
- "Configure BGP defaults\n"
- "local preference (higher=more preferred)\n"
- "Configure default local preference value\n")
- static void
- peer_announce_routes_if_rmap_out (struct bgp *bgp)
- {
- struct peer *peer;
- struct listnode *node, *nnode;
- struct bgp_filter *filter;
- afi_t afi;
- safi_t safi;
- /* Reannounce all routes to appropriate neighbors */
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- for (afi = AFI_IP; afi < AFI_MAX; afi++)
- for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
- {
- if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
- {
- /* check if there's an out route-map on this client */
- filter = &peer->filter[afi][safi];
- if (ROUTE_MAP_OUT_NAME(filter))
- {
- if (BGP_DEBUG(update, UPDATE_OUT))
- zlog_debug("%s: Announcing routes again for peer %s"
- "(afi=%d, safi=%d", __func__, peer->host, afi,
- safi);
- bgp_announce_route_all(peer);
- }
- }
- }
- }
- }
- DEFUN (bgp_rr_allow_outbound_policy,
- bgp_rr_allow_outbound_policy_cmd,
- "bgp route-reflector allow-outbound-policy",
- "BGP specific commands\n"
- "Allow modifications made by out route-map\n"
- "on ibgp neighbors\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
- {
- bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
- peer_announce_routes_if_rmap_out(bgp);
- }
- return CMD_SUCCESS;
- }
- DEFUN (no_bgp_rr_allow_outbound_policy,
- no_bgp_rr_allow_outbound_policy_cmd,
- "no bgp route-reflector allow-outbound-policy",
- NO_STR
- "BGP specific commands\n"
- "Allow modifications made by out route-map\n"
- "on ibgp neighbors\n")
- {
- struct bgp *bgp;
- bgp = vty->index;
- if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
- {
- bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
- peer_announce_routes_if_rmap_out(bgp);
- }
- return CMD_SUCCESS;
- }
- static int
- peer_remote_as_vty (struct vty *vty, const char *peer_str,
- const char *as_str, afi_t afi, safi_t safi)
- {
- int ret;
- struct bgp *bgp;
- as_t as;
- union sockunion su;
- bgp = vty->index;
- /* Get AS number. */
- VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
- /* If peer is peer group, call proper function. */
- ret = str2sockunion (peer_str, &su);
- if (ret < 0)
- {
- ret = peer_group_remote_as (bgp, peer_str, &as);
- if (ret < 0)
- {
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- if (peer_address_self_check (&su))
- {
- vty_out (vty, "%% Can not configure the local system as neighbor%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- ret = peer_remote_as (bgp, &su, &as, afi, safi);
- /* This peer belongs to peer group. */
- switch (ret)
- {
- case BGP_ERR_PEER_GROUP_MEMBER:
- vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
- return CMD_WARNING;
- case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
- vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_remote_as,
- neighbor_remote_as_cmd,
- NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a BGP neighbor\n"
- AS_STR)
- {
- return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (neighbor_peer_group,
- neighbor_peer_group_cmd,
- "neighbor WORD peer-group",
- NEIGHBOR_STR
- "Neighbor tag\n"
- "Configure peer-group\n")
- {
- struct bgp *bgp;
- struct peer_group *group;
- bgp = vty->index;
- group = peer_group_get (bgp, argv[0]);
- if (! group)
- return CMD_WARNING;
- return CMD_SUCCESS;
- }
- DEFUN (no_neighbor,
- no_neighbor_cmd,
- NO_NEIGHBOR_CMD2,
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2)
- {
- int ret;
- union sockunion su;
- struct peer_group *group;
- struct peer *peer;
- ret = str2sockunion (argv[0], &su);
- if (ret < 0)
- {
- group = peer_group_lookup (vty->index, argv[0]);
- if (group)
- peer_group_delete (group);
- else
- {
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- else
- {
- peer = peer_lookup (vty->index, &su);
- if (peer)
- peer_delete (peer);
- }
- return CMD_SUCCESS;
- }
- ALIAS (no_neighbor,
- no_neighbor_remote_as_cmd,
- NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Specify a BGP neighbor\n"
- AS_STR)
- DEFUN (no_neighbor_peer_group,
- no_neighbor_peer_group_cmd,
- "no neighbor WORD peer-group",
- NO_STR
- NEIGHBOR_STR
- "Neighbor tag\n"
- "Configure peer-group\n")
- {
- struct peer_group *group;
- group = peer_group_lookup (vty->index, argv[0]);
- if (group)
- peer_group_delete (group);
- else
- {
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- DEFUN (no_neighbor_peer_group_remote_as,
- no_neighbor_peer_group_remote_as_cmd,
- "no neighbor WORD remote-as " CMD_AS_RANGE,
- NO_STR
- NEIGHBOR_STR
- "Neighbor tag\n"
- "Specify a BGP neighbor\n"
- AS_STR)
- {
- struct peer_group *group;
- group = peer_group_lookup (vty->index, argv[0]);
- if (group)
- peer_group_remote_as_delete (group);
- else
- {
- vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return CMD_SUCCESS;
- }
- DEFUN (neighbor_local_as,
- neighbor_local_as_cmd,
- NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_local_as_no_prepend,
- neighbor_local_as_no_prepend_cmd,
- NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n"
- "Do not prepend local-as to updates from ebgp peers\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_local_as_no_prepend_replace_as,
- neighbor_local_as_no_prepend_replace_as_cmd,
- NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n"
- "Do not prepend local-as to updates from ebgp peers\n"
- "Do not prepend local-as to updates from ibgp peers\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (no_neighbor_local_as,
- no_neighbor_local_as_cmd,
- NO_NEIGHBOR_CMD2 "local-as",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_local_as_unset (peer);
- return bgp_vty_return (vty, ret);
- }
- ALIAS (no_neighbor_local_as,
- no_neighbor_local_as_val_cmd,
- NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n")
- ALIAS (no_neighbor_local_as,
- no_neighbor_local_as_val2_cmd,
- NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n"
- "Do not prepend local-as to updates from ebgp peers\n")
- ALIAS (no_neighbor_local_as,
- no_neighbor_local_as_val3_cmd,
- NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify a local-as number\n"
- "AS number used as local AS\n"
- "Do not prepend local-as to updates from ebgp peers\n"
- "Do not prepend local-as to updates from ibgp peers\n")
- DEFUN (neighbor_password,
- neighbor_password_cmd,
- NEIGHBOR_CMD2 "password LINE",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Set a password\n"
- "The password\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_password_set (peer, argv[1]);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (no_neighbor_password,
- no_neighbor_password_cmd,
- NO_NEIGHBOR_CMD2 "password",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Set a password\n")
- {
- struct peer *peer;
- int ret;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_password_unset (peer);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_activate,
- neighbor_activate_cmd,
- NEIGHBOR_CMD2 "activate",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Enable the Address Family for this Neighbor\n")
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
- return CMD_SUCCESS;
- }
- DEFUN (no_neighbor_activate,
- no_neighbor_activate_cmd,
- NO_NEIGHBOR_CMD2 "activate",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Enable the Address Family for this Neighbor\n")
- {
- int ret;
- struct peer *peer;
- /* Lookup peer. */
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_set_peer_group,
- neighbor_set_peer_group_cmd,
- NEIGHBOR_CMD "peer-group WORD",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Member of the peer-group\n"
- "peer-group name\n")
- {
- int ret;
- as_t as;
- union sockunion su;
- struct bgp *bgp;
- struct peer_group *group;
- bgp = vty->index;
- ret = str2sockunion (argv[0], &su);
- if (ret < 0)
- {
- vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
- return CMD_WARNING;
- }
- group = peer_group_lookup (bgp, argv[1]);
- if (! group)
- {
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (peer_address_self_check (&su))
- {
- vty_out (vty, "%% Can not configure the local system as neighbor%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
- ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
- bgp_node_safi (vty), &as);
- if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
- {
- vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_vty_return (vty, ret);
- }
- DEFUN (no_neighbor_set_peer_group,
- no_neighbor_set_peer_group_cmd,
- NO_NEIGHBOR_CMD "peer-group WORD",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Member of the peer-group\n"
- "peer-group name\n")
- {
- int ret;
- struct bgp *bgp;
- struct peer *peer;
- struct peer_group *group;
- bgp = vty->index;
- peer = peer_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- group = peer_group_lookup (bgp, argv[1]);
- if (! group)
- {
- vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
- bgp_node_safi (vty));
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_flag_modify_vty (struct vty *vty, const char *ip_str,
- u_int16_t flag, int set)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- if (set)
- ret = peer_flag_set (peer, flag);
- else
- ret = peer_flag_unset (peer, flag);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
- {
- return peer_flag_modify_vty (vty, ip_str, flag, 1);
- }
- static int
- peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
- {
- return peer_flag_modify_vty (vty, ip_str, flag, 0);
- }
- /* neighbor passive. */
- DEFUN (neighbor_passive,
- neighbor_passive_cmd,
- NEIGHBOR_CMD2 "passive",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Don't send open messages to this neighbor\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
- }
- DEFUN (no_neighbor_passive,
- no_neighbor_passive_cmd,
- NO_NEIGHBOR_CMD2 "passive",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Don't send open messages to this neighbor\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
- }
- /* neighbor shutdown. */
- DEFUN (neighbor_shutdown,
- neighbor_shutdown_cmd,
- NEIGHBOR_CMD2 "shutdown",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Administratively shut down this neighbor\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
- }
- DEFUN (no_neighbor_shutdown,
- no_neighbor_shutdown_cmd,
- NO_NEIGHBOR_CMD2 "shutdown",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Administratively shut down this neighbor\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
- }
- /* Deprecated neighbor capability route-refresh. */
- DEFUN_DEPRECATED (neighbor_capability_route_refresh,
- neighbor_capability_route_refresh_cmd,
- NEIGHBOR_CMD2 "capability route-refresh",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise route-refresh capability to this neighbor\n")
- {
- return CMD_SUCCESS;
- }
- DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
- no_neighbor_capability_route_refresh_cmd,
- NO_NEIGHBOR_CMD2 "capability route-refresh",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise route-refresh capability to this neighbor\n")
- {
- return CMD_SUCCESS;
- }
- /* neighbor capability dynamic. */
- DEFUN (neighbor_capability_dynamic,
- neighbor_capability_dynamic_cmd,
- NEIGHBOR_CMD2 "capability dynamic",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise dynamic capability to this neighbor\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
- }
- DEFUN (no_neighbor_capability_dynamic,
- no_neighbor_capability_dynamic_cmd,
- NO_NEIGHBOR_CMD2 "capability dynamic",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise dynamic capability to this neighbor\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
- }
- /* neighbor dont-capability-negotiate */
- DEFUN (neighbor_dont_capability_negotiate,
- neighbor_dont_capability_negotiate_cmd,
- NEIGHBOR_CMD2 "dont-capability-negotiate",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Do not perform capability negotiation\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
- }
- DEFUN (no_neighbor_dont_capability_negotiate,
- no_neighbor_dont_capability_negotiate_cmd,
- NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Do not perform capability negotiation\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
- }
- static int
- peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
- safi_t safi, u_int32_t flag, int set)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, peer_str);
- if (! peer)
- return CMD_WARNING;
- if (set)
- ret = peer_af_flag_set (peer, afi, safi, flag);
- else
- ret = peer_af_flag_unset (peer, afi, safi, flag);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
- safi_t safi, u_int32_t flag)
- {
- return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
- }
- static int
- peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
- safi_t safi, u_int32_t flag)
- {
- return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
- }
- /* neighbor capability orf prefix-list. */
- DEFUN (neighbor_capability_orf_prefix,
- neighbor_capability_orf_prefix_cmd,
- NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise ORF capability to the peer\n"
- "Advertise prefixlist ORF capability to this neighbor\n"
- "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
- "Capability to RECEIVE the ORF from this neighbor\n"
- "Capability to SEND the ORF to this neighbor\n")
- {
- u_int16_t flag = 0;
- if (strncmp (argv[1], "s", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_SM;
- else if (strncmp (argv[1], "r", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_RM;
- else if (strncmp (argv[1], "b", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
- else
- return CMD_WARNING;
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flag);
- }
- DEFUN (no_neighbor_capability_orf_prefix,
- no_neighbor_capability_orf_prefix_cmd,
- NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Advertise capability to the peer\n"
- "Advertise ORF capability to the peer\n"
- "Advertise prefixlist ORF capability to this neighbor\n"
- "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
- "Capability to RECEIVE the ORF from this neighbor\n"
- "Capability to SEND the ORF to this neighbor\n")
- {
- u_int16_t flag = 0;
- if (strncmp (argv[1], "s", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_SM;
- else if (strncmp (argv[1], "r", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_RM;
- else if (strncmp (argv[1], "b", 1) == 0)
- flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
- else
- return CMD_WARNING;
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flag);
- }
- /* neighbor next-hop-self. */
- DEFUN (neighbor_nexthop_self,
- neighbor_nexthop_self_cmd,
- NEIGHBOR_CMD2 "next-hop-self {all}",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Disable the next hop calculation for this neighbor\n"
- "Apply also to ibgp-learned routes when acting as a route reflector\n")
- {
- u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
- int rc;
- /* Check if "all" is specified */
- if (argv[1] != NULL)
- flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
- else
- unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
- rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- if ( rc == CMD_SUCCESS && unset )
- rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), unset);
- return rc;
- }
- DEFUN (no_neighbor_nexthop_self,
- no_neighbor_nexthop_self_cmd,
- NO_NEIGHBOR_CMD2 "next-hop-self {all}",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Disable the next hop calculation for this neighbor\n"
- "Apply also to ibgp-learned routes when acting as a route reflector\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
- }
- /* neighbor remove-private-AS. */
- DEFUN (neighbor_remove_private_as,
- neighbor_remove_private_as_cmd,
- NEIGHBOR_CMD2 "remove-private-AS",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Remove private AS number from outbound updates\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_REMOVE_PRIVATE_AS);
- }
- DEFUN (no_neighbor_remove_private_as,
- no_neighbor_remove_private_as_cmd,
- NO_NEIGHBOR_CMD2 "remove-private-AS",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Remove private AS number from outbound updates\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_REMOVE_PRIVATE_AS);
- }
- /* neighbor send-community. */
- DEFUN (neighbor_send_community,
- neighbor_send_community_cmd,
- NEIGHBOR_CMD2 "send-community",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Send Community attribute to this neighbor\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_COMMUNITY);
- }
- DEFUN (no_neighbor_send_community,
- no_neighbor_send_community_cmd,
- NO_NEIGHBOR_CMD2 "send-community",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Send Community attribute to this neighbor\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_COMMUNITY);
- }
- /* neighbor send-community extended. */
- DEFUN (neighbor_send_community_type,
- neighbor_send_community_type_cmd,
- NEIGHBOR_CMD2 "send-community (both|all|extended|standard|large)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Send Community attribute to this neighbor\n"
- "Send Standard, Large and Extended Community attributes\n"
- "Send Standard, Large and Extended Community attributes\n"
- "Send Extended Community attributes\n"
- "Send Standard Community attributes\n"
- "Send Large Community attributes\n")
- {
- if (strncmp (argv[1], "s", 1) == 0)
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_COMMUNITY);
- if (strncmp (argv[1], "e", 1) == 0)
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_EXT_COMMUNITY);
- if (strncmp (argv[1], "l", 1) == 0)
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_LARGE_COMMUNITY);
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- (PEER_FLAG_SEND_COMMUNITY|
- PEER_FLAG_SEND_EXT_COMMUNITY|
- PEER_FLAG_SEND_LARGE_COMMUNITY));
- }
- DEFUN (no_neighbor_send_community_type,
- no_neighbor_send_community_type_cmd,
- NO_NEIGHBOR_CMD2 "send-community (both|all|extended|standard|large)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Send Community attribute to this neighbor\n"
- "Send Standard, Large and Extended Community attributes\n"
- "Send Standard, Large and Extended Community attributes\n"
- "Send Extended Community attributes\n"
- "Send Standard Community attributes\n"
- "Send Large Community attributes\n")
- {
- if (strncmp (argv[1], "s", 1) == 0)
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_COMMUNITY);
- if (strncmp (argv[1], "e", 1) == 0)
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_EXT_COMMUNITY);
- if (strncmp (argv[1], "l", 1) == 0)
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_SEND_LARGE_COMMUNITY);
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- (PEER_FLAG_SEND_COMMUNITY |
- PEER_FLAG_SEND_EXT_COMMUNITY|
- PEER_FLAG_SEND_LARGE_COMMUNITY));
- }
- /* neighbor soft-reconfig. */
- DEFUN (neighbor_soft_reconfiguration,
- neighbor_soft_reconfiguration_cmd,
- NEIGHBOR_CMD2 "soft-reconfiguration inbound",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Per neighbor soft reconfiguration\n"
- "Allow inbound soft reconfiguration for this neighbor\n")
- {
- return peer_af_flag_set_vty (vty, argv[0],
- bgp_node_afi (vty), bgp_node_safi (vty),
- PEER_FLAG_SOFT_RECONFIG);
- }
- DEFUN (no_neighbor_soft_reconfiguration,
- no_neighbor_soft_reconfiguration_cmd,
- NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Per neighbor soft reconfiguration\n"
- "Allow inbound soft reconfiguration for this neighbor\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0],
- bgp_node_afi (vty), bgp_node_safi (vty),
- PEER_FLAG_SOFT_RECONFIG);
- }
- DEFUN (neighbor_route_reflector_client,
- neighbor_route_reflector_client_cmd,
- NEIGHBOR_CMD2 "route-reflector-client",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure a neighbor as Route Reflector client\n")
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_REFLECTOR_CLIENT);
- }
- DEFUN (no_neighbor_route_reflector_client,
- no_neighbor_route_reflector_client_cmd,
- NO_NEIGHBOR_CMD2 "route-reflector-client",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure a neighbor as Route Reflector client\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_REFLECTOR_CLIENT);
- }
- static int
- peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
- int afi, int safi)
- {
- int ret;
- struct bgp *bgp;
- struct peer *peer;
- struct peer_group *group;
- struct listnode *node, *nnode;
- struct bgp_filter *pfilter;
- struct bgp_filter *gfilter;
- int locked_and_added = 0;
- bgp = vty->index;
- peer = peer_and_group_lookup_vty (vty, peer_str);
- if ( ! peer )
- return CMD_WARNING;
- /* If it is already a RS-Client, don't do anything. */
- if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
- return CMD_SUCCESS;
- if ( ! peer_rsclient_active (peer) )
- {
- peer = peer_lock (peer); /* rsclient peer list reference */
- listnode_add_sort (bgp->rsclient, peer);
- locked_and_added = 1;
- }
- ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
- if (ret < 0)
- {
- if (locked_and_added)
- {
- listnode_delete (bgp->rsclient, peer);
- peer_unlock (peer); /* rsclient peer list reference */
- }
- return bgp_vty_return (vty, ret);
- }
- peer->rib[afi][safi] = bgp_table_init (afi, safi);
- peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
- /* RIB peer reference. Released when table is free'd in bgp_table_free. */
- peer->rib[afi][safi]->owner = peer_lock (peer);
- /* Check for existing 'network' and 'redistribute' routes. */
- bgp_check_local_routes_rsclient (peer, afi, safi);
- /* Check for routes for peers configured with 'soft-reconfiguration'. */
- bgp_soft_reconfig_rsclient (peer, afi, safi);
- if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
- {
- group = peer->group;
- gfilter = &peer->filter[afi][safi];
- for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
- {
- pfilter = &peer->filter[afi][safi];
- /* Members of a non-RS-Client group should not be RS-Clients, as that
- is checked when the become part of the peer-group */
- ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
- if (ret < 0)
- return bgp_vty_return (vty, ret);
- /* Make peer's RIB point to group's RIB. */
- peer->rib[afi][safi] = group->conf->rib[afi][safi];
- /* Import policy. */
- if (pfilter->map[RMAP_IMPORT].name)
- free (pfilter->map[RMAP_IMPORT].name);
- if (gfilter->map[RMAP_IMPORT].name)
- {
- pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
- pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
- }
- else
- {
- pfilter->map[RMAP_IMPORT].name = NULL;
- pfilter->map[RMAP_IMPORT].map =NULL;
- }
- /* Export policy. */
- if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
- {
- pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
- pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
- }
- }
- }
- return CMD_SUCCESS;
- }
- static int
- peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
- int afi, int safi)
- {
- int ret;
- struct bgp *bgp;
- struct peer *peer;
- struct peer_group *group;
- struct listnode *node, *nnode;
- bgp = vty->index;
- peer = peer_and_group_lookup_vty (vty, peer_str);
- if ( ! peer )
- return CMD_WARNING;
- /* If it is not a RS-Client, don't do anything. */
- if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
- return CMD_SUCCESS;
- if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
- {
- group = peer->group;
- for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
- {
- ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
- if (ret < 0)
- return bgp_vty_return (vty, ret);
- peer->rib[afi][safi] = NULL;
- }
- peer = group->conf;
- }
- ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
- if (ret < 0)
- return bgp_vty_return (vty, ret);
- if ( ! peer_rsclient_active (peer) )
- {
- bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
- listnode_delete (bgp->rsclient, peer);
- peer_unlock (peer); /* peer bgp rsclient reference */
- }
- bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
- return CMD_SUCCESS;
- }
- /* neighbor route-server-client. */
- DEFUN (neighbor_route_server_client,
- neighbor_route_server_client_cmd,
- NEIGHBOR_CMD2 "route-server-client",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure a neighbor as Route Server client\n")
- {
- return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
- bgp_node_safi(vty));
- }
- DEFUN (no_neighbor_route_server_client,
- no_neighbor_route_server_client_cmd,
- NO_NEIGHBOR_CMD2 "route-server-client",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure a neighbor as Route Server client\n")
- {
- return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
- bgp_node_safi(vty));
- }
- DEFUN (neighbor_nexthop_local_unchanged,
- neighbor_nexthop_local_unchanged_cmd,
- NEIGHBOR_CMD2 "nexthop-local unchanged",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure treatment of outgoing link-local nexthop attribute\n"
- "Leave link-local nexthop unchanged for this peer\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
- }
- DEFUN (no_neighbor_nexthop_local_unchanged,
- no_neighbor_nexthop_local_unchanged_cmd,
- NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Configure treatment of outgoing link-local-nexthop attribute\n"
- "Leave link-local nexthop unchanged for this peer\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
- }
- DEFUN (neighbor_attr_unchanged,
- neighbor_attr_unchanged_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- (PEER_FLAG_AS_PATH_UNCHANGED |
- PEER_FLAG_NEXTHOP_UNCHANGED |
- PEER_FLAG_MED_UNCHANGED));
- }
- DEFUN (neighbor_attr_unchanged1,
- neighbor_attr_unchanged1_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = 0;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (neighbor_attr_unchanged2,
- neighbor_attr_unchanged2_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
- if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (neighbor_attr_unchanged3,
- neighbor_attr_unchanged3_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (neighbor_attr_unchanged4,
- neighbor_attr_unchanged4_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n")
- {
- u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged5_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged6_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n")
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged7_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "Med attribute\n"
- "As-path attribute\n")
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged8_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n")
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged9_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
- ALIAS (neighbor_attr_unchanged,
- neighbor_attr_unchanged10_cmd,
- NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n")
- DEFUN (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n")
- {
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- (PEER_FLAG_AS_PATH_UNCHANGED |
- PEER_FLAG_NEXTHOP_UNCHANGED |
- PEER_FLAG_MED_UNCHANGED));
- }
- DEFUN (no_neighbor_attr_unchanged1,
- no_neighbor_attr_unchanged1_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = 0;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (no_neighbor_attr_unchanged2,
- no_neighbor_attr_unchanged2_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
- if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (no_neighbor_attr_unchanged3,
- no_neighbor_attr_unchanged3_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n")
- {
- u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "med", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- DEFUN (no_neighbor_attr_unchanged4,
- no_neighbor_attr_unchanged4_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n")
- {
- u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
- if (strncmp (argv[1], "as-path", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
- else if (strncmp (argv[1], "next-hop", 1) == 0)
- SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
- return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), flags);
- }
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged5_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Nexthop attribute\n"
- "Med attribute\n")
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged6_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "As-path attribute\n"
- "Med attribute\n"
- "Nexthop attribute\n")
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged7_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "Med attribute\n"
- "As-path attribute\n")
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged8_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Nexthop attribute\n"
- "As-path attribute\n"
- "Med attribute\n")
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged9_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "Nexthop attribute\n"
- "As-path attribute\n")
- ALIAS (no_neighbor_attr_unchanged,
- no_neighbor_attr_unchanged10_cmd,
- NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP attribute is propagated unchanged to this neighbor\n"
- "Med attribute\n"
- "As-path attribute\n"
- "Nexthop attribute\n")
- /* For old version Zebra compatibility. */
- DEFUN_DEPRECATED (neighbor_transparent_as,
- neighbor_transparent_as_cmd,
- NEIGHBOR_CMD "transparent-as",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Do not append my AS number even peer is EBGP peer\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_AS_PATH_UNCHANGED);
- }
- DEFUN_DEPRECATED (neighbor_transparent_nexthop,
- neighbor_transparent_nexthop_cmd,
- NEIGHBOR_CMD "transparent-nexthop",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Do not change nexthop even peer is EBGP peer\n")
- {
- return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty),
- PEER_FLAG_NEXTHOP_UNCHANGED);
- }
- /* EBGP multihop configuration. */
- static int
- peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
- const char *ttl_str)
- {
- struct peer *peer;
- unsigned int ttl;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- if (! ttl_str)
- ttl = TTL_MAX;
- else
- VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
- return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
- }
- static int
- peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, 0));
- }
- /* neighbor ebgp-multihop. */
- DEFUN (neighbor_ebgp_multihop,
- neighbor_ebgp_multihop_cmd,
- NEIGHBOR_CMD2 "ebgp-multihop",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Allow EBGP neighbors not on directly connected networks\n")
- {
- return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
- }
- DEFUN (neighbor_ebgp_multihop_ttl,
- neighbor_ebgp_multihop_ttl_cmd,
- NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Allow EBGP neighbors not on directly connected networks\n"
- "maximum hop count\n")
- {
- return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
- }
- DEFUN (no_neighbor_ebgp_multihop,
- no_neighbor_ebgp_multihop_cmd,
- NO_NEIGHBOR_CMD2 "ebgp-multihop",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Allow EBGP neighbors not on directly connected networks\n")
- {
- return peer_ebgp_multihop_unset_vty (vty, argv[0]);
- }
- ALIAS (no_neighbor_ebgp_multihop,
- no_neighbor_ebgp_multihop_ttl_cmd,
- NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Allow EBGP neighbors not on directly connected networks\n"
- "maximum hop count\n")
- /* disable-connected-check */
- DEFUN (neighbor_disable_connected_check,
- neighbor_disable_connected_check_cmd,
- NEIGHBOR_CMD2 "disable-connected-check",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "one-hop away EBGP peer using loopback address\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
- }
- DEFUN (no_neighbor_disable_connected_check,
- no_neighbor_disable_connected_check_cmd,
- NO_NEIGHBOR_CMD2 "disable-connected-check",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "one-hop away EBGP peer using loopback address\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
- }
- /* Enforce multihop. */
- ALIAS (neighbor_disable_connected_check,
- neighbor_enforce_multihop_cmd,
- NEIGHBOR_CMD2 "enforce-multihop",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Enforce EBGP neighbors perform multihop\n")
- /* Enforce multihop. */
- ALIAS (no_neighbor_disable_connected_check,
- no_neighbor_enforce_multihop_cmd,
- NO_NEIGHBOR_CMD2 "enforce-multihop",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Enforce EBGP neighbors perform multihop\n")
- DEFUN (neighbor_description,
- neighbor_description_cmd,
- NEIGHBOR_CMD2 "description .LINE",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Neighbor specific description\n"
- "Up to 80 characters describing this neighbor\n")
- {
- struct peer *peer;
- char *str;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- if (argc == 1)
- return CMD_SUCCESS;
- str = argv_concat(argv, argc, 1);
- peer_description_set (peer, str);
- XFREE (MTYPE_TMP, str);
- return CMD_SUCCESS;
- }
- DEFUN (no_neighbor_description,
- no_neighbor_description_cmd,
- NO_NEIGHBOR_CMD2 "description",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Neighbor specific description\n")
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- peer_description_unset (peer);
- return CMD_SUCCESS;
- }
- ALIAS (no_neighbor_description,
- no_neighbor_description_val_cmd,
- NO_NEIGHBOR_CMD2 "description .LINE",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Neighbor specific description\n"
- "Up to 80 characters describing this neighbor\n")
- /* Neighbor update-source. */
- static int
- peer_update_source_vty (struct vty *vty, const char *peer_str,
- const char *source_str)
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, peer_str);
- if (! peer)
- return CMD_WARNING;
- if (source_str)
- {
- union sockunion su;
- int ret = str2sockunion (source_str, &su);
- if (ret == 0)
- peer_update_source_addr_set (peer, &su);
- else
- peer_update_source_if_set (peer, source_str);
- }
- else
- peer_update_source_unset (peer);
- return CMD_SUCCESS;
- }
- #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
- #define BGP_UPDATE_SOURCE_HELP_STR \
- "IPv4 address\n" \
- "IPv6 address\n" \
- "Interface name (requires zebra to be running)\n"
- DEFUN (neighbor_update_source,
- neighbor_update_source_cmd,
- NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Source of routing updates\n"
- BGP_UPDATE_SOURCE_HELP_STR)
- {
- return peer_update_source_vty (vty, argv[0], argv[1]);
- }
- DEFUN (no_neighbor_update_source,
- no_neighbor_update_source_cmd,
- NO_NEIGHBOR_CMD2 "update-source",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Source of routing updates\n")
- {
- return peer_update_source_vty (vty, argv[0], NULL);
- }
- static int
- peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
- afi_t afi, safi_t safi,
- const char *rmap, int set)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, peer_str);
- if (! peer)
- return CMD_WARNING;
- if (set)
- ret = peer_default_originate_set (peer, afi, safi, rmap);
- else
- ret = peer_default_originate_unset (peer, afi, safi);
- return bgp_vty_return (vty, ret);
- }
- /* neighbor default-originate. */
- DEFUN (neighbor_default_originate,
- neighbor_default_originate_cmd,
- NEIGHBOR_CMD2 "default-originate",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Originate default route to this neighbor\n")
- {
- return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), NULL, 1);
- }
- DEFUN (neighbor_default_originate_rmap,
- neighbor_default_originate_rmap_cmd,
- NEIGHBOR_CMD2 "default-originate route-map WORD",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Originate default route to this neighbor\n"
- "Route-map to specify criteria to originate default\n"
- "route-map name\n")
- {
- return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], 1);
- }
- DEFUN (no_neighbor_default_originate,
- no_neighbor_default_originate_cmd,
- NO_NEIGHBOR_CMD2 "default-originate",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Originate default route to this neighbor\n")
- {
- return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), NULL, 0);
- }
- ALIAS (no_neighbor_default_originate,
- no_neighbor_default_originate_rmap_cmd,
- NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Originate default route to this neighbor\n"
- "Route-map to specify criteria to originate default\n"
- "route-map name\n")
- /* Set neighbor's BGP port. */
- static int
- peer_port_vty (struct vty *vty, const char *ip_str, int afi,
- const char *port_str)
- {
- struct peer *peer;
- u_int16_t port;
- struct servent *sp;
- peer = peer_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- if (! port_str)
- {
- sp = getservbyname ("bgp", "tcp");
- port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
- }
- else
- {
- VTY_GET_INTEGER("port", port, port_str);
- }
- peer_port_set (peer, port);
- return CMD_SUCCESS;
- }
- /* Set specified peer's BGP port. */
- DEFUN (neighbor_port,
- neighbor_port_cmd,
- NEIGHBOR_CMD "port <0-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Neighbor's BGP port\n"
- "TCP port number\n")
- {
- return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
- }
- DEFUN (no_neighbor_port,
- no_neighbor_port_cmd,
- NO_NEIGHBOR_CMD "port",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Neighbor's BGP port\n")
- {
- return peer_port_vty (vty, argv[0], AFI_IP, NULL);
- }
- ALIAS (no_neighbor_port,
- no_neighbor_port_val_cmd,
- NO_NEIGHBOR_CMD "port <0-65535>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Neighbor's BGP port\n"
- "TCP port number\n")
- /* neighbor weight. */
- static int
- peer_weight_set_vty (struct vty *vty, const char *ip_str,
- const char *weight_str)
- {
- struct peer *peer;
- unsigned long weight;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
- return bgp_vty_return (vty, peer_weight_set (peer, weight));
- }
- static int
- peer_weight_unset_vty (struct vty *vty, const char *ip_str)
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- return bgp_vty_return (vty, peer_weight_unset (peer));
- }
- DEFUN (neighbor_weight,
- neighbor_weight_cmd,
- NEIGHBOR_CMD2 "weight <0-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Set default weight for routes from this neighbor\n"
- "default weight\n")
- {
- return peer_weight_set_vty (vty, argv[0], argv[1]);
- }
- DEFUN (no_neighbor_weight,
- no_neighbor_weight_cmd,
- NO_NEIGHBOR_CMD2 "weight",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Set default weight for routes from this neighbor\n")
- {
- return peer_weight_unset_vty (vty, argv[0]);
- }
- ALIAS (no_neighbor_weight,
- no_neighbor_weight_val_cmd,
- NO_NEIGHBOR_CMD2 "weight <0-65535>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Set default weight for routes from this neighbor\n"
- "default weight\n")
- /* Override capability negotiation. */
- DEFUN (neighbor_override_capability,
- neighbor_override_capability_cmd,
- NEIGHBOR_CMD2 "override-capability",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Override capability negotiation result\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
- }
- DEFUN (no_neighbor_override_capability,
- no_neighbor_override_capability_cmd,
- NO_NEIGHBOR_CMD2 "override-capability",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Override capability negotiation result\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
- }
- DEFUN (neighbor_strict_capability,
- neighbor_strict_capability_cmd,
- NEIGHBOR_CMD "strict-capability-match",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Strict capability negotiation match\n")
- {
- return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
- }
- DEFUN (no_neighbor_strict_capability,
- no_neighbor_strict_capability_cmd,
- NO_NEIGHBOR_CMD "strict-capability-match",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Strict capability negotiation match\n")
- {
- return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
- }
- static int
- peer_timers_set_vty (struct vty *vty, const char *ip_str,
- const char *keep_str, const char *hold_str)
- {
- int ret;
- struct peer *peer;
- u_int32_t keepalive;
- u_int32_t holdtime;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
- VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
- ret = peer_timers_set (peer, keepalive, holdtime);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_timers_unset_vty (struct vty *vty, const char *ip_str)
- {
- int ret;
- struct peer *peer;
- peer = peer_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- ret = peer_timers_unset (peer);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_timers,
- neighbor_timers_cmd,
- NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP per neighbor timers\n"
- "Keepalive interval\n"
- "Holdtime\n")
- {
- return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
- }
- DEFUN (no_neighbor_timers,
- no_neighbor_timers_cmd,
- NO_NEIGHBOR_CMD2 "timers",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP per neighbor timers\n")
- {
- return peer_timers_unset_vty (vty, argv[0]);
- }
- static int
- peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
- const char *time_str)
- {
- struct peer *peer;
- u_int32_t connect;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
- return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
- }
- static int
- peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- return bgp_vty_return (vty, peer_timers_connect_unset (peer));
- }
- DEFUN (neighbor_timers_connect,
- neighbor_timers_connect_cmd,
- NEIGHBOR_CMD2 "timers connect <1-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP per neighbor timers\n"
- "BGP connect timer\n"
- "Connect timer\n")
- {
- return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
- }
- DEFUN (no_neighbor_timers_connect,
- no_neighbor_timers_connect_cmd,
- NO_NEIGHBOR_CMD2 "timers connect",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP per neighbor timers\n"
- "BGP connect timer\n")
- {
- return peer_timers_connect_unset_vty (vty, argv[0]);
- }
- ALIAS (no_neighbor_timers_connect,
- no_neighbor_timers_connect_val_cmd,
- NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "BGP per neighbor timers\n"
- "BGP connect timer\n"
- "Connect timer\n")
- static int
- peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
- const char *time_str, int set)
- {
- int ret;
- struct peer *peer;
- u_int32_t routeadv = 0;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- if (time_str)
- VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
- if (set)
- ret = peer_advertise_interval_set (peer, routeadv);
- else
- ret = peer_advertise_interval_unset (peer);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_advertise_interval,
- neighbor_advertise_interval_cmd,
- NEIGHBOR_CMD2 "advertisement-interval <0-600>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Minimum interval between sending BGP routing updates\n"
- "time in seconds\n")
- {
- return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
- }
- DEFUN (no_neighbor_advertise_interval,
- no_neighbor_advertise_interval_cmd,
- NO_NEIGHBOR_CMD2 "advertisement-interval",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Minimum interval between sending BGP routing updates\n")
- {
- return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
- }
- ALIAS (no_neighbor_advertise_interval,
- no_neighbor_advertise_interval_val_cmd,
- NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Minimum interval between sending BGP routing updates\n"
- "time in seconds\n")
- /* neighbor interface */
- static int
- peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
- {
- int ret;
- struct peer *peer;
- peer = peer_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- if (str)
- ret = peer_interface_set (peer, str);
- else
- ret = peer_interface_unset (peer);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_interface,
- neighbor_interface_cmd,
- NEIGHBOR_CMD "interface WORD",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Interface\n"
- "Interface name\n")
- {
- return peer_interface_vty (vty, argv[0], argv[1]);
- }
- DEFUN (no_neighbor_interface,
- no_neighbor_interface_cmd,
- NO_NEIGHBOR_CMD "interface WORD",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR
- "Interface\n"
- "Interface name\n")
- {
- return peer_interface_vty (vty, argv[0], NULL);
- }
- /* Set distribute list to the peer. */
- static int
- peer_distribute_set_vty (struct vty *vty, const char *ip_str,
- afi_t afi, safi_t safi,
- const char *name_str, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_distribute_set (peer, afi, safi, direct, name_str);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_distribute_unset (peer, afi, safi, direct);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_distribute_list,
- neighbor_distribute_list_cmd,
- NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Filter updates to/from this neighbor\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n"
- "Filter incoming updates\n"
- "Filter outgoing updates\n")
- {
- return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2]);
- }
- DEFUN (no_neighbor_distribute_list,
- no_neighbor_distribute_list_cmd,
- NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Filter updates to/from this neighbor\n"
- "IP access-list number\n"
- "IP access-list number (expanded range)\n"
- "IP Access-list name\n"
- "Filter incoming updates\n"
- "Filter outgoing updates\n")
- {
- return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[2]);
- }
- /* Set prefix list to the peer. */
- static int
- peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *name_str,
- const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
-
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_prefix_list_unset (peer, afi, safi, direct);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_prefix_list,
- neighbor_prefix_list_cmd,
- NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Filter updates to/from this neighbor\n"
- "Name of a prefix list\n"
- "Filter incoming updates\n"
- "Filter outgoing updates\n")
- {
- return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2]);
- }
- DEFUN (no_neighbor_prefix_list,
- no_neighbor_prefix_list_cmd,
- NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Filter updates to/from this neighbor\n"
- "Name of a prefix list\n"
- "Filter incoming updates\n"
- "Filter outgoing updates\n")
- {
- return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[2]);
- }
- static int
- peer_aslist_set_vty (struct vty *vty, const char *ip_str,
- afi_t afi, safi_t safi,
- const char *name_str, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_aslist_set (peer, afi, safi, direct, name_str);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
- afi_t afi, safi_t safi,
- const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = FILTER_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "i", 1) == 0)
- direct = FILTER_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = FILTER_OUT;
- ret = peer_aslist_unset (peer, afi, safi, direct);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_filter_list,
- neighbor_filter_list_cmd,
- NEIGHBOR_CMD2 "filter-list WORD (in|out)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Establish BGP filters\n"
- "AS path access-list name\n"
- "Filter incoming routes\n"
- "Filter outgoing routes\n")
- {
- return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2]);
- }
- DEFUN (no_neighbor_filter_list,
- no_neighbor_filter_list_cmd,
- NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Establish BGP filters\n"
- "AS path access-list name\n"
- "Filter incoming routes\n"
- "Filter outgoing routes\n")
- {
- return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[2]);
- }
- /* Set route-map to the peer. */
- static int
- peer_route_map_set_vty (struct vty *vty, const char *ip_str,
- afi_t afi, safi_t safi,
- const char *name_str, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = RMAP_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "in", 2) == 0)
- direct = RMAP_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = RMAP_OUT;
- else if (strncmp (direct_str, "im", 2) == 0)
- direct = RMAP_IMPORT;
- else if (strncmp (direct_str, "e", 1) == 0)
- direct = RMAP_EXPORT;
- ret = peer_route_map_set (peer, afi, safi, direct, name_str);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *direct_str)
- {
- int ret;
- struct peer *peer;
- int direct = RMAP_IN;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- /* Check filter direction. */
- if (strncmp (direct_str, "in", 2) == 0)
- direct = RMAP_IN;
- else if (strncmp (direct_str, "o", 1) == 0)
- direct = RMAP_OUT;
- else if (strncmp (direct_str, "im", 2) == 0)
- direct = RMAP_IMPORT;
- else if (strncmp (direct_str, "e", 1) == 0)
- direct = RMAP_EXPORT;
- ret = peer_route_map_unset (peer, afi, safi, direct);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_route_map,
- neighbor_route_map_cmd,
- NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Apply route map to neighbor\n"
- "Name of route map\n"
- "Apply map to incoming routes\n"
- "Apply map to outbound routes\n"
- "Apply map to routes going into a Route-Server client's table\n"
- "Apply map to routes coming from a Route-Server client")
- {
- return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2]);
- }
- DEFUN (no_neighbor_route_map,
- no_neighbor_route_map_cmd,
- NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Apply route map to neighbor\n"
- "Name of route map\n"
- "Apply map to incoming routes\n"
- "Apply map to outbound routes\n"
- "Apply map to routes going into a Route-Server client's table\n"
- "Apply map to routes coming from a Route-Server client")
- {
- return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[2]);
- }
- /* Set unsuppress-map to the peer. */
- static int
- peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *name_str)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
- return bgp_vty_return (vty, ret);
- }
- /* Unset route-map from the peer. */
- static int
- peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- ret = peer_unsuppress_map_unset (peer, afi, safi);
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_unsuppress_map,
- neighbor_unsuppress_map_cmd,
- NEIGHBOR_CMD2 "unsuppress-map WORD",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Route-map to selectively unsuppress suppressed routes\n"
- "Name of route map\n")
- {
- return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1]);
- }
- DEFUN (no_neighbor_unsuppress_map,
- no_neighbor_unsuppress_map_cmd,
- NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Route-map to selectively unsuppress suppressed routes\n"
- "Name of route map\n")
- {
- return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty));
- }
- static int
- peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi, const char *num_str,
- const char *threshold_str, int warning,
- const char *restart_str)
- {
- int ret;
- struct peer *peer;
- u_int32_t max;
- u_char threshold;
- u_int16_t restart;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- VTY_GET_INTEGER ("maximum number", max, num_str);
- if (threshold_str)
- threshold = atoi (threshold_str);
- else
- threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
- if (restart_str)
- restart = atoi (restart_str);
- else
- restart = 0;
- ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
- return bgp_vty_return (vty, ret);
- }
- static int
- peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
- safi_t safi)
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, ip_str);
- if (! peer)
- return CMD_WARNING;
- ret = peer_maximum_prefix_unset (peer, afi, safi);
- return bgp_vty_return (vty, ret);
- }
- /* Maximum number of prefix configuration. prefix count is different
- for each peer configuration. So this configuration can be set for
- each peer configuration. */
- DEFUN (neighbor_maximum_prefix,
- neighbor_maximum_prefix_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], NULL, 0,
- NULL);
- }
- DEFUN (neighbor_maximum_prefix_threshold,
- neighbor_maximum_prefix_threshold_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2], 0,
- NULL);
- }
- DEFUN (neighbor_maximum_prefix_warning,
- neighbor_maximum_prefix_warning_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Only give warning message when limit is exceeded\n")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], NULL, 1,
- NULL);
- }
- DEFUN (neighbor_maximum_prefix_threshold_warning,
- neighbor_maximum_prefix_threshold_warning_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n"
- "Only give warning message when limit is exceeded\n")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
- }
- DEFUN (neighbor_maximum_prefix_restart,
- neighbor_maximum_prefix_restart_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Restart bgp connection after limit is exceeded\n"
- "Restart interval in minutes")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
- }
- DEFUN (neighbor_maximum_prefix_threshold_restart,
- neighbor_maximum_prefix_threshold_restart_cmd,
- NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n"
- "Restart bgp connection after limit is exceeded\n"
- "Restart interval in minutes")
- {
- return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
- }
- DEFUN (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n")
- {
- return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty));
- }
-
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_val_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n")
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_threshold_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n")
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_warning_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Only give warning message when limit is exceeded\n")
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_threshold_warning_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n"
- "Only give warning message when limit is exceeded\n")
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_restart_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Restart bgp connection after limit is exceeded\n"
- "Restart interval in minutes")
- ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_threshold_restart_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Maximum number of prefix accept from this peer\n"
- "maximum no. of prefix limit\n"
- "Threshold value (%) at which to generate a warning msg\n"
- "Restart bgp connection after limit is exceeded\n"
- "Restart interval in minutes")
- /* "neighbor allowas-in" */
- DEFUN (neighbor_allowas_in,
- neighbor_allowas_in_cmd,
- NEIGHBOR_CMD2 "allowas-in",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Accept as-path with my AS present in it\n")
- {
- int ret;
- struct peer *peer;
- unsigned int allow_num;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- if (argc == 1)
- allow_num = 3;
- else
- VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
- ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
- allow_num);
- return bgp_vty_return (vty, ret);
- }
- ALIAS (neighbor_allowas_in,
- neighbor_allowas_in_arg_cmd,
- NEIGHBOR_CMD2 "allowas-in <1-10>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Accept as-path with my AS present in it\n"
- "Number of occurrences of AS number\n")
- DEFUN (no_neighbor_allowas_in,
- no_neighbor_allowas_in_cmd,
- NO_NEIGHBOR_CMD2 "allowas-in",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "allow local ASN appears in aspath attribute\n")
- {
- int ret;
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
- return bgp_vty_return (vty, ret);
- }
- DEFUN (neighbor_ttl_security,
- neighbor_ttl_security_cmd,
- NEIGHBOR_CMD2 "ttl-security hops <1-254>",
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify the maximum number of hops to the BGP peer\n")
- {
- struct peer *peer;
- int gtsm_hops;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
-
- VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
- return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
- }
- DEFUN (no_neighbor_ttl_security,
- no_neighbor_ttl_security_cmd,
- NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
- NO_STR
- NEIGHBOR_STR
- NEIGHBOR_ADDR_STR2
- "Specify the maximum number of hops to the BGP peer\n")
- {
- struct peer *peer;
- peer = peer_and_group_lookup_vty (vty, argv[0]);
- if (! peer)
- return CMD_WARNING;
- return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, 0));
- }
- /* Address family configuration. */
- DEFUN (address_family_ipv4,
- address_family_ipv4_cmd,
- "address-family ipv4",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_IPV4_NODE;
- return CMD_SUCCESS;
- }
- DEFUN (address_family_ipv4_safi,
- address_family_ipv4_safi_cmd,
- "address-family ipv4 (unicast|multicast)",
- "Enter Address Family command mode\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- vty->node = BGP_IPV4M_NODE;
- else
- vty->node = BGP_IPV4_NODE;
- return CMD_SUCCESS;
- }
- DEFUN (address_family_ipv6,
- address_family_ipv6_cmd,
- "address-family ipv6",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_IPV6_NODE;
- return CMD_SUCCESS;
- }
- DEFUN (address_family_ipv6_safi,
- address_family_ipv6_safi_cmd,
- "address-family ipv6 (unicast|multicast)",
- "Enter Address Family command mode\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- vty->node = BGP_IPV6M_NODE;
- else
- vty->node = BGP_IPV6_NODE;
- return CMD_SUCCESS;
- }
- DEFUN (address_family_vpnv4,
- address_family_vpnv4_cmd,
- "address-family vpnv4",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_VPNV4_NODE;
- return CMD_SUCCESS;
- }
- ALIAS (address_family_vpnv4,
- address_family_vpnv4_unicast_cmd,
- "address-family vpnv4 unicast",
- "Enter Address Family command mode\n"
- "Address family\n"
- "Address Family Modifier\n")
- DEFUN (address_family_vpnv6,
- address_family_vpnv6_cmd,
- "address-family vpnv6",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_VPNV6_NODE;
- return CMD_SUCCESS;
- }
- ALIAS (address_family_vpnv6,
- address_family_vpnv6_unicast_cmd,
- "address-family vpnv6 unicast",
- "Enter Address Family command mode\n"
- "Address family\n"
- "Address Family Modifier\n")
- DEFUN (address_family_encap,
- address_family_encap_cmd,
- "address-family encap",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_ENCAP_NODE;
- return CMD_SUCCESS;
- }
- ALIAS (address_family_encap,
- address_family_encapv4_cmd,
- "address-family encapv4",
- "Enter Address Family command mode\n"
- "Address family\n")
- DEFUN (address_family_encapv6,
- address_family_encapv6_cmd,
- "address-family encapv6",
- "Enter Address Family command mode\n"
- "Address family\n")
- {
- vty->node = BGP_ENCAPV6_NODE;
- return CMD_SUCCESS;
- }
- DEFUN (exit_address_family,
- exit_address_family_cmd,
- "exit-address-family",
- "Exit from Address Family configuration mode\n")
- {
- /* should match list in command.c:config_exit */
- if (vty->node == BGP_IPV4_NODE
- || vty->node == BGP_ENCAP_NODE
- || vty->node == BGP_ENCAPV6_NODE
- || vty->node == BGP_IPV4M_NODE
- || vty->node == BGP_VPNV4_NODE
- || vty->node == BGP_VPNV6_NODE
- || vty->node == BGP_IPV6_NODE
- || vty->node == BGP_IPV6M_NODE)
- vty->node = BGP_NODE;
- return CMD_SUCCESS;
- }
- /* BGP clear sort. */
- enum clear_sort
- {
- clear_all,
- clear_peer,
- clear_group,
- clear_external,
- clear_as
- };
- static void
- bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
- safi_t safi, int error)
- {
- switch (error)
- {
- case BGP_ERR_AF_UNCONFIGURED:
- vty_out (vty,
- "%%BGP: Enable %s %s address family for the neighbor %s%s",
- afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
- safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
- peer->host, VTY_NEWLINE);
- break;
- case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
- vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE);
- break;
- default:
- break;
- }
- }
- /* `clear ip bgp' functions. */
- static int
- bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
- enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
- {
- int ret;
- struct peer *peer;
- struct listnode *node, *nnode;
- /* Clear all neighbors. */
- if (sort == clear_all)
- {
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- if (stype == BGP_CLEAR_SOFT_NONE)
- ret = peer_clear (peer);
- else
- ret = peer_clear_soft (peer, afi, safi, stype);
- if (ret < 0)
- bgp_clear_vty_error (vty, peer, afi, safi, ret);
- }
- return CMD_SUCCESS;
- }
- /* Clear specified neighbors. */
- if (sort == clear_peer)
- {
- union sockunion su;
- int ret;
- /* Make sockunion for lookup. */
- ret = str2sockunion (arg, &su);
- if (ret < 0)
- {
- vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
- return CMD_WARNING;
- }
- peer = peer_lookup (bgp, &su);
- if (! peer)
- {
- vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
- return CMD_WARNING;
- }
- if (stype == BGP_CLEAR_SOFT_NONE)
- ret = peer_clear (peer);
- else
- ret = peer_clear_soft (peer, afi, safi, stype);
- if (ret < 0)
- bgp_clear_vty_error (vty, peer, afi, safi, ret);
- return CMD_SUCCESS;
- }
- /* Clear all peer-group members. */
- if (sort == clear_group)
- {
- struct peer_group *group;
- group = peer_group_lookup (bgp, arg);
- if (! group)
- {
- vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
- return CMD_WARNING;
- }
- for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
- {
- if (stype == BGP_CLEAR_SOFT_NONE)
- {
- ret = peer_clear (peer);
- continue;
- }
- if (! peer->af_group[afi][safi])
- continue;
- ret = peer_clear_soft (peer, afi, safi, stype);
- if (ret < 0)
- bgp_clear_vty_error (vty, peer, afi, safi, ret);
- }
- return CMD_SUCCESS;
- }
- if (sort == clear_external)
- {
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- if (peer->sort == BGP_PEER_IBGP)
- continue;
- if (stype == BGP_CLEAR_SOFT_NONE)
- ret = peer_clear (peer);
- else
- ret = peer_clear_soft (peer, afi, safi, stype);
- if (ret < 0)
- bgp_clear_vty_error (vty, peer, afi, safi, ret);
- }
- return CMD_SUCCESS;
- }
- if (sort == clear_as)
- {
- as_t as;
- int find = 0;
- VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
-
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- if (peer->as != as)
- continue;
- find = 1;
- if (stype == BGP_CLEAR_SOFT_NONE)
- ret = peer_clear (peer);
- else
- ret = peer_clear_soft (peer, afi, safi, stype);
- if (ret < 0)
- bgp_clear_vty_error (vty, peer, afi, safi, ret);
- }
- if (! find)
- vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
- VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- return CMD_SUCCESS;
- }
- /* Recalculate bestpath and re-advertise a prefix */
- static int
- bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str,
- afi_t afi, safi_t safi, struct prefix_rd *prd)
- {
- int ret;
- struct prefix match;
- struct bgp_node *rn;
- struct bgp_node *rm;
- struct bgp *bgp;
- struct bgp_table *table;
- struct bgp_table *rib;
- /* BGP structure lookup. */
- if (view_name)
- {
- bgp = bgp_lookup_by_name (view_name);
- if (bgp == NULL)
- {
- vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- else
- {
- bgp = bgp_get_default ();
- if (bgp == NULL)
- {
- vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- /* Check IP address argument. */
- ret = str2prefix (ip_str, &match);
- if (! ret)
- {
- vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- match.family = afi2family (afi);
- rib = bgp->rib[afi][safi];
- if (safi == SAFI_MPLS_VPN)
- {
- for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
- {
- if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
- continue;
- if ((table = rn->info) != NULL)
- {
- if ((rm = bgp_node_match (table, &match)) != NULL)
- {
- if (rm->p.prefixlen == match.prefixlen)
- {
- SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
- bgp_process (bgp, rm, afi, safi);
- }
- bgp_unlock_node (rm);
- }
- }
- }
- }
- else
- {
- if ((rn = bgp_node_match (rib, &match)) != NULL)
- {
- if (rn->p.prefixlen == match.prefixlen)
- {
- SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
- bgp_process (bgp, rn, afi, safi);
- }
- bgp_unlock_node (rn);
- }
- }
- return CMD_SUCCESS;
- }
- static int
- bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
- enum clear_sort sort, enum bgp_clear_type stype,
- const char *arg)
- {
- struct bgp *bgp;
- /* BGP structure lookup. */
- if (name)
- {
- bgp = bgp_lookup_by_name (name);
- if (bgp == NULL)
- {
- vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- else
- {
- bgp = bgp_get_default ();
- if (bgp == NULL)
- {
- vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
- }
-
- DEFUN (clear_ip_bgp_all,
- clear_ip_bgp_all_cmd,
- "clear ip bgp *",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n")
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
- return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
- }
- ALIAS (clear_ip_bgp_all,
- clear_bgp_all_cmd,
- "clear bgp *",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n")
- ALIAS (clear_ip_bgp_all,
- clear_bgp_ipv6_all_cmd,
- "clear bgp ipv6 *",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n")
- ALIAS (clear_ip_bgp_all,
- clear_ip_bgp_instance_all_cmd,
- "clear ip bgp view WORD *",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n")
- ALIAS (clear_ip_bgp_all,
- clear_bgp_instance_all_cmd,
- "clear bgp view WORD *",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n")
- DEFUN (clear_ip_bgp_peer,
- clear_ip_bgp_peer_cmd,
- "clear ip bgp (A.B.C.D|X:X::X:X)",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n")
- {
- return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer,
- clear_bgp_peer_cmd,
- "clear bgp (A.B.C.D|X:X::X:X)",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n")
- ALIAS (clear_ip_bgp_peer,
- clear_bgp_ipv6_peer_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n")
- DEFUN (clear_ip_bgp_peer_group,
- clear_ip_bgp_peer_group_cmd,
- "clear ip bgp peer-group WORD",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n")
- {
- return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_group,
- clear_bgp_peer_group_cmd,
- "clear bgp peer-group WORD",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n")
- ALIAS (clear_ip_bgp_peer_group,
- clear_bgp_ipv6_peer_group_cmd,
- "clear bgp ipv6 peer-group WORD",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n")
- DEFUN (clear_ip_bgp_external,
- clear_ip_bgp_external_cmd,
- "clear ip bgp external",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n")
- {
- return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
- }
- ALIAS (clear_ip_bgp_external,
- clear_bgp_external_cmd,
- "clear bgp external",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n")
- ALIAS (clear_ip_bgp_external,
- clear_bgp_ipv6_external_cmd,
- "clear bgp ipv6 external",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n")
- DEFUN (clear_ip_bgp_prefix,
- clear_ip_bgp_prefix_cmd,
- "clear ip bgp prefix A.B.C.D/M",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear bestpath and re-advertise\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
- {
- return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
- }
- ALIAS (clear_ip_bgp_prefix,
- clear_bgp_prefix_cmd,
- "clear bgp prefix A.B.C.D/M",
- CLEAR_STR
- BGP_STR
- "Clear bestpath and re-advertise\n"
- "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
- DEFUN (clear_ip_bgp_as,
- clear_ip_bgp_as_cmd,
- "clear ip bgp " CMD_AS_RANGE,
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n")
- {
- return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
- }
- ALIAS (clear_ip_bgp_as,
- clear_bgp_as_cmd,
- "clear bgp " CMD_AS_RANGE,
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n")
- ALIAS (clear_ip_bgp_as,
- clear_bgp_ipv6_as_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE,
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n")
- /* Outbound soft-reconfiguration */
- DEFUN (clear_ip_bgp_all_soft_out,
- clear_ip_bgp_all_soft_out_cmd,
- "clear ip bgp * soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_all_soft_out,
- clear_ip_bgp_all_out_cmd,
- "clear ip bgp * out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_ip_bgp_all_soft_out,
- clear_ip_bgp_instance_all_soft_out_cmd,
- "clear ip bgp view WORD * soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_all_ipv4_soft_out,
- clear_ip_bgp_all_ipv4_soft_out_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_all_ipv4_soft_out,
- clear_ip_bgp_all_ipv4_out_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
- clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
- "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
- clear_ip_bgp_all_vpnv4_soft_out_cmd,
- "clear ip bgp * vpnv4 unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
- clear_ip_bgp_all_vpnv4_out_cmd,
- "clear ip bgp * vpnv4 unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_all_encap_soft_out,
- clear_ip_bgp_all_encap_soft_out_cmd,
- "clear ip bgp * encap unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n"
- "Soft reconfig outbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_all_encap_soft_out,
- clear_ip_bgp_all_encap_out_cmd,
- "clear ip bgp * encap unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig outbound update\n")
- DEFUN (clear_bgp_all_soft_out,
- clear_bgp_all_soft_out_cmd,
- "clear bgp * soft out",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_bgp_all_soft_out,
- clear_bgp_instance_all_soft_out_cmd,
- "clear bgp view WORD * soft out",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_all_soft_out,
- clear_bgp_all_out_cmd,
- "clear bgp * out",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_all_soft_out,
- clear_bgp_ipv6_all_soft_out_cmd,
- "clear bgp ipv6 * soft out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_all_soft_out,
- clear_bgp_ipv6_all_out_cmd,
- "clear bgp ipv6 * out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_bgp_ipv6_safi_prefix,
- clear_bgp_ipv6_safi_prefix_cmd,
- "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Address Family Modifier\n"
- "Clear bestpath and re-advertise\n"
- "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
- else
- return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
- }
- DEFUN (clear_ip_bgp_peer_soft_out,
- clear_ip_bgp_peer_soft_out_cmd,
- "clear ip bgp A.B.C.D soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_soft_out,
- clear_ip_bgp_peer_out_cmd,
- "clear ip bgp A.B.C.D out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
- clear_ip_bgp_peer_ipv4_soft_out_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
- clear_ip_bgp_peer_ipv4_out_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
- clear_ip_bgp_peer_vpnv4_soft_out_cmd,
- "clear ip bgp A.B.C.D vpnv4 unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
- clear_ip_bgp_peer_vpnv4_out_cmd,
- "clear ip bgp A.B.C.D vpnv4 unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_peer_encap_soft_out,
- clear_ip_bgp_peer_encap_soft_out_cmd,
- "clear ip bgp A.B.C.D encap unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n"
- "Soft reconfig outbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_encap_soft_out,
- clear_ip_bgp_peer_encap_out_cmd,
- "clear ip bgp A.B.C.D encap unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig outbound update\n")
- DEFUN (clear_bgp_peer_soft_out,
- clear_bgp_peer_soft_out_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) soft out",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_bgp_peer_soft_out,
- clear_bgp_ipv6_peer_soft_out_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_peer_soft_out,
- clear_bgp_peer_out_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) out",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_peer_soft_out,
- clear_bgp_ipv6_peer_out_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_peer_group_soft_out,
- clear_ip_bgp_peer_group_soft_out_cmd,
- "clear ip bgp peer-group WORD soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_group_soft_out,
- clear_ip_bgp_peer_group_out_cmd,
- "clear ip bgp peer-group WORD out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
- clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
- clear_ip_bgp_peer_group_ipv4_out_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_bgp_peer_group_soft_out,
- clear_bgp_peer_group_soft_out_cmd,
- "clear bgp peer-group WORD soft out",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_bgp_peer_group_soft_out,
- clear_bgp_ipv6_peer_group_soft_out_cmd,
- "clear bgp ipv6 peer-group WORD soft out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_peer_group_soft_out,
- clear_bgp_peer_group_out_cmd,
- "clear bgp peer-group WORD out",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_peer_group_soft_out,
- clear_bgp_ipv6_peer_group_out_cmd,
- "clear bgp ipv6 peer-group WORD out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_external_soft_out,
- clear_ip_bgp_external_soft_out_cmd,
- "clear ip bgp external soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_external_soft_out,
- clear_ip_bgp_external_out_cmd,
- "clear ip bgp external out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_external_ipv4_soft_out,
- clear_ip_bgp_external_ipv4_soft_out_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
- BGP_CLEAR_SOFT_OUT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_ip_bgp_external_ipv4_soft_out,
- clear_ip_bgp_external_ipv4_out_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_bgp_external_soft_out,
- clear_bgp_external_soft_out_cmd,
- "clear bgp external soft out",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_OUT, NULL);
- }
- ALIAS (clear_bgp_external_soft_out,
- clear_bgp_ipv6_external_soft_out_cmd,
- "clear bgp ipv6 external soft out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_external_soft_out,
- clear_bgp_external_out_cmd,
- "clear bgp external out",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_external_soft_out,
- clear_bgp_ipv6_external_out_cmd,
- "clear bgp ipv6 external WORD out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_as_soft_out,
- clear_ip_bgp_as_soft_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_soft_out,
- clear_ip_bgp_as_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_as_ipv4_soft_out,
- clear_ip_bgp_as_ipv4_soft_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_ipv4_soft_out,
- clear_ip_bgp_as_ipv4_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
- clear_ip_bgp_as_vpnv4_soft_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
- clear_ip_bgp_as_vpnv4_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- BGP_SOFT_OUT_STR)
- DEFUN (clear_ip_bgp_as_encap_soft_out,
- clear_ip_bgp_as_encap_soft_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Soft reconfig\n"
- "Soft reconfig outbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_encap_soft_out,
- clear_ip_bgp_as_encap_out_cmd,
- "clear ip bgp " CMD_AS_RANGE " encap unicast out",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Soft reconfig outbound update\n")
- DEFUN (clear_bgp_as_soft_out,
- clear_bgp_as_soft_out_cmd,
- "clear bgp " CMD_AS_RANGE " soft out",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_OUT, argv[0]);
- }
- ALIAS (clear_bgp_as_soft_out,
- clear_bgp_ipv6_as_soft_out_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " soft out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_as_soft_out,
- clear_bgp_as_out_cmd,
- "clear bgp " CMD_AS_RANGE " out",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_OUT_STR)
- ALIAS (clear_bgp_as_soft_out,
- clear_bgp_ipv6_as_out_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " out",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_OUT_STR)
- /* Inbound soft-reconfiguration */
- DEFUN (clear_ip_bgp_all_soft_in,
- clear_ip_bgp_all_soft_in_cmd,
- "clear ip bgp * soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_all_soft_in,
- clear_ip_bgp_instance_all_soft_in_cmd,
- "clear ip bgp view WORD * soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_ip_bgp_all_soft_in,
- clear_ip_bgp_all_in_cmd,
- "clear ip bgp * in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_all_in_prefix_filter,
- clear_ip_bgp_all_in_prefix_filter_cmd,
- "clear ip bgp * in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (argc== 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- ALIAS (clear_ip_bgp_all_in_prefix_filter,
- clear_ip_bgp_instance_all_in_prefix_filter_cmd,
- "clear ip bgp view WORD * in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- DEFUN (clear_ip_bgp_all_ipv4_soft_in,
- clear_ip_bgp_all_ipv4_soft_in_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_all_ipv4_soft_in,
- clear_ip_bgp_all_ipv4_in_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
- clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
- "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
- clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
- clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
- "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
- clear_ip_bgp_all_vpnv4_soft_in_cmd,
- "clear ip bgp * vpnv4 unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
- clear_ip_bgp_all_vpnv4_in_cmd,
- "clear ip bgp * vpnv4 unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_all_encap_soft_in,
- clear_ip_bgp_all_encap_soft_in_cmd,
- "clear ip bgp * encap unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n"
- "Soft reconfig inbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_all_encap_soft_in,
- clear_ip_bgp_all_encap_in_cmd,
- "clear ip bgp * encap unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig inbound update\n")
- DEFUN (clear_bgp_all_soft_in,
- clear_bgp_all_soft_in_cmd,
- "clear bgp * soft in",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_bgp_all_soft_in,
- clear_bgp_instance_all_soft_in_cmd,
- "clear bgp view WORD * soft in",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_all_soft_in,
- clear_bgp_ipv6_all_soft_in_cmd,
- "clear bgp ipv6 * soft in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_all_soft_in,
- clear_bgp_all_in_cmd,
- "clear bgp * in",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_all_soft_in,
- clear_bgp_ipv6_all_in_cmd,
- "clear bgp ipv6 * in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_bgp_all_in_prefix_filter,
- clear_bgp_all_in_prefix_filter_cmd,
- "clear bgp * in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- ALIAS (clear_bgp_all_in_prefix_filter,
- clear_bgp_ipv6_all_in_prefix_filter_cmd,
- "clear bgp ipv6 * in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- DEFUN (clear_ip_bgp_peer_soft_in,
- clear_ip_bgp_peer_soft_in_cmd,
- "clear ip bgp A.B.C.D soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_soft_in,
- clear_ip_bgp_peer_in_cmd,
- "clear ip bgp A.B.C.D in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_IN_STR)
-
- DEFUN (clear_ip_bgp_peer_in_prefix_filter,
- clear_ip_bgp_peer_in_prefix_filter_cmd,
- "clear ip bgp A.B.C.D in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_IN_STR
- "Push out the existing ORF prefix-list\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
- clear_ip_bgp_peer_ipv4_soft_in_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
- clear_ip_bgp_peer_ipv4_in_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
- clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out the existing ORF prefix-list\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
- clear_ip_bgp_peer_vpnv4_soft_in_cmd,
- "clear ip bgp A.B.C.D vpnv4 unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
- clear_ip_bgp_peer_vpnv4_in_cmd,
- "clear ip bgp A.B.C.D vpnv4 unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_peer_encap_soft_in,
- clear_ip_bgp_peer_encap_soft_in_cmd,
- "clear ip bgp A.B.C.D encap unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n"
- "Soft reconfig inbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_encap_soft_in,
- clear_ip_bgp_peer_encap_in_cmd,
- "clear ip bgp A.B.C.D encap unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig inbound update\n")
- DEFUN (clear_bgp_peer_soft_in,
- clear_bgp_peer_soft_in_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) soft in",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_bgp_peer_soft_in,
- clear_bgp_ipv6_peer_soft_in_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_peer_soft_in,
- clear_bgp_peer_in_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) in",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_peer_soft_in,
- clear_bgp_ipv6_peer_in_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_bgp_peer_in_prefix_filter,
- clear_bgp_peer_in_prefix_filter_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_IN_STR
- "Push out the existing ORF prefix-list\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- ALIAS (clear_bgp_peer_in_prefix_filter,
- clear_bgp_ipv6_peer_in_prefix_filter_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_IN_STR
- "Push out the existing ORF prefix-list\n")
- DEFUN (clear_ip_bgp_peer_group_soft_in,
- clear_ip_bgp_peer_group_soft_in_cmd,
- "clear ip bgp peer-group WORD soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_group_soft_in,
- clear_ip_bgp_peer_group_in_cmd,
- "clear ip bgp peer-group WORD in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
- clear_ip_bgp_peer_group_in_prefix_filter_cmd,
- "clear ip bgp peer-group WORD in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
- clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
- BGP_CLEAR_SOFT_IN, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
- clear_ip_bgp_peer_group_ipv4_in_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
- clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_bgp_peer_group_soft_in,
- clear_bgp_peer_group_soft_in_cmd,
- "clear bgp peer-group WORD soft in",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_bgp_peer_group_soft_in,
- clear_bgp_ipv6_peer_group_soft_in_cmd,
- "clear bgp ipv6 peer-group WORD soft in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_peer_group_soft_in,
- clear_bgp_peer_group_in_cmd,
- "clear bgp peer-group WORD in",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_peer_group_soft_in,
- clear_bgp_ipv6_peer_group_in_cmd,
- "clear bgp ipv6 peer-group WORD in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_bgp_peer_group_in_prefix_filter,
- clear_bgp_peer_group_in_prefix_filter_cmd,
- "clear bgp peer-group WORD in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- ALIAS (clear_bgp_peer_group_in_prefix_filter,
- clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
- "clear bgp ipv6 peer-group WORD in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- DEFUN (clear_ip_bgp_external_soft_in,
- clear_ip_bgp_external_soft_in_cmd,
- "clear ip bgp external soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_external_soft_in,
- clear_ip_bgp_external_in_cmd,
- "clear ip bgp external in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_external_in_prefix_filter,
- clear_ip_bgp_external_in_prefix_filter_cmd,
- "clear ip bgp external in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- DEFUN (clear_ip_bgp_external_ipv4_soft_in,
- clear_ip_bgp_external_ipv4_soft_in_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
- BGP_CLEAR_SOFT_IN, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_ip_bgp_external_ipv4_soft_in,
- clear_ip_bgp_external_ipv4_in_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
- clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- DEFUN (clear_bgp_external_soft_in,
- clear_bgp_external_soft_in_cmd,
- "clear bgp external soft in",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN, NULL);
- }
- ALIAS (clear_bgp_external_soft_in,
- clear_bgp_ipv6_external_soft_in_cmd,
- "clear bgp ipv6 external soft in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_external_soft_in,
- clear_bgp_external_in_cmd,
- "clear bgp external in",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_external_soft_in,
- clear_bgp_ipv6_external_in_cmd,
- "clear bgp ipv6 external WORD in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_bgp_external_in_prefix_filter,
- clear_bgp_external_in_prefix_filter_cmd,
- "clear bgp external in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
- }
- ALIAS (clear_bgp_external_in_prefix_filter,
- clear_bgp_ipv6_external_in_prefix_filter_cmd,
- "clear bgp ipv6 external in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- DEFUN (clear_ip_bgp_as_soft_in,
- clear_ip_bgp_as_soft_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_soft_in,
- clear_ip_bgp_as_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_as_in_prefix_filter,
- clear_ip_bgp_as_in_prefix_filter_cmd,
- "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_ip_bgp_as_ipv4_soft_in,
- clear_ip_bgp_as_ipv4_soft_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_ipv4_soft_in,
- clear_ip_bgp_as_ipv4_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
- clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
- clear_ip_bgp_as_vpnv4_soft_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
- clear_ip_bgp_as_vpnv4_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_ip_bgp_as_encap_soft_in,
- clear_ip_bgp_as_encap_soft_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Soft reconfig\n"
- "Soft reconfig inbound update\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_ip_bgp_as_encap_soft_in,
- clear_ip_bgp_as_encap_in_cmd,
- "clear ip bgp " CMD_AS_RANGE " encap unicast in",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family modifier\n"
- "Soft reconfig inbound update\n")
- DEFUN (clear_bgp_as_soft_in,
- clear_bgp_as_soft_in_cmd,
- "clear bgp " CMD_AS_RANGE " soft in",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN, argv[0]);
- }
- ALIAS (clear_bgp_as_soft_in,
- clear_bgp_ipv6_as_soft_in_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " soft in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_STR
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_as_soft_in,
- clear_bgp_as_in_cmd,
- "clear bgp " CMD_AS_RANGE " in",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR)
- ALIAS (clear_bgp_as_soft_in,
- clear_bgp_ipv6_as_in_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " in",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR)
- DEFUN (clear_bgp_as_in_prefix_filter,
- clear_bgp_as_in_prefix_filter_cmd,
- "clear bgp " CMD_AS_RANGE " in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
- }
- ALIAS (clear_bgp_as_in_prefix_filter,
- clear_bgp_ipv6_as_in_prefix_filter_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_IN_STR
- "Push out prefix-list ORF and do inbound soft reconfig\n")
- /* Both soft-reconfiguration */
- DEFUN (clear_ip_bgp_all_soft,
- clear_ip_bgp_all_soft_cmd,
- "clear ip bgp * soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- ALIAS (clear_ip_bgp_all_soft,
- clear_ip_bgp_instance_all_soft_cmd,
- "clear ip bgp view WORD * soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR)
- DEFUN (clear_ip_bgp_all_ipv4_soft,
- clear_ip_bgp_all_ipv4_soft_cmd,
- "clear ip bgp * ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
- clear_ip_bgp_instance_all_ipv4_soft_cmd,
- "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- DEFUN (clear_ip_bgp_all_vpnv4_soft,
- clear_ip_bgp_all_vpnv4_soft_cmd,
- "clear ip bgp * vpnv4 unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_all_encap_soft,
- clear_ip_bgp_all_encap_soft_cmd,
- "clear ip bgp * encap unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_bgp_all_soft,
- clear_bgp_all_soft_cmd,
- "clear bgp * soft",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
-
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- ALIAS (clear_bgp_all_soft,
- clear_bgp_instance_all_soft_cmd,
- "clear bgp view WORD * soft",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_STR)
- ALIAS (clear_bgp_all_soft,
- clear_bgp_ipv6_all_soft_cmd,
- "clear bgp ipv6 * soft",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_STR)
- DEFUN (clear_ip_bgp_peer_soft,
- clear_ip_bgp_peer_soft_cmd,
- "clear ip bgp A.B.C.D soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_ipv4_soft,
- clear_ip_bgp_peer_ipv4_soft_cmd,
- "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_vpnv4_soft,
- clear_ip_bgp_peer_vpnv4_soft_cmd,
- "clear ip bgp A.B.C.D vpnv4 unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_encap_soft,
- clear_ip_bgp_peer_encap_soft_cmd,
- "clear ip bgp A.B.C.D encap unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_bgp_peer_soft,
- clear_bgp_peer_soft_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) soft",
- CLEAR_STR
- BGP_STR
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- ALIAS (clear_bgp_peer_soft,
- clear_bgp_ipv6_peer_soft_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_STR)
- DEFUN (clear_ip_bgp_peer_group_soft,
- clear_ip_bgp_peer_group_soft_cmd,
- "clear ip bgp peer-group WORD soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
- clear_ip_bgp_peer_group_ipv4_soft_cmd,
- "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_bgp_peer_group_soft,
- clear_bgp_peer_group_soft_cmd,
- "clear bgp peer-group WORD soft",
- CLEAR_STR
- BGP_STR
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- ALIAS (clear_bgp_peer_group_soft,
- clear_bgp_ipv6_peer_group_soft_cmd,
- "clear bgp ipv6 peer-group WORD soft",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all members of peer-group\n"
- "BGP peer-group name\n"
- BGP_SOFT_STR)
- DEFUN (clear_ip_bgp_external_soft,
- clear_ip_bgp_external_soft_cmd,
- "clear ip bgp external soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- DEFUN (clear_ip_bgp_external_ipv4_soft,
- clear_ip_bgp_external_ipv4_soft_cmd,
- "clear ip bgp external ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all external peers\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
- BGP_CLEAR_SOFT_BOTH, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- DEFUN (clear_bgp_external_soft,
- clear_bgp_external_soft_cmd,
- "clear bgp external soft",
- CLEAR_STR
- BGP_STR
- "Clear all external peers\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
- BGP_CLEAR_SOFT_BOTH, NULL);
- }
- ALIAS (clear_bgp_external_soft,
- clear_bgp_ipv6_external_soft_cmd,
- "clear bgp ipv6 external soft",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all external peers\n"
- BGP_SOFT_STR)
- DEFUN (clear_ip_bgp_as_soft,
- clear_ip_bgp_as_soft_cmd,
- "clear ip bgp " CMD_AS_RANGE " soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_as_ipv4_soft,
- clear_ip_bgp_as_ipv4_soft_cmd,
- "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_as_vpnv4_soft,
- clear_ip_bgp_as_vpnv4_soft_cmd,
- "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family Modifier\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_ip_bgp_as_encap_soft,
- clear_ip_bgp_as_encap_soft_cmd,
- "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear peers with the AS number\n"
- "Address family\n"
- "Address Family Modifier\n"
- "Soft reconfig\n")
- {
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- DEFUN (clear_bgp_as_soft,
- clear_bgp_as_soft_cmd,
- "clear bgp " CMD_AS_RANGE " soft",
- CLEAR_STR
- BGP_STR
- "Clear peers with the AS number\n"
- BGP_SOFT_STR)
- {
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
- BGP_CLEAR_SOFT_BOTH, argv[0]);
- }
- ALIAS (clear_bgp_as_soft,
- clear_bgp_ipv6_as_soft_cmd,
- "clear bgp ipv6 " CMD_AS_RANGE " soft",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear peers with the AS number\n"
- BGP_SOFT_STR)
- /* RS-client soft reconfiguration. */
- DEFUN (clear_bgp_all_rsclient,
- clear_bgp_all_rsclient_cmd,
- "clear bgp * rsclient",
- CLEAR_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_RSCLIENT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_RSCLIENT, NULL);
- }
- ALIAS (clear_bgp_all_rsclient,
- clear_bgp_ipv6_all_rsclient_cmd,
- "clear bgp ipv6 * rsclient",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- ALIAS (clear_bgp_all_rsclient,
- clear_bgp_instance_all_rsclient_cmd,
- "clear bgp view WORD * rsclient",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- ALIAS (clear_bgp_all_rsclient,
- clear_bgp_ipv6_instance_all_rsclient_cmd,
- "clear bgp ipv6 view WORD * rsclient",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- DEFUN (clear_ip_bgp_all_rsclient,
- clear_ip_bgp_all_rsclient_cmd,
- "clear ip bgp * rsclient",
- CLEAR_STR
- IP_STR
- BGP_STR
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- {
- if (argc == 1)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_RSCLIENT, NULL);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
- BGP_CLEAR_SOFT_RSCLIENT, NULL);
- }
- ALIAS (clear_ip_bgp_all_rsclient,
- clear_ip_bgp_instance_all_rsclient_cmd,
- "clear ip bgp view WORD * rsclient",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "Clear all peers\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- DEFUN (clear_bgp_peer_rsclient,
- clear_bgp_peer_rsclient_cmd,
- "clear bgp (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- BGP_STR
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- {
- if (argc == 2)
- return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
- return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
- }
- ALIAS (clear_bgp_peer_rsclient,
- clear_bgp_ipv6_peer_rsclient_cmd,
- "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- ALIAS (clear_bgp_peer_rsclient,
- clear_bgp_instance_peer_rsclient_cmd,
- "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- ALIAS (clear_bgp_peer_rsclient,
- clear_bgp_ipv6_instance_peer_rsclient_cmd,
- "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- BGP_STR
- "Address family\n"
- "BGP view\n"
- "view name\n"
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- DEFUN (clear_ip_bgp_peer_rsclient,
- clear_ip_bgp_peer_rsclient_cmd,
- "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- {
- if (argc == 2)
- return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
- return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
- BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
- }
- ALIAS (clear_ip_bgp_peer_rsclient,
- clear_ip_bgp_instance_peer_rsclient_cmd,
- "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
- CLEAR_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "view name\n"
- "BGP neighbor IP address to clear\n"
- "BGP IPv6 neighbor to clear\n"
- BGP_SOFT_RSCLIENT_RIB_STR)
- DEFUN (show_bgp_views,
- show_bgp_views_cmd,
- "show bgp views",
- SHOW_STR
- BGP_STR
- "Show the defined BGP views\n")
- {
- struct list *inst = bm->bgp;
- struct listnode *node;
- struct bgp *bgp;
- if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
- {
- vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
- for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
- vty_out (vty, "\t%s (AS%u)%s",
- bgp->name ? bgp->name : "(null)",
- bgp->as, VTY_NEWLINE);
-
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_memory,
- show_bgp_memory_cmd,
- "show bgp memory",
- SHOW_STR
- BGP_STR
- "Global BGP memory statistics\n")
- {
- char memstrbuf[MTYPE_MEMSTR_LEN];
- unsigned long count;
-
- /* RIB related usage stats */
- count = mtype_stats_alloc (MTYPE_BGP_NODE);
- vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_node)),
- VTY_NEWLINE);
-
- count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
- vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_info)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
- vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_info_extra)),
- VTY_NEWLINE);
-
- if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
- vty_out (vty, "%ld Static routes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_static)),
- VTY_NEWLINE);
-
- /* Adj-In/Out */
- if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
- vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_adj_in)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
- vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_adj_out)),
- VTY_NEWLINE);
-
- if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
- vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_nexthop_cache)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
- vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct bgp_damp_info)),
- VTY_NEWLINE);
- /* Attributes */
- count = attr_count();
- vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof(struct attr)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
- vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof(struct attr_extra)),
- VTY_NEWLINE);
-
- if ((count = attr_unknown_count()))
- vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
-
- /* AS_PATH attributes */
- count = aspath_count ();
- vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct aspath)),
- VTY_NEWLINE);
-
- count = mtype_stats_alloc (MTYPE_AS_SEG);
- vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct assegment)),
- VTY_NEWLINE);
-
- /* Other attributes */
- if ((count = community_count ()))
- vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct community)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
- vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct ecommunity)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_LCOMMUNITY)))
- vty_out (vty, "%ld BGP large-community entries, using %s of memory%s",
- count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct lcommunity)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
- vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct cluster_list)),
- VTY_NEWLINE);
-
- /* Peer related usage */
- count = mtype_stats_alloc (MTYPE_BGP_PEER);
- vty_out (vty, "%ld peers, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct peer)),
- VTY_NEWLINE);
-
- if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
- vty_out (vty, "%ld peer groups, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct peer_group)),
- VTY_NEWLINE);
-
- /* Other */
- if ((count = mtype_stats_alloc (MTYPE_HASH)))
- vty_out (vty, "%ld hash tables, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct hash)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
- vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (struct hash_backet)),
- VTY_NEWLINE);
- if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
- vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- count * sizeof (regex_t)),
- VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- /* Show BGP peer's summary information. */
- static int
- bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
- {
- struct peer *peer;
- struct listnode *node, *nnode;
- unsigned int count = 0;
- unsigned int totrcount = 0;
- unsigned int totecount = 0;
- char timebuf[BGP_UPTIME_LEN];
- int len;
- /* Header string for each address family. */
- static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
-
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- if (peer->afc[afi][safi])
- {
- if (!count)
- {
- unsigned long ents;
- char memstrbuf[MTYPE_MEMSTR_LEN];
-
- /* Usage summary and header */
- vty_out (vty,
- "BGP router identifier %s, local AS number %u%s",
- inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
- ents = bgp_table_count (bgp->rib[afi][safi]);
- vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- ents * sizeof (struct bgp_node)),
- VTY_NEWLINE);
-
- /* Peer related usage */
- ents = listcount (bgp->peer);
- vty_out (vty, "Peers %ld, using %s of memory%s",
- ents,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- ents * sizeof (struct peer)),
- VTY_NEWLINE);
-
- if ((ents = listcount (bgp->rsclient)))
- vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
- ents,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- ents * sizeof (struct peer)),
- VTY_NEWLINE);
-
- if ((ents = listcount (bgp->group)))
- vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
- mtype_memstr (memstrbuf, sizeof (memstrbuf),
- ents * sizeof (struct peer_group)),
- VTY_NEWLINE);
- if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
- vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "%s%s", header, VTY_NEWLINE);
- }
-
- count++;
- len = vty_out (vty, "%s", peer->host);
- len = 16 - len;
- if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
- else
- vty_out (vty, "%*s", len, " ");
- vty_out (vty, "4 ");
- vty_out (vty, "%5u %7d %7d %8d %4d %4d ",
- peer->as,
- peer->open_in + peer->update_in + peer->keepalive_in
- + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
- peer->open_out + peer->update_out + peer->keepalive_out
- + peer->notify_out + peer->refresh_out
- + peer->dynamic_cap_out,
- 0, 0,
- peer->sync[afi][safi]->update.count +
- peer->sync[afi][safi]->withdraw.count);
- vty_out (vty, "%8s",
- peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
- if (peer->status == Established)
- {
- vty_out (vty, " %8ld", peer->pcount[afi][safi]);
- totrcount += peer->pcount[afi][safi];
- totecount++;
- }
- else
- {
- if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
- vty_out (vty, " Idle (Admin)");
- else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
- vty_out (vty, " Idle (PfxCt)");
- else
- vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- }
- if (count)
- {
- vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
- count, VTY_NEWLINE);
- vty_out (vty, "%sTotal num. Established sessions %d%s", VTY_NEWLINE,
- totecount, VTY_NEWLINE);
- vty_out (vty, "Total num. of routes received %d%s",
- totrcount, VTY_NEWLINE);
- }
- else
- vty_out (vty, "No %s neighbor is configured%s",
- afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- static int
- bgp_show_summary_vty (struct vty *vty, const char *name,
- afi_t afi, safi_t safi)
- {
- struct bgp *bgp;
- if (name)
- {
- bgp = bgp_lookup_by_name (name);
-
- if (! bgp)
- {
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_show_summary (vty, bgp, afi, safi);
- return CMD_SUCCESS;
- }
-
- bgp = bgp_get_default ();
- if (bgp)
- bgp_show_summary (vty, bgp, afi, safi);
-
- return CMD_SUCCESS;
- }
- /* `show ip bgp summary' commands. */
- DEFUN (show_ip_bgp_summary,
- show_ip_bgp_summary_cmd,
- "show ip bgp summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_instance_summary,
- show_ip_bgp_instance_summary_cmd,
- "show ip bgp view WORD summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_ipv4_summary,
- show_ip_bgp_ipv4_summary_cmd,
- "show ip bgp ipv4 (unicast|multicast) summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_instance_ipv4_summary,
- show_ip_bgp_instance_ipv4_summary_cmd,
- "show ip bgp view WORD ipv4 (unicast|multicast) summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- else
- return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_vpnv4_all_summary,
- show_ip_bgp_vpnv4_all_summary_cmd,
- "show ip bgp vpnv4 all summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information about all VPNv4 NLRIs\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- }
- DEFUN (show_ip_bgp_vpnv4_rd_summary,
- show_ip_bgp_vpnv4_rd_summary_cmd,
- "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information for a route distinguisher\n"
- "VPN Route Distinguisher\n"
- "Summary of BGP neighbor status\n")
- {
- int ret;
- struct prefix_rd prd;
- ret = str2prefix_rd (argv[0], &prd);
- if (! ret)
- {
- vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- }
- DEFUN (show_bgp_ipv4_safi_summary,
- show_bgp_ipv4_safi_summary_cmd,
- "show bgp ipv4 (unicast|multicast) summary",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_bgp_instance_ipv4_safi_summary,
- show_bgp_instance_ipv4_safi_summary_cmd,
- "show bgp view WORD ipv4 (unicast|multicast) summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- else
- return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_bgp_ipv4_vpn_summary,
- show_bgp_ipv4_vpn_summary_cmd,
- "show bgp ipv4 vpn summary",
- SHOW_STR
- BGP_STR
- "IPv4\n"
- "Display VPN NLRI specific information\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- }
- /* `show ip bgp summary' commands. */
- DEFUN (show_bgp_ipv6_vpn_summary,
- show_bgp_ipv6_vpn_summary_cmd,
- "show bgp ipv6 vpn summary",
- SHOW_STR
- BGP_STR
- "IPv6\n"
- "Display VPN NLRI specific information\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- }
- DEFUN (show_bgp_ipv4_encap_summary,
- show_bgp_ipv4_encap_summary_cmd,
- "show bgp ipv4 encap summary",
- SHOW_STR
- BGP_STR
- "IPv4\n"
- "Display ENCAP NLRI specific information\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
- }
- DEFUN (show_bgp_ipv6_encap_summary,
- show_bgp_ipv6_encap_summary_cmd,
- "show bgp ipv6 encap summary",
- SHOW_STR
- BGP_STR
- "IPv6\n"
- "Display ENCAP NLRI specific information\n"
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- }
- DEFUN (show_bgp_instance_summary,
- show_bgp_instance_summary_cmd,
- "show bgp view WORD summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Summary of BGP neighbor status\n")
- {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_instance_ipv4_summary,
- show_bgp_instance_ipv4_summary_cmd,
- "show bgp view WORD ipv4 summary",
- SHOW_STR
- BGP_STR
- IP_STR
- "Address Family modifier\n"
- "Address Family modifier\n"
- "BGP view\n"
- "View name\n"
- "Summary of BGP neighbor status\n")
- {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_instance_ipv6_summary,
- show_bgp_instance_ipv6_summary_cmd,
- "show bgp view WORD ipv6 summary",
- SHOW_STR
- BGP_STR
- IPV6_STR
- "Address Family modifier\n"
- "Address Family modifier\n"
- "BGP view\n"
- "View name\n"
- "Summary of BGP neighbor status\n")
- {
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_ipv6_safi_summary,
- show_bgp_ipv6_safi_summary_cmd,
- "show bgp ipv6 (unicast|multicast) summary",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- }
- DEFUN (show_bgp_instance_ipv6_safi_summary,
- show_bgp_instance_ipv6_safi_summary_cmd,
- "show bgp view WORD ipv6 (unicast|multicast) summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
- return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
- }
- /* old command */
- DEFUN (show_ipv6_bgp_summary,
- show_ipv6_bgp_summary_cmd,
- "show ipv6 bgp summary",
- SHOW_STR
- IPV6_STR
- BGP_STR
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- }
- /* old command */
- DEFUN (show_ipv6_mbgp_summary,
- show_ipv6_mbgp_summary_cmd,
- "show ipv6 mbgp summary",
- SHOW_STR
- IPV6_STR
- MBGP_STR
- "Summary of BGP neighbor status\n")
- {
- return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- }
- /* variations of show bgp [...] summary */
- /* This one is for the 0-keyword variant */
- DEFUN (show_bgp_summary,
- show_bgp_summary_cmd,
- "show bgp summary",
- SHOW_STR
- BGP_STR
- "Summary of BGP neighbor status\n")
- {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- ALIAS (show_bgp_summary,
- show_bgp_ipv6_summary_cmd,
- "show bgp ipv6 summary",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Summary of BGP neighbor status\n")
- DEFUN (show_bgp_summary_1w,
- show_bgp_summary_1w_cmd,
- "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
- SHOW_STR
- BGP_STR
- IP_STR
- IP6_STR
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Summary of BGP neighbor status\n")
- {
- if (strcmp (argv[0], "ipv4") == 0) {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- if (strcmp (argv[0], "ipv6") == 0) {
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- if (strcmp (argv[0], "unicast") == 0) {
- vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- return CMD_SUCCESS;
- }
- if (strcmp (argv[0], "multicast") == 0) {
- vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- return CMD_SUCCESS;
- }
- if (strcmp (argv[0], "vpn") == 0) {
- vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- return CMD_SUCCESS;
- }
- if (strcmp (argv[0], "encap") == 0) {
- vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
- vty_out(vty, "%s", VTY_NEWLINE);
- vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
- return CMD_WARNING;
- }
- const char *
- afi_safi_print (afi_t afi, safi_t safi)
- {
- if (afi == AFI_IP && safi == SAFI_UNICAST)
- return "IPv4 Unicast";
- else if (afi == AFI_IP && safi == SAFI_MULTICAST)
- return "IPv4 Multicast";
- else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
- return "VPN-IPv4 Unicast";
- else if (afi == AFI_IP && safi == SAFI_ENCAP)
- return "ENCAP-IPv4 Unicast";
- else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
- return "IPv6 Unicast";
- else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
- return "IPv6 Multicast";
- else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
- return "VPN-IPv6 Unicast";
- else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
- return "ENCAP-IPv6 Unicast";
- else
- return "Unknown";
- }
- /* Show BGP peer's information. */
- enum show_type
- {
- show_all,
- show_peer
- };
- static void
- bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
- afi_t afi, safi_t safi,
- u_int16_t adv_smcap, u_int16_t adv_rmcap,
- u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
- {
- /* Send-Mode */
- if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
- || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
- {
- vty_out (vty, " Send-mode: ");
- if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
- vty_out (vty, "advertised");
- if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
- vty_out (vty, "%sreceived",
- CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
- ", " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Receive-Mode */
- if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
- || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
- {
- vty_out (vty, " Receive-mode: ");
- if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
- vty_out (vty, "advertised");
- if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
- vty_out (vty, "%sreceived",
- CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
- ", " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- }
- static void
- bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
- {
- struct bgp_filter *filter;
- char orf_pfx_name[BUFSIZ];
- int orf_pfx_count;
- filter = &p->filter[afi][safi];
- vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
- VTY_NEWLINE);
- if (p->af_group[afi][safi])
- vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
- if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
- vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
- {
- vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
- ORF_TYPE_PREFIX, VTY_NEWLINE);
- bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
- PEER_CAP_ORF_PREFIX_SM_ADV,
- PEER_CAP_ORF_PREFIX_RM_ADV,
- PEER_CAP_ORF_PREFIX_SM_RCV,
- PEER_CAP_ORF_PREFIX_RM_RCV);
- }
- if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
- || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
- {
- vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
- ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
- bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
- PEER_CAP_ORF_PREFIX_SM_ADV,
- PEER_CAP_ORF_PREFIX_RM_ADV,
- PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
- PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
- }
- sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
- orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
- || orf_pfx_count)
- {
- vty_out (vty, " Outbound Route Filter (ORF):");
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
- vty_out (vty, " sent;");
- if (orf_pfx_count)
- vty_out (vty, " received (%d entries)", orf_pfx_count);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
- vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
- vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
- vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
- vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
- vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
- vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
- vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
- vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
- vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
- || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
- || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
- {
- vty_out (vty, " Community attribute sent to this neighbor");
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
- && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
- && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
- vty_out (vty, "(all)%s", VTY_NEWLINE);
- else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
- vty_out (vty, "(extended)%s", VTY_NEWLINE);
- else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
- vty_out (vty, "(large)%s", VTY_NEWLINE);
- else
- vty_out (vty, "(standard)%s", VTY_NEWLINE);
- }
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
- {
- vty_out (vty, " Default information originate,");
- if (p->default_rmap[afi][safi].name)
- vty_out (vty, " default route-map %s%s,",
- p->default_rmap[afi][safi].map ? "*" : "",
- p->default_rmap[afi][safi].name);
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
- vty_out (vty, " default sent%s", VTY_NEWLINE);
- else
- vty_out (vty, " default not sent%s", VTY_NEWLINE);
- }
- if (filter->plist[FILTER_IN].name
- || filter->dlist[FILTER_IN].name
- || filter->aslist[FILTER_IN].name
- || filter->map[RMAP_IN].name)
- vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
- if (filter->plist[FILTER_OUT].name
- || filter->dlist[FILTER_OUT].name
- || filter->aslist[FILTER_OUT].name
- || filter->map[RMAP_OUT].name
- || filter->usmap.name)
- vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
- if (filter->map[RMAP_IMPORT].name)
- vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
- if (filter->map[RMAP_EXPORT].name)
- vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
- /* prefix-list */
- if (filter->plist[FILTER_IN].name)
- vty_out (vty, " Incoming update prefix filter list is %s%s%s",
- filter->plist[FILTER_IN].plist ? "*" : "",
- filter->plist[FILTER_IN].name,
- VTY_NEWLINE);
- if (filter->plist[FILTER_OUT].name)
- vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
- filter->plist[FILTER_OUT].plist ? "*" : "",
- filter->plist[FILTER_OUT].name,
- VTY_NEWLINE);
- /* distribute-list */
- if (filter->dlist[FILTER_IN].name)
- vty_out (vty, " Incoming update network filter list is %s%s%s",
- filter->dlist[FILTER_IN].alist ? "*" : "",
- filter->dlist[FILTER_IN].name,
- VTY_NEWLINE);
- if (filter->dlist[FILTER_OUT].name)
- vty_out (vty, " Outgoing update network filter list is %s%s%s",
- filter->dlist[FILTER_OUT].alist ? "*" : "",
- filter->dlist[FILTER_OUT].name,
- VTY_NEWLINE);
- /* filter-list. */
- if (filter->aslist[FILTER_IN].name)
- vty_out (vty, " Incoming update AS path filter list is %s%s%s",
- filter->aslist[FILTER_IN].aslist ? "*" : "",
- filter->aslist[FILTER_IN].name,
- VTY_NEWLINE);
- if (filter->aslist[FILTER_OUT].name)
- vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
- filter->aslist[FILTER_OUT].aslist ? "*" : "",
- filter->aslist[FILTER_OUT].name,
- VTY_NEWLINE);
- /* route-map. */
- if (filter->map[RMAP_IN].name)
- vty_out (vty, " Route map for incoming advertisements is %s%s%s",
- filter->map[RMAP_IN].map ? "*" : "",
- filter->map[RMAP_IN].name,
- VTY_NEWLINE);
- if (filter->map[RMAP_OUT].name)
- vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
- filter->map[RMAP_OUT].map ? "*" : "",
- filter->map[RMAP_OUT].name,
- VTY_NEWLINE);
- if (filter->map[RMAP_IMPORT].name)
- vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
- filter->map[RMAP_IMPORT].map ? "*" : "",
- filter->map[RMAP_IMPORT].name,
- VTY_NEWLINE);
- if (filter->map[RMAP_EXPORT].name)
- vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
- filter->map[RMAP_EXPORT].map ? "*" : "",
- filter->map[RMAP_EXPORT].name,
- VTY_NEWLINE);
- /* unsuppress-map */
- if (filter->usmap.name)
- vty_out (vty, " Route map for selective unsuppress is %s%s%s",
- filter->usmap.map ? "*" : "",
- filter->usmap.name, VTY_NEWLINE);
- /* Receive prefix count */
- vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
- /* Maximum prefix */
- if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
- {
- vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
- CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
- ? " (warning-only)" : "", VTY_NEWLINE);
- vty_out (vty, " Threshold for warning message %d%%",
- p->pmax_threshold[afi][safi]);
- if (p->pmax_restart[afi][safi])
- vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- static void
- bgp_show_peer (struct vty *vty, struct peer *p)
- {
- struct bgp *bgp;
- char buf1[BUFSIZ];
- char timebuf[BGP_UPTIME_LEN];
- afi_t afi;
- safi_t safi;
- int ttl;
- bgp = p->bgp;
- /* Configured IP address. */
- vty_out (vty, "BGP neighbor is %s, ", p->host);
- vty_out (vty, "remote AS %u, ", p->as);
- vty_out (vty, "local AS %u%s%s, ",
- p->change_local_as ? p->change_local_as : p->local_as,
- CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
- " no-prepend" : "",
- CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
- " replace-as" : "");
- vty_out (vty, "%s link%s",
- p->as == p->local_as ? "internal" : "external",
- VTY_NEWLINE);
- /* Description. */
- if (p->desc)
- vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
-
- /* Peer-group */
- if (p->group)
- vty_out (vty, " Member of peer-group %s for session parameters%s",
- p->group->name, VTY_NEWLINE);
- /* Administrative shutdown. */
- if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
- vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
- /* BGP Version. */
- vty_out (vty, " BGP version 4");
- vty_out (vty, ", remote router ID %s%s",
- inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
- VTY_NEWLINE);
- /* Confederation */
- if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
- && bgp_confederation_peers_check (bgp, p->as))
- vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
-
- /* Status. */
- vty_out (vty, " BGP state = %s",
- LOOKUP (bgp_status_msg, p->status));
- if (p->status == Established)
- vty_out (vty, ", up for %8s",
- peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
- else if (p->status == Active)
- {
- if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
- vty_out (vty, " (passive)");
- else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
- vty_out (vty, " (NSF passive)");
- }
- vty_out (vty, "%s", VTY_NEWLINE);
-
- /* read timer */
- vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
- /* Configured timer values. */
- vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
- p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
- if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
- {
- vty_out (vty, " Configured hold time is %d", p->holdtime);
- vty_out (vty, ", keepalive interval is %d seconds%s",
- p->keepalive, VTY_NEWLINE);
- }
- /* Capability. */
- if (p->status == Established)
- {
- if (p->cap
- || p->afc_adv[AFI_IP][SAFI_UNICAST]
- || p->afc_recv[AFI_IP][SAFI_UNICAST]
- || p->afc_adv[AFI_IP][SAFI_MULTICAST]
- || p->afc_recv[AFI_IP][SAFI_MULTICAST]
- || p->afc_adv[AFI_IP6][SAFI_UNICAST]
- || p->afc_recv[AFI_IP6][SAFI_UNICAST]
- || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
- || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
- || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
- || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
- || p->afc_adv[AFI_IP6][SAFI_ENCAP]
- || p->afc_recv[AFI_IP6][SAFI_ENCAP]
- || p->afc_adv[AFI_IP][SAFI_ENCAP]
- || p->afc_recv[AFI_IP][SAFI_ENCAP]
- || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
- || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
- {
- vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
- /* AS4 */
- if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
- || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
- {
- vty_out (vty, " 4 Byte AS:");
- if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
- vty_out (vty, " advertised");
- if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
- vty_out (vty, " %sreceived",
- CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Dynamic */
- if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
- || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
- {
- vty_out (vty, " Dynamic:");
- if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
- vty_out (vty, " advertised");
- if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
- vty_out (vty, " %sreceived",
- CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Route Refresh */
- if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
- || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
- || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
- {
- vty_out (vty, " Route refresh:");
- if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
- vty_out (vty, " advertised");
- if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
- || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
- vty_out (vty, " %sreceived(%s)",
- CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
- (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
- && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
- "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Multiprotocol Extensions */
- for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
- {
- vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
- if (p->afc_adv[afi][safi])
- vty_out (vty, " advertised");
- if (p->afc_recv[afi][safi])
- vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Gracefull Restart */
- if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
- || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
- {
- vty_out (vty, " Graceful Restart Capabilty:");
- if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
- vty_out (vty, " advertised");
- if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
- vty_out (vty, " %sreceived",
- CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
- vty_out (vty, "%s", VTY_NEWLINE);
- if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
- {
- int restart_af_count = 0;
- vty_out (vty, " Remote Restart timer is %d seconds%s",
- p->v_gr_restart, VTY_NEWLINE);
- vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
- for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
- {
- vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
- afi_safi_print (afi, safi),
- CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
- "preserved" : "not preserved");
- restart_af_count++;
- }
- if (! restart_af_count)
- vty_out (vty, "none");
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- }
- }
- }
- /* graceful restart information */
- if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
- || p->t_gr_restart
- || p->t_gr_stale)
- {
- int eor_send_af_count = 0;
- int eor_receive_af_count = 0;
- vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
- if (p->status == Established)
- {
- vty_out (vty, " End-of-RIB send: ");
- for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
- {
- vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
- afi_safi_print (afi, safi));
- eor_send_af_count++;
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, " End-of-RIB received: ");
- for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
- {
- vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
- afi_safi_print (afi, safi));
- eor_receive_af_count++;
- }
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- if (p->t_gr_restart)
- vty_out (vty, " The remaining time of restart timer is %ld%s",
- thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
-
- if (p->t_gr_stale)
- vty_out (vty, " The remaining time of stalepath timer is %ld%s",
- thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
- }
- /* Packet counts. */
- vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
- vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
- vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
- vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
- vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
- vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
- vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
- vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
- vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
- vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
- vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
- p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
- p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
- p->dynamic_cap_in, VTY_NEWLINE);
- /* advertisement-interval */
- vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
- p->v_routeadv, VTY_NEWLINE);
- /* Update-source. */
- if (p->update_if || p->update_source)
- {
- vty_out (vty, " Update source is ");
- if (p->update_if)
- vty_out (vty, "%s", p->update_if);
- else if (p->update_source)
- vty_out (vty, "%s",
- sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- /* Default weight */
- if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
- vty_out (vty, " Default weight %d%s", p->weight,
- VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
- /* Address Family Information */
- for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- if (p->afc[afi][safi])
- bgp_show_peer_afi (vty, p, afi, safi);
- vty_out (vty, " Connections established %d; dropped %d%s",
- p->established, p->dropped,
- VTY_NEWLINE);
- if (! p->dropped)
- vty_out (vty, " Last reset never%s", VTY_NEWLINE);
- else
- vty_out (vty, " Last reset %s, due to %s%s",
- peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
- peer_down_str[(int) p->last_reset], VTY_NEWLINE);
- if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
- {
- vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
- if (p->t_pmax_restart)
- vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
- p->host, thread_timer_remain_second (p->t_pmax_restart),
- VTY_NEWLINE);
- else
- vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
- p->host, VTY_NEWLINE);
- }
- /* EBGP Multihop and GTSM */
- ttl = p->gtsm_hops;
- if (! ttl)
- ttl = peer_ttl (p);
- vty_out (vty, " %s BGP neighbor may be up to %d hops away.%s",
- p->sort == BGP_PEER_IBGP ? "Internal" : "External",
- ttl, VTY_NEWLINE);
- /* Local address. */
- if (p->su_local)
- {
- vty_out (vty, "Local host: %s, Local port: %d%s",
- sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
- ntohs (p->su_local->sin.sin_port),
- VTY_NEWLINE);
- }
-
- /* Remote address. */
- if (p->su_remote)
- {
- vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
- sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
- ntohs (p->su_remote->sin.sin_port),
- VTY_NEWLINE);
- }
- /* Nexthop display. */
- if (p->su_local)
- {
- vty_out (vty, "Nexthop: %s%s",
- inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
- VTY_NEWLINE);
- vty_out (vty, "Nexthop global: %s%s",
- inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
- VTY_NEWLINE);
- vty_out (vty, "Nexthop local: %s%s",
- inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
- VTY_NEWLINE);
- vty_out (vty, "BGP connection: %s%s",
- p->shared_network ? "shared network" : "non shared network",
- VTY_NEWLINE);
- }
- /* TCP metrics. */
- if (p->status == Established && p->rtt)
- vty_out (vty, "Estimated round trip time: %d ms%s",
- p->rtt, VTY_NEWLINE);
- /* Timer information. */
- if (p->t_start)
- vty_out (vty, "Next start timer due in %ld seconds%s",
- thread_timer_remain_second (p->t_start), VTY_NEWLINE);
- if (p->t_connect)
- vty_out (vty, "Next connect timer due in %ld seconds%s",
- thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
-
- vty_out (vty, "Read thread: %s Write thread: %s%s",
- p->t_read ? "on" : "off",
- p->t_write ? "on" : "off",
- VTY_NEWLINE);
- if (p->notify.code == BGP_NOTIFY_OPEN_ERR
- && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
- bgp_capability_vty_out (vty, p);
-
- vty_out (vty, "%s", VTY_NEWLINE);
- }
- static int
- bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
- enum show_type type, union sockunion *su)
- {
- struct listnode *node, *nnode;
- struct peer *peer;
- int find = 0;
- for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
- {
- switch (type)
- {
- case show_all:
- bgp_show_peer (vty, peer);
- break;
- case show_peer:
- if (sockunion_same (&peer->su, su))
- {
- find = 1;
- bgp_show_peer (vty, peer);
- }
- break;
- }
- }
- if (type == show_peer && ! find)
- vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
-
- return CMD_SUCCESS;
- }
- static int
- bgp_show_neighbor_vty (struct vty *vty, const char *name,
- enum show_type type, const char *ip_str)
- {
- int ret;
- struct bgp *bgp;
- union sockunion su;
- if (ip_str)
- {
- ret = str2sockunion (ip_str, &su);
- if (ret < 0)
- {
- vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
- return CMD_WARNING;
- }
- }
- if (name)
- {
- bgp = bgp_lookup_by_name (name);
-
- if (! bgp)
- {
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_show_neighbor (vty, bgp, type, &su);
- return CMD_SUCCESS;
- }
- bgp = bgp_get_default ();
- if (bgp)
- bgp_show_neighbor (vty, bgp, type, &su);
- return CMD_SUCCESS;
- }
- /* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
- show_ip_bgp_neighbors_cmd,
- "show ip bgp neighbors",
- SHOW_STR
- IP_STR
- BGP_STR
- "Detailed information on TCP and BGP neighbor connections\n")
- {
- return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
- }
- ALIAS (show_ip_bgp_neighbors,
- show_ip_bgp_ipv4_neighbors_cmd,
- "show ip bgp ipv4 (unicast|multicast) neighbors",
- SHOW_STR
- IP_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- ALIAS (show_ip_bgp_neighbors,
- show_ip_bgp_vpnv4_all_neighbors_cmd,
- "show ip bgp vpnv4 all neighbors",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information about all VPNv4 NLRIs\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- ALIAS (show_ip_bgp_neighbors,
- show_ip_bgp_vpnv4_rd_neighbors_cmd,
- "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information for a route distinguisher\n"
- "VPN Route Distinguisher\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- ALIAS (show_ip_bgp_neighbors,
- show_bgp_ipv6_neighbors_cmd,
- "show bgp ipv6 neighbors",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- DEFUN (show_ip_bgp_neighbors_peer,
- show_ip_bgp_neighbors_peer_cmd,
- "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- IP_STR
- BGP_STR
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- {
- return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
- }
- ALIAS (show_ip_bgp_neighbors_peer,
- show_ip_bgp_ipv4_neighbors_peer_cmd,
- "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- IP_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- ALIAS (show_ip_bgp_neighbors_peer,
- show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
- "show ip bgp vpnv4 all neighbors A.B.C.D",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information about all VPNv4 NLRIs\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n")
- ALIAS (show_ip_bgp_neighbors_peer,
- show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
- "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
- SHOW_STR
- IP_STR
- BGP_STR
- "Display VPNv4 NLRI specific information\n"
- "Display information about all VPNv4 NLRIs\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n")
- ALIAS (show_ip_bgp_neighbors_peer,
- show_bgp_ipv6_neighbors_peer_cmd,
- "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- DEFUN (show_ip_bgp_instance_neighbors,
- show_ip_bgp_instance_neighbors_cmd,
- "show ip bgp view WORD neighbors",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- {
- return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
- }
- ALIAS (show_ip_bgp_instance_neighbors,
- show_bgp_instance_ipv6_neighbors_cmd,
- "show bgp view WORD ipv6 neighbors",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- DEFUN (show_ip_bgp_instance_neighbors_peer,
- show_ip_bgp_instance_neighbors_peer_cmd,
- "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- {
- return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
- }
- /* Show BGP's AS paths internal data. There are both `show ip bgp
- paths' and `show ip mbgp paths'. Those functions results are the
- same.*/
- DEFUN (show_ip_bgp_paths,
- show_ip_bgp_paths_cmd,
- "show ip bgp paths",
- SHOW_STR
- IP_STR
- BGP_STR
- "Path information\n")
- {
- vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
- aspath_print_all_vty (vty);
- return CMD_SUCCESS;
- }
- DEFUN (show_ip_bgp_ipv4_paths,
- show_ip_bgp_ipv4_paths_cmd,
- "show ip bgp ipv4 (unicast|multicast) paths",
- SHOW_STR
- IP_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Path information\n")
- {
- vty_out (vty, "Address Refcnt Path\r\n");
- aspath_print_all_vty (vty);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_neighbors,
- show_bgp_neighbors_cmd,
- "show bgp neighbors",
- SHOW_STR
- BGP_STR
- "Detailed information on TCP and BGP neighbor connections\n")
- {
- return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
- }
- DEFUN (show_bgp_neighbors_peer,
- show_bgp_neighbors_peer_cmd,
- "show bgp neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- BGP_STR
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- {
- return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
- }
- DEFUN (show_bgp_instance_neighbors,
- show_bgp_instance_neighbors_cmd,
- "show bgp view WORD neighbors",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Detailed information on TCP and BGP neighbor connections\n")
- {
- return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
- }
- DEFUN (show_bgp_instance_neighbors_peer,
- show_bgp_instance_neighbors_peer_cmd,
- "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
- {
- return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
- }
- ALIAS (show_bgp_instance_neighbors_peer,
- show_bgp_instance_ipv6_neighbors_peer_cmd,
- "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Detailed information on TCP and BGP neighbor connections\n"
- "Neighbor to display information about\n"
- "Neighbor to display information about\n")
-
- /* Show BGP's AS paths internal data. There are both `show ip bgp
- paths' and `show ip mbgp paths'. Those functions results are the
- same.*/
- DEFUN (show_bgp_ipv4_paths,
- show_bgp_ipv4_paths_cmd,
- "show bgp paths",
- SHOW_STR
- BGP_STR
- "Path information\n")
- {
- vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
- aspath_print_all_vty (vty);
- return CMD_SUCCESS;
- }
- #include "hash.h"
- static void
- community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
- {
- struct community *com;
- com = (struct community *) backet->data;
- vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
- community_str (com), VTY_NEWLINE);
- }
- /* Show BGP's community internal data. */
- DEFUN (show_ip_bgp_community_info,
- show_ip_bgp_community_info_cmd,
- "show ip bgp community-info",
- SHOW_STR
- IP_STR
- BGP_STR
- "List all bgp community information\n")
- {
- vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
- hash_iterate (community_hash (),
- (void (*) (struct hash_backet *, void *))
- community_show_all_iterator,
- vty);
- return CMD_SUCCESS;
- }
- static void
- lcommunity_show_all_iterator (struct hash_backet *backet, struct vty *vty)
- {
- struct lcommunity *lcom;
- lcom = (struct lcommunity *) backet->data;
- vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, lcom->refcnt,
- lcommunity_str (lcom), VTY_NEWLINE);
- }
- /* Show BGP's community internal data. */
- DEFUN (show_ip_bgp_lcommunity_info,
- show_ip_bgp_lcommunity_info_cmd,
- "show ip bgp large-community-info",
- SHOW_STR
- IP_STR
- BGP_STR
- "List all bgp large-community information\n")
- {
- vty_out (vty, "Address Refcnt Large-community%s", VTY_NEWLINE);
- hash_iterate (lcommunity_hash (),
- (void (*) (struct hash_backet *, void *))
- lcommunity_show_all_iterator,
- vty);
- return CMD_SUCCESS;
- }
- DEFUN (show_ip_bgp_attr_info,
- show_ip_bgp_attr_info_cmd,
- "show ip bgp attribute-info",
- SHOW_STR
- IP_STR
- BGP_STR
- "List all bgp attribute information\n")
- {
- attr_show_all (vty);
- return CMD_SUCCESS;
- }
- static int
- bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
- afi_t afi, safi_t safi)
- {
- char timebuf[BGP_UPTIME_LEN];
- char rmbuf[14];
- const char *rmname;
- struct peer *peer;
- struct listnode *node, *nnode;
- int len;
- int count = 0;
- if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
- {
- for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
- {
- count++;
- bgp_write_rsclient_summary (vty, peer, afi, safi);
- }
- return count;
- }
- len = vty_out (vty, "%s", rsclient->host);
- len = 16 - len;
- if (len < 1)
- vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
- else
- vty_out (vty, "%*s", len, " ");
- vty_out (vty, "4 ");
- vty_out (vty, "%10u ", rsclient->as);
- rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
- if ( rmname && strlen (rmname) > 13 )
- {
- sprintf (rmbuf, "%13s", "...");
- rmname = strncpy (rmbuf, rmname, 10);
- }
- else if (! rmname)
- rmname = "<none>";
- vty_out (vty, " %13s ", rmname);
- rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
- if ( rmname && strlen (rmname) > 13 )
- {
- sprintf (rmbuf, "%13s", "...");
- rmname = strncpy (rmbuf, rmname, 10);
- }
- else if (! rmname)
- rmname = "<none>";
- vty_out (vty, " %13s ", rmname);
- vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
- if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
- vty_out (vty, " Idle (Admin)");
- else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
- vty_out (vty, " Idle (PfxCt)");
- else
- vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
- vty_out (vty, "%s", VTY_NEWLINE);
- return 1;
- }
- static int
- bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
- afi_t afi, safi_t safi)
- {
- struct peer *peer;
- struct listnode *node, *nnode;
- int count = 0;
- /* Header string for each address family. */
- static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
- for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
- {
- if (peer->afc[afi][safi] &&
- CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
- {
- if (! count)
- {
- vty_out (vty,
- "Route Server's BGP router identifier %s%s",
- inet_ntoa (bgp->router_id), VTY_NEWLINE);
- vty_out (vty,
- "Route Server's local AS number %u%s", bgp->as,
- VTY_NEWLINE);
- vty_out (vty, "%s", VTY_NEWLINE);
- vty_out (vty, "%s%s", header, VTY_NEWLINE);
- }
- count += bgp_write_rsclient_summary (vty, peer, afi, safi);
- }
- }
- if (count)
- vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
- count, VTY_NEWLINE);
- else
- vty_out (vty, "No %s Route Server Client is configured%s",
- afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
- return CMD_SUCCESS;
- }
- static int
- bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
- afi_t afi, safi_t safi)
- {
- struct bgp *bgp;
- if (name)
- {
- bgp = bgp_lookup_by_name (name);
- if (! bgp)
- {
- vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_show_rsclient_summary (vty, bgp, afi, safi);
- return CMD_SUCCESS;
- }
- bgp = bgp_get_default ();
- if (bgp)
- bgp_show_rsclient_summary (vty, bgp, afi, safi);
- return CMD_SUCCESS;
- }
- /* 'show bgp rsclient' commands. */
- DEFUN (show_ip_bgp_rsclient_summary,
- show_ip_bgp_rsclient_summary_cmd,
- "show ip bgp rsclient summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_instance_rsclient_summary,
- show_ip_bgp_instance_rsclient_summary_cmd,
- "show ip bgp view WORD rsclient summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_ipv4_rsclient_summary,
- show_ip_bgp_ipv4_rsclient_summary_cmd,
- "show ip bgp ipv4 (unicast|multicast) rsclient summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- if (strncmp (argv[0], "m", 1) == 0)
- return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
- show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
- "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
- SHOW_STR
- IP_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- if (strncmp (argv[1], "m", 1) == 0)
- return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- }
- DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
- show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
- "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- safi_t safi;
- if (argc == 2) {
- safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
- } else {
- safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
- }
- }
- ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
- show_bgp_ipv4_safi_rsclient_summary_cmd,
- "show bgp ipv4 (unicast|multicast) rsclient summary",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- DEFUN (show_bgp_rsclient_summary,
- show_bgp_rsclient_summary_cmd,
- "show bgp rsclient summary",
- SHOW_STR
- BGP_STR
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_instance_rsclient_summary,
- show_bgp_instance_rsclient_summary_cmd,
- "show bgp view WORD rsclient summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
- vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
- vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_ipv6_rsclient_summary,
- show_bgp_ipv6_rsclient_summary_cmd,
- "show bgp ipv6 rsclient summary",
- SHOW_STR
- BGP_STR
- "Address family\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_instance_ipv6_rsclient_summary,
- show_bgp_instance_ipv6_rsclient_summary_cmd,
- "show bgp view WORD ipv6 rsclient summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "---------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
- vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
- vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-----------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
- vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
- vty_out(vty, "-------------------%s", VTY_NEWLINE);
- bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
- return CMD_SUCCESS;
- }
- DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
- show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
- "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
- SHOW_STR
- BGP_STR
- "BGP view\n"
- "View name\n"
- "Address family\n"
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- {
- safi_t safi;
- if (argc == 2) {
- safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
- } else {
- safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
- }
- }
- ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
- show_bgp_ipv6_safi_rsclient_summary_cmd,
- "show bgp ipv6 (unicast|multicast) rsclient summary",
- SHOW_STR
- BGP_STR
- IPV6_STR
- "Address Family modifier\n"
- "Address Family modifier\n"
- "Information about Route Server Clients\n"
- "Summary of all Route Server Clients\n")
- /* Redistribute VTY commands. */
- DEFUN (bgp_redistribute_ipv4,
- bgp_redistribute_ipv4_cmd,
- "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD)
- {
- int type;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_redistribute_set (vty->index, AFI_IP, type);
- }
- DEFUN (bgp_redistribute_ipv4_rmap,
- bgp_redistribute_ipv4_rmap_cmd,
- "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
- {
- int type;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
- return bgp_redistribute_set (vty->index, AFI_IP, type);
- }
- DEFUN (bgp_redistribute_ipv4_metric,
- bgp_redistribute_ipv4_metric_cmd,
- "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
- return bgp_redistribute_set (vty->index, AFI_IP, type);
- }
- DEFUN (bgp_redistribute_ipv4_rmap_metric,
- bgp_redistribute_ipv4_rmap_metric_cmd,
- "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n"
- "Metric for redistributed routes\n"
- "Default metric\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[2]);
- bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
- return bgp_redistribute_set (vty->index, AFI_IP, type);
- }
- DEFUN (bgp_redistribute_ipv4_metric_rmap,
- bgp_redistribute_ipv4_metric_rmap_cmd,
- "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
- bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
- return bgp_redistribute_set (vty->index, AFI_IP, type);
- }
- DEFUN (no_bgp_redistribute_ipv4,
- no_bgp_redistribute_ipv4_cmd,
- "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD)
- {
- int type;
- type = proto_redistnum (AFI_IP, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_redistribute_unset (vty->index, AFI_IP, type);
- }
- ALIAS (no_bgp_redistribute_ipv4,
- no_bgp_redistribute_ipv4_rmap_cmd,
- "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
- ALIAS (no_bgp_redistribute_ipv4,
- no_bgp_redistribute_ipv4_metric_cmd,
- "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n")
- ALIAS (no_bgp_redistribute_ipv4,
- no_bgp_redistribute_ipv4_rmap_metric_cmd,
- "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n"
- "Metric for redistributed routes\n"
- "Default metric\n")
- ALIAS (no_bgp_redistribute_ipv4,
- no_bgp_redistribute_ipv4_metric_rmap_cmd,
- "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
- DEFUN (bgp_redistribute_ipv6,
- bgp_redistribute_ipv6_cmd,
- "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD)
- {
- int type;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_redistribute_set (vty->index, AFI_IP6, type);
- }
- DEFUN (bgp_redistribute_ipv6_rmap,
- bgp_redistribute_ipv6_rmap_cmd,
- "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
- {
- int type;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
- return bgp_redistribute_set (vty->index, AFI_IP6, type);
- }
- DEFUN (bgp_redistribute_ipv6_metric,
- bgp_redistribute_ipv6_metric_cmd,
- "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
- return bgp_redistribute_set (vty->index, AFI_IP6, type);
- }
- DEFUN (bgp_redistribute_ipv6_rmap_metric,
- bgp_redistribute_ipv6_rmap_metric_cmd,
- "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n"
- "Metric for redistributed routes\n"
- "Default metric\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[2]);
- bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
- return bgp_redistribute_set (vty->index, AFI_IP6, type);
- }
- DEFUN (bgp_redistribute_ipv6_metric_rmap,
- bgp_redistribute_ipv6_metric_rmap_cmd,
- "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
- {
- int type;
- u_int32_t metric;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- VTY_GET_INTEGER ("metric", metric, argv[1]);
- bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
- bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
- return bgp_redistribute_set (vty->index, AFI_IP6, type);
- }
- DEFUN (no_bgp_redistribute_ipv6,
- no_bgp_redistribute_ipv6_cmd,
- "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD)
- {
- int type;
- type = proto_redistnum (AFI_IP6, argv[0]);
- if (type < 0 || type == ZEBRA_ROUTE_BGP)
- {
- vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
- return bgp_redistribute_unset (vty->index, AFI_IP6, type);
- }
- ALIAS (no_bgp_redistribute_ipv6,
- no_bgp_redistribute_ipv6_rmap_cmd,
- "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
- ALIAS (no_bgp_redistribute_ipv6,
- no_bgp_redistribute_ipv6_metric_cmd,
- "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n")
- ALIAS (no_bgp_redistribute_ipv6,
- no_bgp_redistribute_ipv6_rmap_metric_cmd,
- "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Route map reference\n"
- "Pointer to route-map entries\n"
- "Metric for redistributed routes\n"
- "Default metric\n")
- ALIAS (no_bgp_redistribute_ipv6,
- no_bgp_redistribute_ipv6_metric_rmap_cmd,
- "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
- NO_STR
- "Redistribute information from another routing protocol\n"
- QUAGGA_IP6_REDIST_HELP_STR_BGPD
- "Metric for redistributed routes\n"
- "Default metric\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
- int
- bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
- safi_t safi, int *write)
- {
- int i;
- /* Unica
|