bgp_vty.c 345 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131
  1. /* BGP VTY interface.
  2. Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
  3. This file is part of GNU Zebra.
  4. GNU Zebra is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. GNU Zebra is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Zebra; see the file COPYING. If not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. 02111-1307, USA. */
  16. #include <zebra.h>
  17. #include "command.h"
  18. #include "prefix.h"
  19. #include "plist.h"
  20. #include "buffer.h"
  21. #include "linklist.h"
  22. #include "stream.h"
  23. #include "thread.h"
  24. #include "log.h"
  25. #include "memory.h"
  26. #include "hash.h"
  27. #include "filter.h"
  28. #include "bgpd/bgpd.h"
  29. #include "bgpd/bgp_advertise.h"
  30. #include "bgpd/bgp_attr.h"
  31. #include "bgpd/bgp_aspath.h"
  32. #include "bgpd/bgp_community.h"
  33. #include "bgpd/bgp_ecommunity.h"
  34. #include "bgpd/bgp_damp.h"
  35. #include "bgpd/bgp_debug.h"
  36. #include "bgpd/bgp_fsm.h"
  37. #include "bgpd/bgp_mplsvpn.h"
  38. #include "bgpd/bgp_nexthop.h"
  39. #include "bgpd/bgp_open.h"
  40. #include "bgpd/bgp_regex.h"
  41. #include "bgpd/bgp_route.h"
  42. #include "bgpd/bgp_zebra.h"
  43. #include "bgpd/bgp_table.h"
  44. #include "bgpd/bgp_vty.h"
  45. #include "bgpd/bgp_mpath.h"
  46. extern struct in_addr router_id_zebra;
  47. /* Utility function to get address family from current node. */
  48. afi_t
  49. bgp_node_afi (struct vty *vty)
  50. {
  51. if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
  52. return AFI_IP6;
  53. return AFI_IP;
  54. }
  55. /* Utility function to get subsequent address family from current
  56. node. */
  57. safi_t
  58. bgp_node_safi (struct vty *vty)
  59. {
  60. if (vty->node == BGP_VPNV4_NODE)
  61. return SAFI_MPLS_VPN;
  62. if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
  63. return SAFI_MULTICAST;
  64. return SAFI_UNICAST;
  65. }
  66. static int
  67. peer_address_self_check (union sockunion *su)
  68. {
  69. struct interface *ifp = NULL;
  70. if (su->sa.sa_family == AF_INET)
  71. ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
  72. #ifdef HAVE_IPV6
  73. else if (su->sa.sa_family == AF_INET6)
  74. ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
  75. #endif /* HAVE IPV6 */
  76. if (ifp)
  77. return 1;
  78. return 0;
  79. }
  80. /* Utility function for looking up peer from VTY. */
  81. static struct peer *
  82. peer_lookup_vty (struct vty *vty, const char *ip_str)
  83. {
  84. int ret;
  85. struct bgp *bgp;
  86. union sockunion su;
  87. struct peer *peer;
  88. bgp = vty->index;
  89. ret = str2sockunion (ip_str, &su);
  90. if (ret < 0)
  91. {
  92. vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
  93. return NULL;
  94. }
  95. peer = peer_lookup (bgp, &su);
  96. if (! peer)
  97. {
  98. vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
  99. return NULL;
  100. }
  101. return peer;
  102. }
  103. /* Utility function for looking up peer or peer group. */
  104. static struct peer *
  105. peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
  106. {
  107. int ret;
  108. struct bgp *bgp;
  109. union sockunion su;
  110. struct peer *peer;
  111. struct peer_group *group;
  112. bgp = vty->index;
  113. ret = str2sockunion (peer_str, &su);
  114. if (ret == 0)
  115. {
  116. peer = peer_lookup (bgp, &su);
  117. if (peer)
  118. return peer;
  119. }
  120. else
  121. {
  122. group = peer_group_lookup (bgp, peer_str);
  123. if (group)
  124. return group->conf;
  125. }
  126. vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
  127. VTY_NEWLINE);
  128. return NULL;
  129. }
  130. static int
  131. bgp_vty_return (struct vty *vty, int ret)
  132. {
  133. const char *str = NULL;
  134. switch (ret)
  135. {
  136. case BGP_ERR_INVALID_VALUE:
  137. str = "Invalid value";
  138. break;
  139. case BGP_ERR_INVALID_FLAG:
  140. str = "Invalid flag";
  141. break;
  142. case BGP_ERR_PEER_INACTIVE:
  143. str = "Activate the neighbor for the address family first";
  144. break;
  145. case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
  146. str = "Invalid command for a peer-group member";
  147. break;
  148. case BGP_ERR_PEER_GROUP_SHUTDOWN:
  149. str = "Peer-group has been shutdown. Activate the peer-group first";
  150. break;
  151. case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
  152. str = "This peer is a peer-group member. Please change peer-group configuration";
  153. break;
  154. case BGP_ERR_PEER_FLAG_CONFLICT:
  155. str = "Can't set override-capability and strict-capability-match at the same time";
  156. break;
  157. case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
  158. str = "No activate for peergroup can be given only if peer-group has no members";
  159. break;
  160. case BGP_ERR_PEER_BELONGS_TO_GROUP:
  161. str = "No activate for an individual peer-group member is invalid";
  162. break;
  163. case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
  164. str = "Activate the peer-group for the address family first";
  165. break;
  166. case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
  167. str = "Specify remote-as or peer-group remote AS first";
  168. break;
  169. case BGP_ERR_PEER_GROUP_CANT_CHANGE:
  170. str = "Cannot change the peer-group. Deconfigure first";
  171. break;
  172. case BGP_ERR_PEER_GROUP_MISMATCH:
  173. str = "Cannot have different peer-group for the neighbor";
  174. break;
  175. case BGP_ERR_PEER_FILTER_CONFLICT:
  176. str = "Prefix/distribute list can not co-exist";
  177. break;
  178. case BGP_ERR_NOT_INTERNAL_PEER:
  179. str = "Invalid command. Not an internal neighbor";
  180. break;
  181. case BGP_ERR_REMOVE_PRIVATE_AS:
  182. str = "Private AS cannot be removed for IBGP peers";
  183. break;
  184. case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
  185. str = "Local-AS allowed only for EBGP peers";
  186. break;
  187. case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
  188. str = "Cannot have local-as same as BGP AS number";
  189. break;
  190. case BGP_ERR_TCPSIG_FAILED:
  191. str = "Error while applying TCP-Sig to session(s)";
  192. break;
  193. case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
  194. str = "ebgp-multihop and ttl-security cannot be configured together";
  195. break;
  196. case BGP_ERR_NO_IBGP_WITH_TTLHACK:
  197. str = "ttl-security only allowed for EBGP peers";
  198. break;
  199. }
  200. if (str)
  201. {
  202. vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
  203. return CMD_WARNING;
  204. }
  205. return CMD_SUCCESS;
  206. }
  207. /* BGP global configuration. */
  208. DEFUN (bgp_multiple_instance_func,
  209. bgp_multiple_instance_cmd,
  210. "bgp multiple-instance",
  211. BGP_STR
  212. "Enable bgp multiple instance\n")
  213. {
  214. bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
  215. return CMD_SUCCESS;
  216. }
  217. DEFUN (no_bgp_multiple_instance,
  218. no_bgp_multiple_instance_cmd,
  219. "no bgp multiple-instance",
  220. NO_STR
  221. BGP_STR
  222. "BGP multiple instance\n")
  223. {
  224. int ret;
  225. ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
  226. if (ret < 0)
  227. {
  228. vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
  229. return CMD_WARNING;
  230. }
  231. return CMD_SUCCESS;
  232. }
  233. DEFUN (bgp_config_type,
  234. bgp_config_type_cmd,
  235. "bgp config-type (cisco|zebra)",
  236. BGP_STR
  237. "Configuration type\n"
  238. "cisco\n"
  239. "zebra\n")
  240. {
  241. if (strncmp (argv[0], "c", 1) == 0)
  242. bgp_option_set (BGP_OPT_CONFIG_CISCO);
  243. else
  244. bgp_option_unset (BGP_OPT_CONFIG_CISCO);
  245. return CMD_SUCCESS;
  246. }
  247. DEFUN (no_bgp_config_type,
  248. no_bgp_config_type_cmd,
  249. "no bgp config-type",
  250. NO_STR
  251. BGP_STR
  252. "Display configuration type\n")
  253. {
  254. bgp_option_unset (BGP_OPT_CONFIG_CISCO);
  255. return CMD_SUCCESS;
  256. }
  257. DEFUN (no_synchronization,
  258. no_synchronization_cmd,
  259. "no synchronization",
  260. NO_STR
  261. "Perform IGP synchronization\n")
  262. {
  263. return CMD_SUCCESS;
  264. }
  265. DEFUN (no_auto_summary,
  266. no_auto_summary_cmd,
  267. "no auto-summary",
  268. NO_STR
  269. "Enable automatic network number summarization\n")
  270. {
  271. return CMD_SUCCESS;
  272. }
  273. DEFUN_DEPRECATED (neighbor_version,
  274. neighbor_version_cmd,
  275. NEIGHBOR_CMD "version (4|4-)",
  276. NEIGHBOR_STR
  277. NEIGHBOR_ADDR_STR
  278. "Set the BGP version to match a neighbor\n"
  279. "Neighbor's BGP version\n")
  280. {
  281. return CMD_SUCCESS;
  282. }
  283. /* "router bgp" commands. */
  284. DEFUN (router_bgp,
  285. router_bgp_cmd,
  286. "router bgp " CMD_AS_RANGE,
  287. ROUTER_STR
  288. BGP_STR
  289. AS_STR)
  290. {
  291. int ret;
  292. as_t as;
  293. struct bgp *bgp;
  294. const char *name = NULL;
  295. VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
  296. if (argc == 2)
  297. name = argv[1];
  298. ret = bgp_get (&bgp, &as, name);
  299. switch (ret)
  300. {
  301. case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
  302. vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
  303. VTY_NEWLINE);
  304. return CMD_WARNING;
  305. case BGP_ERR_AS_MISMATCH:
  306. vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
  307. return CMD_WARNING;
  308. case BGP_ERR_INSTANCE_MISMATCH:
  309. vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
  310. vty_out (vty, "BGP instance is already running; AS is %u%s",
  311. as, VTY_NEWLINE);
  312. return CMD_WARNING;
  313. }
  314. vty->node = BGP_NODE;
  315. vty->index = bgp;
  316. return CMD_SUCCESS;
  317. }
  318. ALIAS (router_bgp,
  319. router_bgp_view_cmd,
  320. "router bgp " CMD_AS_RANGE " view WORD",
  321. ROUTER_STR
  322. BGP_STR
  323. AS_STR
  324. "BGP view\n"
  325. "view name\n")
  326. /* "no router bgp" commands. */
  327. DEFUN (no_router_bgp,
  328. no_router_bgp_cmd,
  329. "no router bgp " CMD_AS_RANGE,
  330. NO_STR
  331. ROUTER_STR
  332. BGP_STR
  333. AS_STR)
  334. {
  335. as_t as;
  336. struct bgp *bgp;
  337. const char *name = NULL;
  338. VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
  339. if (argc == 2)
  340. name = argv[1];
  341. /* Lookup bgp structure. */
  342. bgp = bgp_lookup (as, name);
  343. if (! bgp)
  344. {
  345. vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
  346. return CMD_WARNING;
  347. }
  348. bgp_delete (bgp);
  349. return CMD_SUCCESS;
  350. }
  351. ALIAS (no_router_bgp,
  352. no_router_bgp_view_cmd,
  353. "no router bgp " CMD_AS_RANGE " view WORD",
  354. NO_STR
  355. ROUTER_STR
  356. BGP_STR
  357. AS_STR
  358. "BGP view\n"
  359. "view name\n")
  360. /* BGP router-id. */
  361. DEFUN (bgp_router_id,
  362. bgp_router_id_cmd,
  363. "bgp router-id A.B.C.D",
  364. BGP_STR
  365. "Override configured router identifier\n"
  366. "Manually configured router identifier\n")
  367. {
  368. int ret;
  369. struct in_addr id;
  370. struct bgp *bgp;
  371. bgp = vty->index;
  372. ret = inet_aton (argv[0], &id);
  373. if (! ret)
  374. {
  375. vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
  376. return CMD_WARNING;
  377. }
  378. bgp->router_id_static = id;
  379. bgp_router_id_set (bgp, &id);
  380. return CMD_SUCCESS;
  381. }
  382. DEFUN (no_bgp_router_id,
  383. no_bgp_router_id_cmd,
  384. "no bgp router-id",
  385. NO_STR
  386. BGP_STR
  387. "Override configured router identifier\n")
  388. {
  389. int ret;
  390. struct in_addr id;
  391. struct bgp *bgp;
  392. bgp = vty->index;
  393. if (argc == 1)
  394. {
  395. ret = inet_aton (argv[0], &id);
  396. if (! ret)
  397. {
  398. vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
  399. return CMD_WARNING;
  400. }
  401. if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
  402. {
  403. vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
  404. return CMD_WARNING;
  405. }
  406. }
  407. bgp->router_id_static.s_addr = 0;
  408. bgp_router_id_set (bgp, &router_id_zebra);
  409. return CMD_SUCCESS;
  410. }
  411. ALIAS (no_bgp_router_id,
  412. no_bgp_router_id_val_cmd,
  413. "no bgp router-id A.B.C.D",
  414. NO_STR
  415. BGP_STR
  416. "Override configured router identifier\n"
  417. "Manually configured router identifier\n")
  418. /* BGP Cluster ID. */
  419. DEFUN (bgp_cluster_id,
  420. bgp_cluster_id_cmd,
  421. "bgp cluster-id A.B.C.D",
  422. BGP_STR
  423. "Configure Route-Reflector Cluster-id\n"
  424. "Route-Reflector Cluster-id in IP address format\n")
  425. {
  426. int ret;
  427. struct bgp *bgp;
  428. struct in_addr cluster;
  429. bgp = vty->index;
  430. ret = inet_aton (argv[0], &cluster);
  431. if (! ret)
  432. {
  433. vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
  434. return CMD_WARNING;
  435. }
  436. bgp_cluster_id_set (bgp, &cluster);
  437. return CMD_SUCCESS;
  438. }
  439. ALIAS (bgp_cluster_id,
  440. bgp_cluster_id32_cmd,
  441. "bgp cluster-id <1-4294967295>",
  442. BGP_STR
  443. "Configure Route-Reflector Cluster-id\n"
  444. "Route-Reflector Cluster-id as 32 bit quantity\n")
  445. DEFUN (no_bgp_cluster_id,
  446. no_bgp_cluster_id_cmd,
  447. "no bgp cluster-id",
  448. NO_STR
  449. BGP_STR
  450. "Configure Route-Reflector Cluster-id\n")
  451. {
  452. int ret;
  453. struct bgp *bgp;
  454. struct in_addr cluster;
  455. bgp = vty->index;
  456. if (argc == 1)
  457. {
  458. ret = inet_aton (argv[0], &cluster);
  459. if (! ret)
  460. {
  461. vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
  462. return CMD_WARNING;
  463. }
  464. }
  465. bgp_cluster_id_unset (bgp);
  466. return CMD_SUCCESS;
  467. }
  468. ALIAS (no_bgp_cluster_id,
  469. no_bgp_cluster_id_arg_cmd,
  470. "no bgp cluster-id A.B.C.D",
  471. NO_STR
  472. BGP_STR
  473. "Configure Route-Reflector Cluster-id\n"
  474. "Route-Reflector Cluster-id in IP address format\n")
  475. DEFUN (bgp_confederation_identifier,
  476. bgp_confederation_identifier_cmd,
  477. "bgp confederation identifier " CMD_AS_RANGE,
  478. "BGP specific commands\n"
  479. "AS confederation parameters\n"
  480. "AS number\n"
  481. "Set routing domain confederation AS\n")
  482. {
  483. struct bgp *bgp;
  484. as_t as;
  485. bgp = vty->index;
  486. VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
  487. bgp_confederation_id_set (bgp, as);
  488. return CMD_SUCCESS;
  489. }
  490. DEFUN (no_bgp_confederation_identifier,
  491. no_bgp_confederation_identifier_cmd,
  492. "no bgp confederation identifier",
  493. NO_STR
  494. "BGP specific commands\n"
  495. "AS confederation parameters\n"
  496. "AS number\n")
  497. {
  498. struct bgp *bgp;
  499. as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
  500. bgp = vty->index;
  501. if (argc == 1)
  502. VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
  503. bgp_confederation_id_unset (bgp);
  504. return CMD_SUCCESS;
  505. }
  506. ALIAS (no_bgp_confederation_identifier,
  507. no_bgp_confederation_identifier_arg_cmd,
  508. "no bgp confederation identifier " CMD_AS_RANGE,
  509. NO_STR
  510. "BGP specific commands\n"
  511. "AS confederation parameters\n"
  512. "AS number\n"
  513. "Set routing domain confederation AS\n")
  514. DEFUN (bgp_confederation_peers,
  515. bgp_confederation_peers_cmd,
  516. "bgp confederation peers ." CMD_AS_RANGE,
  517. "BGP specific commands\n"
  518. "AS confederation parameters\n"
  519. "Peer ASs in BGP confederation\n"
  520. AS_STR)
  521. {
  522. struct bgp *bgp;
  523. as_t as;
  524. int i;
  525. bgp = vty->index;
  526. for (i = 0; i < argc; i++)
  527. {
  528. VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
  529. if (bgp->as == as)
  530. {
  531. vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
  532. VTY_NEWLINE);
  533. continue;
  534. }
  535. bgp_confederation_peers_add (bgp, as);
  536. }
  537. return CMD_SUCCESS;
  538. }
  539. DEFUN (no_bgp_confederation_peers,
  540. no_bgp_confederation_peers_cmd,
  541. "no bgp confederation peers ." CMD_AS_RANGE,
  542. NO_STR
  543. "BGP specific commands\n"
  544. "AS confederation parameters\n"
  545. "Peer ASs in BGP confederation\n"
  546. AS_STR)
  547. {
  548. struct bgp *bgp;
  549. as_t as;
  550. int i;
  551. bgp = vty->index;
  552. for (i = 0; i < argc; i++)
  553. {
  554. VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
  555. bgp_confederation_peers_remove (bgp, as);
  556. }
  557. return CMD_SUCCESS;
  558. }
  559. /* Maximum-paths configuration */
  560. DEFUN (bgp_maxpaths,
  561. bgp_maxpaths_cmd,
  562. "maximum-paths <1-255>",
  563. "Forward packets over multiple paths\n"
  564. "Number of paths\n")
  565. {
  566. struct bgp *bgp;
  567. u_int16_t maxpaths;
  568. int ret;
  569. bgp = vty->index;
  570. VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
  571. ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
  572. BGP_PEER_EBGP, maxpaths);
  573. if (ret < 0)
  574. {
  575. vty_out (vty,
  576. "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
  577. maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
  578. return CMD_WARNING;
  579. }
  580. if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
  581. vty_out (vty,
  582. "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
  583. maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
  584. return CMD_SUCCESS;
  585. }
  586. DEFUN (bgp_maxpaths_ibgp,
  587. bgp_maxpaths_ibgp_cmd,
  588. "maximum-paths ibgp <1-255>",
  589. "Forward packets over multiple paths\n"
  590. "iBGP-multipath\n"
  591. "Number of paths\n")
  592. {
  593. struct bgp *bgp;
  594. u_int16_t maxpaths;
  595. int ret;
  596. bgp = vty->index;
  597. VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
  598. ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
  599. BGP_PEER_IBGP, maxpaths);
  600. if (ret < 0)
  601. {
  602. vty_out (vty,
  603. "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
  604. maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
  605. return CMD_WARNING;
  606. }
  607. if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
  608. vty_out (vty,
  609. "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
  610. maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
  611. return CMD_SUCCESS;
  612. }
  613. DEFUN (no_bgp_maxpaths,
  614. no_bgp_maxpaths_cmd,
  615. "no maximum-paths",
  616. NO_STR
  617. "Forward packets over multiple paths\n"
  618. "Number of paths\n")
  619. {
  620. struct bgp *bgp;
  621. int ret;
  622. bgp = vty->index;
  623. ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
  624. BGP_PEER_EBGP);
  625. if (ret < 0)
  626. {
  627. vty_out (vty,
  628. "%% Failed to unset maximum-paths for afi %u, safi %u%s",
  629. bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
  630. return CMD_WARNING;
  631. }
  632. return CMD_SUCCESS;
  633. }
  634. ALIAS (no_bgp_maxpaths,
  635. no_bgp_maxpaths_arg_cmd,
  636. "no maximum-paths <1-255>",
  637. NO_STR
  638. "Forward packets over multiple paths\n"
  639. "Number of paths\n")
  640. DEFUN (no_bgp_maxpaths_ibgp,
  641. no_bgp_maxpaths_ibgp_cmd,
  642. "no maximum-paths ibgp",
  643. NO_STR
  644. "Forward packets over multiple paths\n"
  645. "iBGP-multipath\n"
  646. "Number of paths\n")
  647. {
  648. struct bgp *bgp;
  649. int ret;
  650. bgp = vty->index;
  651. ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
  652. BGP_PEER_IBGP);
  653. if (ret < 0)
  654. {
  655. vty_out (vty,
  656. "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
  657. bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
  658. return CMD_WARNING;
  659. }
  660. return CMD_SUCCESS;
  661. }
  662. ALIAS (no_bgp_maxpaths_ibgp,
  663. no_bgp_maxpaths_ibgp_arg_cmd,
  664. "no maximum-paths ibgp <1-255>",
  665. NO_STR
  666. "Forward packets over multiple paths\n"
  667. "iBGP-multipath\n"
  668. "Number of paths\n")
  669. int
  670. bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
  671. safi_t safi, int *write)
  672. {
  673. if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
  674. {
  675. bgp_config_write_family_header (vty, afi, safi, write);
  676. vty_out (vty, " maximum-paths %d%s",
  677. bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
  678. }
  679. if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
  680. {
  681. bgp_config_write_family_header (vty, afi, safi, write);
  682. vty_out (vty, " maximum-paths ibgp %d%s",
  683. bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
  684. }
  685. return 0;
  686. }
  687. /* BGP timers. */
  688. DEFUN (bgp_timers,
  689. bgp_timers_cmd,
  690. "timers bgp <0-65535> <0-65535>",
  691. "Adjust routing timers\n"
  692. "BGP timers\n"
  693. "Keepalive interval\n"
  694. "Holdtime\n")
  695. {
  696. struct bgp *bgp;
  697. unsigned long keepalive = 0;
  698. unsigned long holdtime = 0;
  699. bgp = vty->index;
  700. VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
  701. VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
  702. /* Holdtime value check. */
  703. if (holdtime < 3 && holdtime != 0)
  704. {
  705. vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
  706. VTY_NEWLINE);
  707. return CMD_WARNING;
  708. }
  709. bgp_timers_set (bgp, keepalive, holdtime);
  710. return CMD_SUCCESS;
  711. }
  712. DEFUN (no_bgp_timers,
  713. no_bgp_timers_cmd,
  714. "no timers bgp",
  715. NO_STR
  716. "Adjust routing timers\n"
  717. "BGP timers\n")
  718. {
  719. struct bgp *bgp;
  720. bgp = vty->index;
  721. bgp_timers_unset (bgp);
  722. return CMD_SUCCESS;
  723. }
  724. ALIAS (no_bgp_timers,
  725. no_bgp_timers_arg_cmd,
  726. "no timers bgp <0-65535> <0-65535>",
  727. NO_STR
  728. "Adjust routing timers\n"
  729. "BGP timers\n"
  730. "Keepalive interval\n"
  731. "Holdtime\n")
  732. DEFUN (bgp_client_to_client_reflection,
  733. bgp_client_to_client_reflection_cmd,
  734. "bgp client-to-client reflection",
  735. "BGP specific commands\n"
  736. "Configure client to client route reflection\n"
  737. "reflection of routes allowed\n")
  738. {
  739. struct bgp *bgp;
  740. bgp = vty->index;
  741. bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
  742. return CMD_SUCCESS;
  743. }
  744. DEFUN (no_bgp_client_to_client_reflection,
  745. no_bgp_client_to_client_reflection_cmd,
  746. "no bgp client-to-client reflection",
  747. NO_STR
  748. "BGP specific commands\n"
  749. "Configure client to client route reflection\n"
  750. "reflection of routes allowed\n")
  751. {
  752. struct bgp *bgp;
  753. bgp = vty->index;
  754. bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
  755. return CMD_SUCCESS;
  756. }
  757. /* "bgp always-compare-med" configuration. */
  758. DEFUN (bgp_always_compare_med,
  759. bgp_always_compare_med_cmd,
  760. "bgp always-compare-med",
  761. "BGP specific commands\n"
  762. "Allow comparing MED from different neighbors\n")
  763. {
  764. struct bgp *bgp;
  765. bgp = vty->index;
  766. bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
  767. return CMD_SUCCESS;
  768. }
  769. DEFUN (no_bgp_always_compare_med,
  770. no_bgp_always_compare_med_cmd,
  771. "no bgp always-compare-med",
  772. NO_STR
  773. "BGP specific commands\n"
  774. "Allow comparing MED from different neighbors\n")
  775. {
  776. struct bgp *bgp;
  777. bgp = vty->index;
  778. bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
  779. return CMD_SUCCESS;
  780. }
  781. /* "bgp deterministic-med" configuration. */
  782. DEFUN (bgp_deterministic_med,
  783. bgp_deterministic_med_cmd,
  784. "bgp deterministic-med",
  785. "BGP specific commands\n"
  786. "Pick the best-MED path among paths advertised from the neighboring AS\n")
  787. {
  788. struct bgp *bgp;
  789. bgp = vty->index;
  790. bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
  791. return CMD_SUCCESS;
  792. }
  793. DEFUN (no_bgp_deterministic_med,
  794. no_bgp_deterministic_med_cmd,
  795. "no bgp deterministic-med",
  796. NO_STR
  797. "BGP specific commands\n"
  798. "Pick the best-MED path among paths advertised from the neighboring AS\n")
  799. {
  800. struct bgp *bgp;
  801. bgp = vty->index;
  802. bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
  803. return CMD_SUCCESS;
  804. }
  805. /* "bgp graceful-restart" configuration. */
  806. DEFUN (bgp_graceful_restart,
  807. bgp_graceful_restart_cmd,
  808. "bgp graceful-restart",
  809. "BGP specific commands\n"
  810. "Graceful restart capability parameters\n")
  811. {
  812. struct bgp *bgp;
  813. bgp = vty->index;
  814. bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
  815. return CMD_SUCCESS;
  816. }
  817. DEFUN (no_bgp_graceful_restart,
  818. no_bgp_graceful_restart_cmd,
  819. "no bgp graceful-restart",
  820. NO_STR
  821. "BGP specific commands\n"
  822. "Graceful restart capability parameters\n")
  823. {
  824. struct bgp *bgp;
  825. bgp = vty->index;
  826. bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
  827. return CMD_SUCCESS;
  828. }
  829. DEFUN (bgp_graceful_restart_stalepath_time,
  830. bgp_graceful_restart_stalepath_time_cmd,
  831. "bgp graceful-restart stalepath-time <1-3600>",
  832. "BGP specific commands\n"
  833. "Graceful restart capability parameters\n"
  834. "Set the max time to hold onto restarting peer's stale paths\n"
  835. "Delay value (seconds)\n")
  836. {
  837. struct bgp *bgp;
  838. u_int32_t stalepath;
  839. bgp = vty->index;
  840. if (! bgp)
  841. return CMD_WARNING;
  842. VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
  843. bgp->stalepath_time = stalepath;
  844. return CMD_SUCCESS;
  845. }
  846. DEFUN (no_bgp_graceful_restart_stalepath_time,
  847. no_bgp_graceful_restart_stalepath_time_cmd,
  848. "no bgp graceful-restart stalepath-time",
  849. NO_STR
  850. "BGP specific commands\n"
  851. "Graceful restart capability parameters\n"
  852. "Set the max time to hold onto restarting peer's stale paths\n")
  853. {
  854. struct bgp *bgp;
  855. bgp = vty->index;
  856. if (! bgp)
  857. return CMD_WARNING;
  858. bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
  859. return CMD_SUCCESS;
  860. }
  861. ALIAS (no_bgp_graceful_restart_stalepath_time,
  862. no_bgp_graceful_restart_stalepath_time_val_cmd,
  863. "no bgp graceful-restart stalepath-time <1-3600>",
  864. NO_STR
  865. "BGP specific commands\n"
  866. "Graceful restart capability parameters\n"
  867. "Set the max time to hold onto restarting peer's stale paths\n"
  868. "Delay value (seconds)\n")
  869. /* "bgp fast-external-failover" configuration. */
  870. DEFUN (bgp_fast_external_failover,
  871. bgp_fast_external_failover_cmd,
  872. "bgp fast-external-failover",
  873. BGP_STR
  874. "Immediately reset session if a link to a directly connected external peer goes down\n")
  875. {
  876. struct bgp *bgp;
  877. bgp = vty->index;
  878. bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
  879. return CMD_SUCCESS;
  880. }
  881. DEFUN (no_bgp_fast_external_failover,
  882. no_bgp_fast_external_failover_cmd,
  883. "no bgp fast-external-failover",
  884. NO_STR
  885. BGP_STR
  886. "Immediately reset session if a link to a directly connected external peer goes down\n")
  887. {
  888. struct bgp *bgp;
  889. bgp = vty->index;
  890. bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
  891. return CMD_SUCCESS;
  892. }
  893. /* "bgp enforce-first-as" configuration. */
  894. DEFUN (bgp_enforce_first_as,
  895. bgp_enforce_first_as_cmd,
  896. "bgp enforce-first-as",
  897. BGP_STR
  898. "Enforce the first AS for EBGP routes\n")
  899. {
  900. struct bgp *bgp;
  901. bgp = vty->index;
  902. bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
  903. return CMD_SUCCESS;
  904. }
  905. DEFUN (no_bgp_enforce_first_as,
  906. no_bgp_enforce_first_as_cmd,
  907. "no bgp enforce-first-as",
  908. NO_STR
  909. BGP_STR
  910. "Enforce the first AS for EBGP routes\n")
  911. {
  912. struct bgp *bgp;
  913. bgp = vty->index;
  914. bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
  915. return CMD_SUCCESS;
  916. }
  917. /* "bgp bestpath compare-routerid" configuration. */
  918. DEFUN (bgp_bestpath_compare_router_id,
  919. bgp_bestpath_compare_router_id_cmd,
  920. "bgp bestpath compare-routerid",
  921. "BGP specific commands\n"
  922. "Change the default bestpath selection\n"
  923. "Compare router-id for identical EBGP paths\n")
  924. {
  925. struct bgp *bgp;
  926. bgp = vty->index;
  927. bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
  928. return CMD_SUCCESS;
  929. }
  930. DEFUN (no_bgp_bestpath_compare_router_id,
  931. no_bgp_bestpath_compare_router_id_cmd,
  932. "no bgp bestpath compare-routerid",
  933. NO_STR
  934. "BGP specific commands\n"
  935. "Change the default bestpath selection\n"
  936. "Compare router-id for identical EBGP paths\n")
  937. {
  938. struct bgp *bgp;
  939. bgp = vty->index;
  940. bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
  941. return CMD_SUCCESS;
  942. }
  943. /* "bgp bestpath as-path ignore" configuration. */
  944. DEFUN (bgp_bestpath_aspath_ignore,
  945. bgp_bestpath_aspath_ignore_cmd,
  946. "bgp bestpath as-path ignore",
  947. "BGP specific commands\n"
  948. "Change the default bestpath selection\n"
  949. "AS-path attribute\n"
  950. "Ignore as-path length in selecting a route\n")
  951. {
  952. struct bgp *bgp;
  953. bgp = vty->index;
  954. bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
  955. return CMD_SUCCESS;
  956. }
  957. DEFUN (no_bgp_bestpath_aspath_ignore,
  958. no_bgp_bestpath_aspath_ignore_cmd,
  959. "no bgp bestpath as-path ignore",
  960. NO_STR
  961. "BGP specific commands\n"
  962. "Change the default bestpath selection\n"
  963. "AS-path attribute\n"
  964. "Ignore as-path length in selecting a route\n")
  965. {
  966. struct bgp *bgp;
  967. bgp = vty->index;
  968. bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
  969. return CMD_SUCCESS;
  970. }
  971. /* "bgp bestpath as-path confed" configuration. */
  972. DEFUN (bgp_bestpath_aspath_confed,
  973. bgp_bestpath_aspath_confed_cmd,
  974. "bgp bestpath as-path confed",
  975. "BGP specific commands\n"
  976. "Change the default bestpath selection\n"
  977. "AS-path attribute\n"
  978. "Compare path lengths including confederation sets & sequences in selecting a route\n")
  979. {
  980. struct bgp *bgp;
  981. bgp = vty->index;
  982. bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
  983. return CMD_SUCCESS;
  984. }
  985. DEFUN (no_bgp_bestpath_aspath_confed,
  986. no_bgp_bestpath_aspath_confed_cmd,
  987. "no bgp bestpath as-path confed",
  988. NO_STR
  989. "BGP specific commands\n"
  990. "Change the default bestpath selection\n"
  991. "AS-path attribute\n"
  992. "Compare path lengths including confederation sets & sequences in selecting a route\n")
  993. {
  994. struct bgp *bgp;
  995. bgp = vty->index;
  996. bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
  997. return CMD_SUCCESS;
  998. }
  999. /* "bgp bestpath as-path multipath-relax" configuration. */
  1000. DEFUN (bgp_bestpath_aspath_multipath_relax,
  1001. bgp_bestpath_aspath_multipath_relax_cmd,
  1002. "bgp bestpath as-path multipath-relax",
  1003. "BGP specific commands\n"
  1004. "Change the default bestpath selection\n"
  1005. "AS-path attribute\n"
  1006. "Allow load sharing across routes that have different AS paths (but same length)\n")
  1007. {
  1008. struct bgp *bgp;
  1009. bgp = vty->index;
  1010. bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
  1011. return CMD_SUCCESS;
  1012. }
  1013. DEFUN (no_bgp_bestpath_aspath_multipath_relax,
  1014. no_bgp_bestpath_aspath_multipath_relax_cmd,
  1015. "no bgp bestpath as-path multipath-relax",
  1016. NO_STR
  1017. "BGP specific commands\n"
  1018. "Change the default bestpath selection\n"
  1019. "AS-path attribute\n"
  1020. "Allow load sharing across routes that have different AS paths (but same length)\n")
  1021. {
  1022. struct bgp *bgp;
  1023. bgp = vty->index;
  1024. bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
  1025. return CMD_SUCCESS;
  1026. }
  1027. /* "bgp log-neighbor-changes" configuration. */
  1028. DEFUN (bgp_log_neighbor_changes,
  1029. bgp_log_neighbor_changes_cmd,
  1030. "bgp log-neighbor-changes",
  1031. "BGP specific commands\n"
  1032. "Log neighbor up/down and reset reason\n")
  1033. {
  1034. struct bgp *bgp;
  1035. bgp = vty->index;
  1036. bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
  1037. return CMD_SUCCESS;
  1038. }
  1039. DEFUN (no_bgp_log_neighbor_changes,
  1040. no_bgp_log_neighbor_changes_cmd,
  1041. "no bgp log-neighbor-changes",
  1042. NO_STR
  1043. "BGP specific commands\n"
  1044. "Log neighbor up/down and reset reason\n")
  1045. {
  1046. struct bgp *bgp;
  1047. bgp = vty->index;
  1048. bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
  1049. return CMD_SUCCESS;
  1050. }
  1051. /* "bgp bestpath med" configuration. */
  1052. DEFUN (bgp_bestpath_med,
  1053. bgp_bestpath_med_cmd,
  1054. "bgp bestpath med (confed|missing-as-worst)",
  1055. "BGP specific commands\n"
  1056. "Change the default bestpath selection\n"
  1057. "MED attribute\n"
  1058. "Compare MED among confederation paths\n"
  1059. "Treat missing MED as the least preferred one\n")
  1060. {
  1061. struct bgp *bgp;
  1062. bgp = vty->index;
  1063. if (strncmp (argv[0], "confed", 1) == 0)
  1064. bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
  1065. else
  1066. bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
  1067. return CMD_SUCCESS;
  1068. }
  1069. DEFUN (bgp_bestpath_med2,
  1070. bgp_bestpath_med2_cmd,
  1071. "bgp bestpath med confed missing-as-worst",
  1072. "BGP specific commands\n"
  1073. "Change the default bestpath selection\n"
  1074. "MED attribute\n"
  1075. "Compare MED among confederation paths\n"
  1076. "Treat missing MED as the least preferred one\n")
  1077. {
  1078. struct bgp *bgp;
  1079. bgp = vty->index;
  1080. bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
  1081. bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
  1082. return CMD_SUCCESS;
  1083. }
  1084. ALIAS (bgp_bestpath_med2,
  1085. bgp_bestpath_med3_cmd,
  1086. "bgp bestpath med missing-as-worst confed",
  1087. "BGP specific commands\n"
  1088. "Change the default bestpath selection\n"
  1089. "MED attribute\n"
  1090. "Treat missing MED as the least preferred one\n"
  1091. "Compare MED among confederation paths\n")
  1092. DEFUN (no_bgp_bestpath_med,
  1093. no_bgp_bestpath_med_cmd,
  1094. "no bgp bestpath med (confed|missing-as-worst)",
  1095. NO_STR
  1096. "BGP specific commands\n"
  1097. "Change the default bestpath selection\n"
  1098. "MED attribute\n"
  1099. "Compare MED among confederation paths\n"
  1100. "Treat missing MED as the least preferred one\n")
  1101. {
  1102. struct bgp *bgp;
  1103. bgp = vty->index;
  1104. if (strncmp (argv[0], "confed", 1) == 0)
  1105. bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
  1106. else
  1107. bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
  1108. return CMD_SUCCESS;
  1109. }
  1110. DEFUN (no_bgp_bestpath_med2,
  1111. no_bgp_bestpath_med2_cmd,
  1112. "no bgp bestpath med confed missing-as-worst",
  1113. NO_STR
  1114. "BGP specific commands\n"
  1115. "Change the default bestpath selection\n"
  1116. "MED attribute\n"
  1117. "Compare MED among confederation paths\n"
  1118. "Treat missing MED as the least preferred one\n")
  1119. {
  1120. struct bgp *bgp;
  1121. bgp = vty->index;
  1122. bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
  1123. bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
  1124. return CMD_SUCCESS;
  1125. }
  1126. ALIAS (no_bgp_bestpath_med2,
  1127. no_bgp_bestpath_med3_cmd,
  1128. "no bgp bestpath med missing-as-worst confed",
  1129. NO_STR
  1130. "BGP specific commands\n"
  1131. "Change the default bestpath selection\n"
  1132. "MED attribute\n"
  1133. "Treat missing MED as the least preferred one\n"
  1134. "Compare MED among confederation paths\n")
  1135. /* "no bgp default ipv4-unicast". */
  1136. DEFUN (no_bgp_default_ipv4_unicast,
  1137. no_bgp_default_ipv4_unicast_cmd,
  1138. "no bgp default ipv4-unicast",
  1139. NO_STR
  1140. "BGP specific commands\n"
  1141. "Configure BGP defaults\n"
  1142. "Activate ipv4-unicast for a peer by default\n")
  1143. {
  1144. struct bgp *bgp;
  1145. bgp = vty->index;
  1146. bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
  1147. return CMD_SUCCESS;
  1148. }
  1149. DEFUN (bgp_default_ipv4_unicast,
  1150. bgp_default_ipv4_unicast_cmd,
  1151. "bgp default ipv4-unicast",
  1152. "BGP specific commands\n"
  1153. "Configure BGP defaults\n"
  1154. "Activate ipv4-unicast for a peer by default\n")
  1155. {
  1156. struct bgp *bgp;
  1157. bgp = vty->index;
  1158. bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
  1159. return CMD_SUCCESS;
  1160. }
  1161. /* "bgp import-check" configuration. */
  1162. DEFUN (bgp_network_import_check,
  1163. bgp_network_import_check_cmd,
  1164. "bgp network import-check",
  1165. "BGP specific commands\n"
  1166. "BGP network command\n"
  1167. "Check BGP network route exists in IGP\n")
  1168. {
  1169. struct bgp *bgp;
  1170. bgp = vty->index;
  1171. bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
  1172. return CMD_SUCCESS;
  1173. }
  1174. DEFUN (no_bgp_network_import_check,
  1175. no_bgp_network_import_check_cmd,
  1176. "no bgp network import-check",
  1177. NO_STR
  1178. "BGP specific commands\n"
  1179. "BGP network command\n"
  1180. "Check BGP network route exists in IGP\n")
  1181. {
  1182. struct bgp *bgp;
  1183. bgp = vty->index;
  1184. bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
  1185. return CMD_SUCCESS;
  1186. }
  1187. DEFUN (bgp_default_local_preference,
  1188. bgp_default_local_preference_cmd,
  1189. "bgp default local-preference <0-4294967295>",
  1190. "BGP specific commands\n"
  1191. "Configure BGP defaults\n"
  1192. "local preference (higher=more preferred)\n"
  1193. "Configure default local preference value\n")
  1194. {
  1195. struct bgp *bgp;
  1196. u_int32_t local_pref;
  1197. bgp = vty->index;
  1198. VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
  1199. bgp_default_local_preference_set (bgp, local_pref);
  1200. return CMD_SUCCESS;
  1201. }
  1202. DEFUN (no_bgp_default_local_preference,
  1203. no_bgp_default_local_preference_cmd,
  1204. "no bgp default local-preference",
  1205. NO_STR
  1206. "BGP specific commands\n"
  1207. "Configure BGP defaults\n"
  1208. "local preference (higher=more preferred)\n")
  1209. {
  1210. struct bgp *bgp;
  1211. bgp = vty->index;
  1212. bgp_default_local_preference_unset (bgp);
  1213. return CMD_SUCCESS;
  1214. }
  1215. ALIAS (no_bgp_default_local_preference,
  1216. no_bgp_default_local_preference_val_cmd,
  1217. "no bgp default local-preference <0-4294967295>",
  1218. NO_STR
  1219. "BGP specific commands\n"
  1220. "Configure BGP defaults\n"
  1221. "local preference (higher=more preferred)\n"
  1222. "Configure default local preference value\n")
  1223. static int
  1224. peer_remote_as_vty (struct vty *vty, const char *peer_str,
  1225. const char *as_str, afi_t afi, safi_t safi)
  1226. {
  1227. int ret;
  1228. struct bgp *bgp;
  1229. as_t as;
  1230. union sockunion su;
  1231. bgp = vty->index;
  1232. /* Get AS number. */
  1233. VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
  1234. /* If peer is peer group, call proper function. */
  1235. ret = str2sockunion (peer_str, &su);
  1236. if (ret < 0)
  1237. {
  1238. ret = peer_group_remote_as (bgp, peer_str, &as);
  1239. if (ret < 0)
  1240. {
  1241. vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
  1242. return CMD_WARNING;
  1243. }
  1244. return CMD_SUCCESS;
  1245. }
  1246. if (peer_address_self_check (&su))
  1247. {
  1248. vty_out (vty, "%% Can not configure the local system as neighbor%s",
  1249. VTY_NEWLINE);
  1250. return CMD_WARNING;
  1251. }
  1252. ret = peer_remote_as (bgp, &su, &as, afi, safi);
  1253. /* This peer belongs to peer group. */
  1254. switch (ret)
  1255. {
  1256. case BGP_ERR_PEER_GROUP_MEMBER:
  1257. vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
  1258. return CMD_WARNING;
  1259. case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
  1260. 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);
  1261. return CMD_WARNING;
  1262. }
  1263. return bgp_vty_return (vty, ret);
  1264. }
  1265. DEFUN (neighbor_remote_as,
  1266. neighbor_remote_as_cmd,
  1267. NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
  1268. NEIGHBOR_STR
  1269. NEIGHBOR_ADDR_STR2
  1270. "Specify a BGP neighbor\n"
  1271. AS_STR)
  1272. {
  1273. return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
  1274. }
  1275. DEFUN (neighbor_peer_group,
  1276. neighbor_peer_group_cmd,
  1277. "neighbor WORD peer-group",
  1278. NEIGHBOR_STR
  1279. "Neighbor tag\n"
  1280. "Configure peer-group\n")
  1281. {
  1282. struct bgp *bgp;
  1283. struct peer_group *group;
  1284. bgp = vty->index;
  1285. group = peer_group_get (bgp, argv[0]);
  1286. if (! group)
  1287. return CMD_WARNING;
  1288. return CMD_SUCCESS;
  1289. }
  1290. DEFUN (no_neighbor,
  1291. no_neighbor_cmd,
  1292. NO_NEIGHBOR_CMD2,
  1293. NO_STR
  1294. NEIGHBOR_STR
  1295. NEIGHBOR_ADDR_STR2)
  1296. {
  1297. int ret;
  1298. union sockunion su;
  1299. struct peer_group *group;
  1300. struct peer *peer;
  1301. ret = str2sockunion (argv[0], &su);
  1302. if (ret < 0)
  1303. {
  1304. group = peer_group_lookup (vty->index, argv[0]);
  1305. if (group)
  1306. peer_group_delete (group);
  1307. else
  1308. {
  1309. vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
  1310. return CMD_WARNING;
  1311. }
  1312. }
  1313. else
  1314. {
  1315. peer = peer_lookup (vty->index, &su);
  1316. if (peer)
  1317. peer_delete (peer);
  1318. }
  1319. return CMD_SUCCESS;
  1320. }
  1321. ALIAS (no_neighbor,
  1322. no_neighbor_remote_as_cmd,
  1323. NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
  1324. NO_STR
  1325. NEIGHBOR_STR
  1326. NEIGHBOR_ADDR_STR
  1327. "Specify a BGP neighbor\n"
  1328. AS_STR)
  1329. DEFUN (no_neighbor_peer_group,
  1330. no_neighbor_peer_group_cmd,
  1331. "no neighbor WORD peer-group",
  1332. NO_STR
  1333. NEIGHBOR_STR
  1334. "Neighbor tag\n"
  1335. "Configure peer-group\n")
  1336. {
  1337. struct peer_group *group;
  1338. group = peer_group_lookup (vty->index, argv[0]);
  1339. if (group)
  1340. peer_group_delete (group);
  1341. else
  1342. {
  1343. vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
  1344. return CMD_WARNING;
  1345. }
  1346. return CMD_SUCCESS;
  1347. }
  1348. DEFUN (no_neighbor_peer_group_remote_as,
  1349. no_neighbor_peer_group_remote_as_cmd,
  1350. "no neighbor WORD remote-as " CMD_AS_RANGE,
  1351. NO_STR
  1352. NEIGHBOR_STR
  1353. "Neighbor tag\n"
  1354. "Specify a BGP neighbor\n"
  1355. AS_STR)
  1356. {
  1357. struct peer_group *group;
  1358. group = peer_group_lookup (vty->index, argv[0]);
  1359. if (group)
  1360. peer_group_remote_as_delete (group);
  1361. else
  1362. {
  1363. vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
  1364. return CMD_WARNING;
  1365. }
  1366. return CMD_SUCCESS;
  1367. }
  1368. DEFUN (neighbor_local_as,
  1369. neighbor_local_as_cmd,
  1370. NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
  1371. NEIGHBOR_STR
  1372. NEIGHBOR_ADDR_STR2
  1373. "Specify a local-as number\n"
  1374. "AS number used as local AS\n")
  1375. {
  1376. struct peer *peer;
  1377. int ret;
  1378. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1379. if (! peer)
  1380. return CMD_WARNING;
  1381. ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
  1382. return bgp_vty_return (vty, ret);
  1383. }
  1384. DEFUN (neighbor_local_as_no_prepend,
  1385. neighbor_local_as_no_prepend_cmd,
  1386. NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
  1387. NEIGHBOR_STR
  1388. NEIGHBOR_ADDR_STR2
  1389. "Specify a local-as number\n"
  1390. "AS number used as local AS\n"
  1391. "Do not prepend local-as to updates from ebgp peers\n")
  1392. {
  1393. struct peer *peer;
  1394. int ret;
  1395. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1396. if (! peer)
  1397. return CMD_WARNING;
  1398. ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
  1399. return bgp_vty_return (vty, ret);
  1400. }
  1401. DEFUN (neighbor_local_as_no_prepend_replace_as,
  1402. neighbor_local_as_no_prepend_replace_as_cmd,
  1403. NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
  1404. NEIGHBOR_STR
  1405. NEIGHBOR_ADDR_STR2
  1406. "Specify a local-as number\n"
  1407. "AS number used as local AS\n"
  1408. "Do not prepend local-as to updates from ebgp peers\n"
  1409. "Do not prepend local-as to updates from ibgp peers\n")
  1410. {
  1411. struct peer *peer;
  1412. int ret;
  1413. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1414. if (! peer)
  1415. return CMD_WARNING;
  1416. ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
  1417. return bgp_vty_return (vty, ret);
  1418. }
  1419. DEFUN (no_neighbor_local_as,
  1420. no_neighbor_local_as_cmd,
  1421. NO_NEIGHBOR_CMD2 "local-as",
  1422. NO_STR
  1423. NEIGHBOR_STR
  1424. NEIGHBOR_ADDR_STR2
  1425. "Specify a local-as number\n")
  1426. {
  1427. struct peer *peer;
  1428. int ret;
  1429. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1430. if (! peer)
  1431. return CMD_WARNING;
  1432. ret = peer_local_as_unset (peer);
  1433. return bgp_vty_return (vty, ret);
  1434. }
  1435. ALIAS (no_neighbor_local_as,
  1436. no_neighbor_local_as_val_cmd,
  1437. NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
  1438. NO_STR
  1439. NEIGHBOR_STR
  1440. NEIGHBOR_ADDR_STR2
  1441. "Specify a local-as number\n"
  1442. "AS number used as local AS\n")
  1443. ALIAS (no_neighbor_local_as,
  1444. no_neighbor_local_as_val2_cmd,
  1445. NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
  1446. NO_STR
  1447. NEIGHBOR_STR
  1448. NEIGHBOR_ADDR_STR2
  1449. "Specify a local-as number\n"
  1450. "AS number used as local AS\n"
  1451. "Do not prepend local-as to updates from ebgp peers\n")
  1452. ALIAS (no_neighbor_local_as,
  1453. no_neighbor_local_as_val3_cmd,
  1454. NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
  1455. NO_STR
  1456. NEIGHBOR_STR
  1457. NEIGHBOR_ADDR_STR2
  1458. "Specify a local-as number\n"
  1459. "AS number used as local AS\n"
  1460. "Do not prepend local-as to updates from ebgp peers\n"
  1461. "Do not prepend local-as to updates from ibgp peers\n")
  1462. DEFUN (neighbor_password,
  1463. neighbor_password_cmd,
  1464. NEIGHBOR_CMD2 "password LINE",
  1465. NEIGHBOR_STR
  1466. NEIGHBOR_ADDR_STR2
  1467. "Set a password\n"
  1468. "The password\n")
  1469. {
  1470. struct peer *peer;
  1471. int ret;
  1472. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1473. if (! peer)
  1474. return CMD_WARNING;
  1475. ret = peer_password_set (peer, argv[1]);
  1476. return bgp_vty_return (vty, ret);
  1477. }
  1478. DEFUN (no_neighbor_password,
  1479. no_neighbor_password_cmd,
  1480. NO_NEIGHBOR_CMD2 "password",
  1481. NO_STR
  1482. NEIGHBOR_STR
  1483. NEIGHBOR_ADDR_STR2
  1484. "Set a password\n")
  1485. {
  1486. struct peer *peer;
  1487. int ret;
  1488. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1489. if (! peer)
  1490. return CMD_WARNING;
  1491. ret = peer_password_unset (peer);
  1492. return bgp_vty_return (vty, ret);
  1493. }
  1494. DEFUN (neighbor_activate,
  1495. neighbor_activate_cmd,
  1496. NEIGHBOR_CMD2 "activate",
  1497. NEIGHBOR_STR
  1498. NEIGHBOR_ADDR_STR2
  1499. "Enable the Address Family for this Neighbor\n")
  1500. {
  1501. struct peer *peer;
  1502. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1503. if (! peer)
  1504. return CMD_WARNING;
  1505. peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
  1506. return CMD_SUCCESS;
  1507. }
  1508. DEFUN (no_neighbor_activate,
  1509. no_neighbor_activate_cmd,
  1510. NO_NEIGHBOR_CMD2 "activate",
  1511. NO_STR
  1512. NEIGHBOR_STR
  1513. NEIGHBOR_ADDR_STR2
  1514. "Enable the Address Family for this Neighbor\n")
  1515. {
  1516. int ret;
  1517. struct peer *peer;
  1518. /* Lookup peer. */
  1519. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1520. if (! peer)
  1521. return CMD_WARNING;
  1522. ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
  1523. return bgp_vty_return (vty, ret);
  1524. }
  1525. DEFUN (neighbor_set_peer_group,
  1526. neighbor_set_peer_group_cmd,
  1527. NEIGHBOR_CMD "peer-group WORD",
  1528. NEIGHBOR_STR
  1529. NEIGHBOR_ADDR_STR
  1530. "Member of the peer-group\n"
  1531. "peer-group name\n")
  1532. {
  1533. int ret;
  1534. as_t as;
  1535. union sockunion su;
  1536. struct bgp *bgp;
  1537. struct peer_group *group;
  1538. bgp = vty->index;
  1539. ret = str2sockunion (argv[0], &su);
  1540. if (ret < 0)
  1541. {
  1542. vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
  1543. return CMD_WARNING;
  1544. }
  1545. group = peer_group_lookup (bgp, argv[1]);
  1546. if (! group)
  1547. {
  1548. vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
  1549. return CMD_WARNING;
  1550. }
  1551. if (peer_address_self_check (&su))
  1552. {
  1553. vty_out (vty, "%% Can not configure the local system as neighbor%s",
  1554. VTY_NEWLINE);
  1555. return CMD_WARNING;
  1556. }
  1557. ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
  1558. bgp_node_safi (vty), &as);
  1559. if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
  1560. {
  1561. 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);
  1562. return CMD_WARNING;
  1563. }
  1564. return bgp_vty_return (vty, ret);
  1565. }
  1566. DEFUN (no_neighbor_set_peer_group,
  1567. no_neighbor_set_peer_group_cmd,
  1568. NO_NEIGHBOR_CMD "peer-group WORD",
  1569. NO_STR
  1570. NEIGHBOR_STR
  1571. NEIGHBOR_ADDR_STR
  1572. "Member of the peer-group\n"
  1573. "peer-group name\n")
  1574. {
  1575. int ret;
  1576. struct bgp *bgp;
  1577. struct peer *peer;
  1578. struct peer_group *group;
  1579. bgp = vty->index;
  1580. peer = peer_lookup_vty (vty, argv[0]);
  1581. if (! peer)
  1582. return CMD_WARNING;
  1583. group = peer_group_lookup (bgp, argv[1]);
  1584. if (! group)
  1585. {
  1586. vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
  1587. return CMD_WARNING;
  1588. }
  1589. ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
  1590. bgp_node_safi (vty));
  1591. return bgp_vty_return (vty, ret);
  1592. }
  1593. static int
  1594. peer_flag_modify_vty (struct vty *vty, const char *ip_str,
  1595. u_int16_t flag, int set)
  1596. {
  1597. int ret;
  1598. struct peer *peer;
  1599. peer = peer_and_group_lookup_vty (vty, ip_str);
  1600. if (! peer)
  1601. return CMD_WARNING;
  1602. if (set)
  1603. ret = peer_flag_set (peer, flag);
  1604. else
  1605. ret = peer_flag_unset (peer, flag);
  1606. return bgp_vty_return (vty, ret);
  1607. }
  1608. static int
  1609. peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
  1610. {
  1611. return peer_flag_modify_vty (vty, ip_str, flag, 1);
  1612. }
  1613. static int
  1614. peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
  1615. {
  1616. return peer_flag_modify_vty (vty, ip_str, flag, 0);
  1617. }
  1618. /* neighbor passive. */
  1619. DEFUN (neighbor_passive,
  1620. neighbor_passive_cmd,
  1621. NEIGHBOR_CMD2 "passive",
  1622. NEIGHBOR_STR
  1623. NEIGHBOR_ADDR_STR2
  1624. "Don't send open messages to this neighbor\n")
  1625. {
  1626. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
  1627. }
  1628. DEFUN (no_neighbor_passive,
  1629. no_neighbor_passive_cmd,
  1630. NO_NEIGHBOR_CMD2 "passive",
  1631. NO_STR
  1632. NEIGHBOR_STR
  1633. NEIGHBOR_ADDR_STR2
  1634. "Don't send open messages to this neighbor\n")
  1635. {
  1636. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
  1637. }
  1638. /* neighbor shutdown. */
  1639. DEFUN (neighbor_shutdown,
  1640. neighbor_shutdown_cmd,
  1641. NEIGHBOR_CMD2 "shutdown",
  1642. NEIGHBOR_STR
  1643. NEIGHBOR_ADDR_STR2
  1644. "Administratively shut down this neighbor\n")
  1645. {
  1646. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
  1647. }
  1648. DEFUN (no_neighbor_shutdown,
  1649. no_neighbor_shutdown_cmd,
  1650. NO_NEIGHBOR_CMD2 "shutdown",
  1651. NO_STR
  1652. NEIGHBOR_STR
  1653. NEIGHBOR_ADDR_STR2
  1654. "Administratively shut down this neighbor\n")
  1655. {
  1656. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
  1657. }
  1658. /* Deprecated neighbor capability route-refresh. */
  1659. DEFUN_DEPRECATED (neighbor_capability_route_refresh,
  1660. neighbor_capability_route_refresh_cmd,
  1661. NEIGHBOR_CMD2 "capability route-refresh",
  1662. NEIGHBOR_STR
  1663. NEIGHBOR_ADDR_STR2
  1664. "Advertise capability to the peer\n"
  1665. "Advertise route-refresh capability to this neighbor\n")
  1666. {
  1667. return CMD_SUCCESS;
  1668. }
  1669. DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
  1670. no_neighbor_capability_route_refresh_cmd,
  1671. NO_NEIGHBOR_CMD2 "capability route-refresh",
  1672. NO_STR
  1673. NEIGHBOR_STR
  1674. NEIGHBOR_ADDR_STR2
  1675. "Advertise capability to the peer\n"
  1676. "Advertise route-refresh capability to this neighbor\n")
  1677. {
  1678. return CMD_SUCCESS;
  1679. }
  1680. /* neighbor capability dynamic. */
  1681. DEFUN (neighbor_capability_dynamic,
  1682. neighbor_capability_dynamic_cmd,
  1683. NEIGHBOR_CMD2 "capability dynamic",
  1684. NEIGHBOR_STR
  1685. NEIGHBOR_ADDR_STR2
  1686. "Advertise capability to the peer\n"
  1687. "Advertise dynamic capability to this neighbor\n")
  1688. {
  1689. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
  1690. }
  1691. DEFUN (no_neighbor_capability_dynamic,
  1692. no_neighbor_capability_dynamic_cmd,
  1693. NO_NEIGHBOR_CMD2 "capability dynamic",
  1694. NO_STR
  1695. NEIGHBOR_STR
  1696. NEIGHBOR_ADDR_STR2
  1697. "Advertise capability to the peer\n"
  1698. "Advertise dynamic capability to this neighbor\n")
  1699. {
  1700. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
  1701. }
  1702. /* neighbor dont-capability-negotiate */
  1703. DEFUN (neighbor_dont_capability_negotiate,
  1704. neighbor_dont_capability_negotiate_cmd,
  1705. NEIGHBOR_CMD2 "dont-capability-negotiate",
  1706. NEIGHBOR_STR
  1707. NEIGHBOR_ADDR_STR2
  1708. "Do not perform capability negotiation\n")
  1709. {
  1710. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
  1711. }
  1712. DEFUN (no_neighbor_dont_capability_negotiate,
  1713. no_neighbor_dont_capability_negotiate_cmd,
  1714. NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
  1715. NO_STR
  1716. NEIGHBOR_STR
  1717. NEIGHBOR_ADDR_STR2
  1718. "Do not perform capability negotiation\n")
  1719. {
  1720. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
  1721. }
  1722. static int
  1723. peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
  1724. safi_t safi, u_int32_t flag, int set)
  1725. {
  1726. int ret;
  1727. struct peer *peer;
  1728. peer = peer_and_group_lookup_vty (vty, peer_str);
  1729. if (! peer)
  1730. return CMD_WARNING;
  1731. if (set)
  1732. ret = peer_af_flag_set (peer, afi, safi, flag);
  1733. else
  1734. ret = peer_af_flag_unset (peer, afi, safi, flag);
  1735. return bgp_vty_return (vty, ret);
  1736. }
  1737. static int
  1738. peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
  1739. safi_t safi, u_int32_t flag)
  1740. {
  1741. return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
  1742. }
  1743. static int
  1744. peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
  1745. safi_t safi, u_int32_t flag)
  1746. {
  1747. return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
  1748. }
  1749. /* neighbor capability orf prefix-list. */
  1750. DEFUN (neighbor_capability_orf_prefix,
  1751. neighbor_capability_orf_prefix_cmd,
  1752. NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
  1753. NEIGHBOR_STR
  1754. NEIGHBOR_ADDR_STR2
  1755. "Advertise capability to the peer\n"
  1756. "Advertise ORF capability to the peer\n"
  1757. "Advertise prefixlist ORF capability to this neighbor\n"
  1758. "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
  1759. "Capability to RECEIVE the ORF from this neighbor\n"
  1760. "Capability to SEND the ORF to this neighbor\n")
  1761. {
  1762. u_int16_t flag = 0;
  1763. if (strncmp (argv[1], "s", 1) == 0)
  1764. flag = PEER_FLAG_ORF_PREFIX_SM;
  1765. else if (strncmp (argv[1], "r", 1) == 0)
  1766. flag = PEER_FLAG_ORF_PREFIX_RM;
  1767. else if (strncmp (argv[1], "b", 1) == 0)
  1768. flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
  1769. else
  1770. return CMD_WARNING;
  1771. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1772. bgp_node_safi (vty), flag);
  1773. }
  1774. DEFUN (no_neighbor_capability_orf_prefix,
  1775. no_neighbor_capability_orf_prefix_cmd,
  1776. NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
  1777. NO_STR
  1778. NEIGHBOR_STR
  1779. NEIGHBOR_ADDR_STR2
  1780. "Advertise capability to the peer\n"
  1781. "Advertise ORF capability to the peer\n"
  1782. "Advertise prefixlist ORF capability to this neighbor\n"
  1783. "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
  1784. "Capability to RECEIVE the ORF from this neighbor\n"
  1785. "Capability to SEND the ORF to this neighbor\n")
  1786. {
  1787. u_int16_t flag = 0;
  1788. if (strncmp (argv[1], "s", 1) == 0)
  1789. flag = PEER_FLAG_ORF_PREFIX_SM;
  1790. else if (strncmp (argv[1], "r", 1) == 0)
  1791. flag = PEER_FLAG_ORF_PREFIX_RM;
  1792. else if (strncmp (argv[1], "b", 1) == 0)
  1793. flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
  1794. else
  1795. return CMD_WARNING;
  1796. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1797. bgp_node_safi (vty), flag);
  1798. }
  1799. /* neighbor next-hop-self. */
  1800. DEFUN (neighbor_nexthop_self,
  1801. neighbor_nexthop_self_cmd,
  1802. NEIGHBOR_CMD2 "next-hop-self {all}",
  1803. NEIGHBOR_STR
  1804. NEIGHBOR_ADDR_STR2
  1805. "Disable the next hop calculation for this neighbor\n"
  1806. "Apply also to ibgp-learned routes when acting as a route reflector\n")
  1807. {
  1808. u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
  1809. int rc;
  1810. /* Check if "all" is specified */
  1811. if (argv[1] != NULL)
  1812. flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
  1813. else
  1814. unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
  1815. rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1816. bgp_node_safi (vty), flags);
  1817. if ( rc == CMD_SUCCESS && unset )
  1818. rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1819. bgp_node_safi (vty), unset);
  1820. return rc;
  1821. }
  1822. DEFUN (no_neighbor_nexthop_self,
  1823. no_neighbor_nexthop_self_cmd,
  1824. NO_NEIGHBOR_CMD2 "next-hop-self {all}",
  1825. NO_STR
  1826. NEIGHBOR_STR
  1827. NEIGHBOR_ADDR_STR2
  1828. "Disable the next hop calculation for this neighbor\n"
  1829. "Apply also to ibgp-learned routes when acting as a route reflector\n")
  1830. {
  1831. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1832. bgp_node_safi (vty),
  1833. PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
  1834. }
  1835. /* neighbor remove-private-AS. */
  1836. DEFUN (neighbor_remove_private_as,
  1837. neighbor_remove_private_as_cmd,
  1838. NEIGHBOR_CMD2 "remove-private-AS",
  1839. NEIGHBOR_STR
  1840. NEIGHBOR_ADDR_STR2
  1841. "Remove private AS number from outbound updates\n")
  1842. {
  1843. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1844. bgp_node_safi (vty),
  1845. PEER_FLAG_REMOVE_PRIVATE_AS);
  1846. }
  1847. DEFUN (no_neighbor_remove_private_as,
  1848. no_neighbor_remove_private_as_cmd,
  1849. NO_NEIGHBOR_CMD2 "remove-private-AS",
  1850. NO_STR
  1851. NEIGHBOR_STR
  1852. NEIGHBOR_ADDR_STR2
  1853. "Remove private AS number from outbound updates\n")
  1854. {
  1855. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1856. bgp_node_safi (vty),
  1857. PEER_FLAG_REMOVE_PRIVATE_AS);
  1858. }
  1859. /* neighbor send-community. */
  1860. DEFUN (neighbor_send_community,
  1861. neighbor_send_community_cmd,
  1862. NEIGHBOR_CMD2 "send-community",
  1863. NEIGHBOR_STR
  1864. NEIGHBOR_ADDR_STR2
  1865. "Send Community attribute to this neighbor\n")
  1866. {
  1867. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1868. bgp_node_safi (vty),
  1869. PEER_FLAG_SEND_COMMUNITY);
  1870. }
  1871. DEFUN (no_neighbor_send_community,
  1872. no_neighbor_send_community_cmd,
  1873. NO_NEIGHBOR_CMD2 "send-community",
  1874. NO_STR
  1875. NEIGHBOR_STR
  1876. NEIGHBOR_ADDR_STR2
  1877. "Send Community attribute to this neighbor\n")
  1878. {
  1879. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1880. bgp_node_safi (vty),
  1881. PEER_FLAG_SEND_COMMUNITY);
  1882. }
  1883. /* neighbor send-community extended. */
  1884. DEFUN (neighbor_send_community_type,
  1885. neighbor_send_community_type_cmd,
  1886. NEIGHBOR_CMD2 "send-community (both|extended|standard)",
  1887. NEIGHBOR_STR
  1888. NEIGHBOR_ADDR_STR2
  1889. "Send Community attribute to this neighbor\n"
  1890. "Send Standard and Extended Community attributes\n"
  1891. "Send Extended Community attributes\n"
  1892. "Send Standard Community attributes\n")
  1893. {
  1894. if (strncmp (argv[1], "s", 1) == 0)
  1895. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1896. bgp_node_safi (vty),
  1897. PEER_FLAG_SEND_COMMUNITY);
  1898. if (strncmp (argv[1], "e", 1) == 0)
  1899. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1900. bgp_node_safi (vty),
  1901. PEER_FLAG_SEND_EXT_COMMUNITY);
  1902. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1903. bgp_node_safi (vty),
  1904. (PEER_FLAG_SEND_COMMUNITY|
  1905. PEER_FLAG_SEND_EXT_COMMUNITY));
  1906. }
  1907. DEFUN (no_neighbor_send_community_type,
  1908. no_neighbor_send_community_type_cmd,
  1909. NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
  1910. NO_STR
  1911. NEIGHBOR_STR
  1912. NEIGHBOR_ADDR_STR2
  1913. "Send Community attribute to this neighbor\n"
  1914. "Send Standard and Extended Community attributes\n"
  1915. "Send Extended Community attributes\n"
  1916. "Send Standard Community attributes\n")
  1917. {
  1918. if (strncmp (argv[1], "s", 1) == 0)
  1919. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1920. bgp_node_safi (vty),
  1921. PEER_FLAG_SEND_COMMUNITY);
  1922. if (strncmp (argv[1], "e", 1) == 0)
  1923. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1924. bgp_node_safi (vty),
  1925. PEER_FLAG_SEND_EXT_COMMUNITY);
  1926. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1927. bgp_node_safi (vty),
  1928. (PEER_FLAG_SEND_COMMUNITY |
  1929. PEER_FLAG_SEND_EXT_COMMUNITY));
  1930. }
  1931. /* neighbor soft-reconfig. */
  1932. DEFUN (neighbor_soft_reconfiguration,
  1933. neighbor_soft_reconfiguration_cmd,
  1934. NEIGHBOR_CMD2 "soft-reconfiguration inbound",
  1935. NEIGHBOR_STR
  1936. NEIGHBOR_ADDR_STR2
  1937. "Per neighbor soft reconfiguration\n"
  1938. "Allow inbound soft reconfiguration for this neighbor\n")
  1939. {
  1940. return peer_af_flag_set_vty (vty, argv[0],
  1941. bgp_node_afi (vty), bgp_node_safi (vty),
  1942. PEER_FLAG_SOFT_RECONFIG);
  1943. }
  1944. DEFUN (no_neighbor_soft_reconfiguration,
  1945. no_neighbor_soft_reconfiguration_cmd,
  1946. NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
  1947. NO_STR
  1948. NEIGHBOR_STR
  1949. NEIGHBOR_ADDR_STR2
  1950. "Per neighbor soft reconfiguration\n"
  1951. "Allow inbound soft reconfiguration for this neighbor\n")
  1952. {
  1953. return peer_af_flag_unset_vty (vty, argv[0],
  1954. bgp_node_afi (vty), bgp_node_safi (vty),
  1955. PEER_FLAG_SOFT_RECONFIG);
  1956. }
  1957. DEFUN (neighbor_route_reflector_client,
  1958. neighbor_route_reflector_client_cmd,
  1959. NEIGHBOR_CMD2 "route-reflector-client",
  1960. NEIGHBOR_STR
  1961. NEIGHBOR_ADDR_STR2
  1962. "Configure a neighbor as Route Reflector client\n")
  1963. {
  1964. struct peer *peer;
  1965. peer = peer_and_group_lookup_vty (vty, argv[0]);
  1966. if (! peer)
  1967. return CMD_WARNING;
  1968. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  1969. bgp_node_safi (vty),
  1970. PEER_FLAG_REFLECTOR_CLIENT);
  1971. }
  1972. DEFUN (no_neighbor_route_reflector_client,
  1973. no_neighbor_route_reflector_client_cmd,
  1974. NO_NEIGHBOR_CMD2 "route-reflector-client",
  1975. NO_STR
  1976. NEIGHBOR_STR
  1977. NEIGHBOR_ADDR_STR2
  1978. "Configure a neighbor as Route Reflector client\n")
  1979. {
  1980. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  1981. bgp_node_safi (vty),
  1982. PEER_FLAG_REFLECTOR_CLIENT);
  1983. }
  1984. static int
  1985. peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
  1986. int afi, int safi)
  1987. {
  1988. int ret;
  1989. struct bgp *bgp;
  1990. struct peer *peer;
  1991. struct peer_group *group;
  1992. struct listnode *node, *nnode;
  1993. struct bgp_filter *pfilter;
  1994. struct bgp_filter *gfilter;
  1995. int locked_and_added = 0;
  1996. bgp = vty->index;
  1997. peer = peer_and_group_lookup_vty (vty, peer_str);
  1998. if ( ! peer )
  1999. return CMD_WARNING;
  2000. /* If it is already a RS-Client, don't do anything. */
  2001. if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
  2002. return CMD_SUCCESS;
  2003. if ( ! peer_rsclient_active (peer) )
  2004. {
  2005. peer = peer_lock (peer); /* rsclient peer list reference */
  2006. listnode_add_sort (bgp->rsclient, peer);
  2007. locked_and_added = 1;
  2008. }
  2009. ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
  2010. if (ret < 0)
  2011. {
  2012. if (locked_and_added)
  2013. {
  2014. listnode_delete (bgp->rsclient, peer);
  2015. peer_unlock (peer); /* rsclient peer list reference */
  2016. }
  2017. return bgp_vty_return (vty, ret);
  2018. }
  2019. peer->rib[afi][safi] = bgp_table_init (afi, safi);
  2020. peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
  2021. /* RIB peer reference. Released when table is free'd in bgp_table_free. */
  2022. peer->rib[afi][safi]->owner = peer_lock (peer);
  2023. /* Check for existing 'network' and 'redistribute' routes. */
  2024. bgp_check_local_routes_rsclient (peer, afi, safi);
  2025. /* Check for routes for peers configured with 'soft-reconfiguration'. */
  2026. bgp_soft_reconfig_rsclient (peer, afi, safi);
  2027. if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
  2028. {
  2029. group = peer->group;
  2030. gfilter = &peer->filter[afi][safi];
  2031. for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
  2032. {
  2033. pfilter = &peer->filter[afi][safi];
  2034. /* Members of a non-RS-Client group should not be RS-Clients, as that
  2035. is checked when the become part of the peer-group */
  2036. ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
  2037. if (ret < 0)
  2038. return bgp_vty_return (vty, ret);
  2039. /* Make peer's RIB point to group's RIB. */
  2040. peer->rib[afi][safi] = group->conf->rib[afi][safi];
  2041. /* Import policy. */
  2042. if (pfilter->map[RMAP_IMPORT].name)
  2043. free (pfilter->map[RMAP_IMPORT].name);
  2044. if (gfilter->map[RMAP_IMPORT].name)
  2045. {
  2046. pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
  2047. pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
  2048. }
  2049. else
  2050. {
  2051. pfilter->map[RMAP_IMPORT].name = NULL;
  2052. pfilter->map[RMAP_IMPORT].map =NULL;
  2053. }
  2054. /* Export policy. */
  2055. if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
  2056. {
  2057. pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
  2058. pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
  2059. }
  2060. }
  2061. }
  2062. return CMD_SUCCESS;
  2063. }
  2064. static int
  2065. peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
  2066. int afi, int safi)
  2067. {
  2068. int ret;
  2069. struct bgp *bgp;
  2070. struct peer *peer;
  2071. struct peer_group *group;
  2072. struct listnode *node, *nnode;
  2073. bgp = vty->index;
  2074. peer = peer_and_group_lookup_vty (vty, peer_str);
  2075. if ( ! peer )
  2076. return CMD_WARNING;
  2077. /* If it is not a RS-Client, don't do anything. */
  2078. if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
  2079. return CMD_SUCCESS;
  2080. if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
  2081. {
  2082. group = peer->group;
  2083. for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
  2084. {
  2085. ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
  2086. if (ret < 0)
  2087. return bgp_vty_return (vty, ret);
  2088. peer->rib[afi][safi] = NULL;
  2089. }
  2090. peer = group->conf;
  2091. }
  2092. ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
  2093. if (ret < 0)
  2094. return bgp_vty_return (vty, ret);
  2095. if ( ! peer_rsclient_active (peer) )
  2096. {
  2097. bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
  2098. listnode_delete (bgp->rsclient, peer);
  2099. peer_unlock (peer); /* peer bgp rsclient reference */
  2100. }
  2101. bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
  2102. return CMD_SUCCESS;
  2103. }
  2104. /* neighbor route-server-client. */
  2105. DEFUN (neighbor_route_server_client,
  2106. neighbor_route_server_client_cmd,
  2107. NEIGHBOR_CMD2 "route-server-client",
  2108. NEIGHBOR_STR
  2109. NEIGHBOR_ADDR_STR2
  2110. "Configure a neighbor as Route Server client\n")
  2111. {
  2112. return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
  2113. bgp_node_safi(vty));
  2114. }
  2115. DEFUN (no_neighbor_route_server_client,
  2116. no_neighbor_route_server_client_cmd,
  2117. NO_NEIGHBOR_CMD2 "route-server-client",
  2118. NO_STR
  2119. NEIGHBOR_STR
  2120. NEIGHBOR_ADDR_STR2
  2121. "Configure a neighbor as Route Server client\n")
  2122. {
  2123. return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
  2124. bgp_node_safi(vty));
  2125. }
  2126. DEFUN (neighbor_nexthop_local_unchanged,
  2127. neighbor_nexthop_local_unchanged_cmd,
  2128. NEIGHBOR_CMD2 "nexthop-local unchanged",
  2129. NEIGHBOR_STR
  2130. NEIGHBOR_ADDR_STR2
  2131. "Configure treatment of outgoing link-local nexthop attribute\n"
  2132. "Leave link-local nexthop unchanged for this peer\n")
  2133. {
  2134. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2135. bgp_node_safi (vty),
  2136. PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
  2137. }
  2138. DEFUN (no_neighbor_nexthop_local_unchanged,
  2139. no_neighbor_nexthop_local_unchanged_cmd,
  2140. NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
  2141. NO_STR
  2142. NEIGHBOR_STR
  2143. NEIGHBOR_ADDR_STR2
  2144. "Configure treatment of outgoing link-local-nexthop attribute\n"
  2145. "Leave link-local nexthop unchanged for this peer\n")
  2146. {
  2147. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2148. bgp_node_safi (vty),
  2149. PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
  2150. }
  2151. DEFUN (neighbor_attr_unchanged,
  2152. neighbor_attr_unchanged_cmd,
  2153. NEIGHBOR_CMD2 "attribute-unchanged",
  2154. NEIGHBOR_STR
  2155. NEIGHBOR_ADDR_STR2
  2156. "BGP attribute is propagated unchanged to this neighbor\n")
  2157. {
  2158. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2159. bgp_node_safi (vty),
  2160. (PEER_FLAG_AS_PATH_UNCHANGED |
  2161. PEER_FLAG_NEXTHOP_UNCHANGED |
  2162. PEER_FLAG_MED_UNCHANGED));
  2163. }
  2164. DEFUN (neighbor_attr_unchanged1,
  2165. neighbor_attr_unchanged1_cmd,
  2166. NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
  2167. NEIGHBOR_STR
  2168. NEIGHBOR_ADDR_STR2
  2169. "BGP attribute is propagated unchanged to this neighbor\n"
  2170. "As-path attribute\n"
  2171. "Nexthop attribute\n"
  2172. "Med attribute\n")
  2173. {
  2174. u_int16_t flags = 0;
  2175. if (strncmp (argv[1], "as-path", 1) == 0)
  2176. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2177. else if (strncmp (argv[1], "next-hop", 1) == 0)
  2178. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2179. else if (strncmp (argv[1], "med", 1) == 0)
  2180. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2181. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2182. bgp_node_safi (vty), flags);
  2183. }
  2184. DEFUN (neighbor_attr_unchanged2,
  2185. neighbor_attr_unchanged2_cmd,
  2186. NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
  2187. NEIGHBOR_STR
  2188. NEIGHBOR_ADDR_STR2
  2189. "BGP attribute is propagated unchanged to this neighbor\n"
  2190. "As-path attribute\n"
  2191. "Nexthop attribute\n"
  2192. "Med attribute\n")
  2193. {
  2194. u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
  2195. if (strncmp (argv[1], "next-hop", 1) == 0)
  2196. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2197. else if (strncmp (argv[1], "med", 1) == 0)
  2198. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2199. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2200. bgp_node_safi (vty), flags);
  2201. }
  2202. DEFUN (neighbor_attr_unchanged3,
  2203. neighbor_attr_unchanged3_cmd,
  2204. NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
  2205. NEIGHBOR_STR
  2206. NEIGHBOR_ADDR_STR2
  2207. "BGP attribute is propagated unchanged to this neighbor\n"
  2208. "Nexthop attribute\n"
  2209. "As-path attribute\n"
  2210. "Med attribute\n")
  2211. {
  2212. u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
  2213. if (strncmp (argv[1], "as-path", 1) == 0)
  2214. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2215. else if (strncmp (argv[1], "med", 1) == 0)
  2216. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2217. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2218. bgp_node_safi (vty), flags);
  2219. }
  2220. DEFUN (neighbor_attr_unchanged4,
  2221. neighbor_attr_unchanged4_cmd,
  2222. NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
  2223. NEIGHBOR_STR
  2224. NEIGHBOR_ADDR_STR2
  2225. "BGP attribute is propagated unchanged to this neighbor\n"
  2226. "Med attribute\n"
  2227. "As-path attribute\n"
  2228. "Nexthop attribute\n")
  2229. {
  2230. u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
  2231. if (strncmp (argv[1], "as-path", 1) == 0)
  2232. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2233. else if (strncmp (argv[1], "next-hop", 1) == 0)
  2234. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2235. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2236. bgp_node_safi (vty), flags);
  2237. }
  2238. ALIAS (neighbor_attr_unchanged,
  2239. neighbor_attr_unchanged5_cmd,
  2240. NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
  2241. NEIGHBOR_STR
  2242. NEIGHBOR_ADDR_STR2
  2243. "BGP attribute is propagated unchanged to this neighbor\n"
  2244. "As-path attribute\n"
  2245. "Nexthop attribute\n"
  2246. "Med attribute\n")
  2247. ALIAS (neighbor_attr_unchanged,
  2248. neighbor_attr_unchanged6_cmd,
  2249. NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
  2250. NEIGHBOR_STR
  2251. NEIGHBOR_ADDR_STR2
  2252. "BGP attribute is propagated unchanged to this neighbor\n"
  2253. "As-path attribute\n"
  2254. "Med attribute\n"
  2255. "Nexthop attribute\n")
  2256. ALIAS (neighbor_attr_unchanged,
  2257. neighbor_attr_unchanged7_cmd,
  2258. NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
  2259. NEIGHBOR_STR
  2260. NEIGHBOR_ADDR_STR2
  2261. "BGP attribute is propagated unchanged to this neighbor\n"
  2262. "Nexthop attribute\n"
  2263. "Med attribute\n"
  2264. "As-path attribute\n")
  2265. ALIAS (neighbor_attr_unchanged,
  2266. neighbor_attr_unchanged8_cmd,
  2267. NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
  2268. NEIGHBOR_STR
  2269. NEIGHBOR_ADDR_STR2
  2270. "BGP attribute is propagated unchanged to this neighbor\n"
  2271. "Nexthop attribute\n"
  2272. "As-path attribute\n"
  2273. "Med attribute\n")
  2274. ALIAS (neighbor_attr_unchanged,
  2275. neighbor_attr_unchanged9_cmd,
  2276. NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
  2277. NEIGHBOR_STR
  2278. NEIGHBOR_ADDR_STR2
  2279. "BGP attribute is propagated unchanged to this neighbor\n"
  2280. "Med attribute\n"
  2281. "Nexthop attribute\n"
  2282. "As-path attribute\n")
  2283. ALIAS (neighbor_attr_unchanged,
  2284. neighbor_attr_unchanged10_cmd,
  2285. NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
  2286. NEIGHBOR_STR
  2287. NEIGHBOR_ADDR_STR2
  2288. "BGP attribute is propagated unchanged to this neighbor\n"
  2289. "Med attribute\n"
  2290. "As-path attribute\n"
  2291. "Nexthop attribute\n")
  2292. DEFUN (no_neighbor_attr_unchanged,
  2293. no_neighbor_attr_unchanged_cmd,
  2294. NO_NEIGHBOR_CMD2 "attribute-unchanged",
  2295. NO_STR
  2296. NEIGHBOR_STR
  2297. NEIGHBOR_ADDR_STR2
  2298. "BGP attribute is propagated unchanged to this neighbor\n")
  2299. {
  2300. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2301. bgp_node_safi (vty),
  2302. (PEER_FLAG_AS_PATH_UNCHANGED |
  2303. PEER_FLAG_NEXTHOP_UNCHANGED |
  2304. PEER_FLAG_MED_UNCHANGED));
  2305. }
  2306. DEFUN (no_neighbor_attr_unchanged1,
  2307. no_neighbor_attr_unchanged1_cmd,
  2308. NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
  2309. NO_STR
  2310. NEIGHBOR_STR
  2311. NEIGHBOR_ADDR_STR2
  2312. "BGP attribute is propagated unchanged to this neighbor\n"
  2313. "As-path attribute\n"
  2314. "Nexthop attribute\n"
  2315. "Med attribute\n")
  2316. {
  2317. u_int16_t flags = 0;
  2318. if (strncmp (argv[1], "as-path", 1) == 0)
  2319. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2320. else if (strncmp (argv[1], "next-hop", 1) == 0)
  2321. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2322. else if (strncmp (argv[1], "med", 1) == 0)
  2323. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2324. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2325. bgp_node_safi (vty), flags);
  2326. }
  2327. DEFUN (no_neighbor_attr_unchanged2,
  2328. no_neighbor_attr_unchanged2_cmd,
  2329. NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
  2330. NO_STR
  2331. NEIGHBOR_STR
  2332. NEIGHBOR_ADDR_STR2
  2333. "BGP attribute is propagated unchanged to this neighbor\n"
  2334. "As-path attribute\n"
  2335. "Nexthop attribute\n"
  2336. "Med attribute\n")
  2337. {
  2338. u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
  2339. if (strncmp (argv[1], "next-hop", 1) == 0)
  2340. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2341. else if (strncmp (argv[1], "med", 1) == 0)
  2342. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2343. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2344. bgp_node_safi (vty), flags);
  2345. }
  2346. DEFUN (no_neighbor_attr_unchanged3,
  2347. no_neighbor_attr_unchanged3_cmd,
  2348. NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
  2349. NO_STR
  2350. NEIGHBOR_STR
  2351. NEIGHBOR_ADDR_STR2
  2352. "BGP attribute is propagated unchanged to this neighbor\n"
  2353. "Nexthop attribute\n"
  2354. "As-path attribute\n"
  2355. "Med attribute\n")
  2356. {
  2357. u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
  2358. if (strncmp (argv[1], "as-path", 1) == 0)
  2359. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2360. else if (strncmp (argv[1], "med", 1) == 0)
  2361. SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
  2362. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2363. bgp_node_safi (vty), flags);
  2364. }
  2365. DEFUN (no_neighbor_attr_unchanged4,
  2366. no_neighbor_attr_unchanged4_cmd,
  2367. NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
  2368. NO_STR
  2369. NEIGHBOR_STR
  2370. NEIGHBOR_ADDR_STR2
  2371. "BGP attribute is propagated unchanged to this neighbor\n"
  2372. "Med attribute\n"
  2373. "As-path attribute\n"
  2374. "Nexthop attribute\n")
  2375. {
  2376. u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
  2377. if (strncmp (argv[1], "as-path", 1) == 0)
  2378. SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
  2379. else if (strncmp (argv[1], "next-hop", 1) == 0)
  2380. SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
  2381. return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
  2382. bgp_node_safi (vty), flags);
  2383. }
  2384. ALIAS (no_neighbor_attr_unchanged,
  2385. no_neighbor_attr_unchanged5_cmd,
  2386. NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
  2387. NO_STR
  2388. NEIGHBOR_STR
  2389. NEIGHBOR_ADDR_STR2
  2390. "BGP attribute is propagated unchanged to this neighbor\n"
  2391. "As-path attribute\n"
  2392. "Nexthop attribute\n"
  2393. "Med attribute\n")
  2394. ALIAS (no_neighbor_attr_unchanged,
  2395. no_neighbor_attr_unchanged6_cmd,
  2396. NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
  2397. NO_STR
  2398. NEIGHBOR_STR
  2399. NEIGHBOR_ADDR_STR2
  2400. "BGP attribute is propagated unchanged to this neighbor\n"
  2401. "As-path attribute\n"
  2402. "Med attribute\n"
  2403. "Nexthop attribute\n")
  2404. ALIAS (no_neighbor_attr_unchanged,
  2405. no_neighbor_attr_unchanged7_cmd,
  2406. NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
  2407. NO_STR
  2408. NEIGHBOR_STR
  2409. NEIGHBOR_ADDR_STR2
  2410. "BGP attribute is propagated unchanged to this neighbor\n"
  2411. "Nexthop attribute\n"
  2412. "Med attribute\n"
  2413. "As-path attribute\n")
  2414. ALIAS (no_neighbor_attr_unchanged,
  2415. no_neighbor_attr_unchanged8_cmd,
  2416. NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
  2417. NO_STR
  2418. NEIGHBOR_STR
  2419. NEIGHBOR_ADDR_STR2
  2420. "BGP attribute is propagated unchanged to this neighbor\n"
  2421. "Nexthop attribute\n"
  2422. "As-path attribute\n"
  2423. "Med attribute\n")
  2424. ALIAS (no_neighbor_attr_unchanged,
  2425. no_neighbor_attr_unchanged9_cmd,
  2426. NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
  2427. NO_STR
  2428. NEIGHBOR_STR
  2429. NEIGHBOR_ADDR_STR2
  2430. "BGP attribute is propagated unchanged to this neighbor\n"
  2431. "Med attribute\n"
  2432. "Nexthop attribute\n"
  2433. "As-path attribute\n")
  2434. ALIAS (no_neighbor_attr_unchanged,
  2435. no_neighbor_attr_unchanged10_cmd,
  2436. NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
  2437. NO_STR
  2438. NEIGHBOR_STR
  2439. NEIGHBOR_ADDR_STR2
  2440. "BGP attribute is propagated unchanged to this neighbor\n"
  2441. "Med attribute\n"
  2442. "As-path attribute\n"
  2443. "Nexthop attribute\n")
  2444. /* For old version Zebra compatibility. */
  2445. DEFUN_DEPRECATED (neighbor_transparent_as,
  2446. neighbor_transparent_as_cmd,
  2447. NEIGHBOR_CMD "transparent-as",
  2448. NEIGHBOR_STR
  2449. NEIGHBOR_ADDR_STR
  2450. "Do not append my AS number even peer is EBGP peer\n")
  2451. {
  2452. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2453. bgp_node_safi (vty),
  2454. PEER_FLAG_AS_PATH_UNCHANGED);
  2455. }
  2456. DEFUN_DEPRECATED (neighbor_transparent_nexthop,
  2457. neighbor_transparent_nexthop_cmd,
  2458. NEIGHBOR_CMD "transparent-nexthop",
  2459. NEIGHBOR_STR
  2460. NEIGHBOR_ADDR_STR
  2461. "Do not change nexthop even peer is EBGP peer\n")
  2462. {
  2463. return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
  2464. bgp_node_safi (vty),
  2465. PEER_FLAG_NEXTHOP_UNCHANGED);
  2466. }
  2467. /* EBGP multihop configuration. */
  2468. static int
  2469. peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
  2470. const char *ttl_str)
  2471. {
  2472. struct peer *peer;
  2473. unsigned int ttl;
  2474. peer = peer_and_group_lookup_vty (vty, ip_str);
  2475. if (! peer)
  2476. return CMD_WARNING;
  2477. if (! ttl_str)
  2478. ttl = TTL_MAX;
  2479. else
  2480. VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
  2481. return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
  2482. }
  2483. static int
  2484. peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
  2485. {
  2486. struct peer *peer;
  2487. peer = peer_and_group_lookup_vty (vty, ip_str);
  2488. if (! peer)
  2489. return CMD_WARNING;
  2490. return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
  2491. }
  2492. /* neighbor ebgp-multihop. */
  2493. DEFUN (neighbor_ebgp_multihop,
  2494. neighbor_ebgp_multihop_cmd,
  2495. NEIGHBOR_CMD2 "ebgp-multihop",
  2496. NEIGHBOR_STR
  2497. NEIGHBOR_ADDR_STR2
  2498. "Allow EBGP neighbors not on directly connected networks\n")
  2499. {
  2500. return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
  2501. }
  2502. DEFUN (neighbor_ebgp_multihop_ttl,
  2503. neighbor_ebgp_multihop_ttl_cmd,
  2504. NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
  2505. NEIGHBOR_STR
  2506. NEIGHBOR_ADDR_STR2
  2507. "Allow EBGP neighbors not on directly connected networks\n"
  2508. "maximum hop count\n")
  2509. {
  2510. return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
  2511. }
  2512. DEFUN (no_neighbor_ebgp_multihop,
  2513. no_neighbor_ebgp_multihop_cmd,
  2514. NO_NEIGHBOR_CMD2 "ebgp-multihop",
  2515. NO_STR
  2516. NEIGHBOR_STR
  2517. NEIGHBOR_ADDR_STR2
  2518. "Allow EBGP neighbors not on directly connected networks\n")
  2519. {
  2520. return peer_ebgp_multihop_unset_vty (vty, argv[0]);
  2521. }
  2522. ALIAS (no_neighbor_ebgp_multihop,
  2523. no_neighbor_ebgp_multihop_ttl_cmd,
  2524. NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
  2525. NO_STR
  2526. NEIGHBOR_STR
  2527. NEIGHBOR_ADDR_STR2
  2528. "Allow EBGP neighbors not on directly connected networks\n"
  2529. "maximum hop count\n")
  2530. /* disable-connected-check */
  2531. DEFUN (neighbor_disable_connected_check,
  2532. neighbor_disable_connected_check_cmd,
  2533. NEIGHBOR_CMD2 "disable-connected-check",
  2534. NEIGHBOR_STR
  2535. NEIGHBOR_ADDR_STR2
  2536. "one-hop away EBGP peer using loopback address\n")
  2537. {
  2538. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
  2539. }
  2540. DEFUN (no_neighbor_disable_connected_check,
  2541. no_neighbor_disable_connected_check_cmd,
  2542. NO_NEIGHBOR_CMD2 "disable-connected-check",
  2543. NO_STR
  2544. NEIGHBOR_STR
  2545. NEIGHBOR_ADDR_STR2
  2546. "one-hop away EBGP peer using loopback address\n")
  2547. {
  2548. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
  2549. }
  2550. /* Enforce multihop. */
  2551. ALIAS (neighbor_disable_connected_check,
  2552. neighbor_enforce_multihop_cmd,
  2553. NEIGHBOR_CMD2 "enforce-multihop",
  2554. NEIGHBOR_STR
  2555. NEIGHBOR_ADDR_STR2
  2556. "Enforce EBGP neighbors perform multihop\n")
  2557. /* Enforce multihop. */
  2558. ALIAS (no_neighbor_disable_connected_check,
  2559. no_neighbor_enforce_multihop_cmd,
  2560. NO_NEIGHBOR_CMD2 "enforce-multihop",
  2561. NO_STR
  2562. NEIGHBOR_STR
  2563. NEIGHBOR_ADDR_STR2
  2564. "Enforce EBGP neighbors perform multihop\n")
  2565. DEFUN (neighbor_description,
  2566. neighbor_description_cmd,
  2567. NEIGHBOR_CMD2 "description .LINE",
  2568. NEIGHBOR_STR
  2569. NEIGHBOR_ADDR_STR2
  2570. "Neighbor specific description\n"
  2571. "Up to 80 characters describing this neighbor\n")
  2572. {
  2573. struct peer *peer;
  2574. char *str;
  2575. peer = peer_and_group_lookup_vty (vty, argv[0]);
  2576. if (! peer)
  2577. return CMD_WARNING;
  2578. if (argc == 1)
  2579. return CMD_SUCCESS;
  2580. str = argv_concat(argv, argc, 1);
  2581. peer_description_set (peer, str);
  2582. XFREE (MTYPE_TMP, str);
  2583. return CMD_SUCCESS;
  2584. }
  2585. DEFUN (no_neighbor_description,
  2586. no_neighbor_description_cmd,
  2587. NO_NEIGHBOR_CMD2 "description",
  2588. NO_STR
  2589. NEIGHBOR_STR
  2590. NEIGHBOR_ADDR_STR2
  2591. "Neighbor specific description\n")
  2592. {
  2593. struct peer *peer;
  2594. peer = peer_and_group_lookup_vty (vty, argv[0]);
  2595. if (! peer)
  2596. return CMD_WARNING;
  2597. peer_description_unset (peer);
  2598. return CMD_SUCCESS;
  2599. }
  2600. ALIAS (no_neighbor_description,
  2601. no_neighbor_description_val_cmd,
  2602. NO_NEIGHBOR_CMD2 "description .LINE",
  2603. NO_STR
  2604. NEIGHBOR_STR
  2605. NEIGHBOR_ADDR_STR2
  2606. "Neighbor specific description\n"
  2607. "Up to 80 characters describing this neighbor\n")
  2608. /* Neighbor update-source. */
  2609. static int
  2610. peer_update_source_vty (struct vty *vty, const char *peer_str,
  2611. const char *source_str)
  2612. {
  2613. struct peer *peer;
  2614. peer = peer_and_group_lookup_vty (vty, peer_str);
  2615. if (! peer)
  2616. return CMD_WARNING;
  2617. if (source_str)
  2618. {
  2619. union sockunion su;
  2620. int ret = str2sockunion (source_str, &su);
  2621. if (ret == 0)
  2622. peer_update_source_addr_set (peer, &su);
  2623. else
  2624. peer_update_source_if_set (peer, source_str);
  2625. }
  2626. else
  2627. peer_update_source_unset (peer);
  2628. return CMD_SUCCESS;
  2629. }
  2630. #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
  2631. #define BGP_UPDATE_SOURCE_HELP_STR \
  2632. "IPv4 address\n" \
  2633. "IPv6 address\n" \
  2634. "Interface name (requires zebra to be running)\n"
  2635. DEFUN (neighbor_update_source,
  2636. neighbor_update_source_cmd,
  2637. NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
  2638. NEIGHBOR_STR
  2639. NEIGHBOR_ADDR_STR2
  2640. "Source of routing updates\n"
  2641. BGP_UPDATE_SOURCE_HELP_STR)
  2642. {
  2643. return peer_update_source_vty (vty, argv[0], argv[1]);
  2644. }
  2645. DEFUN (no_neighbor_update_source,
  2646. no_neighbor_update_source_cmd,
  2647. NO_NEIGHBOR_CMD2 "update-source",
  2648. NO_STR
  2649. NEIGHBOR_STR
  2650. NEIGHBOR_ADDR_STR2
  2651. "Source of routing updates\n")
  2652. {
  2653. return peer_update_source_vty (vty, argv[0], NULL);
  2654. }
  2655. static int
  2656. peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
  2657. afi_t afi, safi_t safi,
  2658. const char *rmap, int set)
  2659. {
  2660. int ret;
  2661. struct peer *peer;
  2662. peer = peer_and_group_lookup_vty (vty, peer_str);
  2663. if (! peer)
  2664. return CMD_WARNING;
  2665. if (set)
  2666. ret = peer_default_originate_set (peer, afi, safi, rmap);
  2667. else
  2668. ret = peer_default_originate_unset (peer, afi, safi);
  2669. return bgp_vty_return (vty, ret);
  2670. }
  2671. /* neighbor default-originate. */
  2672. DEFUN (neighbor_default_originate,
  2673. neighbor_default_originate_cmd,
  2674. NEIGHBOR_CMD2 "default-originate",
  2675. NEIGHBOR_STR
  2676. NEIGHBOR_ADDR_STR2
  2677. "Originate default route to this neighbor\n")
  2678. {
  2679. return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
  2680. bgp_node_safi (vty), NULL, 1);
  2681. }
  2682. DEFUN (neighbor_default_originate_rmap,
  2683. neighbor_default_originate_rmap_cmd,
  2684. NEIGHBOR_CMD2 "default-originate route-map WORD",
  2685. NEIGHBOR_STR
  2686. NEIGHBOR_ADDR_STR2
  2687. "Originate default route to this neighbor\n"
  2688. "Route-map to specify criteria to originate default\n"
  2689. "route-map name\n")
  2690. {
  2691. return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
  2692. bgp_node_safi (vty), argv[1], 1);
  2693. }
  2694. DEFUN (no_neighbor_default_originate,
  2695. no_neighbor_default_originate_cmd,
  2696. NO_NEIGHBOR_CMD2 "default-originate",
  2697. NO_STR
  2698. NEIGHBOR_STR
  2699. NEIGHBOR_ADDR_STR2
  2700. "Originate default route to this neighbor\n")
  2701. {
  2702. return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
  2703. bgp_node_safi (vty), NULL, 0);
  2704. }
  2705. ALIAS (no_neighbor_default_originate,
  2706. no_neighbor_default_originate_rmap_cmd,
  2707. NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
  2708. NO_STR
  2709. NEIGHBOR_STR
  2710. NEIGHBOR_ADDR_STR2
  2711. "Originate default route to this neighbor\n"
  2712. "Route-map to specify criteria to originate default\n"
  2713. "route-map name\n")
  2714. /* Set neighbor's BGP port. */
  2715. static int
  2716. peer_port_vty (struct vty *vty, const char *ip_str, int afi,
  2717. const char *port_str)
  2718. {
  2719. struct peer *peer;
  2720. u_int16_t port;
  2721. struct servent *sp;
  2722. peer = peer_lookup_vty (vty, ip_str);
  2723. if (! peer)
  2724. return CMD_WARNING;
  2725. if (! port_str)
  2726. {
  2727. sp = getservbyname ("bgp", "tcp");
  2728. port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
  2729. }
  2730. else
  2731. {
  2732. VTY_GET_INTEGER("port", port, port_str);
  2733. }
  2734. peer_port_set (peer, port);
  2735. return CMD_SUCCESS;
  2736. }
  2737. /* Set specified peer's BGP port. */
  2738. DEFUN (neighbor_port,
  2739. neighbor_port_cmd,
  2740. NEIGHBOR_CMD "port <0-65535>",
  2741. NEIGHBOR_STR
  2742. NEIGHBOR_ADDR_STR
  2743. "Neighbor's BGP port\n"
  2744. "TCP port number\n")
  2745. {
  2746. return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
  2747. }
  2748. DEFUN (no_neighbor_port,
  2749. no_neighbor_port_cmd,
  2750. NO_NEIGHBOR_CMD "port",
  2751. NO_STR
  2752. NEIGHBOR_STR
  2753. NEIGHBOR_ADDR_STR
  2754. "Neighbor's BGP port\n")
  2755. {
  2756. return peer_port_vty (vty, argv[0], AFI_IP, NULL);
  2757. }
  2758. ALIAS (no_neighbor_port,
  2759. no_neighbor_port_val_cmd,
  2760. NO_NEIGHBOR_CMD "port <0-65535>",
  2761. NO_STR
  2762. NEIGHBOR_STR
  2763. NEIGHBOR_ADDR_STR
  2764. "Neighbor's BGP port\n"
  2765. "TCP port number\n")
  2766. /* neighbor weight. */
  2767. static int
  2768. peer_weight_set_vty (struct vty *vty, const char *ip_str,
  2769. const char *weight_str)
  2770. {
  2771. struct peer *peer;
  2772. unsigned long weight;
  2773. peer = peer_and_group_lookup_vty (vty, ip_str);
  2774. if (! peer)
  2775. return CMD_WARNING;
  2776. VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
  2777. return bgp_vty_return (vty, peer_weight_set (peer, weight));
  2778. }
  2779. static int
  2780. peer_weight_unset_vty (struct vty *vty, const char *ip_str)
  2781. {
  2782. struct peer *peer;
  2783. peer = peer_and_group_lookup_vty (vty, ip_str);
  2784. if (! peer)
  2785. return CMD_WARNING;
  2786. return bgp_vty_return (vty, peer_weight_unset (peer));
  2787. }
  2788. DEFUN (neighbor_weight,
  2789. neighbor_weight_cmd,
  2790. NEIGHBOR_CMD2 "weight <0-65535>",
  2791. NEIGHBOR_STR
  2792. NEIGHBOR_ADDR_STR2
  2793. "Set default weight for routes from this neighbor\n"
  2794. "default weight\n")
  2795. {
  2796. return peer_weight_set_vty (vty, argv[0], argv[1]);
  2797. }
  2798. DEFUN (no_neighbor_weight,
  2799. no_neighbor_weight_cmd,
  2800. NO_NEIGHBOR_CMD2 "weight",
  2801. NO_STR
  2802. NEIGHBOR_STR
  2803. NEIGHBOR_ADDR_STR2
  2804. "Set default weight for routes from this neighbor\n")
  2805. {
  2806. return peer_weight_unset_vty (vty, argv[0]);
  2807. }
  2808. ALIAS (no_neighbor_weight,
  2809. no_neighbor_weight_val_cmd,
  2810. NO_NEIGHBOR_CMD2 "weight <0-65535>",
  2811. NO_STR
  2812. NEIGHBOR_STR
  2813. NEIGHBOR_ADDR_STR2
  2814. "Set default weight for routes from this neighbor\n"
  2815. "default weight\n")
  2816. /* Override capability negotiation. */
  2817. DEFUN (neighbor_override_capability,
  2818. neighbor_override_capability_cmd,
  2819. NEIGHBOR_CMD2 "override-capability",
  2820. NEIGHBOR_STR
  2821. NEIGHBOR_ADDR_STR2
  2822. "Override capability negotiation result\n")
  2823. {
  2824. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
  2825. }
  2826. DEFUN (no_neighbor_override_capability,
  2827. no_neighbor_override_capability_cmd,
  2828. NO_NEIGHBOR_CMD2 "override-capability",
  2829. NO_STR
  2830. NEIGHBOR_STR
  2831. NEIGHBOR_ADDR_STR2
  2832. "Override capability negotiation result\n")
  2833. {
  2834. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
  2835. }
  2836. DEFUN (neighbor_strict_capability,
  2837. neighbor_strict_capability_cmd,
  2838. NEIGHBOR_CMD "strict-capability-match",
  2839. NEIGHBOR_STR
  2840. NEIGHBOR_ADDR_STR
  2841. "Strict capability negotiation match\n")
  2842. {
  2843. return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
  2844. }
  2845. DEFUN (no_neighbor_strict_capability,
  2846. no_neighbor_strict_capability_cmd,
  2847. NO_NEIGHBOR_CMD "strict-capability-match",
  2848. NO_STR
  2849. NEIGHBOR_STR
  2850. NEIGHBOR_ADDR_STR
  2851. "Strict capability negotiation match\n")
  2852. {
  2853. return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
  2854. }
  2855. static int
  2856. peer_timers_set_vty (struct vty *vty, const char *ip_str,
  2857. const char *keep_str, const char *hold_str)
  2858. {
  2859. int ret;
  2860. struct peer *peer;
  2861. u_int32_t keepalive;
  2862. u_int32_t holdtime;
  2863. peer = peer_and_group_lookup_vty (vty, ip_str);
  2864. if (! peer)
  2865. return CMD_WARNING;
  2866. VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
  2867. VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
  2868. ret = peer_timers_set (peer, keepalive, holdtime);
  2869. return bgp_vty_return (vty, ret);
  2870. }
  2871. static int
  2872. peer_timers_unset_vty (struct vty *vty, const char *ip_str)
  2873. {
  2874. int ret;
  2875. struct peer *peer;
  2876. peer = peer_lookup_vty (vty, ip_str);
  2877. if (! peer)
  2878. return CMD_WARNING;
  2879. ret = peer_timers_unset (peer);
  2880. return bgp_vty_return (vty, ret);
  2881. }
  2882. DEFUN (neighbor_timers,
  2883. neighbor_timers_cmd,
  2884. NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
  2885. NEIGHBOR_STR
  2886. NEIGHBOR_ADDR_STR2
  2887. "BGP per neighbor timers\n"
  2888. "Keepalive interval\n"
  2889. "Holdtime\n")
  2890. {
  2891. return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
  2892. }
  2893. DEFUN (no_neighbor_timers,
  2894. no_neighbor_timers_cmd,
  2895. NO_NEIGHBOR_CMD2 "timers",
  2896. NO_STR
  2897. NEIGHBOR_STR
  2898. NEIGHBOR_ADDR_STR2
  2899. "BGP per neighbor timers\n")
  2900. {
  2901. return peer_timers_unset_vty (vty, argv[0]);
  2902. }
  2903. static int
  2904. peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
  2905. const char *time_str)
  2906. {
  2907. struct peer *peer;
  2908. u_int32_t connect;
  2909. peer = peer_and_group_lookup_vty (vty, ip_str);
  2910. if (! peer)
  2911. return CMD_WARNING;
  2912. VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
  2913. return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
  2914. }
  2915. static int
  2916. peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
  2917. {
  2918. struct peer *peer;
  2919. peer = peer_and_group_lookup_vty (vty, ip_str);
  2920. if (! peer)
  2921. return CMD_WARNING;
  2922. return bgp_vty_return (vty, peer_timers_connect_unset (peer));
  2923. }
  2924. DEFUN (neighbor_timers_connect,
  2925. neighbor_timers_connect_cmd,
  2926. NEIGHBOR_CMD2 "timers connect <1-65535>",
  2927. NEIGHBOR_STR
  2928. NEIGHBOR_ADDR_STR2
  2929. "BGP per neighbor timers\n"
  2930. "BGP connect timer\n"
  2931. "Connect timer\n")
  2932. {
  2933. return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
  2934. }
  2935. DEFUN (no_neighbor_timers_connect,
  2936. no_neighbor_timers_connect_cmd,
  2937. NO_NEIGHBOR_CMD2 "timers connect",
  2938. NO_STR
  2939. NEIGHBOR_STR
  2940. NEIGHBOR_ADDR_STR2
  2941. "BGP per neighbor timers\n"
  2942. "BGP connect timer\n")
  2943. {
  2944. return peer_timers_connect_unset_vty (vty, argv[0]);
  2945. }
  2946. ALIAS (no_neighbor_timers_connect,
  2947. no_neighbor_timers_connect_val_cmd,
  2948. NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
  2949. NO_STR
  2950. NEIGHBOR_STR
  2951. NEIGHBOR_ADDR_STR2
  2952. "BGP per neighbor timers\n"
  2953. "BGP connect timer\n"
  2954. "Connect timer\n")
  2955. static int
  2956. peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
  2957. const char *time_str, int set)
  2958. {
  2959. int ret;
  2960. struct peer *peer;
  2961. u_int32_t routeadv = 0;
  2962. peer = peer_and_group_lookup_vty (vty, ip_str);
  2963. if (! peer)
  2964. return CMD_WARNING;
  2965. if (time_str)
  2966. VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
  2967. if (set)
  2968. ret = peer_advertise_interval_set (peer, routeadv);
  2969. else
  2970. ret = peer_advertise_interval_unset (peer);
  2971. return bgp_vty_return (vty, ret);
  2972. }
  2973. DEFUN (neighbor_advertise_interval,
  2974. neighbor_advertise_interval_cmd,
  2975. NEIGHBOR_CMD2 "advertisement-interval <0-600>",
  2976. NEIGHBOR_STR
  2977. NEIGHBOR_ADDR_STR2
  2978. "Minimum interval between sending BGP routing updates\n"
  2979. "time in seconds\n")
  2980. {
  2981. return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
  2982. }
  2983. DEFUN (no_neighbor_advertise_interval,
  2984. no_neighbor_advertise_interval_cmd,
  2985. NO_NEIGHBOR_CMD2 "advertisement-interval",
  2986. NO_STR
  2987. NEIGHBOR_STR
  2988. NEIGHBOR_ADDR_STR2
  2989. "Minimum interval between sending BGP routing updates\n")
  2990. {
  2991. return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
  2992. }
  2993. ALIAS (no_neighbor_advertise_interval,
  2994. no_neighbor_advertise_interval_val_cmd,
  2995. NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
  2996. NO_STR
  2997. NEIGHBOR_STR
  2998. NEIGHBOR_ADDR_STR2
  2999. "Minimum interval between sending BGP routing updates\n"
  3000. "time in seconds\n")
  3001. /* neighbor interface */
  3002. static int
  3003. peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
  3004. {
  3005. int ret;
  3006. struct peer *peer;
  3007. peer = peer_lookup_vty (vty, ip_str);
  3008. if (! peer)
  3009. return CMD_WARNING;
  3010. if (str)
  3011. ret = peer_interface_set (peer, str);
  3012. else
  3013. ret = peer_interface_unset (peer);
  3014. return bgp_vty_return (vty, ret);
  3015. }
  3016. DEFUN (neighbor_interface,
  3017. neighbor_interface_cmd,
  3018. NEIGHBOR_CMD "interface WORD",
  3019. NEIGHBOR_STR
  3020. NEIGHBOR_ADDR_STR
  3021. "Interface\n"
  3022. "Interface name\n")
  3023. {
  3024. return peer_interface_vty (vty, argv[0], argv[1]);
  3025. }
  3026. DEFUN (no_neighbor_interface,
  3027. no_neighbor_interface_cmd,
  3028. NO_NEIGHBOR_CMD "interface WORD",
  3029. NO_STR
  3030. NEIGHBOR_STR
  3031. NEIGHBOR_ADDR_STR
  3032. "Interface\n"
  3033. "Interface name\n")
  3034. {
  3035. return peer_interface_vty (vty, argv[0], NULL);
  3036. }
  3037. /* Set distribute list to the peer. */
  3038. static int
  3039. peer_distribute_set_vty (struct vty *vty, const char *ip_str,
  3040. afi_t afi, safi_t safi,
  3041. const char *name_str, const char *direct_str)
  3042. {
  3043. int ret;
  3044. struct peer *peer;
  3045. int direct = FILTER_IN;
  3046. peer = peer_and_group_lookup_vty (vty, ip_str);
  3047. if (! peer)
  3048. return CMD_WARNING;
  3049. /* Check filter direction. */
  3050. if (strncmp (direct_str, "i", 1) == 0)
  3051. direct = FILTER_IN;
  3052. else if (strncmp (direct_str, "o", 1) == 0)
  3053. direct = FILTER_OUT;
  3054. ret = peer_distribute_set (peer, afi, safi, direct, name_str);
  3055. return bgp_vty_return (vty, ret);
  3056. }
  3057. static int
  3058. peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3059. safi_t safi, const char *direct_str)
  3060. {
  3061. int ret;
  3062. struct peer *peer;
  3063. int direct = FILTER_IN;
  3064. peer = peer_and_group_lookup_vty (vty, ip_str);
  3065. if (! peer)
  3066. return CMD_WARNING;
  3067. /* Check filter direction. */
  3068. if (strncmp (direct_str, "i", 1) == 0)
  3069. direct = FILTER_IN;
  3070. else if (strncmp (direct_str, "o", 1) == 0)
  3071. direct = FILTER_OUT;
  3072. ret = peer_distribute_unset (peer, afi, safi, direct);
  3073. return bgp_vty_return (vty, ret);
  3074. }
  3075. DEFUN (neighbor_distribute_list,
  3076. neighbor_distribute_list_cmd,
  3077. NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
  3078. NEIGHBOR_STR
  3079. NEIGHBOR_ADDR_STR2
  3080. "Filter updates to/from this neighbor\n"
  3081. "IP access-list number\n"
  3082. "IP access-list number (expanded range)\n"
  3083. "IP Access-list name\n"
  3084. "Filter incoming updates\n"
  3085. "Filter outgoing updates\n")
  3086. {
  3087. return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
  3088. bgp_node_safi (vty), argv[1], argv[2]);
  3089. }
  3090. DEFUN (no_neighbor_distribute_list,
  3091. no_neighbor_distribute_list_cmd,
  3092. NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
  3093. NO_STR
  3094. NEIGHBOR_STR
  3095. NEIGHBOR_ADDR_STR2
  3096. "Filter updates to/from this neighbor\n"
  3097. "IP access-list number\n"
  3098. "IP access-list number (expanded range)\n"
  3099. "IP Access-list name\n"
  3100. "Filter incoming updates\n"
  3101. "Filter outgoing updates\n")
  3102. {
  3103. return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3104. bgp_node_safi (vty), argv[2]);
  3105. }
  3106. /* Set prefix list to the peer. */
  3107. static int
  3108. peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3109. safi_t safi, const char *name_str,
  3110. const char *direct_str)
  3111. {
  3112. int ret;
  3113. struct peer *peer;
  3114. int direct = FILTER_IN;
  3115. peer = peer_and_group_lookup_vty (vty, ip_str);
  3116. if (! peer)
  3117. return CMD_WARNING;
  3118. /* Check filter direction. */
  3119. if (strncmp (direct_str, "i", 1) == 0)
  3120. direct = FILTER_IN;
  3121. else if (strncmp (direct_str, "o", 1) == 0)
  3122. direct = FILTER_OUT;
  3123. ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
  3124. return bgp_vty_return (vty, ret);
  3125. }
  3126. static int
  3127. peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3128. safi_t safi, const char *direct_str)
  3129. {
  3130. int ret;
  3131. struct peer *peer;
  3132. int direct = FILTER_IN;
  3133. peer = peer_and_group_lookup_vty (vty, ip_str);
  3134. if (! peer)
  3135. return CMD_WARNING;
  3136. /* Check filter direction. */
  3137. if (strncmp (direct_str, "i", 1) == 0)
  3138. direct = FILTER_IN;
  3139. else if (strncmp (direct_str, "o", 1) == 0)
  3140. direct = FILTER_OUT;
  3141. ret = peer_prefix_list_unset (peer, afi, safi, direct);
  3142. return bgp_vty_return (vty, ret);
  3143. }
  3144. DEFUN (neighbor_prefix_list,
  3145. neighbor_prefix_list_cmd,
  3146. NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
  3147. NEIGHBOR_STR
  3148. NEIGHBOR_ADDR_STR2
  3149. "Filter updates to/from this neighbor\n"
  3150. "Name of a prefix list\n"
  3151. "Filter incoming updates\n"
  3152. "Filter outgoing updates\n")
  3153. {
  3154. return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
  3155. bgp_node_safi (vty), argv[1], argv[2]);
  3156. }
  3157. DEFUN (no_neighbor_prefix_list,
  3158. no_neighbor_prefix_list_cmd,
  3159. NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
  3160. NO_STR
  3161. NEIGHBOR_STR
  3162. NEIGHBOR_ADDR_STR2
  3163. "Filter updates to/from this neighbor\n"
  3164. "Name of a prefix list\n"
  3165. "Filter incoming updates\n"
  3166. "Filter outgoing updates\n")
  3167. {
  3168. return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3169. bgp_node_safi (vty), argv[2]);
  3170. }
  3171. static int
  3172. peer_aslist_set_vty (struct vty *vty, const char *ip_str,
  3173. afi_t afi, safi_t safi,
  3174. const char *name_str, const char *direct_str)
  3175. {
  3176. int ret;
  3177. struct peer *peer;
  3178. int direct = FILTER_IN;
  3179. peer = peer_and_group_lookup_vty (vty, ip_str);
  3180. if (! peer)
  3181. return CMD_WARNING;
  3182. /* Check filter direction. */
  3183. if (strncmp (direct_str, "i", 1) == 0)
  3184. direct = FILTER_IN;
  3185. else if (strncmp (direct_str, "o", 1) == 0)
  3186. direct = FILTER_OUT;
  3187. ret = peer_aslist_set (peer, afi, safi, direct, name_str);
  3188. return bgp_vty_return (vty, ret);
  3189. }
  3190. static int
  3191. peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
  3192. afi_t afi, safi_t safi,
  3193. const char *direct_str)
  3194. {
  3195. int ret;
  3196. struct peer *peer;
  3197. int direct = FILTER_IN;
  3198. peer = peer_and_group_lookup_vty (vty, ip_str);
  3199. if (! peer)
  3200. return CMD_WARNING;
  3201. /* Check filter direction. */
  3202. if (strncmp (direct_str, "i", 1) == 0)
  3203. direct = FILTER_IN;
  3204. else if (strncmp (direct_str, "o", 1) == 0)
  3205. direct = FILTER_OUT;
  3206. ret = peer_aslist_unset (peer, afi, safi, direct);
  3207. return bgp_vty_return (vty, ret);
  3208. }
  3209. DEFUN (neighbor_filter_list,
  3210. neighbor_filter_list_cmd,
  3211. NEIGHBOR_CMD2 "filter-list WORD (in|out)",
  3212. NEIGHBOR_STR
  3213. NEIGHBOR_ADDR_STR2
  3214. "Establish BGP filters\n"
  3215. "AS path access-list name\n"
  3216. "Filter incoming routes\n"
  3217. "Filter outgoing routes\n")
  3218. {
  3219. return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
  3220. bgp_node_safi (vty), argv[1], argv[2]);
  3221. }
  3222. DEFUN (no_neighbor_filter_list,
  3223. no_neighbor_filter_list_cmd,
  3224. NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
  3225. NO_STR
  3226. NEIGHBOR_STR
  3227. NEIGHBOR_ADDR_STR2
  3228. "Establish BGP filters\n"
  3229. "AS path access-list name\n"
  3230. "Filter incoming routes\n"
  3231. "Filter outgoing routes\n")
  3232. {
  3233. return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3234. bgp_node_safi (vty), argv[2]);
  3235. }
  3236. /* Set route-map to the peer. */
  3237. static int
  3238. peer_route_map_set_vty (struct vty *vty, const char *ip_str,
  3239. afi_t afi, safi_t safi,
  3240. const char *name_str, const char *direct_str)
  3241. {
  3242. int ret;
  3243. struct peer *peer;
  3244. int direct = RMAP_IN;
  3245. peer = peer_and_group_lookup_vty (vty, ip_str);
  3246. if (! peer)
  3247. return CMD_WARNING;
  3248. /* Check filter direction. */
  3249. if (strncmp (direct_str, "in", 2) == 0)
  3250. direct = RMAP_IN;
  3251. else if (strncmp (direct_str, "o", 1) == 0)
  3252. direct = RMAP_OUT;
  3253. else if (strncmp (direct_str, "im", 2) == 0)
  3254. direct = RMAP_IMPORT;
  3255. else if (strncmp (direct_str, "e", 1) == 0)
  3256. direct = RMAP_EXPORT;
  3257. ret = peer_route_map_set (peer, afi, safi, direct, name_str);
  3258. return bgp_vty_return (vty, ret);
  3259. }
  3260. static int
  3261. peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3262. safi_t safi, const char *direct_str)
  3263. {
  3264. int ret;
  3265. struct peer *peer;
  3266. int direct = RMAP_IN;
  3267. peer = peer_and_group_lookup_vty (vty, ip_str);
  3268. if (! peer)
  3269. return CMD_WARNING;
  3270. /* Check filter direction. */
  3271. if (strncmp (direct_str, "in", 2) == 0)
  3272. direct = RMAP_IN;
  3273. else if (strncmp (direct_str, "o", 1) == 0)
  3274. direct = RMAP_OUT;
  3275. else if (strncmp (direct_str, "im", 2) == 0)
  3276. direct = RMAP_IMPORT;
  3277. else if (strncmp (direct_str, "e", 1) == 0)
  3278. direct = RMAP_EXPORT;
  3279. ret = peer_route_map_unset (peer, afi, safi, direct);
  3280. return bgp_vty_return (vty, ret);
  3281. }
  3282. DEFUN (neighbor_route_map,
  3283. neighbor_route_map_cmd,
  3284. NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
  3285. NEIGHBOR_STR
  3286. NEIGHBOR_ADDR_STR2
  3287. "Apply route map to neighbor\n"
  3288. "Name of route map\n"
  3289. "Apply map to incoming routes\n"
  3290. "Apply map to outbound routes\n"
  3291. "Apply map to routes going into a Route-Server client's table\n"
  3292. "Apply map to routes coming from a Route-Server client")
  3293. {
  3294. return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
  3295. bgp_node_safi (vty), argv[1], argv[2]);
  3296. }
  3297. DEFUN (no_neighbor_route_map,
  3298. no_neighbor_route_map_cmd,
  3299. NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
  3300. NO_STR
  3301. NEIGHBOR_STR
  3302. NEIGHBOR_ADDR_STR2
  3303. "Apply route map to neighbor\n"
  3304. "Name of route map\n"
  3305. "Apply map to incoming routes\n"
  3306. "Apply map to outbound routes\n"
  3307. "Apply map to routes going into a Route-Server client's table\n"
  3308. "Apply map to routes coming from a Route-Server client")
  3309. {
  3310. return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3311. bgp_node_safi (vty), argv[2]);
  3312. }
  3313. /* Set unsuppress-map to the peer. */
  3314. static int
  3315. peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3316. safi_t safi, const char *name_str)
  3317. {
  3318. int ret;
  3319. struct peer *peer;
  3320. peer = peer_and_group_lookup_vty (vty, ip_str);
  3321. if (! peer)
  3322. return CMD_WARNING;
  3323. ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
  3324. return bgp_vty_return (vty, ret);
  3325. }
  3326. /* Unset route-map from the peer. */
  3327. static int
  3328. peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3329. safi_t safi)
  3330. {
  3331. int ret;
  3332. struct peer *peer;
  3333. peer = peer_and_group_lookup_vty (vty, ip_str);
  3334. if (! peer)
  3335. return CMD_WARNING;
  3336. ret = peer_unsuppress_map_unset (peer, afi, safi);
  3337. return bgp_vty_return (vty, ret);
  3338. }
  3339. DEFUN (neighbor_unsuppress_map,
  3340. neighbor_unsuppress_map_cmd,
  3341. NEIGHBOR_CMD2 "unsuppress-map WORD",
  3342. NEIGHBOR_STR
  3343. NEIGHBOR_ADDR_STR2
  3344. "Route-map to selectively unsuppress suppressed routes\n"
  3345. "Name of route map\n")
  3346. {
  3347. return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
  3348. bgp_node_safi (vty), argv[1]);
  3349. }
  3350. DEFUN (no_neighbor_unsuppress_map,
  3351. no_neighbor_unsuppress_map_cmd,
  3352. NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
  3353. NO_STR
  3354. NEIGHBOR_STR
  3355. NEIGHBOR_ADDR_STR2
  3356. "Route-map to selectively unsuppress suppressed routes\n"
  3357. "Name of route map\n")
  3358. {
  3359. return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3360. bgp_node_safi (vty));
  3361. }
  3362. static int
  3363. peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3364. safi_t safi, const char *num_str,
  3365. const char *threshold_str, int warning,
  3366. const char *restart_str)
  3367. {
  3368. int ret;
  3369. struct peer *peer;
  3370. u_int32_t max;
  3371. u_char threshold;
  3372. u_int16_t restart;
  3373. peer = peer_and_group_lookup_vty (vty, ip_str);
  3374. if (! peer)
  3375. return CMD_WARNING;
  3376. VTY_GET_INTEGER ("maximum number", max, num_str);
  3377. if (threshold_str)
  3378. threshold = atoi (threshold_str);
  3379. else
  3380. threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
  3381. if (restart_str)
  3382. restart = atoi (restart_str);
  3383. else
  3384. restart = 0;
  3385. ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
  3386. return bgp_vty_return (vty, ret);
  3387. }
  3388. static int
  3389. peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
  3390. safi_t safi)
  3391. {
  3392. int ret;
  3393. struct peer *peer;
  3394. peer = peer_and_group_lookup_vty (vty, ip_str);
  3395. if (! peer)
  3396. return CMD_WARNING;
  3397. ret = peer_maximum_prefix_unset (peer, afi, safi);
  3398. return bgp_vty_return (vty, ret);
  3399. }
  3400. /* Maximum number of prefix configuration. prefix count is different
  3401. for each peer configuration. So this configuration can be set for
  3402. each peer configuration. */
  3403. DEFUN (neighbor_maximum_prefix,
  3404. neighbor_maximum_prefix_cmd,
  3405. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
  3406. NEIGHBOR_STR
  3407. NEIGHBOR_ADDR_STR2
  3408. "Maximum number of prefix accept from this peer\n"
  3409. "maximum no. of prefix limit\n")
  3410. {
  3411. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3412. bgp_node_safi (vty), argv[1], NULL, 0,
  3413. NULL);
  3414. }
  3415. DEFUN (neighbor_maximum_prefix_threshold,
  3416. neighbor_maximum_prefix_threshold_cmd,
  3417. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
  3418. NEIGHBOR_STR
  3419. NEIGHBOR_ADDR_STR2
  3420. "Maximum number of prefix accept from this peer\n"
  3421. "maximum no. of prefix limit\n"
  3422. "Threshold value (%) at which to generate a warning msg\n")
  3423. {
  3424. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3425. bgp_node_safi (vty), argv[1], argv[2], 0,
  3426. NULL);
  3427. }
  3428. DEFUN (neighbor_maximum_prefix_warning,
  3429. neighbor_maximum_prefix_warning_cmd,
  3430. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
  3431. NEIGHBOR_STR
  3432. NEIGHBOR_ADDR_STR2
  3433. "Maximum number of prefix accept from this peer\n"
  3434. "maximum no. of prefix limit\n"
  3435. "Only give warning message when limit is exceeded\n")
  3436. {
  3437. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3438. bgp_node_safi (vty), argv[1], NULL, 1,
  3439. NULL);
  3440. }
  3441. DEFUN (neighbor_maximum_prefix_threshold_warning,
  3442. neighbor_maximum_prefix_threshold_warning_cmd,
  3443. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
  3444. NEIGHBOR_STR
  3445. NEIGHBOR_ADDR_STR2
  3446. "Maximum number of prefix accept from this peer\n"
  3447. "maximum no. of prefix limit\n"
  3448. "Threshold value (%) at which to generate a warning msg\n"
  3449. "Only give warning message when limit is exceeded\n")
  3450. {
  3451. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3452. bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
  3453. }
  3454. DEFUN (neighbor_maximum_prefix_restart,
  3455. neighbor_maximum_prefix_restart_cmd,
  3456. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
  3457. NEIGHBOR_STR
  3458. NEIGHBOR_ADDR_STR2
  3459. "Maximum number of prefix accept from this peer\n"
  3460. "maximum no. of prefix limit\n"
  3461. "Restart bgp connection after limit is exceeded\n"
  3462. "Restart interval in minutes")
  3463. {
  3464. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3465. bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
  3466. }
  3467. DEFUN (neighbor_maximum_prefix_threshold_restart,
  3468. neighbor_maximum_prefix_threshold_restart_cmd,
  3469. NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
  3470. NEIGHBOR_STR
  3471. NEIGHBOR_ADDR_STR2
  3472. "Maximum number of prefix accept from this peer\n"
  3473. "maximum no. of prefix limit\n"
  3474. "Threshold value (%) at which to generate a warning msg\n"
  3475. "Restart bgp connection after limit is exceeded\n"
  3476. "Restart interval in minutes")
  3477. {
  3478. return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
  3479. bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
  3480. }
  3481. DEFUN (no_neighbor_maximum_prefix,
  3482. no_neighbor_maximum_prefix_cmd,
  3483. NO_NEIGHBOR_CMD2 "maximum-prefix",
  3484. NO_STR
  3485. NEIGHBOR_STR
  3486. NEIGHBOR_ADDR_STR2
  3487. "Maximum number of prefix accept from this peer\n")
  3488. {
  3489. return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
  3490. bgp_node_safi (vty));
  3491. }
  3492. ALIAS (no_neighbor_maximum_prefix,
  3493. no_neighbor_maximum_prefix_val_cmd,
  3494. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
  3495. NO_STR
  3496. NEIGHBOR_STR
  3497. NEIGHBOR_ADDR_STR2
  3498. "Maximum number of prefix accept from this peer\n"
  3499. "maximum no. of prefix limit\n")
  3500. ALIAS (no_neighbor_maximum_prefix,
  3501. no_neighbor_maximum_prefix_threshold_cmd,
  3502. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
  3503. NO_STR
  3504. NEIGHBOR_STR
  3505. NEIGHBOR_ADDR_STR2
  3506. "Maximum number of prefix accept from this peer\n"
  3507. "maximum no. of prefix limit\n"
  3508. "Threshold value (%) at which to generate a warning msg\n")
  3509. ALIAS (no_neighbor_maximum_prefix,
  3510. no_neighbor_maximum_prefix_warning_cmd,
  3511. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
  3512. NO_STR
  3513. NEIGHBOR_STR
  3514. NEIGHBOR_ADDR_STR2
  3515. "Maximum number of prefix accept from this peer\n"
  3516. "maximum no. of prefix limit\n"
  3517. "Only give warning message when limit is exceeded\n")
  3518. ALIAS (no_neighbor_maximum_prefix,
  3519. no_neighbor_maximum_prefix_threshold_warning_cmd,
  3520. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
  3521. NO_STR
  3522. NEIGHBOR_STR
  3523. NEIGHBOR_ADDR_STR2
  3524. "Maximum number of prefix accept from this peer\n"
  3525. "maximum no. of prefix limit\n"
  3526. "Threshold value (%) at which to generate a warning msg\n"
  3527. "Only give warning message when limit is exceeded\n")
  3528. ALIAS (no_neighbor_maximum_prefix,
  3529. no_neighbor_maximum_prefix_restart_cmd,
  3530. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
  3531. NO_STR
  3532. NEIGHBOR_STR
  3533. NEIGHBOR_ADDR_STR2
  3534. "Maximum number of prefix accept from this peer\n"
  3535. "maximum no. of prefix limit\n"
  3536. "Restart bgp connection after limit is exceeded\n"
  3537. "Restart interval in minutes")
  3538. ALIAS (no_neighbor_maximum_prefix,
  3539. no_neighbor_maximum_prefix_threshold_restart_cmd,
  3540. NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
  3541. NO_STR
  3542. NEIGHBOR_STR
  3543. NEIGHBOR_ADDR_STR2
  3544. "Maximum number of prefix accept from this peer\n"
  3545. "maximum no. of prefix limit\n"
  3546. "Threshold value (%) at which to generate a warning msg\n"
  3547. "Restart bgp connection after limit is exceeded\n"
  3548. "Restart interval in minutes")
  3549. /* "neighbor allowas-in" */
  3550. DEFUN (neighbor_allowas_in,
  3551. neighbor_allowas_in_cmd,
  3552. NEIGHBOR_CMD2 "allowas-in",
  3553. NEIGHBOR_STR
  3554. NEIGHBOR_ADDR_STR2
  3555. "Accept as-path with my AS present in it\n")
  3556. {
  3557. int ret;
  3558. struct peer *peer;
  3559. unsigned int allow_num;
  3560. peer = peer_and_group_lookup_vty (vty, argv[0]);
  3561. if (! peer)
  3562. return CMD_WARNING;
  3563. if (argc == 1)
  3564. allow_num = 3;
  3565. else
  3566. VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
  3567. ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
  3568. allow_num);
  3569. return bgp_vty_return (vty, ret);
  3570. }
  3571. ALIAS (neighbor_allowas_in,
  3572. neighbor_allowas_in_arg_cmd,
  3573. NEIGHBOR_CMD2 "allowas-in <1-10>",
  3574. NEIGHBOR_STR
  3575. NEIGHBOR_ADDR_STR2
  3576. "Accept as-path with my AS present in it\n"
  3577. "Number of occurances of AS number\n")
  3578. DEFUN (no_neighbor_allowas_in,
  3579. no_neighbor_allowas_in_cmd,
  3580. NO_NEIGHBOR_CMD2 "allowas-in",
  3581. NO_STR
  3582. NEIGHBOR_STR
  3583. NEIGHBOR_ADDR_STR2
  3584. "allow local ASN appears in aspath attribute\n")
  3585. {
  3586. int ret;
  3587. struct peer *peer;
  3588. peer = peer_and_group_lookup_vty (vty, argv[0]);
  3589. if (! peer)
  3590. return CMD_WARNING;
  3591. ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
  3592. return bgp_vty_return (vty, ret);
  3593. }
  3594. DEFUN (neighbor_ttl_security,
  3595. neighbor_ttl_security_cmd,
  3596. NEIGHBOR_CMD2 "ttl-security hops <1-254>",
  3597. NEIGHBOR_STR
  3598. NEIGHBOR_ADDR_STR2
  3599. "Specify the maximum number of hops to the BGP peer\n")
  3600. {
  3601. struct peer *peer;
  3602. int gtsm_hops;
  3603. peer = peer_and_group_lookup_vty (vty, argv[0]);
  3604. if (! peer)
  3605. return CMD_WARNING;
  3606. VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
  3607. return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
  3608. }
  3609. DEFUN (no_neighbor_ttl_security,
  3610. no_neighbor_ttl_security_cmd,
  3611. NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
  3612. NO_STR
  3613. NEIGHBOR_STR
  3614. NEIGHBOR_ADDR_STR2
  3615. "Specify the maximum number of hops to the BGP peer\n")
  3616. {
  3617. struct peer *peer;
  3618. peer = peer_and_group_lookup_vty (vty, argv[0]);
  3619. if (! peer)
  3620. return CMD_WARNING;
  3621. return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
  3622. }
  3623. /* Address family configuration. */
  3624. DEFUN (address_family_ipv4,
  3625. address_family_ipv4_cmd,
  3626. "address-family ipv4",
  3627. "Enter Address Family command mode\n"
  3628. "Address family\n")
  3629. {
  3630. vty->node = BGP_IPV4_NODE;
  3631. return CMD_SUCCESS;
  3632. }
  3633. DEFUN (address_family_ipv4_safi,
  3634. address_family_ipv4_safi_cmd,
  3635. "address-family ipv4 (unicast|multicast)",
  3636. "Enter Address Family command mode\n"
  3637. "Address family\n"
  3638. "Address Family modifier\n"
  3639. "Address Family modifier\n")
  3640. {
  3641. if (strncmp (argv[0], "m", 1) == 0)
  3642. vty->node = BGP_IPV4M_NODE;
  3643. else
  3644. vty->node = BGP_IPV4_NODE;
  3645. return CMD_SUCCESS;
  3646. }
  3647. DEFUN (address_family_ipv6,
  3648. address_family_ipv6_cmd,
  3649. "address-family ipv6",
  3650. "Enter Address Family command mode\n"
  3651. "Address family\n")
  3652. {
  3653. vty->node = BGP_IPV6_NODE;
  3654. return CMD_SUCCESS;
  3655. }
  3656. DEFUN (address_family_ipv6_safi,
  3657. address_family_ipv6_safi_cmd,
  3658. "address-family ipv6 (unicast|multicast)",
  3659. "Enter Address Family command mode\n"
  3660. "Address family\n"
  3661. "Address Family modifier\n"
  3662. "Address Family modifier\n")
  3663. {
  3664. if (strncmp (argv[0], "m", 1) == 0)
  3665. vty->node = BGP_IPV6M_NODE;
  3666. else
  3667. vty->node = BGP_IPV6_NODE;
  3668. return CMD_SUCCESS;
  3669. }
  3670. DEFUN (address_family_vpnv4,
  3671. address_family_vpnv4_cmd,
  3672. "address-family vpnv4",
  3673. "Enter Address Family command mode\n"
  3674. "Address family\n")
  3675. {
  3676. vty->node = BGP_VPNV4_NODE;
  3677. return CMD_SUCCESS;
  3678. }
  3679. ALIAS (address_family_vpnv4,
  3680. address_family_vpnv4_unicast_cmd,
  3681. "address-family vpnv4 unicast",
  3682. "Enter Address Family command mode\n"
  3683. "Address family\n"
  3684. "Address Family Modifier\n")
  3685. DEFUN (exit_address_family,
  3686. exit_address_family_cmd,
  3687. "exit-address-family",
  3688. "Exit from Address Family configuration mode\n")
  3689. {
  3690. if (vty->node == BGP_IPV4_NODE
  3691. || vty->node == BGP_IPV4M_NODE
  3692. || vty->node == BGP_VPNV4_NODE
  3693. || vty->node == BGP_IPV6_NODE
  3694. || vty->node == BGP_IPV6M_NODE)
  3695. vty->node = BGP_NODE;
  3696. return CMD_SUCCESS;
  3697. }
  3698. /* BGP clear sort. */
  3699. enum clear_sort
  3700. {
  3701. clear_all,
  3702. clear_peer,
  3703. clear_group,
  3704. clear_external,
  3705. clear_as
  3706. };
  3707. static void
  3708. bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
  3709. safi_t safi, int error)
  3710. {
  3711. switch (error)
  3712. {
  3713. case BGP_ERR_AF_UNCONFIGURED:
  3714. vty_out (vty,
  3715. "%%BGP: Enable %s %s address family for the neighbor %s%s",
  3716. afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
  3717. safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
  3718. peer->host, VTY_NEWLINE);
  3719. break;
  3720. case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
  3721. 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);
  3722. break;
  3723. default:
  3724. break;
  3725. }
  3726. }
  3727. /* `clear ip bgp' functions. */
  3728. static int
  3729. bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
  3730. enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
  3731. {
  3732. int ret;
  3733. struct peer *peer;
  3734. struct listnode *node, *nnode;
  3735. /* Clear all neighbors. */
  3736. if (sort == clear_all)
  3737. {
  3738. for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
  3739. {
  3740. if (stype == BGP_CLEAR_SOFT_NONE)
  3741. ret = peer_clear (peer);
  3742. else
  3743. ret = peer_clear_soft (peer, afi, safi, stype);
  3744. if (ret < 0)
  3745. bgp_clear_vty_error (vty, peer, afi, safi, ret);
  3746. }
  3747. return CMD_SUCCESS;
  3748. }
  3749. /* Clear specified neighbors. */
  3750. if (sort == clear_peer)
  3751. {
  3752. union sockunion su;
  3753. int ret;
  3754. /* Make sockunion for lookup. */
  3755. ret = str2sockunion (arg, &su);
  3756. if (ret < 0)
  3757. {
  3758. vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
  3759. return CMD_WARNING;
  3760. }
  3761. peer = peer_lookup (bgp, &su);
  3762. if (! peer)
  3763. {
  3764. vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
  3765. return CMD_WARNING;
  3766. }
  3767. if (stype == BGP_CLEAR_SOFT_NONE)
  3768. ret = peer_clear (peer);
  3769. else
  3770. ret = peer_clear_soft (peer, afi, safi, stype);
  3771. if (ret < 0)
  3772. bgp_clear_vty_error (vty, peer, afi, safi, ret);
  3773. return CMD_SUCCESS;
  3774. }
  3775. /* Clear all peer-group members. */
  3776. if (sort == clear_group)
  3777. {
  3778. struct peer_group *group;
  3779. group = peer_group_lookup (bgp, arg);
  3780. if (! group)
  3781. {
  3782. vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
  3783. return CMD_WARNING;
  3784. }
  3785. for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
  3786. {
  3787. if (stype == BGP_CLEAR_SOFT_NONE)
  3788. {
  3789. ret = peer_clear (peer);
  3790. continue;
  3791. }
  3792. if (! peer->af_group[afi][safi])
  3793. continue;
  3794. ret = peer_clear_soft (peer, afi, safi, stype);
  3795. if (ret < 0)
  3796. bgp_clear_vty_error (vty, peer, afi, safi, ret);
  3797. }
  3798. return CMD_SUCCESS;
  3799. }
  3800. if (sort == clear_external)
  3801. {
  3802. for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
  3803. {
  3804. if (peer->sort == BGP_PEER_IBGP)
  3805. continue;
  3806. if (stype == BGP_CLEAR_SOFT_NONE)
  3807. ret = peer_clear (peer);
  3808. else
  3809. ret = peer_clear_soft (peer, afi, safi, stype);
  3810. if (ret < 0)
  3811. bgp_clear_vty_error (vty, peer, afi, safi, ret);
  3812. }
  3813. return CMD_SUCCESS;
  3814. }
  3815. if (sort == clear_as)
  3816. {
  3817. as_t as;
  3818. int find = 0;
  3819. VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
  3820. for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
  3821. {
  3822. if (peer->as != as)
  3823. continue;
  3824. find = 1;
  3825. if (stype == BGP_CLEAR_SOFT_NONE)
  3826. ret = peer_clear (peer);
  3827. else
  3828. ret = peer_clear_soft (peer, afi, safi, stype);
  3829. if (ret < 0)
  3830. bgp_clear_vty_error (vty, peer, afi, safi, ret);
  3831. }
  3832. if (! find)
  3833. vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
  3834. VTY_NEWLINE);
  3835. return CMD_SUCCESS;
  3836. }
  3837. return CMD_SUCCESS;
  3838. }
  3839. static int
  3840. bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
  3841. enum clear_sort sort, enum bgp_clear_type stype,
  3842. const char *arg)
  3843. {
  3844. struct bgp *bgp;
  3845. /* BGP structure lookup. */
  3846. if (name)
  3847. {
  3848. bgp = bgp_lookup_by_name (name);
  3849. if (bgp == NULL)
  3850. {
  3851. vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
  3852. return CMD_WARNING;
  3853. }
  3854. }
  3855. else
  3856. {
  3857. bgp = bgp_get_default ();
  3858. if (bgp == NULL)
  3859. {
  3860. vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
  3861. return CMD_WARNING;
  3862. }
  3863. }
  3864. return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
  3865. }
  3866. DEFUN (clear_ip_bgp_all,
  3867. clear_ip_bgp_all_cmd,
  3868. "clear ip bgp *",
  3869. CLEAR_STR
  3870. IP_STR
  3871. BGP_STR
  3872. "Clear all peers\n")
  3873. {
  3874. if (argc == 1)
  3875. return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
  3876. return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
  3877. }
  3878. ALIAS (clear_ip_bgp_all,
  3879. clear_bgp_all_cmd,
  3880. "clear bgp *",
  3881. CLEAR_STR
  3882. BGP_STR
  3883. "Clear all peers\n")
  3884. ALIAS (clear_ip_bgp_all,
  3885. clear_bgp_ipv6_all_cmd,
  3886. "clear bgp ipv6 *",
  3887. CLEAR_STR
  3888. BGP_STR
  3889. "Address family\n"
  3890. "Clear all peers\n")
  3891. ALIAS (clear_ip_bgp_all,
  3892. clear_ip_bgp_instance_all_cmd,
  3893. "clear ip bgp view WORD *",
  3894. CLEAR_STR
  3895. IP_STR
  3896. BGP_STR
  3897. "BGP view\n"
  3898. "view name\n"
  3899. "Clear all peers\n")
  3900. ALIAS (clear_ip_bgp_all,
  3901. clear_bgp_instance_all_cmd,
  3902. "clear bgp view WORD *",
  3903. CLEAR_STR
  3904. BGP_STR
  3905. "BGP view\n"
  3906. "view name\n"
  3907. "Clear all peers\n")
  3908. DEFUN (clear_ip_bgp_peer,
  3909. clear_ip_bgp_peer_cmd,
  3910. "clear ip bgp (A.B.C.D|X:X::X:X)",
  3911. CLEAR_STR
  3912. IP_STR
  3913. BGP_STR
  3914. "BGP neighbor IP address to clear\n"
  3915. "BGP IPv6 neighbor to clear\n")
  3916. {
  3917. return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
  3918. }
  3919. ALIAS (clear_ip_bgp_peer,
  3920. clear_bgp_peer_cmd,
  3921. "clear bgp (A.B.C.D|X:X::X:X)",
  3922. CLEAR_STR
  3923. BGP_STR
  3924. "BGP neighbor address to clear\n"
  3925. "BGP IPv6 neighbor to clear\n")
  3926. ALIAS (clear_ip_bgp_peer,
  3927. clear_bgp_ipv6_peer_cmd,
  3928. "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
  3929. CLEAR_STR
  3930. BGP_STR
  3931. "Address family\n"
  3932. "BGP neighbor address to clear\n"
  3933. "BGP IPv6 neighbor to clear\n")
  3934. DEFUN (clear_ip_bgp_peer_group,
  3935. clear_ip_bgp_peer_group_cmd,
  3936. "clear ip bgp peer-group WORD",
  3937. CLEAR_STR
  3938. IP_STR
  3939. BGP_STR
  3940. "Clear all members of peer-group\n"
  3941. "BGP peer-group name\n")
  3942. {
  3943. return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
  3944. }
  3945. ALIAS (clear_ip_bgp_peer_group,
  3946. clear_bgp_peer_group_cmd,
  3947. "clear bgp peer-group WORD",
  3948. CLEAR_STR
  3949. BGP_STR
  3950. "Clear all members of peer-group\n"
  3951. "BGP peer-group name\n")
  3952. ALIAS (clear_ip_bgp_peer_group,
  3953. clear_bgp_ipv6_peer_group_cmd,
  3954. "clear bgp ipv6 peer-group WORD",
  3955. CLEAR_STR
  3956. BGP_STR
  3957. "Address family\n"
  3958. "Clear all members of peer-group\n"
  3959. "BGP peer-group name\n")
  3960. DEFUN (clear_ip_bgp_external,
  3961. clear_ip_bgp_external_cmd,
  3962. "clear ip bgp external",
  3963. CLEAR_STR
  3964. IP_STR
  3965. BGP_STR
  3966. "Clear all external peers\n")
  3967. {
  3968. return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
  3969. }
  3970. ALIAS (clear_ip_bgp_external,
  3971. clear_bgp_external_cmd,
  3972. "clear bgp external",
  3973. CLEAR_STR
  3974. BGP_STR
  3975. "Clear all external peers\n")
  3976. ALIAS (clear_ip_bgp_external,
  3977. clear_bgp_ipv6_external_cmd,
  3978. "clear bgp ipv6 external",
  3979. CLEAR_STR
  3980. BGP_STR
  3981. "Address family\n"
  3982. "Clear all external peers\n")
  3983. DEFUN (clear_ip_bgp_as,
  3984. clear_ip_bgp_as_cmd,
  3985. "clear ip bgp " CMD_AS_RANGE,
  3986. CLEAR_STR
  3987. IP_STR
  3988. BGP_STR
  3989. "Clear peers with the AS number\n")
  3990. {
  3991. return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
  3992. }
  3993. ALIAS (clear_ip_bgp_as,
  3994. clear_bgp_as_cmd,
  3995. "clear bgp " CMD_AS_RANGE,
  3996. CLEAR_STR
  3997. BGP_STR
  3998. "Clear peers with the AS number\n")
  3999. ALIAS (clear_ip_bgp_as,
  4000. clear_bgp_ipv6_as_cmd,
  4001. "clear bgp ipv6 " CMD_AS_RANGE,
  4002. CLEAR_STR
  4003. BGP_STR
  4004. "Address family\n"
  4005. "Clear peers with the AS number\n")
  4006. /* Outbound soft-reconfiguration */
  4007. DEFUN (clear_ip_bgp_all_soft_out,
  4008. clear_ip_bgp_all_soft_out_cmd,
  4009. "clear ip bgp * soft out",
  4010. CLEAR_STR
  4011. IP_STR
  4012. BGP_STR
  4013. "Clear all peers\n"
  4014. "Soft reconfig\n"
  4015. "Soft reconfig outbound update\n")
  4016. {
  4017. if (argc == 1)
  4018. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4019. BGP_CLEAR_SOFT_OUT, NULL);
  4020. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4021. BGP_CLEAR_SOFT_OUT, NULL);
  4022. }
  4023. ALIAS (clear_ip_bgp_all_soft_out,
  4024. clear_ip_bgp_all_out_cmd,
  4025. "clear ip bgp * out",
  4026. CLEAR_STR
  4027. IP_STR
  4028. BGP_STR
  4029. "Clear all peers\n"
  4030. "Soft reconfig outbound update\n")
  4031. ALIAS (clear_ip_bgp_all_soft_out,
  4032. clear_ip_bgp_instance_all_soft_out_cmd,
  4033. "clear ip bgp view WORD * soft out",
  4034. CLEAR_STR
  4035. IP_STR
  4036. BGP_STR
  4037. "BGP view\n"
  4038. "view name\n"
  4039. "Clear all peers\n"
  4040. "Soft reconfig\n"
  4041. "Soft reconfig outbound update\n")
  4042. DEFUN (clear_ip_bgp_all_ipv4_soft_out,
  4043. clear_ip_bgp_all_ipv4_soft_out_cmd,
  4044. "clear ip bgp * ipv4 (unicast|multicast) soft out",
  4045. CLEAR_STR
  4046. IP_STR
  4047. BGP_STR
  4048. "Clear all peers\n"
  4049. "Address family\n"
  4050. "Address Family modifier\n"
  4051. "Address Family modifier\n"
  4052. "Soft reconfig\n"
  4053. "Soft reconfig outbound update\n")
  4054. {
  4055. if (strncmp (argv[0], "m", 1) == 0)
  4056. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
  4057. BGP_CLEAR_SOFT_OUT, NULL);
  4058. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4059. BGP_CLEAR_SOFT_OUT, NULL);
  4060. }
  4061. ALIAS (clear_ip_bgp_all_ipv4_soft_out,
  4062. clear_ip_bgp_all_ipv4_out_cmd,
  4063. "clear ip bgp * ipv4 (unicast|multicast) out",
  4064. CLEAR_STR
  4065. IP_STR
  4066. BGP_STR
  4067. "Clear all peers\n"
  4068. "Address family\n"
  4069. "Address Family modifier\n"
  4070. "Address Family modifier\n"
  4071. "Soft reconfig outbound update\n")
  4072. DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
  4073. clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
  4074. "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
  4075. CLEAR_STR
  4076. IP_STR
  4077. BGP_STR
  4078. "BGP view\n"
  4079. "view name\n"
  4080. "Clear all peers\n"
  4081. "Address family\n"
  4082. "Address Family modifier\n"
  4083. "Address Family modifier\n"
  4084. "Soft reconfig outbound update\n")
  4085. {
  4086. if (strncmp (argv[1], "m", 1) == 0)
  4087. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
  4088. BGP_CLEAR_SOFT_OUT, NULL);
  4089. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4090. BGP_CLEAR_SOFT_OUT, NULL);
  4091. }
  4092. DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
  4093. clear_ip_bgp_all_vpnv4_soft_out_cmd,
  4094. "clear ip bgp * vpnv4 unicast soft out",
  4095. CLEAR_STR
  4096. IP_STR
  4097. BGP_STR
  4098. "Clear all peers\n"
  4099. "Address family\n"
  4100. "Address Family Modifier\n"
  4101. "Soft reconfig\n"
  4102. "Soft reconfig outbound update\n")
  4103. {
  4104. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
  4105. BGP_CLEAR_SOFT_OUT, NULL);
  4106. }
  4107. ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
  4108. clear_ip_bgp_all_vpnv4_out_cmd,
  4109. "clear ip bgp * vpnv4 unicast out",
  4110. CLEAR_STR
  4111. IP_STR
  4112. BGP_STR
  4113. "Clear all peers\n"
  4114. "Address family\n"
  4115. "Address Family Modifier\n"
  4116. "Soft reconfig outbound update\n")
  4117. DEFUN (clear_bgp_all_soft_out,
  4118. clear_bgp_all_soft_out_cmd,
  4119. "clear bgp * soft out",
  4120. CLEAR_STR
  4121. BGP_STR
  4122. "Clear all peers\n"
  4123. "Soft reconfig\n"
  4124. "Soft reconfig outbound update\n")
  4125. {
  4126. if (argc == 1)
  4127. return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
  4128. BGP_CLEAR_SOFT_OUT, NULL);
  4129. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
  4130. BGP_CLEAR_SOFT_OUT, NULL);
  4131. }
  4132. ALIAS (clear_bgp_all_soft_out,
  4133. clear_bgp_instance_all_soft_out_cmd,
  4134. "clear bgp view WORD * soft out",
  4135. CLEAR_STR
  4136. BGP_STR
  4137. "BGP view\n"
  4138. "view name\n"
  4139. "Clear all peers\n"
  4140. "Soft reconfig\n"
  4141. "Soft reconfig outbound update\n")
  4142. ALIAS (clear_bgp_all_soft_out,
  4143. clear_bgp_all_out_cmd,
  4144. "clear bgp * out",
  4145. CLEAR_STR
  4146. BGP_STR
  4147. "Clear all peers\n"
  4148. "Soft reconfig outbound update\n")
  4149. ALIAS (clear_bgp_all_soft_out,
  4150. clear_bgp_ipv6_all_soft_out_cmd,
  4151. "clear bgp ipv6 * soft out",
  4152. CLEAR_STR
  4153. BGP_STR
  4154. "Address family\n"
  4155. "Clear all peers\n"
  4156. "Soft reconfig\n"
  4157. "Soft reconfig outbound update\n")
  4158. ALIAS (clear_bgp_all_soft_out,
  4159. clear_bgp_ipv6_all_out_cmd,
  4160. "clear bgp ipv6 * out",
  4161. CLEAR_STR
  4162. BGP_STR
  4163. "Address family\n"
  4164. "Clear all peers\n"
  4165. "Soft reconfig outbound update\n")
  4166. DEFUN (clear_ip_bgp_peer_soft_out,
  4167. clear_ip_bgp_peer_soft_out_cmd,
  4168. "clear ip bgp A.B.C.D soft out",
  4169. CLEAR_STR
  4170. IP_STR
  4171. BGP_STR
  4172. "BGP neighbor address to clear\n"
  4173. "Soft reconfig\n"
  4174. "Soft reconfig outbound update\n")
  4175. {
  4176. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4177. BGP_CLEAR_SOFT_OUT, argv[0]);
  4178. }
  4179. ALIAS (clear_ip_bgp_peer_soft_out,
  4180. clear_ip_bgp_peer_out_cmd,
  4181. "clear ip bgp A.B.C.D out",
  4182. CLEAR_STR
  4183. IP_STR
  4184. BGP_STR
  4185. "BGP neighbor address to clear\n"
  4186. "Soft reconfig outbound update\n")
  4187. DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
  4188. clear_ip_bgp_peer_ipv4_soft_out_cmd,
  4189. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
  4190. CLEAR_STR
  4191. IP_STR
  4192. BGP_STR
  4193. "BGP neighbor address to clear\n"
  4194. "Address family\n"
  4195. "Address Family modifier\n"
  4196. "Address Family modifier\n"
  4197. "Soft reconfig\n"
  4198. "Soft reconfig outbound update\n")
  4199. {
  4200. if (strncmp (argv[1], "m", 1) == 0)
  4201. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
  4202. BGP_CLEAR_SOFT_OUT, argv[0]);
  4203. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4204. BGP_CLEAR_SOFT_OUT, argv[0]);
  4205. }
  4206. ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
  4207. clear_ip_bgp_peer_ipv4_out_cmd,
  4208. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
  4209. CLEAR_STR
  4210. IP_STR
  4211. BGP_STR
  4212. "BGP neighbor address to clear\n"
  4213. "Address family\n"
  4214. "Address Family modifier\n"
  4215. "Address Family modifier\n"
  4216. "Soft reconfig outbound update\n")
  4217. DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
  4218. clear_ip_bgp_peer_vpnv4_soft_out_cmd,
  4219. "clear ip bgp A.B.C.D vpnv4 unicast soft out",
  4220. CLEAR_STR
  4221. IP_STR
  4222. BGP_STR
  4223. "BGP neighbor address to clear\n"
  4224. "Address family\n"
  4225. "Address Family Modifier\n"
  4226. "Soft reconfig\n"
  4227. "Soft reconfig outbound update\n")
  4228. {
  4229. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
  4230. BGP_CLEAR_SOFT_OUT, argv[0]);
  4231. }
  4232. ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
  4233. clear_ip_bgp_peer_vpnv4_out_cmd,
  4234. "clear ip bgp A.B.C.D vpnv4 unicast out",
  4235. CLEAR_STR
  4236. IP_STR
  4237. BGP_STR
  4238. "BGP neighbor address to clear\n"
  4239. "Address family\n"
  4240. "Address Family Modifier\n"
  4241. "Soft reconfig outbound update\n")
  4242. DEFUN (clear_bgp_peer_soft_out,
  4243. clear_bgp_peer_soft_out_cmd,
  4244. "clear bgp (A.B.C.D|X:X::X:X) soft out",
  4245. CLEAR_STR
  4246. BGP_STR
  4247. "BGP neighbor address to clear\n"
  4248. "BGP IPv6 neighbor to clear\n"
  4249. "Soft reconfig\n"
  4250. "Soft reconfig outbound update\n")
  4251. {
  4252. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
  4253. BGP_CLEAR_SOFT_OUT, argv[0]);
  4254. }
  4255. ALIAS (clear_bgp_peer_soft_out,
  4256. clear_bgp_ipv6_peer_soft_out_cmd,
  4257. "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
  4258. CLEAR_STR
  4259. BGP_STR
  4260. "Address family\n"
  4261. "BGP neighbor address to clear\n"
  4262. "BGP IPv6 neighbor to clear\n"
  4263. "Soft reconfig\n"
  4264. "Soft reconfig outbound update\n")
  4265. ALIAS (clear_bgp_peer_soft_out,
  4266. clear_bgp_peer_out_cmd,
  4267. "clear bgp (A.B.C.D|X:X::X:X) out",
  4268. CLEAR_STR
  4269. BGP_STR
  4270. "BGP neighbor address to clear\n"
  4271. "BGP IPv6 neighbor to clear\n"
  4272. "Soft reconfig outbound update\n")
  4273. ALIAS (clear_bgp_peer_soft_out,
  4274. clear_bgp_ipv6_peer_out_cmd,
  4275. "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
  4276. CLEAR_STR
  4277. BGP_STR
  4278. "Address family\n"
  4279. "BGP neighbor address to clear\n"
  4280. "BGP IPv6 neighbor to clear\n"
  4281. "Soft reconfig outbound update\n")
  4282. DEFUN (clear_ip_bgp_peer_group_soft_out,
  4283. clear_ip_bgp_peer_group_soft_out_cmd,
  4284. "clear ip bgp peer-group WORD soft out",
  4285. CLEAR_STR
  4286. IP_STR
  4287. BGP_STR
  4288. "Clear all members of peer-group\n"
  4289. "BGP peer-group name\n"
  4290. "Soft reconfig\n"
  4291. "Soft reconfig outbound update\n")
  4292. {
  4293. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  4294. BGP_CLEAR_SOFT_OUT, argv[0]);
  4295. }
  4296. ALIAS (clear_ip_bgp_peer_group_soft_out,
  4297. clear_ip_bgp_peer_group_out_cmd,
  4298. "clear ip bgp peer-group WORD out",
  4299. CLEAR_STR
  4300. IP_STR
  4301. BGP_STR
  4302. "Clear all members of peer-group\n"
  4303. "BGP peer-group name\n"
  4304. "Soft reconfig outbound update\n")
  4305. DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
  4306. clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
  4307. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
  4308. CLEAR_STR
  4309. IP_STR
  4310. BGP_STR
  4311. "Clear all members of peer-group\n"
  4312. "BGP peer-group name\n"
  4313. "Address family\n"
  4314. "Address Family modifier\n"
  4315. "Address Family modifier\n"
  4316. "Soft reconfig\n"
  4317. "Soft reconfig outbound update\n")
  4318. {
  4319. if (strncmp (argv[1], "m", 1) == 0)
  4320. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
  4321. BGP_CLEAR_SOFT_OUT, argv[0]);
  4322. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  4323. BGP_CLEAR_SOFT_OUT, argv[0]);
  4324. }
  4325. ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
  4326. clear_ip_bgp_peer_group_ipv4_out_cmd,
  4327. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
  4328. CLEAR_STR
  4329. IP_STR
  4330. BGP_STR
  4331. "Clear all members of peer-group\n"
  4332. "BGP peer-group name\n"
  4333. "Address family\n"
  4334. "Address Family modifier\n"
  4335. "Address Family modifier\n"
  4336. "Soft reconfig outbound update\n")
  4337. DEFUN (clear_bgp_peer_group_soft_out,
  4338. clear_bgp_peer_group_soft_out_cmd,
  4339. "clear bgp peer-group WORD soft out",
  4340. CLEAR_STR
  4341. BGP_STR
  4342. "Clear all members of peer-group\n"
  4343. "BGP peer-group name\n"
  4344. "Soft reconfig\n"
  4345. "Soft reconfig outbound update\n")
  4346. {
  4347. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
  4348. BGP_CLEAR_SOFT_OUT, argv[0]);
  4349. }
  4350. ALIAS (clear_bgp_peer_group_soft_out,
  4351. clear_bgp_ipv6_peer_group_soft_out_cmd,
  4352. "clear bgp ipv6 peer-group WORD soft out",
  4353. CLEAR_STR
  4354. BGP_STR
  4355. "Address family\n"
  4356. "Clear all members of peer-group\n"
  4357. "BGP peer-group name\n"
  4358. "Soft reconfig\n"
  4359. "Soft reconfig outbound update\n")
  4360. ALIAS (clear_bgp_peer_group_soft_out,
  4361. clear_bgp_peer_group_out_cmd,
  4362. "clear bgp peer-group WORD out",
  4363. CLEAR_STR
  4364. BGP_STR
  4365. "Clear all members of peer-group\n"
  4366. "BGP peer-group name\n"
  4367. "Soft reconfig outbound update\n")
  4368. ALIAS (clear_bgp_peer_group_soft_out,
  4369. clear_bgp_ipv6_peer_group_out_cmd,
  4370. "clear bgp ipv6 peer-group WORD out",
  4371. CLEAR_STR
  4372. BGP_STR
  4373. "Address family\n"
  4374. "Clear all members of peer-group\n"
  4375. "BGP peer-group name\n"
  4376. "Soft reconfig outbound update\n")
  4377. DEFUN (clear_ip_bgp_external_soft_out,
  4378. clear_ip_bgp_external_soft_out_cmd,
  4379. "clear ip bgp external soft out",
  4380. CLEAR_STR
  4381. IP_STR
  4382. BGP_STR
  4383. "Clear all external peers\n"
  4384. "Soft reconfig\n"
  4385. "Soft reconfig outbound update\n")
  4386. {
  4387. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  4388. BGP_CLEAR_SOFT_OUT, NULL);
  4389. }
  4390. ALIAS (clear_ip_bgp_external_soft_out,
  4391. clear_ip_bgp_external_out_cmd,
  4392. "clear ip bgp external out",
  4393. CLEAR_STR
  4394. IP_STR
  4395. BGP_STR
  4396. "Clear all external peers\n"
  4397. "Soft reconfig outbound update\n")
  4398. DEFUN (clear_ip_bgp_external_ipv4_soft_out,
  4399. clear_ip_bgp_external_ipv4_soft_out_cmd,
  4400. "clear ip bgp external ipv4 (unicast|multicast) soft out",
  4401. CLEAR_STR
  4402. IP_STR
  4403. BGP_STR
  4404. "Clear all external peers\n"
  4405. "Address family\n"
  4406. "Address Family modifier\n"
  4407. "Address Family modifier\n"
  4408. "Soft reconfig\n"
  4409. "Soft reconfig outbound update\n")
  4410. {
  4411. if (strncmp (argv[0], "m", 1) == 0)
  4412. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
  4413. BGP_CLEAR_SOFT_OUT, NULL);
  4414. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  4415. BGP_CLEAR_SOFT_OUT, NULL);
  4416. }
  4417. ALIAS (clear_ip_bgp_external_ipv4_soft_out,
  4418. clear_ip_bgp_external_ipv4_out_cmd,
  4419. "clear ip bgp external ipv4 (unicast|multicast) out",
  4420. CLEAR_STR
  4421. IP_STR
  4422. BGP_STR
  4423. "Clear all external peers\n"
  4424. "Address family\n"
  4425. "Address Family modifier\n"
  4426. "Address Family modifier\n"
  4427. "Soft reconfig outbound update\n")
  4428. DEFUN (clear_bgp_external_soft_out,
  4429. clear_bgp_external_soft_out_cmd,
  4430. "clear bgp external soft out",
  4431. CLEAR_STR
  4432. BGP_STR
  4433. "Clear all external peers\n"
  4434. "Soft reconfig\n"
  4435. "Soft reconfig outbound update\n")
  4436. {
  4437. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
  4438. BGP_CLEAR_SOFT_OUT, NULL);
  4439. }
  4440. ALIAS (clear_bgp_external_soft_out,
  4441. clear_bgp_ipv6_external_soft_out_cmd,
  4442. "clear bgp ipv6 external soft out",
  4443. CLEAR_STR
  4444. BGP_STR
  4445. "Address family\n"
  4446. "Clear all external peers\n"
  4447. "Soft reconfig\n"
  4448. "Soft reconfig outbound update\n")
  4449. ALIAS (clear_bgp_external_soft_out,
  4450. clear_bgp_external_out_cmd,
  4451. "clear bgp external out",
  4452. CLEAR_STR
  4453. BGP_STR
  4454. "Clear all external peers\n"
  4455. "Soft reconfig outbound update\n")
  4456. ALIAS (clear_bgp_external_soft_out,
  4457. clear_bgp_ipv6_external_out_cmd,
  4458. "clear bgp ipv6 external WORD out",
  4459. CLEAR_STR
  4460. BGP_STR
  4461. "Address family\n"
  4462. "Clear all external peers\n"
  4463. "Soft reconfig outbound update\n")
  4464. DEFUN (clear_ip_bgp_as_soft_out,
  4465. clear_ip_bgp_as_soft_out_cmd,
  4466. "clear ip bgp " CMD_AS_RANGE " soft out",
  4467. CLEAR_STR
  4468. IP_STR
  4469. BGP_STR
  4470. "Clear peers with the AS number\n"
  4471. "Soft reconfig\n"
  4472. "Soft reconfig outbound update\n")
  4473. {
  4474. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  4475. BGP_CLEAR_SOFT_OUT, argv[0]);
  4476. }
  4477. ALIAS (clear_ip_bgp_as_soft_out,
  4478. clear_ip_bgp_as_out_cmd,
  4479. "clear ip bgp " CMD_AS_RANGE " out",
  4480. CLEAR_STR
  4481. IP_STR
  4482. BGP_STR
  4483. "Clear peers with the AS number\n"
  4484. "Soft reconfig outbound update\n")
  4485. DEFUN (clear_ip_bgp_as_ipv4_soft_out,
  4486. clear_ip_bgp_as_ipv4_soft_out_cmd,
  4487. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
  4488. CLEAR_STR
  4489. IP_STR
  4490. BGP_STR
  4491. "Clear peers with the AS number\n"
  4492. "Address family\n"
  4493. "Address Family modifier\n"
  4494. "Address Family modifier\n"
  4495. "Soft reconfig\n"
  4496. "Soft reconfig outbound update\n")
  4497. {
  4498. if (strncmp (argv[1], "m", 1) == 0)
  4499. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
  4500. BGP_CLEAR_SOFT_OUT, argv[0]);
  4501. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  4502. BGP_CLEAR_SOFT_OUT, argv[0]);
  4503. }
  4504. ALIAS (clear_ip_bgp_as_ipv4_soft_out,
  4505. clear_ip_bgp_as_ipv4_out_cmd,
  4506. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
  4507. CLEAR_STR
  4508. IP_STR
  4509. BGP_STR
  4510. "Clear peers with the AS number\n"
  4511. "Address family\n"
  4512. "Address Family modifier\n"
  4513. "Address Family modifier\n"
  4514. "Soft reconfig outbound update\n")
  4515. DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
  4516. clear_ip_bgp_as_vpnv4_soft_out_cmd,
  4517. "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
  4518. CLEAR_STR
  4519. IP_STR
  4520. BGP_STR
  4521. "Clear peers with the AS number\n"
  4522. "Address family\n"
  4523. "Address Family modifier\n"
  4524. "Soft reconfig\n"
  4525. "Soft reconfig outbound update\n")
  4526. {
  4527. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
  4528. BGP_CLEAR_SOFT_OUT, argv[0]);
  4529. }
  4530. ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
  4531. clear_ip_bgp_as_vpnv4_out_cmd,
  4532. "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
  4533. CLEAR_STR
  4534. IP_STR
  4535. BGP_STR
  4536. "Clear peers with the AS number\n"
  4537. "Address family\n"
  4538. "Address Family modifier\n"
  4539. "Soft reconfig outbound update\n")
  4540. DEFUN (clear_bgp_as_soft_out,
  4541. clear_bgp_as_soft_out_cmd,
  4542. "clear bgp " CMD_AS_RANGE " soft out",
  4543. CLEAR_STR
  4544. BGP_STR
  4545. "Clear peers with the AS number\n"
  4546. "Soft reconfig\n"
  4547. "Soft reconfig outbound update\n")
  4548. {
  4549. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
  4550. BGP_CLEAR_SOFT_OUT, argv[0]);
  4551. }
  4552. ALIAS (clear_bgp_as_soft_out,
  4553. clear_bgp_ipv6_as_soft_out_cmd,
  4554. "clear bgp ipv6 " CMD_AS_RANGE " soft out",
  4555. CLEAR_STR
  4556. BGP_STR
  4557. "Address family\n"
  4558. "Clear peers with the AS number\n"
  4559. "Soft reconfig\n"
  4560. "Soft reconfig outbound update\n")
  4561. ALIAS (clear_bgp_as_soft_out,
  4562. clear_bgp_as_out_cmd,
  4563. "clear bgp " CMD_AS_RANGE " out",
  4564. CLEAR_STR
  4565. BGP_STR
  4566. "Clear peers with the AS number\n"
  4567. "Soft reconfig outbound update\n")
  4568. ALIAS (clear_bgp_as_soft_out,
  4569. clear_bgp_ipv6_as_out_cmd,
  4570. "clear bgp ipv6 " CMD_AS_RANGE " out",
  4571. CLEAR_STR
  4572. BGP_STR
  4573. "Address family\n"
  4574. "Clear peers with the AS number\n"
  4575. "Soft reconfig outbound update\n")
  4576. /* Inbound soft-reconfiguration */
  4577. DEFUN (clear_ip_bgp_all_soft_in,
  4578. clear_ip_bgp_all_soft_in_cmd,
  4579. "clear ip bgp * soft in",
  4580. CLEAR_STR
  4581. IP_STR
  4582. BGP_STR
  4583. "Clear all peers\n"
  4584. "Soft reconfig\n"
  4585. "Soft reconfig inbound update\n")
  4586. {
  4587. if (argc == 1)
  4588. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4589. BGP_CLEAR_SOFT_IN, NULL);
  4590. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4591. BGP_CLEAR_SOFT_IN, NULL);
  4592. }
  4593. ALIAS (clear_ip_bgp_all_soft_in,
  4594. clear_ip_bgp_instance_all_soft_in_cmd,
  4595. "clear ip bgp view WORD * soft in",
  4596. CLEAR_STR
  4597. IP_STR
  4598. BGP_STR
  4599. "BGP view\n"
  4600. "view name\n"
  4601. "Clear all peers\n"
  4602. "Soft reconfig\n"
  4603. "Soft reconfig inbound update\n")
  4604. ALIAS (clear_ip_bgp_all_soft_in,
  4605. clear_ip_bgp_all_in_cmd,
  4606. "clear ip bgp * in",
  4607. CLEAR_STR
  4608. IP_STR
  4609. BGP_STR
  4610. "Clear all peers\n"
  4611. "Soft reconfig inbound update\n")
  4612. DEFUN (clear_ip_bgp_all_in_prefix_filter,
  4613. clear_ip_bgp_all_in_prefix_filter_cmd,
  4614. "clear ip bgp * in prefix-filter",
  4615. CLEAR_STR
  4616. IP_STR
  4617. BGP_STR
  4618. "Clear all peers\n"
  4619. "Soft reconfig inbound update\n"
  4620. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4621. {
  4622. if (argc== 1)
  4623. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4624. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4625. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4626. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4627. }
  4628. ALIAS (clear_ip_bgp_all_in_prefix_filter,
  4629. clear_ip_bgp_instance_all_in_prefix_filter_cmd,
  4630. "clear ip bgp view WORD * in prefix-filter",
  4631. CLEAR_STR
  4632. IP_STR
  4633. BGP_STR
  4634. "BGP view\n"
  4635. "view name\n"
  4636. "Clear all peers\n"
  4637. "Soft reconfig inbound update\n"
  4638. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4639. DEFUN (clear_ip_bgp_all_ipv4_soft_in,
  4640. clear_ip_bgp_all_ipv4_soft_in_cmd,
  4641. "clear ip bgp * ipv4 (unicast|multicast) soft in",
  4642. CLEAR_STR
  4643. IP_STR
  4644. BGP_STR
  4645. "Clear all peers\n"
  4646. "Address family\n"
  4647. "Address Family modifier\n"
  4648. "Address Family modifier\n"
  4649. "Soft reconfig\n"
  4650. "Soft reconfig inbound update\n")
  4651. {
  4652. if (strncmp (argv[0], "m", 1) == 0)
  4653. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
  4654. BGP_CLEAR_SOFT_IN, NULL);
  4655. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4656. BGP_CLEAR_SOFT_IN, NULL);
  4657. }
  4658. ALIAS (clear_ip_bgp_all_ipv4_soft_in,
  4659. clear_ip_bgp_all_ipv4_in_cmd,
  4660. "clear ip bgp * ipv4 (unicast|multicast) in",
  4661. CLEAR_STR
  4662. IP_STR
  4663. BGP_STR
  4664. "Clear all peers\n"
  4665. "Address family\n"
  4666. "Address Family modifier\n"
  4667. "Address Family modifier\n"
  4668. "Soft reconfig inbound update\n")
  4669. DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
  4670. clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
  4671. "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
  4672. CLEAR_STR
  4673. IP_STR
  4674. BGP_STR
  4675. "BGP view\n"
  4676. "view name\n"
  4677. "Clear all peers\n"
  4678. "Address family\n"
  4679. "Address Family modifier\n"
  4680. "Address Family modifier\n"
  4681. "Soft reconfig\n"
  4682. "Soft reconfig inbound update\n")
  4683. {
  4684. if (strncmp (argv[1], "m", 1) == 0)
  4685. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
  4686. BGP_CLEAR_SOFT_IN, NULL);
  4687. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4688. BGP_CLEAR_SOFT_IN, NULL);
  4689. }
  4690. DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
  4691. clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
  4692. "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
  4693. CLEAR_STR
  4694. IP_STR
  4695. BGP_STR
  4696. "Clear all peers\n"
  4697. "Address family\n"
  4698. "Address Family modifier\n"
  4699. "Address Family modifier\n"
  4700. "Soft reconfig inbound update\n"
  4701. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4702. {
  4703. if (strncmp (argv[0], "m", 1) == 0)
  4704. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
  4705. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4706. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  4707. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4708. }
  4709. DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
  4710. clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
  4711. "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
  4712. CLEAR_STR
  4713. IP_STR
  4714. BGP_STR
  4715. "Clear all peers\n"
  4716. "Address family\n"
  4717. "Address Family modifier\n"
  4718. "Address Family modifier\n"
  4719. "Soft reconfig inbound update\n"
  4720. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4721. {
  4722. if (strncmp (argv[1], "m", 1) == 0)
  4723. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
  4724. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4725. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  4726. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4727. }
  4728. DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
  4729. clear_ip_bgp_all_vpnv4_soft_in_cmd,
  4730. "clear ip bgp * vpnv4 unicast soft in",
  4731. CLEAR_STR
  4732. IP_STR
  4733. BGP_STR
  4734. "Clear all peers\n"
  4735. "Address family\n"
  4736. "Address Family Modifier\n"
  4737. "Soft reconfig\n"
  4738. "Soft reconfig inbound update\n")
  4739. {
  4740. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
  4741. BGP_CLEAR_SOFT_IN, NULL);
  4742. }
  4743. ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
  4744. clear_ip_bgp_all_vpnv4_in_cmd,
  4745. "clear ip bgp * vpnv4 unicast in",
  4746. CLEAR_STR
  4747. IP_STR
  4748. BGP_STR
  4749. "Clear all peers\n"
  4750. "Address family\n"
  4751. "Address Family Modifier\n"
  4752. "Soft reconfig inbound update\n")
  4753. DEFUN (clear_bgp_all_soft_in,
  4754. clear_bgp_all_soft_in_cmd,
  4755. "clear bgp * soft in",
  4756. CLEAR_STR
  4757. BGP_STR
  4758. "Clear all peers\n"
  4759. "Soft reconfig\n"
  4760. "Soft reconfig inbound update\n")
  4761. {
  4762. if (argc == 1)
  4763. return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
  4764. BGP_CLEAR_SOFT_IN, NULL);
  4765. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
  4766. BGP_CLEAR_SOFT_IN, NULL);
  4767. }
  4768. ALIAS (clear_bgp_all_soft_in,
  4769. clear_bgp_instance_all_soft_in_cmd,
  4770. "clear bgp view WORD * soft in",
  4771. CLEAR_STR
  4772. BGP_STR
  4773. "BGP view\n"
  4774. "view name\n"
  4775. "Clear all peers\n"
  4776. "Soft reconfig\n"
  4777. "Soft reconfig inbound update\n")
  4778. ALIAS (clear_bgp_all_soft_in,
  4779. clear_bgp_ipv6_all_soft_in_cmd,
  4780. "clear bgp ipv6 * soft in",
  4781. CLEAR_STR
  4782. BGP_STR
  4783. "Address family\n"
  4784. "Clear all peers\n"
  4785. "Soft reconfig\n"
  4786. "Soft reconfig inbound update\n")
  4787. ALIAS (clear_bgp_all_soft_in,
  4788. clear_bgp_all_in_cmd,
  4789. "clear bgp * in",
  4790. CLEAR_STR
  4791. BGP_STR
  4792. "Clear all peers\n"
  4793. "Soft reconfig inbound update\n")
  4794. ALIAS (clear_bgp_all_soft_in,
  4795. clear_bgp_ipv6_all_in_cmd,
  4796. "clear bgp ipv6 * in",
  4797. CLEAR_STR
  4798. BGP_STR
  4799. "Address family\n"
  4800. "Clear all peers\n"
  4801. "Soft reconfig inbound update\n")
  4802. DEFUN (clear_bgp_all_in_prefix_filter,
  4803. clear_bgp_all_in_prefix_filter_cmd,
  4804. "clear bgp * in prefix-filter",
  4805. CLEAR_STR
  4806. BGP_STR
  4807. "Clear all peers\n"
  4808. "Soft reconfig inbound update\n"
  4809. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4810. {
  4811. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
  4812. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  4813. }
  4814. ALIAS (clear_bgp_all_in_prefix_filter,
  4815. clear_bgp_ipv6_all_in_prefix_filter_cmd,
  4816. "clear bgp ipv6 * in prefix-filter",
  4817. CLEAR_STR
  4818. BGP_STR
  4819. "Address family\n"
  4820. "Clear all peers\n"
  4821. "Soft reconfig inbound update\n"
  4822. "Push out prefix-list ORF and do inbound soft reconfig\n")
  4823. DEFUN (clear_ip_bgp_peer_soft_in,
  4824. clear_ip_bgp_peer_soft_in_cmd,
  4825. "clear ip bgp A.B.C.D soft in",
  4826. CLEAR_STR
  4827. IP_STR
  4828. BGP_STR
  4829. "BGP neighbor address to clear\n"
  4830. "Soft reconfig\n"
  4831. "Soft reconfig inbound update\n")
  4832. {
  4833. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4834. BGP_CLEAR_SOFT_IN, argv[0]);
  4835. }
  4836. ALIAS (clear_ip_bgp_peer_soft_in,
  4837. clear_ip_bgp_peer_in_cmd,
  4838. "clear ip bgp A.B.C.D in",
  4839. CLEAR_STR
  4840. IP_STR
  4841. BGP_STR
  4842. "BGP neighbor address to clear\n"
  4843. "Soft reconfig inbound update\n")
  4844. DEFUN (clear_ip_bgp_peer_in_prefix_filter,
  4845. clear_ip_bgp_peer_in_prefix_filter_cmd,
  4846. "clear ip bgp A.B.C.D in prefix-filter",
  4847. CLEAR_STR
  4848. IP_STR
  4849. BGP_STR
  4850. "BGP neighbor address to clear\n"
  4851. "Soft reconfig inbound update\n"
  4852. "Push out the existing ORF prefix-list\n")
  4853. {
  4854. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4855. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  4856. }
  4857. DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
  4858. clear_ip_bgp_peer_ipv4_soft_in_cmd,
  4859. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
  4860. CLEAR_STR
  4861. IP_STR
  4862. BGP_STR
  4863. "BGP neighbor address to clear\n"
  4864. "Address family\n"
  4865. "Address Family modifier\n"
  4866. "Address Family modifier\n"
  4867. "Soft reconfig\n"
  4868. "Soft reconfig inbound update\n")
  4869. {
  4870. if (strncmp (argv[1], "m", 1) == 0)
  4871. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
  4872. BGP_CLEAR_SOFT_IN, argv[0]);
  4873. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4874. BGP_CLEAR_SOFT_IN, argv[0]);
  4875. }
  4876. ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
  4877. clear_ip_bgp_peer_ipv4_in_cmd,
  4878. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
  4879. CLEAR_STR
  4880. IP_STR
  4881. BGP_STR
  4882. "BGP neighbor address to clear\n"
  4883. "Address family\n"
  4884. "Address Family modifier\n"
  4885. "Address Family modifier\n"
  4886. "Soft reconfig inbound update\n")
  4887. DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
  4888. clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
  4889. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
  4890. CLEAR_STR
  4891. IP_STR
  4892. BGP_STR
  4893. "BGP neighbor address to clear\n"
  4894. "Address family\n"
  4895. "Address Family modifier\n"
  4896. "Address Family modifier\n"
  4897. "Soft reconfig inbound update\n"
  4898. "Push out the existing ORF prefix-list\n")
  4899. {
  4900. if (strncmp (argv[1], "m", 1) == 0)
  4901. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
  4902. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  4903. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  4904. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  4905. }
  4906. DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
  4907. clear_ip_bgp_peer_vpnv4_soft_in_cmd,
  4908. "clear ip bgp A.B.C.D vpnv4 unicast soft in",
  4909. CLEAR_STR
  4910. IP_STR
  4911. BGP_STR
  4912. "BGP neighbor address to clear\n"
  4913. "Address family\n"
  4914. "Address Family Modifier\n"
  4915. "Soft reconfig\n"
  4916. "Soft reconfig inbound update\n")
  4917. {
  4918. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
  4919. BGP_CLEAR_SOFT_IN, argv[0]);
  4920. }
  4921. ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
  4922. clear_ip_bgp_peer_vpnv4_in_cmd,
  4923. "clear ip bgp A.B.C.D vpnv4 unicast in",
  4924. CLEAR_STR
  4925. IP_STR
  4926. BGP_STR
  4927. "BGP neighbor address to clear\n"
  4928. "Address family\n"
  4929. "Address Family Modifier\n"
  4930. "Soft reconfig inbound update\n")
  4931. DEFUN (clear_bgp_peer_soft_in,
  4932. clear_bgp_peer_soft_in_cmd,
  4933. "clear bgp (A.B.C.D|X:X::X:X) soft in",
  4934. CLEAR_STR
  4935. BGP_STR
  4936. "BGP neighbor address to clear\n"
  4937. "BGP IPv6 neighbor to clear\n"
  4938. "Soft reconfig\n"
  4939. "Soft reconfig inbound update\n")
  4940. {
  4941. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
  4942. BGP_CLEAR_SOFT_IN, argv[0]);
  4943. }
  4944. ALIAS (clear_bgp_peer_soft_in,
  4945. clear_bgp_ipv6_peer_soft_in_cmd,
  4946. "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
  4947. CLEAR_STR
  4948. BGP_STR
  4949. "Address family\n"
  4950. "BGP neighbor address to clear\n"
  4951. "BGP IPv6 neighbor to clear\n"
  4952. "Soft reconfig\n"
  4953. "Soft reconfig inbound update\n")
  4954. ALIAS (clear_bgp_peer_soft_in,
  4955. clear_bgp_peer_in_cmd,
  4956. "clear bgp (A.B.C.D|X:X::X:X) in",
  4957. CLEAR_STR
  4958. BGP_STR
  4959. "BGP neighbor address to clear\n"
  4960. "BGP IPv6 neighbor to clear\n"
  4961. "Soft reconfig inbound update\n")
  4962. ALIAS (clear_bgp_peer_soft_in,
  4963. clear_bgp_ipv6_peer_in_cmd,
  4964. "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
  4965. CLEAR_STR
  4966. BGP_STR
  4967. "Address family\n"
  4968. "BGP neighbor address to clear\n"
  4969. "BGP IPv6 neighbor to clear\n"
  4970. "Soft reconfig inbound update\n")
  4971. DEFUN (clear_bgp_peer_in_prefix_filter,
  4972. clear_bgp_peer_in_prefix_filter_cmd,
  4973. "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
  4974. CLEAR_STR
  4975. BGP_STR
  4976. "BGP neighbor address to clear\n"
  4977. "BGP IPv6 neighbor to clear\n"
  4978. "Soft reconfig inbound update\n"
  4979. "Push out the existing ORF prefix-list\n")
  4980. {
  4981. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
  4982. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  4983. }
  4984. ALIAS (clear_bgp_peer_in_prefix_filter,
  4985. clear_bgp_ipv6_peer_in_prefix_filter_cmd,
  4986. "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
  4987. CLEAR_STR
  4988. BGP_STR
  4989. "Address family\n"
  4990. "BGP neighbor address to clear\n"
  4991. "BGP IPv6 neighbor to clear\n"
  4992. "Soft reconfig inbound update\n"
  4993. "Push out the existing ORF prefix-list\n")
  4994. DEFUN (clear_ip_bgp_peer_group_soft_in,
  4995. clear_ip_bgp_peer_group_soft_in_cmd,
  4996. "clear ip bgp peer-group WORD soft in",
  4997. CLEAR_STR
  4998. IP_STR
  4999. BGP_STR
  5000. "Clear all members of peer-group\n"
  5001. "BGP peer-group name\n"
  5002. "Soft reconfig\n"
  5003. "Soft reconfig inbound update\n")
  5004. {
  5005. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5006. BGP_CLEAR_SOFT_IN, argv[0]);
  5007. }
  5008. ALIAS (clear_ip_bgp_peer_group_soft_in,
  5009. clear_ip_bgp_peer_group_in_cmd,
  5010. "clear ip bgp peer-group WORD in",
  5011. CLEAR_STR
  5012. IP_STR
  5013. BGP_STR
  5014. "Clear all members of peer-group\n"
  5015. "BGP peer-group name\n"
  5016. "Soft reconfig inbound update\n")
  5017. DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
  5018. clear_ip_bgp_peer_group_in_prefix_filter_cmd,
  5019. "clear ip bgp peer-group WORD in prefix-filter",
  5020. CLEAR_STR
  5021. IP_STR
  5022. BGP_STR
  5023. "Clear all members of peer-group\n"
  5024. "BGP peer-group name\n"
  5025. "Soft reconfig inbound update\n"
  5026. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5027. {
  5028. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5029. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5030. }
  5031. DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
  5032. clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
  5033. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
  5034. CLEAR_STR
  5035. IP_STR
  5036. BGP_STR
  5037. "Clear all members of peer-group\n"
  5038. "BGP peer-group name\n"
  5039. "Address family\n"
  5040. "Address Family modifier\n"
  5041. "Address Family modifier\n"
  5042. "Soft reconfig\n"
  5043. "Soft reconfig inbound update\n")
  5044. {
  5045. if (strncmp (argv[1], "m", 1) == 0)
  5046. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
  5047. BGP_CLEAR_SOFT_IN, argv[0]);
  5048. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5049. BGP_CLEAR_SOFT_IN, argv[0]);
  5050. }
  5051. ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
  5052. clear_ip_bgp_peer_group_ipv4_in_cmd,
  5053. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
  5054. CLEAR_STR
  5055. IP_STR
  5056. BGP_STR
  5057. "Clear all members of peer-group\n"
  5058. "BGP peer-group name\n"
  5059. "Address family\n"
  5060. "Address Family modifier\n"
  5061. "Address Family modifier\n"
  5062. "Soft reconfig inbound update\n")
  5063. DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
  5064. clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
  5065. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
  5066. CLEAR_STR
  5067. IP_STR
  5068. BGP_STR
  5069. "Clear all members of peer-group\n"
  5070. "BGP peer-group name\n"
  5071. "Address family\n"
  5072. "Address Family modifier\n"
  5073. "Address Family modifier\n"
  5074. "Soft reconfig inbound update\n"
  5075. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5076. {
  5077. if (strncmp (argv[1], "m", 1) == 0)
  5078. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
  5079. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5080. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5081. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5082. }
  5083. DEFUN (clear_bgp_peer_group_soft_in,
  5084. clear_bgp_peer_group_soft_in_cmd,
  5085. "clear bgp peer-group WORD soft in",
  5086. CLEAR_STR
  5087. BGP_STR
  5088. "Clear all members of peer-group\n"
  5089. "BGP peer-group name\n"
  5090. "Soft reconfig\n"
  5091. "Soft reconfig inbound update\n")
  5092. {
  5093. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
  5094. BGP_CLEAR_SOFT_IN, argv[0]);
  5095. }
  5096. ALIAS (clear_bgp_peer_group_soft_in,
  5097. clear_bgp_ipv6_peer_group_soft_in_cmd,
  5098. "clear bgp ipv6 peer-group WORD soft in",
  5099. CLEAR_STR
  5100. BGP_STR
  5101. "Address family\n"
  5102. "Clear all members of peer-group\n"
  5103. "BGP peer-group name\n"
  5104. "Soft reconfig\n"
  5105. "Soft reconfig inbound update\n")
  5106. ALIAS (clear_bgp_peer_group_soft_in,
  5107. clear_bgp_peer_group_in_cmd,
  5108. "clear bgp peer-group WORD in",
  5109. CLEAR_STR
  5110. BGP_STR
  5111. "Clear all members of peer-group\n"
  5112. "BGP peer-group name\n"
  5113. "Soft reconfig inbound update\n")
  5114. ALIAS (clear_bgp_peer_group_soft_in,
  5115. clear_bgp_ipv6_peer_group_in_cmd,
  5116. "clear bgp ipv6 peer-group WORD in",
  5117. CLEAR_STR
  5118. BGP_STR
  5119. "Address family\n"
  5120. "Clear all members of peer-group\n"
  5121. "BGP peer-group name\n"
  5122. "Soft reconfig inbound update\n")
  5123. DEFUN (clear_bgp_peer_group_in_prefix_filter,
  5124. clear_bgp_peer_group_in_prefix_filter_cmd,
  5125. "clear bgp peer-group WORD in prefix-filter",
  5126. CLEAR_STR
  5127. BGP_STR
  5128. "Clear all members of peer-group\n"
  5129. "BGP peer-group name\n"
  5130. "Soft reconfig inbound update\n"
  5131. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5132. {
  5133. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
  5134. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5135. }
  5136. ALIAS (clear_bgp_peer_group_in_prefix_filter,
  5137. clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
  5138. "clear bgp ipv6 peer-group WORD in prefix-filter",
  5139. CLEAR_STR
  5140. BGP_STR
  5141. "Address family\n"
  5142. "Clear all members of peer-group\n"
  5143. "BGP peer-group name\n"
  5144. "Soft reconfig inbound update\n"
  5145. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5146. DEFUN (clear_ip_bgp_external_soft_in,
  5147. clear_ip_bgp_external_soft_in_cmd,
  5148. "clear ip bgp external soft in",
  5149. CLEAR_STR
  5150. IP_STR
  5151. BGP_STR
  5152. "Clear all external peers\n"
  5153. "Soft reconfig\n"
  5154. "Soft reconfig inbound update\n")
  5155. {
  5156. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5157. BGP_CLEAR_SOFT_IN, NULL);
  5158. }
  5159. ALIAS (clear_ip_bgp_external_soft_in,
  5160. clear_ip_bgp_external_in_cmd,
  5161. "clear ip bgp external in",
  5162. CLEAR_STR
  5163. IP_STR
  5164. BGP_STR
  5165. "Clear all external peers\n"
  5166. "Soft reconfig inbound update\n")
  5167. DEFUN (clear_ip_bgp_external_in_prefix_filter,
  5168. clear_ip_bgp_external_in_prefix_filter_cmd,
  5169. "clear ip bgp external in prefix-filter",
  5170. CLEAR_STR
  5171. IP_STR
  5172. BGP_STR
  5173. "Clear all external peers\n"
  5174. "Soft reconfig inbound update\n"
  5175. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5176. {
  5177. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5178. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  5179. }
  5180. DEFUN (clear_ip_bgp_external_ipv4_soft_in,
  5181. clear_ip_bgp_external_ipv4_soft_in_cmd,
  5182. "clear ip bgp external ipv4 (unicast|multicast) soft in",
  5183. CLEAR_STR
  5184. IP_STR
  5185. BGP_STR
  5186. "Clear all external peers\n"
  5187. "Address family\n"
  5188. "Address Family modifier\n"
  5189. "Address Family modifier\n"
  5190. "Soft reconfig\n"
  5191. "Soft reconfig inbound update\n")
  5192. {
  5193. if (strncmp (argv[0], "m", 1) == 0)
  5194. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
  5195. BGP_CLEAR_SOFT_IN, NULL);
  5196. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5197. BGP_CLEAR_SOFT_IN, NULL);
  5198. }
  5199. ALIAS (clear_ip_bgp_external_ipv4_soft_in,
  5200. clear_ip_bgp_external_ipv4_in_cmd,
  5201. "clear ip bgp external ipv4 (unicast|multicast) in",
  5202. CLEAR_STR
  5203. IP_STR
  5204. BGP_STR
  5205. "Clear all external peers\n"
  5206. "Address family\n"
  5207. "Address Family modifier\n"
  5208. "Address Family modifier\n"
  5209. "Soft reconfig inbound update\n")
  5210. DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
  5211. clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
  5212. "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
  5213. CLEAR_STR
  5214. IP_STR
  5215. BGP_STR
  5216. "Clear all external peers\n"
  5217. "Address family\n"
  5218. "Address Family modifier\n"
  5219. "Address Family modifier\n"
  5220. "Soft reconfig inbound update\n"
  5221. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5222. {
  5223. if (strncmp (argv[0], "m", 1) == 0)
  5224. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
  5225. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  5226. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5227. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  5228. }
  5229. DEFUN (clear_bgp_external_soft_in,
  5230. clear_bgp_external_soft_in_cmd,
  5231. "clear bgp external soft in",
  5232. CLEAR_STR
  5233. BGP_STR
  5234. "Clear all external peers\n"
  5235. "Soft reconfig\n"
  5236. "Soft reconfig inbound update\n")
  5237. {
  5238. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
  5239. BGP_CLEAR_SOFT_IN, NULL);
  5240. }
  5241. ALIAS (clear_bgp_external_soft_in,
  5242. clear_bgp_ipv6_external_soft_in_cmd,
  5243. "clear bgp ipv6 external soft in",
  5244. CLEAR_STR
  5245. BGP_STR
  5246. "Address family\n"
  5247. "Clear all external peers\n"
  5248. "Soft reconfig\n"
  5249. "Soft reconfig inbound update\n")
  5250. ALIAS (clear_bgp_external_soft_in,
  5251. clear_bgp_external_in_cmd,
  5252. "clear bgp external in",
  5253. CLEAR_STR
  5254. BGP_STR
  5255. "Clear all external peers\n"
  5256. "Soft reconfig inbound update\n")
  5257. ALIAS (clear_bgp_external_soft_in,
  5258. clear_bgp_ipv6_external_in_cmd,
  5259. "clear bgp ipv6 external WORD in",
  5260. CLEAR_STR
  5261. BGP_STR
  5262. "Address family\n"
  5263. "Clear all external peers\n"
  5264. "Soft reconfig inbound update\n")
  5265. DEFUN (clear_bgp_external_in_prefix_filter,
  5266. clear_bgp_external_in_prefix_filter_cmd,
  5267. "clear bgp external in prefix-filter",
  5268. CLEAR_STR
  5269. BGP_STR
  5270. "Clear all external peers\n"
  5271. "Soft reconfig inbound update\n"
  5272. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5273. {
  5274. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
  5275. BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
  5276. }
  5277. ALIAS (clear_bgp_external_in_prefix_filter,
  5278. clear_bgp_ipv6_external_in_prefix_filter_cmd,
  5279. "clear bgp ipv6 external in prefix-filter",
  5280. CLEAR_STR
  5281. BGP_STR
  5282. "Address family\n"
  5283. "Clear all external peers\n"
  5284. "Soft reconfig inbound update\n"
  5285. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5286. DEFUN (clear_ip_bgp_as_soft_in,
  5287. clear_ip_bgp_as_soft_in_cmd,
  5288. "clear ip bgp " CMD_AS_RANGE " soft in",
  5289. CLEAR_STR
  5290. IP_STR
  5291. BGP_STR
  5292. "Clear peers with the AS number\n"
  5293. "Soft reconfig\n"
  5294. "Soft reconfig inbound update\n")
  5295. {
  5296. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  5297. BGP_CLEAR_SOFT_IN, argv[0]);
  5298. }
  5299. ALIAS (clear_ip_bgp_as_soft_in,
  5300. clear_ip_bgp_as_in_cmd,
  5301. "clear ip bgp " CMD_AS_RANGE " in",
  5302. CLEAR_STR
  5303. IP_STR
  5304. BGP_STR
  5305. "Clear peers with the AS number\n"
  5306. "Soft reconfig inbound update\n")
  5307. DEFUN (clear_ip_bgp_as_in_prefix_filter,
  5308. clear_ip_bgp_as_in_prefix_filter_cmd,
  5309. "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
  5310. CLEAR_STR
  5311. IP_STR
  5312. BGP_STR
  5313. "Clear peers with the AS number\n"
  5314. "Soft reconfig inbound update\n"
  5315. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5316. {
  5317. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  5318. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5319. }
  5320. DEFUN (clear_ip_bgp_as_ipv4_soft_in,
  5321. clear_ip_bgp_as_ipv4_soft_in_cmd,
  5322. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
  5323. CLEAR_STR
  5324. IP_STR
  5325. BGP_STR
  5326. "Clear peers with the AS number\n"
  5327. "Address family\n"
  5328. "Address Family modifier\n"
  5329. "Address Family modifier\n"
  5330. "Soft reconfig\n"
  5331. "Soft reconfig inbound update\n")
  5332. {
  5333. if (strncmp (argv[1], "m", 1) == 0)
  5334. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
  5335. BGP_CLEAR_SOFT_IN, argv[0]);
  5336. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  5337. BGP_CLEAR_SOFT_IN, argv[0]);
  5338. }
  5339. ALIAS (clear_ip_bgp_as_ipv4_soft_in,
  5340. clear_ip_bgp_as_ipv4_in_cmd,
  5341. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
  5342. CLEAR_STR
  5343. IP_STR
  5344. BGP_STR
  5345. "Clear peers with the AS number\n"
  5346. "Address family\n"
  5347. "Address Family modifier\n"
  5348. "Address Family modifier\n"
  5349. "Soft reconfig inbound update\n")
  5350. DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
  5351. clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
  5352. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
  5353. CLEAR_STR
  5354. IP_STR
  5355. BGP_STR
  5356. "Clear peers with the AS number\n"
  5357. "Address family\n"
  5358. "Address Family modifier\n"
  5359. "Address Family modifier\n"
  5360. "Soft reconfig inbound update\n"
  5361. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5362. {
  5363. if (strncmp (argv[1], "m", 1) == 0)
  5364. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
  5365. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5366. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  5367. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5368. }
  5369. DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
  5370. clear_ip_bgp_as_vpnv4_soft_in_cmd,
  5371. "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
  5372. CLEAR_STR
  5373. IP_STR
  5374. BGP_STR
  5375. "Clear peers with the AS number\n"
  5376. "Address family\n"
  5377. "Address Family modifier\n"
  5378. "Soft reconfig\n"
  5379. "Soft reconfig inbound update\n")
  5380. {
  5381. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
  5382. BGP_CLEAR_SOFT_IN, argv[0]);
  5383. }
  5384. ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
  5385. clear_ip_bgp_as_vpnv4_in_cmd,
  5386. "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
  5387. CLEAR_STR
  5388. IP_STR
  5389. BGP_STR
  5390. "Clear peers with the AS number\n"
  5391. "Address family\n"
  5392. "Address Family modifier\n"
  5393. "Soft reconfig inbound update\n")
  5394. DEFUN (clear_bgp_as_soft_in,
  5395. clear_bgp_as_soft_in_cmd,
  5396. "clear bgp " CMD_AS_RANGE " soft in",
  5397. CLEAR_STR
  5398. BGP_STR
  5399. "Clear peers with the AS number\n"
  5400. "Soft reconfig\n"
  5401. "Soft reconfig inbound update\n")
  5402. {
  5403. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
  5404. BGP_CLEAR_SOFT_IN, argv[0]);
  5405. }
  5406. ALIAS (clear_bgp_as_soft_in,
  5407. clear_bgp_ipv6_as_soft_in_cmd,
  5408. "clear bgp ipv6 " CMD_AS_RANGE " soft in",
  5409. CLEAR_STR
  5410. BGP_STR
  5411. "Address family\n"
  5412. "Clear peers with the AS number\n"
  5413. "Soft reconfig\n"
  5414. "Soft reconfig inbound update\n")
  5415. ALIAS (clear_bgp_as_soft_in,
  5416. clear_bgp_as_in_cmd,
  5417. "clear bgp " CMD_AS_RANGE " in",
  5418. CLEAR_STR
  5419. BGP_STR
  5420. "Clear peers with the AS number\n"
  5421. "Soft reconfig inbound update\n")
  5422. ALIAS (clear_bgp_as_soft_in,
  5423. clear_bgp_ipv6_as_in_cmd,
  5424. "clear bgp ipv6 " CMD_AS_RANGE " in",
  5425. CLEAR_STR
  5426. BGP_STR
  5427. "Address family\n"
  5428. "Clear peers with the AS number\n"
  5429. "Soft reconfig inbound update\n")
  5430. DEFUN (clear_bgp_as_in_prefix_filter,
  5431. clear_bgp_as_in_prefix_filter_cmd,
  5432. "clear bgp " CMD_AS_RANGE " in prefix-filter",
  5433. CLEAR_STR
  5434. BGP_STR
  5435. "Clear peers with the AS number\n"
  5436. "Soft reconfig inbound update\n"
  5437. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5438. {
  5439. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
  5440. BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
  5441. }
  5442. ALIAS (clear_bgp_as_in_prefix_filter,
  5443. clear_bgp_ipv6_as_in_prefix_filter_cmd,
  5444. "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
  5445. CLEAR_STR
  5446. BGP_STR
  5447. "Address family\n"
  5448. "Clear peers with the AS number\n"
  5449. "Soft reconfig inbound update\n"
  5450. "Push out prefix-list ORF and do inbound soft reconfig\n")
  5451. /* Both soft-reconfiguration */
  5452. DEFUN (clear_ip_bgp_all_soft,
  5453. clear_ip_bgp_all_soft_cmd,
  5454. "clear ip bgp * soft",
  5455. CLEAR_STR
  5456. IP_STR
  5457. BGP_STR
  5458. "Clear all peers\n"
  5459. "Soft reconfig\n")
  5460. {
  5461. if (argc == 1)
  5462. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  5463. BGP_CLEAR_SOFT_BOTH, NULL);
  5464. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  5465. BGP_CLEAR_SOFT_BOTH, NULL);
  5466. }
  5467. ALIAS (clear_ip_bgp_all_soft,
  5468. clear_ip_bgp_instance_all_soft_cmd,
  5469. "clear ip bgp view WORD * soft",
  5470. CLEAR_STR
  5471. IP_STR
  5472. BGP_STR
  5473. "BGP view\n"
  5474. "view name\n"
  5475. "Clear all peers\n"
  5476. "Soft reconfig\n")
  5477. DEFUN (clear_ip_bgp_all_ipv4_soft,
  5478. clear_ip_bgp_all_ipv4_soft_cmd,
  5479. "clear ip bgp * ipv4 (unicast|multicast) soft",
  5480. CLEAR_STR
  5481. IP_STR
  5482. BGP_STR
  5483. "Clear all peers\n"
  5484. "Address family\n"
  5485. "Address Family Modifier\n"
  5486. "Address Family Modifier\n"
  5487. "Soft reconfig\n")
  5488. {
  5489. if (strncmp (argv[0], "m", 1) == 0)
  5490. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
  5491. BGP_CLEAR_SOFT_BOTH, NULL);
  5492. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  5493. BGP_CLEAR_SOFT_BOTH, NULL);
  5494. }
  5495. DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
  5496. clear_ip_bgp_instance_all_ipv4_soft_cmd,
  5497. "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
  5498. CLEAR_STR
  5499. IP_STR
  5500. BGP_STR
  5501. "BGP view\n"
  5502. "view name\n"
  5503. "Clear all peers\n"
  5504. "Address family\n"
  5505. "Address Family Modifier\n"
  5506. "Address Family Modifier\n"
  5507. "Soft reconfig\n")
  5508. {
  5509. if (strncmp (argv[1], "m", 1) == 0)
  5510. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
  5511. BGP_CLEAR_SOFT_BOTH, NULL);
  5512. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  5513. BGP_CLEAR_SOFT_BOTH, NULL);
  5514. }
  5515. DEFUN (clear_ip_bgp_all_vpnv4_soft,
  5516. clear_ip_bgp_all_vpnv4_soft_cmd,
  5517. "clear ip bgp * vpnv4 unicast soft",
  5518. CLEAR_STR
  5519. IP_STR
  5520. BGP_STR
  5521. "Clear all peers\n"
  5522. "Address family\n"
  5523. "Address Family Modifier\n"
  5524. "Soft reconfig\n")
  5525. {
  5526. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
  5527. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5528. }
  5529. DEFUN (clear_bgp_all_soft,
  5530. clear_bgp_all_soft_cmd,
  5531. "clear bgp * soft",
  5532. CLEAR_STR
  5533. BGP_STR
  5534. "Clear all peers\n"
  5535. "Soft reconfig\n")
  5536. {
  5537. if (argc == 1)
  5538. return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
  5539. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5540. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
  5541. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5542. }
  5543. ALIAS (clear_bgp_all_soft,
  5544. clear_bgp_instance_all_soft_cmd,
  5545. "clear bgp view WORD * soft",
  5546. CLEAR_STR
  5547. BGP_STR
  5548. "BGP view\n"
  5549. "view name\n"
  5550. "Clear all peers\n"
  5551. "Soft reconfig\n")
  5552. ALIAS (clear_bgp_all_soft,
  5553. clear_bgp_ipv6_all_soft_cmd,
  5554. "clear bgp ipv6 * soft",
  5555. CLEAR_STR
  5556. BGP_STR
  5557. "Address family\n"
  5558. "Clear all peers\n"
  5559. "Soft reconfig\n")
  5560. DEFUN (clear_ip_bgp_peer_soft,
  5561. clear_ip_bgp_peer_soft_cmd,
  5562. "clear ip bgp A.B.C.D soft",
  5563. CLEAR_STR
  5564. IP_STR
  5565. BGP_STR
  5566. "BGP neighbor address to clear\n"
  5567. "Soft reconfig\n")
  5568. {
  5569. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  5570. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5571. }
  5572. DEFUN (clear_ip_bgp_peer_ipv4_soft,
  5573. clear_ip_bgp_peer_ipv4_soft_cmd,
  5574. "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
  5575. CLEAR_STR
  5576. IP_STR
  5577. BGP_STR
  5578. "BGP neighbor address to clear\n"
  5579. "Address family\n"
  5580. "Address Family Modifier\n"
  5581. "Address Family Modifier\n"
  5582. "Soft reconfig\n")
  5583. {
  5584. if (strncmp (argv[1], "m", 1) == 0)
  5585. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
  5586. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5587. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  5588. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5589. }
  5590. DEFUN (clear_ip_bgp_peer_vpnv4_soft,
  5591. clear_ip_bgp_peer_vpnv4_soft_cmd,
  5592. "clear ip bgp A.B.C.D vpnv4 unicast soft",
  5593. CLEAR_STR
  5594. IP_STR
  5595. BGP_STR
  5596. "BGP neighbor address to clear\n"
  5597. "Address family\n"
  5598. "Address Family Modifier\n"
  5599. "Soft reconfig\n")
  5600. {
  5601. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
  5602. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5603. }
  5604. DEFUN (clear_bgp_peer_soft,
  5605. clear_bgp_peer_soft_cmd,
  5606. "clear bgp (A.B.C.D|X:X::X:X) soft",
  5607. CLEAR_STR
  5608. BGP_STR
  5609. "BGP neighbor address to clear\n"
  5610. "BGP IPv6 neighbor to clear\n"
  5611. "Soft reconfig\n")
  5612. {
  5613. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
  5614. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5615. }
  5616. ALIAS (clear_bgp_peer_soft,
  5617. clear_bgp_ipv6_peer_soft_cmd,
  5618. "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
  5619. CLEAR_STR
  5620. BGP_STR
  5621. "Address family\n"
  5622. "BGP neighbor address to clear\n"
  5623. "BGP IPv6 neighbor to clear\n"
  5624. "Soft reconfig\n")
  5625. DEFUN (clear_ip_bgp_peer_group_soft,
  5626. clear_ip_bgp_peer_group_soft_cmd,
  5627. "clear ip bgp peer-group WORD soft",
  5628. CLEAR_STR
  5629. IP_STR
  5630. BGP_STR
  5631. "Clear all members of peer-group\n"
  5632. "BGP peer-group name\n"
  5633. "Soft reconfig\n")
  5634. {
  5635. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5636. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5637. }
  5638. DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
  5639. clear_ip_bgp_peer_group_ipv4_soft_cmd,
  5640. "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
  5641. CLEAR_STR
  5642. IP_STR
  5643. BGP_STR
  5644. "Clear all members of peer-group\n"
  5645. "BGP peer-group name\n"
  5646. "Address family\n"
  5647. "Address Family modifier\n"
  5648. "Address Family modifier\n"
  5649. "Soft reconfig\n")
  5650. {
  5651. if (strncmp (argv[1], "m", 1) == 0)
  5652. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
  5653. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5654. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
  5655. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5656. }
  5657. DEFUN (clear_bgp_peer_group_soft,
  5658. clear_bgp_peer_group_soft_cmd,
  5659. "clear bgp peer-group WORD soft",
  5660. CLEAR_STR
  5661. BGP_STR
  5662. "Clear all members of peer-group\n"
  5663. "BGP peer-group name\n"
  5664. "Soft reconfig\n")
  5665. {
  5666. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
  5667. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5668. }
  5669. ALIAS (clear_bgp_peer_group_soft,
  5670. clear_bgp_ipv6_peer_group_soft_cmd,
  5671. "clear bgp ipv6 peer-group WORD soft",
  5672. CLEAR_STR
  5673. BGP_STR
  5674. "Address family\n"
  5675. "Clear all members of peer-group\n"
  5676. "BGP peer-group name\n"
  5677. "Soft reconfig\n")
  5678. DEFUN (clear_ip_bgp_external_soft,
  5679. clear_ip_bgp_external_soft_cmd,
  5680. "clear ip bgp external soft",
  5681. CLEAR_STR
  5682. IP_STR
  5683. BGP_STR
  5684. "Clear all external peers\n"
  5685. "Soft reconfig\n")
  5686. {
  5687. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5688. BGP_CLEAR_SOFT_BOTH, NULL);
  5689. }
  5690. DEFUN (clear_ip_bgp_external_ipv4_soft,
  5691. clear_ip_bgp_external_ipv4_soft_cmd,
  5692. "clear ip bgp external ipv4 (unicast|multicast) soft",
  5693. CLEAR_STR
  5694. IP_STR
  5695. BGP_STR
  5696. "Clear all external peers\n"
  5697. "Address family\n"
  5698. "Address Family modifier\n"
  5699. "Address Family modifier\n"
  5700. "Soft reconfig\n")
  5701. {
  5702. if (strncmp (argv[0], "m", 1) == 0)
  5703. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
  5704. BGP_CLEAR_SOFT_BOTH, NULL);
  5705. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
  5706. BGP_CLEAR_SOFT_BOTH, NULL);
  5707. }
  5708. DEFUN (clear_bgp_external_soft,
  5709. clear_bgp_external_soft_cmd,
  5710. "clear bgp external soft",
  5711. CLEAR_STR
  5712. BGP_STR
  5713. "Clear all external peers\n"
  5714. "Soft reconfig\n")
  5715. {
  5716. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
  5717. BGP_CLEAR_SOFT_BOTH, NULL);
  5718. }
  5719. ALIAS (clear_bgp_external_soft,
  5720. clear_bgp_ipv6_external_soft_cmd,
  5721. "clear bgp ipv6 external soft",
  5722. CLEAR_STR
  5723. BGP_STR
  5724. "Address family\n"
  5725. "Clear all external peers\n"
  5726. "Soft reconfig\n")
  5727. DEFUN (clear_ip_bgp_as_soft,
  5728. clear_ip_bgp_as_soft_cmd,
  5729. "clear ip bgp " CMD_AS_RANGE " soft",
  5730. CLEAR_STR
  5731. IP_STR
  5732. BGP_STR
  5733. "Clear peers with the AS number\n"
  5734. "Soft reconfig\n")
  5735. {
  5736. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
  5737. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5738. }
  5739. DEFUN (clear_ip_bgp_as_ipv4_soft,
  5740. clear_ip_bgp_as_ipv4_soft_cmd,
  5741. "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
  5742. CLEAR_STR
  5743. IP_STR
  5744. BGP_STR
  5745. "Clear peers with the AS number\n"
  5746. "Address family\n"
  5747. "Address Family Modifier\n"
  5748. "Address Family Modifier\n"
  5749. "Soft reconfig\n")
  5750. {
  5751. if (strncmp (argv[1], "m", 1) == 0)
  5752. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
  5753. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5754. return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
  5755. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5756. }
  5757. DEFUN (clear_ip_bgp_as_vpnv4_soft,
  5758. clear_ip_bgp_as_vpnv4_soft_cmd,
  5759. "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
  5760. CLEAR_STR
  5761. IP_STR
  5762. BGP_STR
  5763. "Clear peers with the AS number\n"
  5764. "Address family\n"
  5765. "Address Family Modifier\n"
  5766. "Soft reconfig\n")
  5767. {
  5768. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
  5769. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5770. }
  5771. DEFUN (clear_bgp_as_soft,
  5772. clear_bgp_as_soft_cmd,
  5773. "clear bgp " CMD_AS_RANGE " soft",
  5774. CLEAR_STR
  5775. BGP_STR
  5776. "Clear peers with the AS number\n"
  5777. "Soft reconfig\n")
  5778. {
  5779. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
  5780. BGP_CLEAR_SOFT_BOTH, argv[0]);
  5781. }
  5782. ALIAS (clear_bgp_as_soft,
  5783. clear_bgp_ipv6_as_soft_cmd,
  5784. "clear bgp ipv6 " CMD_AS_RANGE " soft",
  5785. CLEAR_STR
  5786. BGP_STR
  5787. "Address family\n"
  5788. "Clear peers with the AS number\n"
  5789. "Soft reconfig\n")
  5790. /* RS-client soft reconfiguration. */
  5791. #ifdef HAVE_IPV6
  5792. DEFUN (clear_bgp_all_rsclient,
  5793. clear_bgp_all_rsclient_cmd,
  5794. "clear bgp * rsclient",
  5795. CLEAR_STR
  5796. BGP_STR
  5797. "Clear all peers\n"
  5798. "Soft reconfig for rsclient RIB\n")
  5799. {
  5800. if (argc == 1)
  5801. return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
  5802. BGP_CLEAR_SOFT_RSCLIENT, NULL);
  5803. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
  5804. BGP_CLEAR_SOFT_RSCLIENT, NULL);
  5805. }
  5806. ALIAS (clear_bgp_all_rsclient,
  5807. clear_bgp_ipv6_all_rsclient_cmd,
  5808. "clear bgp ipv6 * rsclient",
  5809. CLEAR_STR
  5810. BGP_STR
  5811. "Address family\n"
  5812. "Clear all peers\n"
  5813. "Soft reconfig for rsclient RIB\n")
  5814. ALIAS (clear_bgp_all_rsclient,
  5815. clear_bgp_instance_all_rsclient_cmd,
  5816. "clear bgp view WORD * rsclient",
  5817. CLEAR_STR
  5818. BGP_STR
  5819. "BGP view\n"
  5820. "view name\n"
  5821. "Clear all peers\n"
  5822. "Soft reconfig for rsclient RIB\n")
  5823. ALIAS (clear_bgp_all_rsclient,
  5824. clear_bgp_ipv6_instance_all_rsclient_cmd,
  5825. "clear bgp ipv6 view WORD * rsclient",
  5826. CLEAR_STR
  5827. BGP_STR
  5828. "Address family\n"
  5829. "BGP view\n"
  5830. "view name\n"
  5831. "Clear all peers\n"
  5832. "Soft reconfig for rsclient RIB\n")
  5833. #endif /* HAVE_IPV6 */
  5834. DEFUN (clear_ip_bgp_all_rsclient,
  5835. clear_ip_bgp_all_rsclient_cmd,
  5836. "clear ip bgp * rsclient",
  5837. CLEAR_STR
  5838. IP_STR
  5839. BGP_STR
  5840. "Clear all peers\n"
  5841. "Soft reconfig for rsclient RIB\n")
  5842. {
  5843. if (argc == 1)
  5844. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
  5845. BGP_CLEAR_SOFT_RSCLIENT, NULL);
  5846. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
  5847. BGP_CLEAR_SOFT_RSCLIENT, NULL);
  5848. }
  5849. ALIAS (clear_ip_bgp_all_rsclient,
  5850. clear_ip_bgp_instance_all_rsclient_cmd,
  5851. "clear ip bgp view WORD * rsclient",
  5852. CLEAR_STR
  5853. IP_STR
  5854. BGP_STR
  5855. "BGP view\n"
  5856. "view name\n"
  5857. "Clear all peers\n"
  5858. "Soft reconfig for rsclient RIB\n")
  5859. #ifdef HAVE_IPV6
  5860. DEFUN (clear_bgp_peer_rsclient,
  5861. clear_bgp_peer_rsclient_cmd,
  5862. "clear bgp (A.B.C.D|X:X::X:X) rsclient",
  5863. CLEAR_STR
  5864. BGP_STR
  5865. "BGP neighbor IP address to clear\n"
  5866. "BGP IPv6 neighbor to clear\n"
  5867. "Soft reconfig for rsclient RIB\n")
  5868. {
  5869. if (argc == 2)
  5870. return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
  5871. BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
  5872. return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
  5873. BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
  5874. }
  5875. ALIAS (clear_bgp_peer_rsclient,
  5876. clear_bgp_ipv6_peer_rsclient_cmd,
  5877. "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
  5878. CLEAR_STR
  5879. BGP_STR
  5880. "Address family\n"
  5881. "BGP neighbor IP address to clear\n"
  5882. "BGP IPv6 neighbor to clear\n"
  5883. "Soft reconfig for rsclient RIB\n")
  5884. ALIAS (clear_bgp_peer_rsclient,
  5885. clear_bgp_instance_peer_rsclient_cmd,
  5886. "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
  5887. CLEAR_STR
  5888. BGP_STR
  5889. "BGP view\n"
  5890. "view name\n"
  5891. "BGP neighbor IP address to clear\n"
  5892. "BGP IPv6 neighbor to clear\n"
  5893. "Soft reconfig for rsclient RIB\n")
  5894. ALIAS (clear_bgp_peer_rsclient,
  5895. clear_bgp_ipv6_instance_peer_rsclient_cmd,
  5896. "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
  5897. CLEAR_STR
  5898. BGP_STR
  5899. "Address family\n"
  5900. "BGP view\n"
  5901. "view name\n"
  5902. "BGP neighbor IP address to clear\n"
  5903. "BGP IPv6 neighbor to clear\n"
  5904. "Soft reconfig for rsclient RIB\n")
  5905. #endif /* HAVE_IPV6 */
  5906. DEFUN (clear_ip_bgp_peer_rsclient,
  5907. clear_ip_bgp_peer_rsclient_cmd,
  5908. "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
  5909. CLEAR_STR
  5910. IP_STR
  5911. BGP_STR
  5912. "BGP neighbor IP address to clear\n"
  5913. "BGP IPv6 neighbor to clear\n"
  5914. "Soft reconfig for rsclient RIB\n")
  5915. {
  5916. if (argc == 2)
  5917. return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
  5918. BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
  5919. return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
  5920. BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
  5921. }
  5922. ALIAS (clear_ip_bgp_peer_rsclient,
  5923. clear_ip_bgp_instance_peer_rsclient_cmd,
  5924. "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
  5925. CLEAR_STR
  5926. IP_STR
  5927. BGP_STR
  5928. "BGP view\n"
  5929. "view name\n"
  5930. "BGP neighbor IP address to clear\n"
  5931. "BGP IPv6 neighbor to clear\n"
  5932. "Soft reconfig for rsclient RIB\n")
  5933. DEFUN (show_bgp_views,
  5934. show_bgp_views_cmd,
  5935. "show bgp views",
  5936. SHOW_STR
  5937. BGP_STR
  5938. "Show the defined BGP views\n")
  5939. {
  5940. struct list *inst = bm->bgp;
  5941. struct listnode *node;
  5942. struct bgp *bgp;
  5943. if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
  5944. {
  5945. vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
  5946. return CMD_WARNING;
  5947. }
  5948. vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
  5949. for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
  5950. vty_out (vty, "\t%s (AS%u)%s",
  5951. bgp->name ? bgp->name : "(null)",
  5952. bgp->as, VTY_NEWLINE);
  5953. return CMD_SUCCESS;
  5954. }
  5955. DEFUN (show_bgp_memory,
  5956. show_bgp_memory_cmd,
  5957. "show bgp memory",
  5958. SHOW_STR
  5959. BGP_STR
  5960. "Global BGP memory statistics\n")
  5961. {
  5962. char memstrbuf[MTYPE_MEMSTR_LEN];
  5963. unsigned long count;
  5964. /* RIB related usage stats */
  5965. count = mtype_stats_alloc (MTYPE_BGP_NODE);
  5966. vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
  5967. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5968. count * sizeof (struct bgp_node)),
  5969. VTY_NEWLINE);
  5970. count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
  5971. vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
  5972. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5973. count * sizeof (struct bgp_info)),
  5974. VTY_NEWLINE);
  5975. if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
  5976. vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
  5977. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5978. count * sizeof (struct bgp_info_extra)),
  5979. VTY_NEWLINE);
  5980. if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
  5981. vty_out (vty, "%ld Static routes, using %s of memory%s", count,
  5982. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5983. count * sizeof (struct bgp_static)),
  5984. VTY_NEWLINE);
  5985. /* Adj-In/Out */
  5986. if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
  5987. vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
  5988. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5989. count * sizeof (struct bgp_adj_in)),
  5990. VTY_NEWLINE);
  5991. if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
  5992. vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
  5993. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5994. count * sizeof (struct bgp_adj_out)),
  5995. VTY_NEWLINE);
  5996. if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
  5997. vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
  5998. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  5999. count * sizeof (struct bgp_nexthop_cache)),
  6000. VTY_NEWLINE);
  6001. if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
  6002. vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
  6003. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6004. count * sizeof (struct bgp_damp_info)),
  6005. VTY_NEWLINE);
  6006. /* Attributes */
  6007. count = attr_count();
  6008. vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
  6009. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6010. count * sizeof(struct attr)),
  6011. VTY_NEWLINE);
  6012. if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
  6013. vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
  6014. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6015. count * sizeof(struct attr_extra)),
  6016. VTY_NEWLINE);
  6017. if ((count = attr_unknown_count()))
  6018. vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
  6019. /* AS_PATH attributes */
  6020. count = aspath_count ();
  6021. vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
  6022. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6023. count * sizeof (struct aspath)),
  6024. VTY_NEWLINE);
  6025. count = mtype_stats_alloc (MTYPE_AS_SEG);
  6026. vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
  6027. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6028. count * sizeof (struct assegment)),
  6029. VTY_NEWLINE);
  6030. /* Other attributes */
  6031. if ((count = community_count ()))
  6032. vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
  6033. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6034. count * sizeof (struct community)),
  6035. VTY_NEWLINE);
  6036. if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
  6037. vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
  6038. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6039. count * sizeof (struct ecommunity)),
  6040. VTY_NEWLINE);
  6041. if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
  6042. vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
  6043. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6044. count * sizeof (struct cluster_list)),
  6045. VTY_NEWLINE);
  6046. /* Peer related usage */
  6047. count = mtype_stats_alloc (MTYPE_BGP_PEER);
  6048. vty_out (vty, "%ld peers, using %s of memory%s", count,
  6049. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6050. count * sizeof (struct peer)),
  6051. VTY_NEWLINE);
  6052. if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
  6053. vty_out (vty, "%ld peer groups, using %s of memory%s", count,
  6054. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6055. count * sizeof (struct peer_group)),
  6056. VTY_NEWLINE);
  6057. /* Other */
  6058. if ((count = mtype_stats_alloc (MTYPE_HASH)))
  6059. vty_out (vty, "%ld hash tables, using %s of memory%s", count,
  6060. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6061. count * sizeof (struct hash)),
  6062. VTY_NEWLINE);
  6063. if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
  6064. vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
  6065. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6066. count * sizeof (struct hash_backet)),
  6067. VTY_NEWLINE);
  6068. if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
  6069. vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
  6070. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6071. count * sizeof (regex_t)),
  6072. VTY_NEWLINE);
  6073. return CMD_SUCCESS;
  6074. }
  6075. /* Show BGP peer's summary information. */
  6076. static int
  6077. bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
  6078. {
  6079. struct peer *peer;
  6080. struct listnode *node, *nnode;
  6081. unsigned int count = 0;
  6082. char timebuf[BGP_UPTIME_LEN];
  6083. int len;
  6084. /* Header string for each address family. */
  6085. static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
  6086. for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
  6087. {
  6088. if (peer->afc[afi][safi])
  6089. {
  6090. if (!count)
  6091. {
  6092. unsigned long ents;
  6093. char memstrbuf[MTYPE_MEMSTR_LEN];
  6094. /* Usage summary and header */
  6095. vty_out (vty,
  6096. "BGP router identifier %s, local AS number %u%s",
  6097. inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
  6098. ents = bgp_table_count (bgp->rib[afi][safi]);
  6099. vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
  6100. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6101. ents * sizeof (struct bgp_node)),
  6102. VTY_NEWLINE);
  6103. /* Peer related usage */
  6104. ents = listcount (bgp->peer);
  6105. vty_out (vty, "Peers %ld, using %s of memory%s",
  6106. ents,
  6107. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6108. ents * sizeof (struct peer)),
  6109. VTY_NEWLINE);
  6110. if ((ents = listcount (bgp->rsclient)))
  6111. vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
  6112. ents,
  6113. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6114. ents * sizeof (struct peer)),
  6115. VTY_NEWLINE);
  6116. if ((ents = listcount (bgp->group)))
  6117. vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
  6118. mtype_memstr (memstrbuf, sizeof (memstrbuf),
  6119. ents * sizeof (struct peer_group)),
  6120. VTY_NEWLINE);
  6121. if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
  6122. vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
  6123. vty_out (vty, "%s", VTY_NEWLINE);
  6124. vty_out (vty, "%s%s", header, VTY_NEWLINE);
  6125. }
  6126. count++;
  6127. len = vty_out (vty, "%s", peer->host);
  6128. len = 16 - len;
  6129. if (len < 1)
  6130. vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
  6131. else
  6132. vty_out (vty, "%*s", len, " ");
  6133. vty_out (vty, "4 ");
  6134. vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
  6135. peer->as,
  6136. peer->open_in + peer->update_in + peer->keepalive_in
  6137. + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
  6138. peer->open_out + peer->update_out + peer->keepalive_out
  6139. + peer->notify_out + peer->refresh_out
  6140. + peer->dynamic_cap_out,
  6141. 0, 0, (unsigned long) peer->obuf->count);
  6142. vty_out (vty, "%8s",
  6143. peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
  6144. if (peer->status == Established)
  6145. {
  6146. vty_out (vty, " %8ld", peer->pcount[afi][safi]);
  6147. }
  6148. else
  6149. {
  6150. if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
  6151. vty_out (vty, " Idle (Admin)");
  6152. else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
  6153. vty_out (vty, " Idle (PfxCt)");
  6154. else
  6155. vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
  6156. }
  6157. vty_out (vty, "%s", VTY_NEWLINE);
  6158. }
  6159. }
  6160. if (count)
  6161. vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
  6162. count, VTY_NEWLINE);
  6163. else
  6164. vty_out (vty, "No %s neighbor is configured%s",
  6165. afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
  6166. return CMD_SUCCESS;
  6167. }
  6168. static int
  6169. bgp_show_summary_vty (struct vty *vty, const char *name,
  6170. afi_t afi, safi_t safi)
  6171. {
  6172. struct bgp *bgp;
  6173. if (name)
  6174. {
  6175. bgp = bgp_lookup_by_name (name);
  6176. if (! bgp)
  6177. {
  6178. vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
  6179. return CMD_WARNING;
  6180. }
  6181. bgp_show_summary (vty, bgp, afi, safi);
  6182. return CMD_SUCCESS;
  6183. }
  6184. bgp = bgp_get_default ();
  6185. if (bgp)
  6186. bgp_show_summary (vty, bgp, afi, safi);
  6187. return CMD_SUCCESS;
  6188. }
  6189. /* `show ip bgp summary' commands. */
  6190. DEFUN (show_ip_bgp_summary,
  6191. show_ip_bgp_summary_cmd,
  6192. "show ip bgp summary",
  6193. SHOW_STR
  6194. IP_STR
  6195. BGP_STR
  6196. "Summary of BGP neighbor status\n")
  6197. {
  6198. return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
  6199. }
  6200. DEFUN (show_ip_bgp_instance_summary,
  6201. show_ip_bgp_instance_summary_cmd,
  6202. "show ip bgp view WORD summary",
  6203. SHOW_STR
  6204. IP_STR
  6205. BGP_STR
  6206. "BGP view\n"
  6207. "View name\n"
  6208. "Summary of BGP neighbor status\n")
  6209. {
  6210. return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
  6211. }
  6212. DEFUN (show_ip_bgp_ipv4_summary,
  6213. show_ip_bgp_ipv4_summary_cmd,
  6214. "show ip bgp ipv4 (unicast|multicast) summary",
  6215. SHOW_STR
  6216. IP_STR
  6217. BGP_STR
  6218. "Address family\n"
  6219. "Address Family modifier\n"
  6220. "Address Family modifier\n"
  6221. "Summary of BGP neighbor status\n")
  6222. {
  6223. if (strncmp (argv[0], "m", 1) == 0)
  6224. return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
  6225. return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
  6226. }
  6227. ALIAS (show_ip_bgp_ipv4_summary,
  6228. show_bgp_ipv4_safi_summary_cmd,
  6229. "show bgp ipv4 (unicast|multicast) summary",
  6230. SHOW_STR
  6231. BGP_STR
  6232. "Address family\n"
  6233. "Address Family modifier\n"
  6234. "Address Family modifier\n"
  6235. "Summary of BGP neighbor status\n")
  6236. DEFUN (show_ip_bgp_instance_ipv4_summary,
  6237. show_ip_bgp_instance_ipv4_summary_cmd,
  6238. "show ip bgp view WORD ipv4 (unicast|multicast) summary",
  6239. SHOW_STR
  6240. IP_STR
  6241. BGP_STR
  6242. "BGP view\n"
  6243. "View name\n"
  6244. "Address family\n"
  6245. "Address Family modifier\n"
  6246. "Address Family modifier\n"
  6247. "Summary of BGP neighbor status\n")
  6248. {
  6249. if (strncmp (argv[1], "m", 1) == 0)
  6250. return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
  6251. else
  6252. return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
  6253. }
  6254. ALIAS (show_ip_bgp_instance_ipv4_summary,
  6255. show_bgp_instance_ipv4_safi_summary_cmd,
  6256. "show bgp view WORD ipv4 (unicast|multicast) summary",
  6257. SHOW_STR
  6258. BGP_STR
  6259. "BGP view\n"
  6260. "View name\n"
  6261. "Address family\n"
  6262. "Address Family modifier\n"
  6263. "Address Family modifier\n"
  6264. "Summary of BGP neighbor status\n")
  6265. DEFUN (show_ip_bgp_vpnv4_all_summary,
  6266. show_ip_bgp_vpnv4_all_summary_cmd,
  6267. "show ip bgp vpnv4 all summary",
  6268. SHOW_STR
  6269. IP_STR
  6270. BGP_STR
  6271. "Display VPNv4 NLRI specific information\n"
  6272. "Display information about all VPNv4 NLRIs\n"
  6273. "Summary of BGP neighbor status\n")
  6274. {
  6275. return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
  6276. }
  6277. DEFUN (show_ip_bgp_vpnv4_rd_summary,
  6278. show_ip_bgp_vpnv4_rd_summary_cmd,
  6279. "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
  6280. SHOW_STR
  6281. IP_STR
  6282. BGP_STR
  6283. "Display VPNv4 NLRI specific information\n"
  6284. "Display information for a route distinguisher\n"
  6285. "VPN Route Distinguisher\n"
  6286. "Summary of BGP neighbor status\n")
  6287. {
  6288. int ret;
  6289. struct prefix_rd prd;
  6290. ret = str2prefix_rd (argv[0], &prd);
  6291. if (! ret)
  6292. {
  6293. vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
  6294. return CMD_WARNING;
  6295. }
  6296. return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
  6297. }
  6298. #ifdef HAVE_IPV6
  6299. DEFUN (show_bgp_summary,
  6300. show_bgp_summary_cmd,
  6301. "show bgp summary",
  6302. SHOW_STR
  6303. BGP_STR
  6304. "Summary of BGP neighbor status\n")
  6305. {
  6306. return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
  6307. }
  6308. DEFUN (show_bgp_instance_summary,
  6309. show_bgp_instance_summary_cmd,
  6310. "show bgp view WORD summary",
  6311. SHOW_STR
  6312. BGP_STR
  6313. "BGP view\n"
  6314. "View name\n"
  6315. "Summary of BGP neighbor status\n")
  6316. {
  6317. return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
  6318. }
  6319. ALIAS (show_bgp_summary,
  6320. show_bgp_ipv6_summary_cmd,
  6321. "show bgp ipv6 summary",
  6322. SHOW_STR
  6323. BGP_STR
  6324. "Address family\n"
  6325. "Summary of BGP neighbor status\n")
  6326. ALIAS (show_bgp_instance_summary,
  6327. show_bgp_instance_ipv6_summary_cmd,
  6328. "show bgp view WORD ipv6 summary",
  6329. SHOW_STR
  6330. BGP_STR
  6331. "BGP view\n"
  6332. "View name\n"
  6333. "Address family\n"
  6334. "Summary of BGP neighbor status\n")
  6335. DEFUN (show_bgp_ipv6_safi_summary,
  6336. show_bgp_ipv6_safi_summary_cmd,
  6337. "show bgp ipv6 (unicast|multicast) summary",
  6338. SHOW_STR
  6339. BGP_STR
  6340. "Address family\n"
  6341. "Address Family modifier\n"
  6342. "Address Family modifier\n"
  6343. "Summary of BGP neighbor status\n")
  6344. {
  6345. if (strncmp (argv[0], "m", 1) == 0)
  6346. return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
  6347. return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
  6348. }
  6349. DEFUN (show_bgp_instance_ipv6_safi_summary,
  6350. show_bgp_instance_ipv6_safi_summary_cmd,
  6351. "show bgp view WORD ipv6 (unicast|multicast) summary",
  6352. SHOW_STR
  6353. BGP_STR
  6354. "BGP view\n"
  6355. "View name\n"
  6356. "Address family\n"
  6357. "Address Family modifier\n"
  6358. "Address Family modifier\n"
  6359. "Summary of BGP neighbor status\n")
  6360. {
  6361. if (strncmp (argv[1], "m", 1) == 0)
  6362. return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
  6363. return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
  6364. }
  6365. /* old command */
  6366. DEFUN (show_ipv6_bgp_summary,
  6367. show_ipv6_bgp_summary_cmd,
  6368. "show ipv6 bgp summary",
  6369. SHOW_STR
  6370. IPV6_STR
  6371. BGP_STR
  6372. "Summary of BGP neighbor status\n")
  6373. {
  6374. return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
  6375. }
  6376. /* old command */
  6377. DEFUN (show_ipv6_mbgp_summary,
  6378. show_ipv6_mbgp_summary_cmd,
  6379. "show ipv6 mbgp summary",
  6380. SHOW_STR
  6381. IPV6_STR
  6382. MBGP_STR
  6383. "Summary of BGP neighbor status\n")
  6384. {
  6385. return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
  6386. }
  6387. #endif /* HAVE_IPV6 */
  6388. const char *
  6389. afi_safi_print (afi_t afi, safi_t safi)
  6390. {
  6391. if (afi == AFI_IP && safi == SAFI_UNICAST)
  6392. return "IPv4 Unicast";
  6393. else if (afi == AFI_IP && safi == SAFI_MULTICAST)
  6394. return "IPv4 Multicast";
  6395. else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
  6396. return "VPNv4 Unicast";
  6397. else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
  6398. return "IPv6 Unicast";
  6399. else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
  6400. return "IPv6 Multicast";
  6401. else
  6402. return "Unknown";
  6403. }
  6404. /* Show BGP peer's information. */
  6405. enum show_type
  6406. {
  6407. show_all,
  6408. show_peer
  6409. };
  6410. static void
  6411. bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
  6412. afi_t afi, safi_t safi,
  6413. u_int16_t adv_smcap, u_int16_t adv_rmcap,
  6414. u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
  6415. {
  6416. /* Send-Mode */
  6417. if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
  6418. || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
  6419. {
  6420. vty_out (vty, " Send-mode: ");
  6421. if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
  6422. vty_out (vty, "advertised");
  6423. if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
  6424. vty_out (vty, "%sreceived",
  6425. CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
  6426. ", " : "");
  6427. vty_out (vty, "%s", VTY_NEWLINE);
  6428. }
  6429. /* Receive-Mode */
  6430. if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
  6431. || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
  6432. {
  6433. vty_out (vty, " Receive-mode: ");
  6434. if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
  6435. vty_out (vty, "advertised");
  6436. if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
  6437. vty_out (vty, "%sreceived",
  6438. CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
  6439. ", " : "");
  6440. vty_out (vty, "%s", VTY_NEWLINE);
  6441. }
  6442. }
  6443. static void
  6444. bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
  6445. {
  6446. struct bgp_filter *filter;
  6447. char orf_pfx_name[BUFSIZ];
  6448. int orf_pfx_count;
  6449. filter = &p->filter[afi][safi];
  6450. vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
  6451. VTY_NEWLINE);
  6452. if (p->af_group[afi][safi])
  6453. vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
  6454. if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
  6455. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
  6456. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
  6457. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
  6458. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
  6459. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
  6460. vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
  6461. if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
  6462. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
  6463. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
  6464. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
  6465. {
  6466. vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
  6467. ORF_TYPE_PREFIX, VTY_NEWLINE);
  6468. bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
  6469. PEER_CAP_ORF_PREFIX_SM_ADV,
  6470. PEER_CAP_ORF_PREFIX_RM_ADV,
  6471. PEER_CAP_ORF_PREFIX_SM_RCV,
  6472. PEER_CAP_ORF_PREFIX_RM_RCV);
  6473. }
  6474. if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
  6475. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
  6476. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
  6477. || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
  6478. {
  6479. vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
  6480. ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
  6481. bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
  6482. PEER_CAP_ORF_PREFIX_SM_ADV,
  6483. PEER_CAP_ORF_PREFIX_RM_ADV,
  6484. PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
  6485. PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
  6486. }
  6487. sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
  6488. orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
  6489. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
  6490. || orf_pfx_count)
  6491. {
  6492. vty_out (vty, " Outbound Route Filter (ORF):");
  6493. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
  6494. vty_out (vty, " sent;");
  6495. if (orf_pfx_count)
  6496. vty_out (vty, " received (%d entries)", orf_pfx_count);
  6497. vty_out (vty, "%s", VTY_NEWLINE);
  6498. }
  6499. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
  6500. vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
  6501. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
  6502. vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
  6503. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
  6504. vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
  6505. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
  6506. vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
  6507. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
  6508. vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
  6509. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
  6510. vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
  6511. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
  6512. vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
  6513. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
  6514. vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
  6515. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
  6516. vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
  6517. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
  6518. || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
  6519. {
  6520. vty_out (vty, " Community attribute sent to this neighbor");
  6521. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
  6522. && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
  6523. vty_out (vty, "(both)%s", VTY_NEWLINE);
  6524. else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
  6525. vty_out (vty, "(extended)%s", VTY_NEWLINE);
  6526. else
  6527. vty_out (vty, "(standard)%s", VTY_NEWLINE);
  6528. }
  6529. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
  6530. {
  6531. vty_out (vty, " Default information originate,");
  6532. if (p->default_rmap[afi][safi].name)
  6533. vty_out (vty, " default route-map %s%s,",
  6534. p->default_rmap[afi][safi].map ? "*" : "",
  6535. p->default_rmap[afi][safi].name);
  6536. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
  6537. vty_out (vty, " default sent%s", VTY_NEWLINE);
  6538. else
  6539. vty_out (vty, " default not sent%s", VTY_NEWLINE);
  6540. }
  6541. if (filter->plist[FILTER_IN].name
  6542. || filter->dlist[FILTER_IN].name
  6543. || filter->aslist[FILTER_IN].name
  6544. || filter->map[RMAP_IN].name)
  6545. vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
  6546. if (filter->plist[FILTER_OUT].name
  6547. || filter->dlist[FILTER_OUT].name
  6548. || filter->aslist[FILTER_OUT].name
  6549. || filter->map[RMAP_OUT].name
  6550. || filter->usmap.name)
  6551. vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
  6552. if (filter->map[RMAP_IMPORT].name)
  6553. vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
  6554. if (filter->map[RMAP_EXPORT].name)
  6555. vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
  6556. /* prefix-list */
  6557. if (filter->plist[FILTER_IN].name)
  6558. vty_out (vty, " Incoming update prefix filter list is %s%s%s",
  6559. filter->plist[FILTER_IN].plist ? "*" : "",
  6560. filter->plist[FILTER_IN].name,
  6561. VTY_NEWLINE);
  6562. if (filter->plist[FILTER_OUT].name)
  6563. vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
  6564. filter->plist[FILTER_OUT].plist ? "*" : "",
  6565. filter->plist[FILTER_OUT].name,
  6566. VTY_NEWLINE);
  6567. /* distribute-list */
  6568. if (filter->dlist[FILTER_IN].name)
  6569. vty_out (vty, " Incoming update network filter list is %s%s%s",
  6570. filter->dlist[FILTER_IN].alist ? "*" : "",
  6571. filter->dlist[FILTER_IN].name,
  6572. VTY_NEWLINE);
  6573. if (filter->dlist[FILTER_OUT].name)
  6574. vty_out (vty, " Outgoing update network filter list is %s%s%s",
  6575. filter->dlist[FILTER_OUT].alist ? "*" : "",
  6576. filter->dlist[FILTER_OUT].name,
  6577. VTY_NEWLINE);
  6578. /* filter-list. */
  6579. if (filter->aslist[FILTER_IN].name)
  6580. vty_out (vty, " Incoming update AS path filter list is %s%s%s",
  6581. filter->aslist[FILTER_IN].aslist ? "*" : "",
  6582. filter->aslist[FILTER_IN].name,
  6583. VTY_NEWLINE);
  6584. if (filter->aslist[FILTER_OUT].name)
  6585. vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
  6586. filter->aslist[FILTER_OUT].aslist ? "*" : "",
  6587. filter->aslist[FILTER_OUT].name,
  6588. VTY_NEWLINE);
  6589. /* route-map. */
  6590. if (filter->map[RMAP_IN].name)
  6591. vty_out (vty, " Route map for incoming advertisements is %s%s%s",
  6592. filter->map[RMAP_IN].map ? "*" : "",
  6593. filter->map[RMAP_IN].name,
  6594. VTY_NEWLINE);
  6595. if (filter->map[RMAP_OUT].name)
  6596. vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
  6597. filter->map[RMAP_OUT].map ? "*" : "",
  6598. filter->map[RMAP_OUT].name,
  6599. VTY_NEWLINE);
  6600. if (filter->map[RMAP_IMPORT].name)
  6601. vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
  6602. filter->map[RMAP_IMPORT].map ? "*" : "",
  6603. filter->map[RMAP_IMPORT].name,
  6604. VTY_NEWLINE);
  6605. if (filter->map[RMAP_EXPORT].name)
  6606. vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
  6607. filter->map[RMAP_EXPORT].map ? "*" : "",
  6608. filter->map[RMAP_EXPORT].name,
  6609. VTY_NEWLINE);
  6610. /* unsuppress-map */
  6611. if (filter->usmap.name)
  6612. vty_out (vty, " Route map for selective unsuppress is %s%s%s",
  6613. filter->usmap.map ? "*" : "",
  6614. filter->usmap.name, VTY_NEWLINE);
  6615. /* Receive prefix count */
  6616. vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
  6617. /* Maximum prefix */
  6618. if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
  6619. {
  6620. vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
  6621. CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
  6622. ? " (warning-only)" : "", VTY_NEWLINE);
  6623. vty_out (vty, " Threshold for warning message %d%%",
  6624. p->pmax_threshold[afi][safi]);
  6625. if (p->pmax_restart[afi][safi])
  6626. vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
  6627. vty_out (vty, "%s", VTY_NEWLINE);
  6628. }
  6629. vty_out (vty, "%s", VTY_NEWLINE);
  6630. }
  6631. static void
  6632. bgp_show_peer (struct vty *vty, struct peer *p)
  6633. {
  6634. struct bgp *bgp;
  6635. char buf1[BUFSIZ];
  6636. char timebuf[BGP_UPTIME_LEN];
  6637. afi_t afi;
  6638. safi_t safi;
  6639. bgp = p->bgp;
  6640. /* Configured IP address. */
  6641. vty_out (vty, "BGP neighbor is %s, ", p->host);
  6642. vty_out (vty, "remote AS %u, ", p->as);
  6643. vty_out (vty, "local AS %u%s%s, ",
  6644. p->change_local_as ? p->change_local_as : p->local_as,
  6645. CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
  6646. " no-prepend" : "",
  6647. CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
  6648. " replace-as" : "");
  6649. vty_out (vty, "%s link%s",
  6650. p->as == p->local_as ? "internal" : "external",
  6651. VTY_NEWLINE);
  6652. /* Description. */
  6653. if (p->desc)
  6654. vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
  6655. /* Peer-group */
  6656. if (p->group)
  6657. vty_out (vty, " Member of peer-group %s for session parameters%s",
  6658. p->group->name, VTY_NEWLINE);
  6659. /* Administrative shutdown. */
  6660. if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
  6661. vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
  6662. /* BGP Version. */
  6663. vty_out (vty, " BGP version 4");
  6664. vty_out (vty, ", remote router ID %s%s",
  6665. inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
  6666. VTY_NEWLINE);
  6667. /* Confederation */
  6668. if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
  6669. && bgp_confederation_peers_check (bgp, p->as))
  6670. vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
  6671. /* Status. */
  6672. vty_out (vty, " BGP state = %s",
  6673. LOOKUP (bgp_status_msg, p->status));
  6674. if (p->status == Established)
  6675. vty_out (vty, ", up for %8s",
  6676. peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
  6677. else if (p->status == Active)
  6678. {
  6679. if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
  6680. vty_out (vty, " (passive)");
  6681. else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
  6682. vty_out (vty, " (NSF passive)");
  6683. }
  6684. vty_out (vty, "%s", VTY_NEWLINE);
  6685. /* read timer */
  6686. vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
  6687. /* Configured timer values. */
  6688. vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
  6689. p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
  6690. if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
  6691. {
  6692. vty_out (vty, " Configured hold time is %d", p->holdtime);
  6693. vty_out (vty, ", keepalive interval is %d seconds%s",
  6694. p->keepalive, VTY_NEWLINE);
  6695. }
  6696. /* Capability. */
  6697. if (p->status == Established)
  6698. {
  6699. if (p->cap
  6700. || p->afc_adv[AFI_IP][SAFI_UNICAST]
  6701. || p->afc_recv[AFI_IP][SAFI_UNICAST]
  6702. || p->afc_adv[AFI_IP][SAFI_MULTICAST]
  6703. || p->afc_recv[AFI_IP][SAFI_MULTICAST]
  6704. #ifdef HAVE_IPV6
  6705. || p->afc_adv[AFI_IP6][SAFI_UNICAST]
  6706. || p->afc_recv[AFI_IP6][SAFI_UNICAST]
  6707. || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
  6708. || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
  6709. #endif /* HAVE_IPV6 */
  6710. || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
  6711. || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
  6712. {
  6713. vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
  6714. /* AS4 */
  6715. if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
  6716. || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
  6717. {
  6718. vty_out (vty, " 4 Byte AS:");
  6719. if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
  6720. vty_out (vty, " advertised");
  6721. if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
  6722. vty_out (vty, " %sreceived",
  6723. CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
  6724. vty_out (vty, "%s", VTY_NEWLINE);
  6725. }
  6726. /* Dynamic */
  6727. if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
  6728. || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
  6729. {
  6730. vty_out (vty, " Dynamic:");
  6731. if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
  6732. vty_out (vty, " advertised");
  6733. if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
  6734. vty_out (vty, " %sreceived",
  6735. CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
  6736. vty_out (vty, "%s", VTY_NEWLINE);
  6737. }
  6738. /* Route Refresh */
  6739. if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
  6740. || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
  6741. || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
  6742. {
  6743. vty_out (vty, " Route refresh:");
  6744. if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
  6745. vty_out (vty, " advertised");
  6746. if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
  6747. || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
  6748. vty_out (vty, " %sreceived(%s)",
  6749. CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
  6750. (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
  6751. && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
  6752. "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
  6753. vty_out (vty, "%s", VTY_NEWLINE);
  6754. }
  6755. /* Multiprotocol Extensions */
  6756. for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
  6757. for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
  6758. if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
  6759. {
  6760. vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
  6761. if (p->afc_adv[afi][safi])
  6762. vty_out (vty, " advertised");
  6763. if (p->afc_recv[afi][safi])
  6764. vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
  6765. vty_out (vty, "%s", VTY_NEWLINE);
  6766. }
  6767. /* Gracefull Restart */
  6768. if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
  6769. || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
  6770. {
  6771. vty_out (vty, " Graceful Restart Capabilty:");
  6772. if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
  6773. vty_out (vty, " advertised");
  6774. if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
  6775. vty_out (vty, " %sreceived",
  6776. CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
  6777. vty_out (vty, "%s", VTY_NEWLINE);
  6778. if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
  6779. {
  6780. int restart_af_count = 0;
  6781. vty_out (vty, " Remote Restart timer is %d seconds%s",
  6782. p->v_gr_restart, VTY_NEWLINE);
  6783. vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
  6784. for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
  6785. for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
  6786. if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
  6787. {
  6788. vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
  6789. afi_safi_print (afi, safi),
  6790. CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
  6791. "preserved" : "not preserved");
  6792. restart_af_count++;
  6793. }
  6794. if (! restart_af_count)
  6795. vty_out (vty, "none");
  6796. vty_out (vty, "%s", VTY_NEWLINE);
  6797. }
  6798. }
  6799. }
  6800. }
  6801. /* graceful restart information */
  6802. if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
  6803. || p->t_gr_restart
  6804. || p->t_gr_stale)
  6805. {
  6806. int eor_send_af_count = 0;
  6807. int eor_receive_af_count = 0;
  6808. vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
  6809. if (p->status == Established)
  6810. {
  6811. vty_out (vty, " End-of-RIB send: ");
  6812. for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
  6813. for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
  6814. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
  6815. {
  6816. vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
  6817. afi_safi_print (afi, safi));
  6818. eor_send_af_count++;
  6819. }
  6820. vty_out (vty, "%s", VTY_NEWLINE);
  6821. vty_out (vty, " End-of-RIB received: ");
  6822. for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
  6823. for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
  6824. if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
  6825. {
  6826. vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
  6827. afi_safi_print (afi, safi));
  6828. eor_receive_af_count++;
  6829. }
  6830. vty_out (vty, "%s", VTY_NEWLINE);
  6831. }
  6832. if (p->t_gr_restart)
  6833. vty_out (vty, " The remaining time of restart timer is %ld%s",
  6834. thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
  6835. if (p->t_gr_stale)
  6836. vty_out (vty, " The remaining time of stalepath timer is %ld%s",
  6837. thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
  6838. }
  6839. /* Packet counts. */
  6840. vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
  6841. vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
  6842. vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
  6843. vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
  6844. vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
  6845. vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
  6846. vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
  6847. vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
  6848. vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
  6849. vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
  6850. vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
  6851. p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
  6852. p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
  6853. p->dynamic_cap_in, VTY_NEWLINE);
  6854. /* advertisement-interval */
  6855. vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
  6856. p->v_routeadv, VTY_NEWLINE);
  6857. /* Update-source. */
  6858. if (p->update_if || p->update_source)
  6859. {
  6860. vty_out (vty, " Update source is ");
  6861. if (p->update_if)
  6862. vty_out (vty, "%s", p->update_if);
  6863. else if (p->update_source)
  6864. vty_out (vty, "%s",
  6865. sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
  6866. vty_out (vty, "%s", VTY_NEWLINE);
  6867. }
  6868. /* Default weight */
  6869. if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
  6870. vty_out (vty, " Default weight %d%s", p->weight,
  6871. VTY_NEWLINE);
  6872. vty_out (vty, "%s", VTY_NEWLINE);
  6873. /* Address Family Information */
  6874. for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
  6875. for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
  6876. if (p->afc[afi][safi])
  6877. bgp_show_peer_afi (vty, p, afi, safi);
  6878. vty_out (vty, " Connections established %d; dropped %d%s",
  6879. p->established, p->dropped,
  6880. VTY_NEWLINE);
  6881. if (! p->dropped)
  6882. vty_out (vty, " Last reset never%s", VTY_NEWLINE);
  6883. else
  6884. vty_out (vty, " Last reset %s, due to %s%s",
  6885. peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
  6886. peer_down_str[(int) p->last_reset], VTY_NEWLINE);
  6887. if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
  6888. {
  6889. vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
  6890. if (p->t_pmax_restart)
  6891. vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
  6892. p->host, thread_timer_remain_second (p->t_pmax_restart),
  6893. VTY_NEWLINE);
  6894. else
  6895. vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
  6896. p->host, VTY_NEWLINE);
  6897. }
  6898. /* EBGP Multihop and GTSM */
  6899. if (p->sort != BGP_PEER_IBGP)
  6900. {
  6901. if (p->gtsm_hops > 0)
  6902. vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
  6903. p->gtsm_hops, VTY_NEWLINE);
  6904. else if (p->ttl > 1)
  6905. vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
  6906. p->ttl, VTY_NEWLINE);
  6907. }
  6908. else
  6909. {
  6910. if (p->gtsm_hops > 0)
  6911. vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
  6912. p->gtsm_hops, VTY_NEWLINE);
  6913. }
  6914. /* Local address. */
  6915. if (p->su_local)
  6916. {
  6917. vty_out (vty, "Local host: %s, Local port: %d%s",
  6918. sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
  6919. ntohs (p->su_local->sin.sin_port),
  6920. VTY_NEWLINE);
  6921. }
  6922. /* Remote address. */
  6923. if (p->su_remote)
  6924. {
  6925. vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
  6926. sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
  6927. ntohs (p->su_remote->sin.sin_port),
  6928. VTY_NEWLINE);
  6929. }
  6930. /* Nexthop display. */
  6931. if (p->su_local)
  6932. {
  6933. vty_out (vty, "Nexthop: %s%s",
  6934. inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
  6935. VTY_NEWLINE);
  6936. #ifdef HAVE_IPV6
  6937. vty_out (vty, "Nexthop global: %s%s",
  6938. inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
  6939. VTY_NEWLINE);
  6940. vty_out (vty, "Nexthop local: %s%s",
  6941. inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
  6942. VTY_NEWLINE);
  6943. vty_out (vty, "BGP connection: %s%s",
  6944. p->shared_network ? "shared network" : "non shared network",
  6945. VTY_NEWLINE);
  6946. #endif /* HAVE_IPV6 */
  6947. }
  6948. /* TCP metrics. */
  6949. if (p->status == Established && p->rtt)
  6950. vty_out (vty, "Estimated round trip time: %d ms%s",
  6951. p->rtt, VTY_NEWLINE);
  6952. /* Timer information. */
  6953. if (p->t_start)
  6954. vty_out (vty, "Next start timer due in %ld seconds%s",
  6955. thread_timer_remain_second (p->t_start), VTY_NEWLINE);
  6956. if (p->t_connect)
  6957. vty_out (vty, "Next connect timer due in %ld seconds%s",
  6958. thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
  6959. vty_out (vty, "Read thread: %s Write thread: %s%s",
  6960. p->t_read ? "on" : "off",
  6961. p->t_write ? "on" : "off",
  6962. VTY_NEWLINE);
  6963. if (p->notify.code == BGP_NOTIFY_OPEN_ERR
  6964. && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
  6965. bgp_capability_vty_out (vty, p);
  6966. vty_out (vty, "%s", VTY_NEWLINE);
  6967. }
  6968. static int
  6969. bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
  6970. enum show_type type, union sockunion *su)
  6971. {
  6972. struct listnode *node, *nnode;
  6973. struct peer *peer;
  6974. int find = 0;
  6975. for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
  6976. {
  6977. switch (type)
  6978. {
  6979. case show_all:
  6980. bgp_show_peer (vty, peer);
  6981. break;
  6982. case show_peer:
  6983. if (sockunion_same (&peer->su, su))
  6984. {
  6985. find = 1;
  6986. bgp_show_peer (vty, peer);
  6987. }
  6988. break;
  6989. }
  6990. }
  6991. if (type == show_peer && ! find)
  6992. vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
  6993. return CMD_SUCCESS;
  6994. }
  6995. static int
  6996. bgp_show_neighbor_vty (struct vty *vty, const char *name,
  6997. enum show_type type, const char *ip_str)
  6998. {
  6999. int ret;
  7000. struct bgp *bgp;
  7001. union sockunion su;
  7002. if (ip_str)
  7003. {
  7004. ret = str2sockunion (ip_str, &su);
  7005. if (ret < 0)
  7006. {
  7007. vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
  7008. return CMD_WARNING;
  7009. }
  7010. }
  7011. if (name)
  7012. {
  7013. bgp = bgp_lookup_by_name (name);
  7014. if (! bgp)
  7015. {
  7016. vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
  7017. return CMD_WARNING;
  7018. }
  7019. bgp_show_neighbor (vty, bgp, type, &su);
  7020. return CMD_SUCCESS;
  7021. }
  7022. bgp = bgp_get_default ();
  7023. if (bgp)
  7024. bgp_show_neighbor (vty, bgp, type, &su);
  7025. return CMD_SUCCESS;
  7026. }
  7027. /* "show ip bgp neighbors" commands. */
  7028. DEFUN (show_ip_bgp_neighbors,
  7029. show_ip_bgp_neighbors_cmd,
  7030. "show ip bgp neighbors",
  7031. SHOW_STR
  7032. IP_STR
  7033. BGP_STR
  7034. "Detailed information on TCP and BGP neighbor connections\n")
  7035. {
  7036. return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
  7037. }
  7038. ALIAS (show_ip_bgp_neighbors,
  7039. show_ip_bgp_ipv4_neighbors_cmd,
  7040. "show ip bgp ipv4 (unicast|multicast) neighbors",
  7041. SHOW_STR
  7042. IP_STR
  7043. BGP_STR
  7044. "Address family\n"
  7045. "Address Family modifier\n"
  7046. "Address Family modifier\n"
  7047. "Detailed information on TCP and BGP neighbor connections\n")
  7048. ALIAS (show_ip_bgp_neighbors,
  7049. show_ip_bgp_vpnv4_all_neighbors_cmd,
  7050. "show ip bgp vpnv4 all neighbors",
  7051. SHOW_STR
  7052. IP_STR
  7053. BGP_STR
  7054. "Display VPNv4 NLRI specific information\n"
  7055. "Display information about all VPNv4 NLRIs\n"
  7056. "Detailed information on TCP and BGP neighbor connections\n")
  7057. ALIAS (show_ip_bgp_neighbors,
  7058. show_ip_bgp_vpnv4_rd_neighbors_cmd,
  7059. "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
  7060. SHOW_STR
  7061. IP_STR
  7062. BGP_STR
  7063. "Display VPNv4 NLRI specific information\n"
  7064. "Display information for a route distinguisher\n"
  7065. "VPN Route Distinguisher\n"
  7066. "Detailed information on TCP and BGP neighbor connections\n")
  7067. ALIAS (show_ip_bgp_neighbors,
  7068. show_bgp_neighbors_cmd,
  7069. "show bgp neighbors",
  7070. SHOW_STR
  7071. BGP_STR
  7072. "Detailed information on TCP and BGP neighbor connections\n")
  7073. ALIAS (show_ip_bgp_neighbors,
  7074. show_bgp_ipv6_neighbors_cmd,
  7075. "show bgp ipv6 neighbors",
  7076. SHOW_STR
  7077. BGP_STR
  7078. "Address family\n"
  7079. "Detailed information on TCP and BGP neighbor connections\n")
  7080. DEFUN (show_ip_bgp_neighbors_peer,
  7081. show_ip_bgp_neighbors_peer_cmd,
  7082. "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
  7083. SHOW_STR
  7084. IP_STR
  7085. BGP_STR
  7086. "Detailed information on TCP and BGP neighbor connections\n"
  7087. "Neighbor to display information about\n"
  7088. "Neighbor to display information about\n")
  7089. {
  7090. return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
  7091. }
  7092. ALIAS (show_ip_bgp_neighbors_peer,
  7093. show_ip_bgp_ipv4_neighbors_peer_cmd,
  7094. "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
  7095. SHOW_STR
  7096. IP_STR
  7097. BGP_STR
  7098. "Address family\n"
  7099. "Address Family modifier\n"
  7100. "Address Family modifier\n"
  7101. "Detailed information on TCP and BGP neighbor connections\n"
  7102. "Neighbor to display information about\n"
  7103. "Neighbor to display information about\n")
  7104. ALIAS (show_ip_bgp_neighbors_peer,
  7105. show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
  7106. "show ip bgp vpnv4 all neighbors A.B.C.D",
  7107. SHOW_STR
  7108. IP_STR
  7109. BGP_STR
  7110. "Display VPNv4 NLRI specific information\n"
  7111. "Display information about all VPNv4 NLRIs\n"
  7112. "Detailed information on TCP and BGP neighbor connections\n"
  7113. "Neighbor to display information about\n")
  7114. ALIAS (show_ip_bgp_neighbors_peer,
  7115. show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
  7116. "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
  7117. SHOW_STR
  7118. IP_STR
  7119. BGP_STR
  7120. "Display VPNv4 NLRI specific information\n"
  7121. "Display information about all VPNv4 NLRIs\n"
  7122. "Detailed information on TCP and BGP neighbor connections\n"
  7123. "Neighbor to display information about\n")
  7124. ALIAS (show_ip_bgp_neighbors_peer,
  7125. show_bgp_neighbors_peer_cmd,
  7126. "show bgp neighbors (A.B.C.D|X:X::X:X)",
  7127. SHOW_STR
  7128. BGP_STR
  7129. "Detailed information on TCP and BGP neighbor connections\n"
  7130. "Neighbor to display information about\n"
  7131. "Neighbor to display information about\n")
  7132. ALIAS (show_ip_bgp_neighbors_peer,
  7133. show_bgp_ipv6_neighbors_peer_cmd,
  7134. "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
  7135. SHOW_STR
  7136. BGP_STR
  7137. "Address family\n"
  7138. "Detailed information on TCP and BGP neighbor connections\n"
  7139. "Neighbor to display information about\n"
  7140. "Neighbor to display information about\n")
  7141. DEFUN (show_ip_bgp_instance_neighbors,
  7142. show_ip_bgp_instance_neighbors_cmd,
  7143. "show ip bgp view WORD neighbors",
  7144. SHOW_STR
  7145. IP_STR
  7146. BGP_STR
  7147. "BGP view\n"
  7148. "View name\n"
  7149. "Detailed information on TCP and BGP neighbor connections\n")
  7150. {
  7151. return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
  7152. }
  7153. ALIAS (show_ip_bgp_instance_neighbors,
  7154. show_bgp_instance_neighbors_cmd,
  7155. "show bgp view WORD neighbors",
  7156. SHOW_STR
  7157. BGP_STR
  7158. "BGP view\n"
  7159. "View name\n"
  7160. "Detailed information on TCP and BGP neighbor connections\n")
  7161. ALIAS (show_ip_bgp_instance_neighbors,
  7162. show_bgp_instance_ipv6_neighbors_cmd,
  7163. "show bgp view WORD ipv6 neighbors",
  7164. SHOW_STR
  7165. BGP_STR
  7166. "BGP view\n"
  7167. "View name\n"
  7168. "Address family\n"
  7169. "Detailed information on TCP and BGP neighbor connections\n")
  7170. DEFUN (show_ip_bgp_instance_neighbors_peer,
  7171. show_ip_bgp_instance_neighbors_peer_cmd,
  7172. "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
  7173. SHOW_STR
  7174. IP_STR
  7175. BGP_STR
  7176. "BGP view\n"
  7177. "View name\n"
  7178. "Detailed information on TCP and BGP neighbor connections\n"
  7179. "Neighbor to display information about\n"
  7180. "Neighbor to display information about\n")
  7181. {
  7182. return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
  7183. }
  7184. ALIAS (show_ip_bgp_instance_neighbors_peer,
  7185. show_bgp_instance_neighbors_peer_cmd,
  7186. "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
  7187. SHOW_STR
  7188. BGP_STR
  7189. "BGP view\n"
  7190. "View name\n"
  7191. "Detailed information on TCP and BGP neighbor connections\n"
  7192. "Neighbor to display information about\n"
  7193. "Neighbor to display information about\n")
  7194. ALIAS (show_ip_bgp_instance_neighbors_peer,
  7195. show_bgp_instance_ipv6_neighbors_peer_cmd,
  7196. "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
  7197. SHOW_STR
  7198. BGP_STR
  7199. "BGP view\n"
  7200. "View name\n"
  7201. "Address family\n"
  7202. "Detailed information on TCP and BGP neighbor connections\n"
  7203. "Neighbor to display information about\n"
  7204. "Neighbor to display information about\n")
  7205. /* Show BGP's AS paths internal data. There are both `show ip bgp
  7206. paths' and `show ip mbgp paths'. Those functions results are the
  7207. same.*/
  7208. DEFUN (show_ip_bgp_paths,
  7209. show_ip_bgp_paths_cmd,
  7210. "show ip bgp paths",
  7211. SHOW_STR
  7212. IP_STR
  7213. BGP_STR
  7214. "Path information\n")
  7215. {
  7216. vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
  7217. aspath_print_all_vty (vty);
  7218. return CMD_SUCCESS;
  7219. }
  7220. DEFUN (show_ip_bgp_ipv4_paths,
  7221. show_ip_bgp_ipv4_paths_cmd,
  7222. "show ip bgp ipv4 (unicast|multicast) paths",
  7223. SHOW_STR
  7224. IP_STR
  7225. BGP_STR
  7226. "Address family\n"
  7227. "Address Family modifier\n"
  7228. "Address Family modifier\n"
  7229. "Path information\n")
  7230. {
  7231. vty_out (vty, "Address Refcnt Path\r\n");
  7232. aspath_print_all_vty (vty);
  7233. return CMD_SUCCESS;
  7234. }
  7235. #include "hash.h"
  7236. static void
  7237. community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
  7238. {
  7239. struct community *com;
  7240. com = (struct community *) backet->data;
  7241. vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
  7242. community_str (com), VTY_NEWLINE);
  7243. }
  7244. /* Show BGP's community internal data. */
  7245. DEFUN (show_ip_bgp_community_info,
  7246. show_ip_bgp_community_info_cmd,
  7247. "show ip bgp community-info",
  7248. SHOW_STR
  7249. IP_STR
  7250. BGP_STR
  7251. "List all bgp community information\n")
  7252. {
  7253. vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
  7254. hash_iterate (community_hash (),
  7255. (void (*) (struct hash_backet *, void *))
  7256. community_show_all_iterator,
  7257. vty);
  7258. return CMD_SUCCESS;
  7259. }
  7260. DEFUN (show_ip_bgp_attr_info,
  7261. show_ip_bgp_attr_info_cmd,
  7262. "show ip bgp attribute-info",
  7263. SHOW_STR
  7264. IP_STR
  7265. BGP_STR
  7266. "List all bgp attribute information\n")
  7267. {
  7268. attr_show_all (vty);
  7269. return CMD_SUCCESS;
  7270. }
  7271. static int
  7272. bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
  7273. afi_t afi, safi_t safi)
  7274. {
  7275. char timebuf[BGP_UPTIME_LEN];
  7276. char rmbuf[14];
  7277. const char *rmname;
  7278. struct peer *peer;
  7279. struct listnode *node, *nnode;
  7280. int len;
  7281. int count = 0;
  7282. if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
  7283. {
  7284. for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
  7285. {
  7286. count++;
  7287. bgp_write_rsclient_summary (vty, peer, afi, safi);
  7288. }
  7289. return count;
  7290. }
  7291. len = vty_out (vty, "%s", rsclient->host);
  7292. len = 16 - len;
  7293. if (len < 1)
  7294. vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
  7295. else
  7296. vty_out (vty, "%*s", len, " ");
  7297. vty_out (vty, "4 ");
  7298. vty_out (vty, "%10u ", rsclient->as);
  7299. rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
  7300. if ( rmname && strlen (rmname) > 13 )
  7301. {
  7302. sprintf (rmbuf, "%13s", "...");
  7303. rmname = strncpy (rmbuf, rmname, 10);
  7304. }
  7305. else if (! rmname)
  7306. rmname = "<none>";
  7307. vty_out (vty, " %13s ", rmname);
  7308. rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
  7309. if ( rmname && strlen (rmname) > 13 )
  7310. {
  7311. sprintf (rmbuf, "%13s", "...");
  7312. rmname = strncpy (rmbuf, rmname, 10);
  7313. }
  7314. else if (! rmname)
  7315. rmname = "<none>";
  7316. vty_out (vty, " %13s ", rmname);
  7317. vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
  7318. if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
  7319. vty_out (vty, " Idle (Admin)");
  7320. else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
  7321. vty_out (vty, " Idle (PfxCt)");
  7322. else
  7323. vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
  7324. vty_out (vty, "%s", VTY_NEWLINE);
  7325. return 1;
  7326. }
  7327. static int
  7328. bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
  7329. afi_t afi, safi_t safi)
  7330. {
  7331. struct peer *peer;
  7332. struct listnode *node, *nnode;
  7333. int count = 0;
  7334. /* Header string for each address family. */
  7335. static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
  7336. for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
  7337. {
  7338. if (peer->afc[afi][safi] &&
  7339. CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
  7340. {
  7341. if (! count)
  7342. {
  7343. vty_out (vty,
  7344. "Route Server's BGP router identifier %s%s",
  7345. inet_ntoa (bgp->router_id), VTY_NEWLINE);
  7346. vty_out (vty,
  7347. "Route Server's local AS number %u%s", bgp->as,
  7348. VTY_NEWLINE);
  7349. vty_out (vty, "%s", VTY_NEWLINE);
  7350. vty_out (vty, "%s%s", header, VTY_NEWLINE);
  7351. }
  7352. count += bgp_write_rsclient_summary (vty, peer, afi, safi);
  7353. }
  7354. }
  7355. if (count)
  7356. vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
  7357. count, VTY_NEWLINE);
  7358. else
  7359. vty_out (vty, "No %s Route Server Client is configured%s",
  7360. afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
  7361. return CMD_SUCCESS;
  7362. }
  7363. static int
  7364. bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
  7365. afi_t afi, safi_t safi)
  7366. {
  7367. struct bgp *bgp;
  7368. if (name)
  7369. {
  7370. bgp = bgp_lookup_by_name (name);
  7371. if (! bgp)
  7372. {
  7373. vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
  7374. return CMD_WARNING;
  7375. }
  7376. bgp_show_rsclient_summary (vty, bgp, afi, safi);
  7377. return CMD_SUCCESS;
  7378. }
  7379. bgp = bgp_get_default ();
  7380. if (bgp)
  7381. bgp_show_rsclient_summary (vty, bgp, afi, safi);
  7382. return CMD_SUCCESS;
  7383. }
  7384. /* 'show bgp rsclient' commands. */
  7385. DEFUN (show_ip_bgp_rsclient_summary,
  7386. show_ip_bgp_rsclient_summary_cmd,
  7387. "show ip bgp rsclient summary",
  7388. SHOW_STR
  7389. IP_STR
  7390. BGP_STR
  7391. "Information about Route Server Clients\n"
  7392. "Summary of all Route Server Clients\n")
  7393. {
  7394. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
  7395. }
  7396. DEFUN (show_ip_bgp_instance_rsclient_summary,
  7397. show_ip_bgp_instance_rsclient_summary_cmd,
  7398. "show ip bgp view WORD rsclient summary",
  7399. SHOW_STR
  7400. IP_STR
  7401. BGP_STR
  7402. "BGP view\n"
  7403. "View name\n"
  7404. "Information about Route Server Clients\n"
  7405. "Summary of all Route Server Clients\n")
  7406. {
  7407. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
  7408. }
  7409. DEFUN (show_ip_bgp_ipv4_rsclient_summary,
  7410. show_ip_bgp_ipv4_rsclient_summary_cmd,
  7411. "show ip bgp ipv4 (unicast|multicast) rsclient summary",
  7412. SHOW_STR
  7413. IP_STR
  7414. BGP_STR
  7415. "Address family\n"
  7416. "Address Family modifier\n"
  7417. "Address Family modifier\n"
  7418. "Information about Route Server Clients\n"
  7419. "Summary of all Route Server Clients\n")
  7420. {
  7421. if (strncmp (argv[0], "m", 1) == 0)
  7422. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
  7423. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
  7424. }
  7425. DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
  7426. show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
  7427. "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
  7428. SHOW_STR
  7429. IP_STR
  7430. BGP_STR
  7431. "BGP view\n"
  7432. "View name\n"
  7433. "Address family\n"
  7434. "Address Family modifier\n"
  7435. "Address Family modifier\n"
  7436. "Information about Route Server Clients\n"
  7437. "Summary of all Route Server Clients\n")
  7438. {
  7439. if (strncmp (argv[1], "m", 1) == 0)
  7440. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
  7441. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
  7442. }
  7443. DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
  7444. show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
  7445. "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
  7446. SHOW_STR
  7447. BGP_STR
  7448. "BGP view\n"
  7449. "View name\n"
  7450. "Address family\n"
  7451. "Address Family modifier\n"
  7452. "Address Family modifier\n"
  7453. "Information about Route Server Clients\n"
  7454. "Summary of all Route Server Clients\n")
  7455. {
  7456. safi_t safi;
  7457. if (argc == 2) {
  7458. safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
  7459. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
  7460. } else {
  7461. safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
  7462. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
  7463. }
  7464. }
  7465. ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
  7466. show_bgp_ipv4_safi_rsclient_summary_cmd,
  7467. "show bgp ipv4 (unicast|multicast) rsclient summary",
  7468. SHOW_STR
  7469. BGP_STR
  7470. "Address family\n"
  7471. "Address Family modifier\n"
  7472. "Address Family modifier\n"
  7473. "Information about Route Server Clients\n"
  7474. "Summary of all Route Server Clients\n")
  7475. #ifdef HAVE_IPV6
  7476. DEFUN (show_bgp_rsclient_summary,
  7477. show_bgp_rsclient_summary_cmd,
  7478. "show bgp rsclient summary",
  7479. SHOW_STR
  7480. BGP_STR
  7481. "Information about Route Server Clients\n"
  7482. "Summary of all Route Server Clients\n")
  7483. {
  7484. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
  7485. }
  7486. DEFUN (show_bgp_instance_rsclient_summary,
  7487. show_bgp_instance_rsclient_summary_cmd,
  7488. "show bgp view WORD rsclient summary",
  7489. SHOW_STR
  7490. BGP_STR
  7491. "BGP view\n"
  7492. "View name\n"
  7493. "Information about Route Server Clients\n"
  7494. "Summary of all Route Server Clients\n")
  7495. {
  7496. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
  7497. }
  7498. ALIAS (show_bgp_rsclient_summary,
  7499. show_bgp_ipv6_rsclient_summary_cmd,
  7500. "show bgp ipv6 rsclient summary",
  7501. SHOW_STR
  7502. BGP_STR
  7503. "Address family\n"
  7504. "Information about Route Server Clients\n"
  7505. "Summary of all Route Server Clients\n")
  7506. ALIAS (show_bgp_instance_rsclient_summary,
  7507. show_bgp_instance_ipv6_rsclient_summary_cmd,
  7508. "show bgp view WORD ipv6 rsclient summary",
  7509. SHOW_STR
  7510. BGP_STR
  7511. "BGP view\n"
  7512. "View name\n"
  7513. "Address family\n"
  7514. "Information about Route Server Clients\n"
  7515. "Summary of all Route Server Clients\n")
  7516. DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
  7517. show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
  7518. "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
  7519. SHOW_STR
  7520. BGP_STR
  7521. "BGP view\n"
  7522. "View name\n"
  7523. "Address family\n"
  7524. "Address Family modifier\n"
  7525. "Address Family modifier\n"
  7526. "Information about Route Server Clients\n"
  7527. "Summary of all Route Server Clients\n")
  7528. {
  7529. safi_t safi;
  7530. if (argc == 2) {
  7531. safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
  7532. return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
  7533. } else {
  7534. safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
  7535. return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
  7536. }
  7537. }
  7538. ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
  7539. show_bgp_ipv6_safi_rsclient_summary_cmd,
  7540. "show bgp ipv6 (unicast|multicast) rsclient summary",
  7541. SHOW_STR
  7542. BGP_STR
  7543. "Address family\n"
  7544. "Address Family modifier\n"
  7545. "Address Family modifier\n"
  7546. "Information about Route Server Clients\n"
  7547. "Summary of all Route Server Clients\n")
  7548. #endif /* HAVE IPV6 */
  7549. /* Redistribute VTY commands. */
  7550. DEFUN (bgp_redistribute_ipv4,
  7551. bgp_redistribute_ipv4_cmd,
  7552. "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
  7553. "Redistribute information from another routing protocol\n"
  7554. QUAGGA_IP_REDIST_HELP_STR_BGPD)
  7555. {
  7556. int type;
  7557. type = proto_redistnum (AFI_IP, argv[0]);
  7558. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7559. {
  7560. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7561. return CMD_WARNING;
  7562. }
  7563. return bgp_redistribute_set (vty->index, AFI_IP, type);
  7564. }
  7565. DEFUN (bgp_redistribute_ipv4_rmap,
  7566. bgp_redistribute_ipv4_rmap_cmd,
  7567. "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
  7568. "Redistribute information from another routing protocol\n"
  7569. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7570. "Route map reference\n"
  7571. "Pointer to route-map entries\n")
  7572. {
  7573. int type;
  7574. type = proto_redistnum (AFI_IP, argv[0]);
  7575. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7576. {
  7577. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7578. return CMD_WARNING;
  7579. }
  7580. bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
  7581. return bgp_redistribute_set (vty->index, AFI_IP, type);
  7582. }
  7583. DEFUN (bgp_redistribute_ipv4_metric,
  7584. bgp_redistribute_ipv4_metric_cmd,
  7585. "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
  7586. "Redistribute information from another routing protocol\n"
  7587. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7588. "Metric for redistributed routes\n"
  7589. "Default metric\n")
  7590. {
  7591. int type;
  7592. u_int32_t metric;
  7593. type = proto_redistnum (AFI_IP, argv[0]);
  7594. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7595. {
  7596. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7597. return CMD_WARNING;
  7598. }
  7599. VTY_GET_INTEGER ("metric", metric, argv[1]);
  7600. bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
  7601. return bgp_redistribute_set (vty->index, AFI_IP, type);
  7602. }
  7603. DEFUN (bgp_redistribute_ipv4_rmap_metric,
  7604. bgp_redistribute_ipv4_rmap_metric_cmd,
  7605. "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
  7606. "Redistribute information from another routing protocol\n"
  7607. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7608. "Route map reference\n"
  7609. "Pointer to route-map entries\n"
  7610. "Metric for redistributed routes\n"
  7611. "Default metric\n")
  7612. {
  7613. int type;
  7614. u_int32_t metric;
  7615. type = proto_redistnum (AFI_IP, argv[0]);
  7616. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7617. {
  7618. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7619. return CMD_WARNING;
  7620. }
  7621. VTY_GET_INTEGER ("metric", metric, argv[2]);
  7622. bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
  7623. bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
  7624. return bgp_redistribute_set (vty->index, AFI_IP, type);
  7625. }
  7626. DEFUN (bgp_redistribute_ipv4_metric_rmap,
  7627. bgp_redistribute_ipv4_metric_rmap_cmd,
  7628. "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
  7629. "Redistribute information from another routing protocol\n"
  7630. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7631. "Metric for redistributed routes\n"
  7632. "Default metric\n"
  7633. "Route map reference\n"
  7634. "Pointer to route-map entries\n")
  7635. {
  7636. int type;
  7637. u_int32_t metric;
  7638. type = proto_redistnum (AFI_IP, argv[0]);
  7639. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7640. {
  7641. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7642. return CMD_WARNING;
  7643. }
  7644. VTY_GET_INTEGER ("metric", metric, argv[1]);
  7645. bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
  7646. bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
  7647. return bgp_redistribute_set (vty->index, AFI_IP, type);
  7648. }
  7649. DEFUN (no_bgp_redistribute_ipv4,
  7650. no_bgp_redistribute_ipv4_cmd,
  7651. "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
  7652. NO_STR
  7653. "Redistribute information from another routing protocol\n"
  7654. QUAGGA_IP_REDIST_HELP_STR_BGPD)
  7655. {
  7656. int type;
  7657. type = proto_redistnum (AFI_IP, argv[0]);
  7658. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7659. {
  7660. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7661. return CMD_WARNING;
  7662. }
  7663. return bgp_redistribute_unset (vty->index, AFI_IP, type);
  7664. }
  7665. DEFUN (no_bgp_redistribute_ipv4_rmap,
  7666. no_bgp_redistribute_ipv4_rmap_cmd,
  7667. "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
  7668. NO_STR
  7669. "Redistribute information from another routing protocol\n"
  7670. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7671. "Route map reference\n"
  7672. "Pointer to route-map entries\n")
  7673. {
  7674. int type;
  7675. type = proto_redistnum (AFI_IP, argv[0]);
  7676. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7677. {
  7678. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7679. return CMD_WARNING;
  7680. }
  7681. bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
  7682. return CMD_SUCCESS;
  7683. }
  7684. DEFUN (no_bgp_redistribute_ipv4_metric,
  7685. no_bgp_redistribute_ipv4_metric_cmd,
  7686. "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
  7687. NO_STR
  7688. "Redistribute information from another routing protocol\n"
  7689. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7690. "Metric for redistributed routes\n"
  7691. "Default metric\n")
  7692. {
  7693. int type;
  7694. type = proto_redistnum (AFI_IP, argv[0]);
  7695. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7696. {
  7697. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7698. return CMD_WARNING;
  7699. }
  7700. bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
  7701. return CMD_SUCCESS;
  7702. }
  7703. DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
  7704. no_bgp_redistribute_ipv4_rmap_metric_cmd,
  7705. "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
  7706. NO_STR
  7707. "Redistribute information from another routing protocol\n"
  7708. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7709. "Route map reference\n"
  7710. "Pointer to route-map entries\n"
  7711. "Metric for redistributed routes\n"
  7712. "Default metric\n")
  7713. {
  7714. int type;
  7715. type = proto_redistnum (AFI_IP, argv[0]);
  7716. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7717. {
  7718. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7719. return CMD_WARNING;
  7720. }
  7721. bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
  7722. bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
  7723. return CMD_SUCCESS;
  7724. }
  7725. ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
  7726. no_bgp_redistribute_ipv4_metric_rmap_cmd,
  7727. "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
  7728. NO_STR
  7729. "Redistribute information from another routing protocol\n"
  7730. QUAGGA_IP_REDIST_HELP_STR_BGPD
  7731. "Metric for redistributed routes\n"
  7732. "Default metric\n"
  7733. "Route map reference\n"
  7734. "Pointer to route-map entries\n")
  7735. #ifdef HAVE_IPV6
  7736. DEFUN (bgp_redistribute_ipv6,
  7737. bgp_redistribute_ipv6_cmd,
  7738. "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
  7739. "Redistribute information from another routing protocol\n"
  7740. QUAGGA_IP6_REDIST_HELP_STR_BGPD)
  7741. {
  7742. int type;
  7743. type = proto_redistnum (AFI_IP6, argv[0]);
  7744. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7745. {
  7746. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7747. return CMD_WARNING;
  7748. }
  7749. return bgp_redistribute_set (vty->index, AFI_IP6, type);
  7750. }
  7751. DEFUN (bgp_redistribute_ipv6_rmap,
  7752. bgp_redistribute_ipv6_rmap_cmd,
  7753. "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
  7754. "Redistribute information from another routing protocol\n"
  7755. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7756. "Route map reference\n"
  7757. "Pointer to route-map entries\n")
  7758. {
  7759. int type;
  7760. type = proto_redistnum (AFI_IP6, argv[0]);
  7761. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7762. {
  7763. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7764. return CMD_WARNING;
  7765. }
  7766. bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
  7767. return bgp_redistribute_set (vty->index, AFI_IP6, type);
  7768. }
  7769. DEFUN (bgp_redistribute_ipv6_metric,
  7770. bgp_redistribute_ipv6_metric_cmd,
  7771. "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
  7772. "Redistribute information from another routing protocol\n"
  7773. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7774. "Metric for redistributed routes\n"
  7775. "Default metric\n")
  7776. {
  7777. int type;
  7778. u_int32_t metric;
  7779. type = proto_redistnum (AFI_IP6, argv[0]);
  7780. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7781. {
  7782. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7783. return CMD_WARNING;
  7784. }
  7785. VTY_GET_INTEGER ("metric", metric, argv[1]);
  7786. bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
  7787. return bgp_redistribute_set (vty->index, AFI_IP6, type);
  7788. }
  7789. DEFUN (bgp_redistribute_ipv6_rmap_metric,
  7790. bgp_redistribute_ipv6_rmap_metric_cmd,
  7791. "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
  7792. "Redistribute information from another routing protocol\n"
  7793. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7794. "Route map reference\n"
  7795. "Pointer to route-map entries\n"
  7796. "Metric for redistributed routes\n"
  7797. "Default metric\n")
  7798. {
  7799. int type;
  7800. u_int32_t metric;
  7801. type = proto_redistnum (AFI_IP6, argv[0]);
  7802. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7803. {
  7804. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7805. return CMD_WARNING;
  7806. }
  7807. VTY_GET_INTEGER ("metric", metric, argv[2]);
  7808. bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
  7809. bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
  7810. return bgp_redistribute_set (vty->index, AFI_IP6, type);
  7811. }
  7812. DEFUN (bgp_redistribute_ipv6_metric_rmap,
  7813. bgp_redistribute_ipv6_metric_rmap_cmd,
  7814. "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
  7815. "Redistribute information from another routing protocol\n"
  7816. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7817. "Metric for redistributed routes\n"
  7818. "Default metric\n"
  7819. "Route map reference\n"
  7820. "Pointer to route-map entries\n")
  7821. {
  7822. int type;
  7823. u_int32_t metric;
  7824. type = proto_redistnum (AFI_IP6, argv[0]);
  7825. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7826. {
  7827. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7828. return CMD_WARNING;
  7829. }
  7830. VTY_GET_INTEGER ("metric", metric, argv[1]);
  7831. bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
  7832. bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
  7833. return bgp_redistribute_set (vty->index, AFI_IP6, type);
  7834. }
  7835. DEFUN (no_bgp_redistribute_ipv6,
  7836. no_bgp_redistribute_ipv6_cmd,
  7837. "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
  7838. NO_STR
  7839. "Redistribute information from another routing protocol\n"
  7840. QUAGGA_IP6_REDIST_HELP_STR_BGPD)
  7841. {
  7842. int type;
  7843. type = proto_redistnum (AFI_IP6, argv[0]);
  7844. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7845. {
  7846. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7847. return CMD_WARNING;
  7848. }
  7849. return bgp_redistribute_unset (vty->index, AFI_IP6, type);
  7850. }
  7851. DEFUN (no_bgp_redistribute_ipv6_rmap,
  7852. no_bgp_redistribute_ipv6_rmap_cmd,
  7853. "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
  7854. NO_STR
  7855. "Redistribute information from another routing protocol\n"
  7856. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7857. "Route map reference\n"
  7858. "Pointer to route-map entries\n")
  7859. {
  7860. int type;
  7861. type = proto_redistnum (AFI_IP6, argv[0]);
  7862. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7863. {
  7864. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7865. return CMD_WARNING;
  7866. }
  7867. bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
  7868. return CMD_SUCCESS;
  7869. }
  7870. DEFUN (no_bgp_redistribute_ipv6_metric,
  7871. no_bgp_redistribute_ipv6_metric_cmd,
  7872. "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
  7873. NO_STR
  7874. "Redistribute information from another routing protocol\n"
  7875. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7876. "Metric for redistributed routes\n"
  7877. "Default metric\n")
  7878. {
  7879. int type;
  7880. type = proto_redistnum (AFI_IP6, argv[0]);
  7881. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7882. {
  7883. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7884. return CMD_WARNING;
  7885. }
  7886. bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
  7887. return CMD_SUCCESS;
  7888. }
  7889. DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
  7890. no_bgp_redistribute_ipv6_rmap_metric_cmd,
  7891. "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
  7892. NO_STR
  7893. "Redistribute information from another routing protocol\n"
  7894. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7895. "Route map reference\n"
  7896. "Pointer to route-map entries\n"
  7897. "Metric for redistributed routes\n"
  7898. "Default metric\n")
  7899. {
  7900. int type;
  7901. type = proto_redistnum (AFI_IP6, argv[0]);
  7902. if (type < 0 || type == ZEBRA_ROUTE_BGP)
  7903. {
  7904. vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
  7905. return CMD_WARNING;
  7906. }
  7907. bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
  7908. bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
  7909. return CMD_SUCCESS;
  7910. }
  7911. ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
  7912. no_bgp_redistribute_ipv6_metric_rmap_cmd,
  7913. "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
  7914. NO_STR
  7915. "Redistribute information from another routing protocol\n"
  7916. QUAGGA_IP6_REDIST_HELP_STR_BGPD
  7917. "Metric for redistributed routes\n"
  7918. "Default metric\n"
  7919. "Route map reference\n"
  7920. "Pointer to route-map entries\n")
  7921. #endif /* HAVE_IPV6 */
  7922. int
  7923. bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
  7924. safi_t safi, int *write)
  7925. {
  7926. int i;
  7927. /* Unicast redistribution only. */
  7928. if (safi != SAFI_UNICAST)
  7929. return 0;
  7930. for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
  7931. {
  7932. /* Redistribute BGP does not make sense. */
  7933. if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
  7934. {
  7935. /* Display "address-family" when it is not yet diplayed. */
  7936. bgp_config_write_family_header (vty, afi, safi, write);
  7937. /* "redistribute" configuration. */
  7938. vty_out (vty, " redistribute %s", zebra_route_string(i));
  7939. if (bgp->redist_metric_flag[afi][i])
  7940. vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
  7941. if (bgp->rmap[afi][i].name)
  7942. vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
  7943. vty_out (vty, "%s", VTY_NEWLINE);
  7944. }
  7945. }
  7946. return *write;
  7947. }
  7948. /* BGP node structure. */
  7949. static struct cmd_node bgp_node =
  7950. {
  7951. BGP_NODE,
  7952. "%s(config-router)# ",
  7953. 1,
  7954. };
  7955. static struct cmd_node bgp_ipv4_unicast_node =
  7956. {
  7957. BGP_IPV4_NODE,
  7958. "%s(config-router-af)# ",
  7959. 1,
  7960. };
  7961. static struct cmd_node bgp_ipv4_multicast_node =
  7962. {
  7963. BGP_IPV4M_NODE,
  7964. "%s(config-router-af)# ",
  7965. 1,
  7966. };
  7967. static struct cmd_node bgp_ipv6_unicast_node =
  7968. {
  7969. BGP_IPV6_NODE,
  7970. "%s(config-router-af)# ",
  7971. 1,
  7972. };
  7973. static struct cmd_node bgp_ipv6_multicast_node =
  7974. {
  7975. BGP_IPV6M_NODE,
  7976. "%s(config-router-af)# ",
  7977. 1,
  7978. };
  7979. static struct cmd_node bgp_vpnv4_node =
  7980. {
  7981. BGP_VPNV4_NODE,
  7982. "%s(config-router-af)# ",
  7983. 1
  7984. };
  7985. static void community_list_vty (void);
  7986. void
  7987. bgp_vty_init (void)
  7988. {
  7989. /* Install bgp top node. */
  7990. install_node (&bgp_node, bgp_config_write);
  7991. install_node (&bgp_ipv4_unicast_node, NULL);
  7992. install_node (&bgp_ipv4_multicast_node, NULL);
  7993. install_node (&bgp_ipv6_unicast_node, NULL);
  7994. install_node (&bgp_ipv6_multicast_node, NULL);
  7995. install_node (&bgp_vpnv4_node, NULL);
  7996. /* Install default VTY commands to new nodes. */
  7997. install_default (BGP_NODE);
  7998. install_default (BGP_IPV4_NODE);
  7999. install_default (BGP_IPV4M_NODE);
  8000. install_default (BGP_IPV6_NODE);
  8001. install_default (BGP_IPV6M_NODE);
  8002. install_default (BGP_VPNV4_NODE);
  8003. /* "bgp multiple-instance" commands. */
  8004. install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
  8005. install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
  8006. /* "bgp config-type" commands. */
  8007. install_element (CONFIG_NODE, &bgp_config_type_cmd);
  8008. install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
  8009. /* Dummy commands (Currently not supported) */
  8010. install_element (BGP_NODE, &no_synchronization_cmd);
  8011. install_element (BGP_NODE, &no_auto_summary_cmd);
  8012. /* "router bgp" commands. */
  8013. install_element (CONFIG_NODE, &router_bgp_cmd);
  8014. install_element (CONFIG_NODE, &router_bgp_view_cmd);
  8015. /* "no router bgp" commands. */
  8016. install_element (CONFIG_NODE, &no_router_bgp_cmd);
  8017. install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
  8018. /* "bgp router-id" commands. */
  8019. install_element (BGP_NODE, &bgp_router_id_cmd);
  8020. install_element (BGP_NODE, &no_bgp_router_id_cmd);
  8021. install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
  8022. /* "bgp cluster-id" commands. */
  8023. install_element (BGP_NODE, &bgp_cluster_id_cmd);
  8024. install_element (BGP_NODE, &bgp_cluster_id32_cmd);
  8025. install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
  8026. install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
  8027. /* "bgp confederation" commands. */
  8028. install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
  8029. install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
  8030. install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
  8031. /* "bgp confederation peers" commands. */
  8032. install_element (BGP_NODE, &bgp_confederation_peers_cmd);
  8033. install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
  8034. /* "maximum-paths" commands. */
  8035. install_element (BGP_NODE, &bgp_maxpaths_cmd);
  8036. install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
  8037. install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
  8038. install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
  8039. install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
  8040. install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
  8041. install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
  8042. install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
  8043. install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
  8044. install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
  8045. install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
  8046. install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
  8047. /* "timers bgp" commands. */
  8048. install_element (BGP_NODE, &bgp_timers_cmd);
  8049. install_element (BGP_NODE, &no_bgp_timers_cmd);
  8050. install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
  8051. /* "bgp client-to-client reflection" commands */
  8052. install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
  8053. install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
  8054. /* "bgp always-compare-med" commands */
  8055. install_element (BGP_NODE, &bgp_always_compare_med_cmd);
  8056. install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
  8057. /* "bgp deterministic-med" commands */
  8058. install_element (BGP_NODE, &bgp_deterministic_med_cmd);
  8059. install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
  8060. /* "bgp graceful-restart" commands */
  8061. install_element (BGP_NODE, &bgp_graceful_restart_cmd);
  8062. install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
  8063. install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
  8064. install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
  8065. install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
  8066. /* "bgp fast-external-failover" commands */
  8067. install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
  8068. install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
  8069. /* "bgp enforce-first-as" commands */
  8070. install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
  8071. install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
  8072. /* "bgp bestpath compare-routerid" commands */
  8073. install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
  8074. install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
  8075. /* "bgp bestpath as-path ignore" commands */
  8076. install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
  8077. install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
  8078. /* "bgp bestpath as-path confed" commands */
  8079. install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
  8080. install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
  8081. /* "bgp bestpath as-path multipath-relax" commands */
  8082. install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
  8083. install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
  8084. /* "bgp log-neighbor-changes" commands */
  8085. install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
  8086. install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
  8087. /* "bgp bestpath med" commands */
  8088. install_element (BGP_NODE, &bgp_bestpath_med_cmd);
  8089. install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
  8090. install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
  8091. install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
  8092. install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
  8093. install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
  8094. /* "no bgp default ipv4-unicast" commands. */
  8095. install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
  8096. install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
  8097. /* "bgp network import-check" commands. */
  8098. install_element (BGP_NODE, &bgp_network_import_check_cmd);
  8099. install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
  8100. /* "bgp default local-preference" commands. */
  8101. install_element (BGP_NODE, &bgp_default_local_preference_cmd);
  8102. install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
  8103. install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
  8104. /* "neighbor remote-as" commands. */
  8105. install_element (BGP_NODE, &neighbor_remote_as_cmd);
  8106. install_element (BGP_NODE, &no_neighbor_cmd);
  8107. install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
  8108. /* "neighbor peer-group" commands. */
  8109. install_element (BGP_NODE, &neighbor_peer_group_cmd);
  8110. install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
  8111. install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
  8112. /* "neighbor local-as" commands. */
  8113. install_element (BGP_NODE, &neighbor_local_as_cmd);
  8114. install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
  8115. install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
  8116. install_element (BGP_NODE, &no_neighbor_local_as_cmd);
  8117. install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
  8118. install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
  8119. install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
  8120. /* "neighbor password" commands. */
  8121. install_element (BGP_NODE, &neighbor_password_cmd);
  8122. install_element (BGP_NODE, &no_neighbor_password_cmd);
  8123. /* "neighbor activate" commands. */
  8124. install_element (BGP_NODE, &neighbor_activate_cmd);
  8125. install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
  8126. install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
  8127. install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
  8128. install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
  8129. install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
  8130. /* "no neighbor activate" commands. */
  8131. install_element (BGP_NODE, &no_neighbor_activate_cmd);
  8132. install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
  8133. install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
  8134. install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
  8135. install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
  8136. install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
  8137. /* "neighbor peer-group set" commands. */
  8138. install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
  8139. install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
  8140. install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
  8141. install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
  8142. install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
  8143. install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
  8144. /* "no neighbor peer-group unset" commands. */
  8145. install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
  8146. install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
  8147. install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
  8148. install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
  8149. install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
  8150. install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
  8151. /* "neighbor softreconfiguration inbound" commands.*/
  8152. install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
  8153. install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8154. install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
  8155. install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8156. install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
  8157. install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8158. install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
  8159. install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8160. install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
  8161. install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8162. install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
  8163. install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
  8164. /* "neighbor attribute-unchanged" commands. */
  8165. install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
  8166. install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
  8167. install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
  8168. install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
  8169. install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
  8170. install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
  8171. install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
  8172. install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
  8173. install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
  8174. install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
  8175. install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
  8176. install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
  8177. install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
  8178. install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
  8179. install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
  8180. install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
  8181. install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
  8182. install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
  8183. install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
  8184. install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
  8185. install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
  8186. install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
  8187. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
  8188. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
  8189. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
  8190. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
  8191. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
  8192. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
  8193. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
  8194. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
  8195. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
  8196. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
  8197. install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
  8198. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
  8199. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
  8200. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
  8201. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
  8202. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
  8203. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
  8204. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
  8205. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
  8206. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
  8207. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
  8208. install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
  8209. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
  8210. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
  8211. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
  8212. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
  8213. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
  8214. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
  8215. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
  8216. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
  8217. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
  8218. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
  8219. install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
  8220. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
  8221. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
  8222. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
  8223. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
  8224. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
  8225. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
  8226. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
  8227. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
  8228. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
  8229. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
  8230. install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
  8231. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
  8232. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
  8233. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
  8234. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
  8235. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
  8236. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
  8237. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
  8238. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
  8239. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
  8240. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
  8241. install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
  8242. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
  8243. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
  8244. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
  8245. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
  8246. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
  8247. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
  8248. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
  8249. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
  8250. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
  8251. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
  8252. install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
  8253. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
  8254. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
  8255. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
  8256. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
  8257. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
  8258. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
  8259. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
  8260. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
  8261. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
  8262. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
  8263. install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
  8264. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
  8265. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
  8266. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
  8267. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
  8268. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
  8269. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
  8270. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
  8271. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
  8272. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
  8273. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
  8274. install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
  8275. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
  8276. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
  8277. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
  8278. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
  8279. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
  8280. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
  8281. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
  8282. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
  8283. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
  8284. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
  8285. install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
  8286. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
  8287. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
  8288. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
  8289. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
  8290. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
  8291. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
  8292. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
  8293. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
  8294. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
  8295. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
  8296. install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
  8297. /* "nexthop-local unchanged" commands */
  8298. install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
  8299. install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
  8300. /* "transparent-as" and "transparent-nexthop" for old version
  8301. compatibility. */
  8302. install_element (BGP_NODE, &neighbor_transparent_as_cmd);
  8303. install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
  8304. /* "neighbor next-hop-self" commands. */
  8305. install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
  8306. install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
  8307. install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
  8308. install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
  8309. install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
  8310. install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
  8311. install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
  8312. install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
  8313. install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
  8314. install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
  8315. install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
  8316. install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
  8317. /* "neighbor remove-private-AS" commands. */
  8318. install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
  8319. install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
  8320. install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
  8321. install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
  8322. install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
  8323. install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
  8324. install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
  8325. install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
  8326. install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
  8327. install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
  8328. install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
  8329. install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
  8330. /* "neighbor send-community" commands.*/
  8331. install_element (BGP_NODE, &neighbor_send_community_cmd);
  8332. install_element (BGP_NODE, &neighbor_send_community_type_cmd);
  8333. install_element (BGP_NODE, &no_neighbor_send_community_cmd);
  8334. install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
  8335. install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
  8336. install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
  8337. install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
  8338. install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
  8339. install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
  8340. install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
  8341. install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
  8342. install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
  8343. install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
  8344. install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
  8345. install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
  8346. install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
  8347. install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
  8348. install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
  8349. install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
  8350. install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
  8351. install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
  8352. install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
  8353. install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
  8354. install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
  8355. /* "neighbor route-reflector" commands.*/
  8356. install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
  8357. install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
  8358. install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
  8359. install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
  8360. install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
  8361. install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
  8362. install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
  8363. install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
  8364. install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
  8365. install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
  8366. install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
  8367. install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
  8368. /* "neighbor route-server" commands.*/
  8369. install_element (BGP_NODE, &neighbor_route_server_client_cmd);
  8370. install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
  8371. install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
  8372. install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
  8373. install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
  8374. install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
  8375. install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
  8376. install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
  8377. install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
  8378. install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
  8379. install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
  8380. install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
  8381. /* "neighbor passive" commands. */
  8382. install_element (BGP_NODE, &neighbor_passive_cmd);
  8383. install_element (BGP_NODE, &no_neighbor_passive_cmd);
  8384. /* "neighbor shutdown" commands. */
  8385. install_element (BGP_NODE, &neighbor_shutdown_cmd);
  8386. install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
  8387. /* Deprecated "neighbor capability route-refresh" commands.*/
  8388. install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
  8389. install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
  8390. /* "neighbor capability orf prefix-list" commands.*/
  8391. install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
  8392. install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
  8393. install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
  8394. install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
  8395. install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
  8396. install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
  8397. install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
  8398. install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
  8399. install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
  8400. install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
  8401. /* "neighbor capability dynamic" commands.*/
  8402. install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
  8403. install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
  8404. /* "neighbor dont-capability-negotiate" commands. */
  8405. install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
  8406. install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
  8407. /* "neighbor ebgp-multihop" commands. */
  8408. install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
  8409. install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
  8410. install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
  8411. install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
  8412. /* "neighbor disable-connected-check" commands. */
  8413. install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
  8414. install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
  8415. install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
  8416. install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
  8417. /* "neighbor description" commands. */
  8418. install_element (BGP_NODE, &neighbor_description_cmd);
  8419. install_element (BGP_NODE, &no_neighbor_description_cmd);
  8420. install_element (BGP_NODE, &no_neighbor_description_val_cmd);
  8421. /* "neighbor update-source" commands. "*/
  8422. install_element (BGP_NODE, &neighbor_update_source_cmd);
  8423. install_element (BGP_NODE, &no_neighbor_update_source_cmd);
  8424. /* "neighbor default-originate" commands. */
  8425. install_element (BGP_NODE, &neighbor_default_originate_cmd);
  8426. install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
  8427. install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
  8428. install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
  8429. install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
  8430. install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
  8431. install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
  8432. install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
  8433. install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
  8434. install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
  8435. install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
  8436. install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
  8437. install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
  8438. install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
  8439. install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
  8440. install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
  8441. install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
  8442. install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
  8443. install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
  8444. install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
  8445. /* "neighbor port" commands. */
  8446. install_element (BGP_NODE, &neighbor_port_cmd);
  8447. install_element (BGP_NODE, &no_neighbor_port_cmd);
  8448. install_element (BGP_NODE, &no_neighbor_port_val_cmd);
  8449. /* "neighbor weight" commands. */
  8450. install_element (BGP_NODE, &neighbor_weight_cmd);
  8451. install_element (BGP_NODE, &no_neighbor_weight_cmd);
  8452. install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
  8453. /* "neighbor override-capability" commands. */
  8454. install_element (BGP_NODE, &neighbor_override_capability_cmd);
  8455. install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
  8456. /* "neighbor strict-capability-match" commands. */
  8457. install_element (BGP_NODE, &neighbor_strict_capability_cmd);
  8458. install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
  8459. /* "neighbor timers" commands. */
  8460. install_element (BGP_NODE, &neighbor_timers_cmd);
  8461. install_element (BGP_NODE, &no_neighbor_timers_cmd);
  8462. /* "neighbor timers connect" commands. */
  8463. install_element (BGP_NODE, &neighbor_timers_connect_cmd);
  8464. install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
  8465. install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
  8466. /* "neighbor advertisement-interval" commands. */
  8467. install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
  8468. install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
  8469. install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
  8470. /* "neighbor version" commands. */
  8471. install_element (BGP_NODE, &neighbor_version_cmd);
  8472. /* "neighbor interface" commands. */
  8473. install_element (BGP_NODE, &neighbor_interface_cmd);
  8474. install_element (BGP_NODE, &no_neighbor_interface_cmd);
  8475. /* "neighbor distribute" commands. */
  8476. install_element (BGP_NODE, &neighbor_distribute_list_cmd);
  8477. install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
  8478. install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
  8479. install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
  8480. install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
  8481. install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
  8482. install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
  8483. install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
  8484. install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
  8485. install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
  8486. install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
  8487. install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
  8488. /* "neighbor prefix-list" commands. */
  8489. install_element (BGP_NODE, &neighbor_prefix_list_cmd);
  8490. install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
  8491. install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
  8492. install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
  8493. install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
  8494. install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
  8495. install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
  8496. install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
  8497. install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
  8498. install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
  8499. install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
  8500. install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
  8501. /* "neighbor filter-list" commands. */
  8502. install_element (BGP_NODE, &neighbor_filter_list_cmd);
  8503. install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
  8504. install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
  8505. install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
  8506. install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
  8507. install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
  8508. install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
  8509. install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
  8510. install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
  8511. install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
  8512. install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
  8513. install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
  8514. /* "neighbor route-map" commands. */
  8515. install_element (BGP_NODE, &neighbor_route_map_cmd);
  8516. install_element (BGP_NODE, &no_neighbor_route_map_cmd);
  8517. install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
  8518. install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
  8519. install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
  8520. install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
  8521. install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
  8522. install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
  8523. install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
  8524. install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
  8525. install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
  8526. install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
  8527. /* "neighbor unsuppress-map" commands. */
  8528. install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
  8529. install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
  8530. install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
  8531. install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
  8532. install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
  8533. install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
  8534. install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
  8535. install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
  8536. install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
  8537. install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
  8538. install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
  8539. install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
  8540. /* "neighbor maximum-prefix" commands. */
  8541. install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
  8542. install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8543. install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
  8544. install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8545. install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
  8546. install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8547. install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
  8548. install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8549. install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8550. install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8551. install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8552. install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8553. install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8554. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
  8555. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8556. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
  8557. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8558. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
  8559. install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8560. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
  8561. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8562. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8563. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8564. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8565. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8566. install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8567. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
  8568. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8569. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
  8570. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8571. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
  8572. install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8573. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
  8574. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8575. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8576. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8577. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8578. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8579. install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8580. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
  8581. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8582. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
  8583. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8584. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
  8585. install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8586. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
  8587. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8588. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8589. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8590. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8591. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8592. install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8593. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
  8594. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8595. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
  8596. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8597. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
  8598. install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8599. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
  8600. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8601. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8602. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8603. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8604. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8605. install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8606. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
  8607. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
  8608. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
  8609. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
  8610. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
  8611. install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
  8612. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
  8613. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
  8614. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
  8615. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
  8616. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
  8617. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
  8618. install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
  8619. /* "neighbor allowas-in" */
  8620. install_element (BGP_NODE, &neighbor_allowas_in_cmd);
  8621. install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
  8622. install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
  8623. install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
  8624. install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
  8625. install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
  8626. install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
  8627. install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
  8628. install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
  8629. install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
  8630. install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
  8631. install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
  8632. install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
  8633. install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
  8634. install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
  8635. install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
  8636. install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
  8637. install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
  8638. /* address-family commands. */
  8639. install_element (BGP_NODE, &address_family_ipv4_cmd);
  8640. install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
  8641. #ifdef HAVE_IPV6
  8642. install_element (BGP_NODE, &address_family_ipv6_cmd);
  8643. install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
  8644. #endif /* HAVE_IPV6 */
  8645. install_element (BGP_NODE, &address_family_vpnv4_cmd);
  8646. install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
  8647. /* "exit-address-family" command. */
  8648. install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
  8649. install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
  8650. install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
  8651. install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
  8652. install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
  8653. /* "clear ip bgp commands" */
  8654. install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
  8655. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
  8656. install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
  8657. install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
  8658. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
  8659. install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
  8660. #ifdef HAVE_IPV6
  8661. install_element (ENABLE_NODE, &clear_bgp_all_cmd);
  8662. install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
  8663. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
  8664. install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
  8665. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
  8666. install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
  8667. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
  8668. install_element (ENABLE_NODE, &clear_bgp_external_cmd);
  8669. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
  8670. install_element (ENABLE_NODE, &clear_bgp_as_cmd);
  8671. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
  8672. #endif /* HAVE_IPV6 */
  8673. /* "clear ip bgp neighbor soft in" */
  8674. install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
  8675. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
  8676. install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
  8677. install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
  8678. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
  8679. install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
  8680. install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
  8681. install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
  8682. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
  8683. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
  8684. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
  8685. install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
  8686. install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
  8687. install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
  8688. install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
  8689. install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
  8690. install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
  8691. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
  8692. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
  8693. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
  8694. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
  8695. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
  8696. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
  8697. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
  8698. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
  8699. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
  8700. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
  8701. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
  8702. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
  8703. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
  8704. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
  8705. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
  8706. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
  8707. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
  8708. install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
  8709. install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
  8710. install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
  8711. install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
  8712. install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
  8713. install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
  8714. #ifdef HAVE_IPV6
  8715. install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
  8716. install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
  8717. install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
  8718. install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
  8719. install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
  8720. install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
  8721. install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
  8722. install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
  8723. install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
  8724. install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
  8725. install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
  8726. install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
  8727. install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
  8728. install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
  8729. install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
  8730. install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
  8731. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
  8732. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
  8733. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
  8734. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
  8735. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
  8736. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
  8737. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
  8738. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
  8739. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
  8740. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
  8741. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
  8742. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
  8743. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
  8744. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
  8745. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
  8746. #endif /* HAVE_IPV6 */
  8747. /* "clear ip bgp neighbor soft out" */
  8748. install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
  8749. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
  8750. install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
  8751. install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
  8752. install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
  8753. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
  8754. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
  8755. install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
  8756. install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
  8757. install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
  8758. install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
  8759. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
  8760. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
  8761. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
  8762. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
  8763. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
  8764. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
  8765. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
  8766. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
  8767. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
  8768. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
  8769. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
  8770. install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
  8771. install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
  8772. install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
  8773. install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
  8774. install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
  8775. install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
  8776. #ifdef HAVE_IPV6
  8777. install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
  8778. install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
  8779. install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
  8780. install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
  8781. install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
  8782. install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
  8783. install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
  8784. install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
  8785. install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
  8786. install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
  8787. install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
  8788. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
  8789. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
  8790. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
  8791. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
  8792. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
  8793. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
  8794. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
  8795. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
  8796. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
  8797. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
  8798. #endif /* HAVE_IPV6 */
  8799. /* "clear ip bgp neighbor soft" */
  8800. install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
  8801. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
  8802. install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
  8803. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
  8804. install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
  8805. install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
  8806. install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
  8807. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
  8808. install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
  8809. install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
  8810. install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
  8811. install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
  8812. install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
  8813. install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
  8814. install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
  8815. #ifdef HAVE_IPV6
  8816. install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
  8817. install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
  8818. install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
  8819. install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
  8820. install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
  8821. install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
  8822. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
  8823. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
  8824. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
  8825. install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
  8826. install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
  8827. #endif /* HAVE_IPV6 */
  8828. /* "clear ip bgp neighbor rsclient" */
  8829. install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
  8830. install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
  8831. install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
  8832. install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
  8833. #ifdef HAVE_IPV6
  8834. install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
  8835. install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
  8836. install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
  8837. install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
  8838. install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
  8839. install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
  8840. install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
  8841. install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
  8842. #endif /* HAVE_IPV6 */
  8843. /* "show ip bgp summary" commands. */
  8844. install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
  8845. install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
  8846. install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
  8847. install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
  8848. install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
  8849. install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
  8850. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
  8851. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
  8852. #ifdef HAVE_IPV6
  8853. install_element (VIEW_NODE, &show_bgp_summary_cmd);
  8854. install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
  8855. install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
  8856. install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
  8857. install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
  8858. install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
  8859. #endif /* HAVE_IPV6 */
  8860. install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
  8861. install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
  8862. install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
  8863. install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
  8864. install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
  8865. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
  8866. install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
  8867. install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
  8868. #ifdef HAVE_IPV6
  8869. install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
  8870. install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
  8871. install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
  8872. install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
  8873. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
  8874. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
  8875. #endif /* HAVE_IPV6 */
  8876. install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
  8877. install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
  8878. install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
  8879. install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
  8880. install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
  8881. install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
  8882. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
  8883. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
  8884. #ifdef HAVE_IPV6
  8885. install_element (ENABLE_NODE, &show_bgp_summary_cmd);
  8886. install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
  8887. install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
  8888. install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
  8889. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
  8890. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
  8891. #endif /* HAVE_IPV6 */
  8892. /* "show ip bgp neighbors" commands. */
  8893. install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
  8894. install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
  8895. install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
  8896. install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
  8897. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
  8898. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
  8899. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
  8900. install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
  8901. install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
  8902. install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
  8903. install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
  8904. install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
  8905. install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
  8906. install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
  8907. install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
  8908. install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
  8909. install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
  8910. install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
  8911. install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
  8912. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
  8913. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
  8914. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
  8915. install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
  8916. install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
  8917. install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
  8918. #ifdef HAVE_IPV6
  8919. install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
  8920. install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
  8921. install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
  8922. install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
  8923. install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
  8924. install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
  8925. install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
  8926. install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
  8927. install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
  8928. install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
  8929. install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
  8930. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
  8931. install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
  8932. install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
  8933. install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
  8934. install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
  8935. install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
  8936. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
  8937. install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
  8938. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
  8939. /* Old commands. */
  8940. install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
  8941. install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
  8942. install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
  8943. install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
  8944. #endif /* HAVE_IPV6 */
  8945. /* "show ip bgp rsclient" commands. */
  8946. install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
  8947. install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
  8948. install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
  8949. install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
  8950. install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
  8951. install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
  8952. install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
  8953. install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
  8954. install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
  8955. install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
  8956. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
  8957. install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
  8958. install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
  8959. install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
  8960. install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
  8961. install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
  8962. install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
  8963. install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
  8964. #ifdef HAVE_IPV6
  8965. install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
  8966. install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
  8967. install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
  8968. install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
  8969. install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
  8970. install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
  8971. install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
  8972. install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
  8973. install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
  8974. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
  8975. install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
  8976. install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
  8977. install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
  8978. install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
  8979. install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
  8980. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
  8981. install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
  8982. install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
  8983. #endif /* HAVE_IPV6 */
  8984. /* "show ip bgp paths" commands. */
  8985. install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
  8986. install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
  8987. install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
  8988. install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
  8989. /* "show ip bgp community" commands. */
  8990. install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
  8991. install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
  8992. /* "show ip bgp attribute-info" commands. */
  8993. install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
  8994. install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
  8995. /* "redistribute" commands. */
  8996. install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
  8997. install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
  8998. install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
  8999. install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
  9000. install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
  9001. install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
  9002. install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
  9003. install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
  9004. install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
  9005. install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
  9006. #ifdef HAVE_IPV6
  9007. install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
  9008. install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
  9009. install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
  9010. install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
  9011. install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
  9012. install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
  9013. install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
  9014. install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
  9015. install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
  9016. install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
  9017. #endif /* HAVE_IPV6 */
  9018. /* ttl_security commands */
  9019. install_element (BGP_NODE, &neighbor_ttl_security_cmd);
  9020. install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
  9021. /* "show bgp memory" commands. */
  9022. install_element (VIEW_NODE, &show_bgp_memory_cmd);
  9023. install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
  9024. install_element (ENABLE_NODE, &show_bgp_memory_cmd);
  9025. /* "show bgp views" commands. */
  9026. install_element (VIEW_NODE, &show_bgp_views_cmd);
  9027. install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
  9028. install_element (ENABLE_NODE, &show_bgp_views_cmd);
  9029. /* Community-list. */
  9030. community_list_vty ();
  9031. }
  9032. #include "memory.h"
  9033. #include "bgp_regex.h"
  9034. #include "bgp_clist.h"
  9035. #include "bgp_ecommunity.h"
  9036. /* VTY functions. */
  9037. /* Direction value to string conversion. */
  9038. static const char *
  9039. community_direct_str (int direct)
  9040. {
  9041. switch (direct)
  9042. {
  9043. case COMMUNITY_DENY:
  9044. return "deny";
  9045. case COMMUNITY_PERMIT:
  9046. return "permit";
  9047. default:
  9048. return "unknown";
  9049. }
  9050. }
  9051. /* Display error string. */
  9052. static void
  9053. community_list_perror (struct vty *vty, int ret)
  9054. {
  9055. switch (ret)
  9056. {
  9057. case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
  9058. vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
  9059. break;
  9060. case COMMUNITY_LIST_ERR_MALFORMED_VAL:
  9061. vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
  9062. break;
  9063. case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
  9064. vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
  9065. break;
  9066. case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
  9067. vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
  9068. break;
  9069. }
  9070. }
  9071. /* VTY interface for community_set() function. */
  9072. static int
  9073. community_list_set_vty (struct vty *vty, int argc, const char **argv,
  9074. int style, int reject_all_digit_name)
  9075. {
  9076. int ret;
  9077. int direct;
  9078. char *str;
  9079. /* Check the list type. */
  9080. if (strncmp (argv[1], "p", 1) == 0)
  9081. direct = COMMUNITY_PERMIT;
  9082. else if (strncmp (argv[1], "d", 1) == 0)
  9083. direct = COMMUNITY_DENY;
  9084. else
  9085. {
  9086. vty_out (vty, "%% Matching condition must be permit or deny%s",
  9087. VTY_NEWLINE);
  9088. return CMD_WARNING;
  9089. }
  9090. /* All digit name check. */
  9091. if (reject_all_digit_name && all_digit (argv[0]))
  9092. {
  9093. vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
  9094. return CMD_WARNING;
  9095. }
  9096. /* Concat community string argument. */
  9097. if (argc > 1)
  9098. str = argv_concat (argv, argc, 2);
  9099. else
  9100. str = NULL;
  9101. /* When community_list_set() return nevetive value, it means
  9102. malformed community string. */
  9103. ret = community_list_set (bgp_clist, argv[0], str, direct, style);
  9104. /* Free temporary community list string allocated by
  9105. argv_concat(). */
  9106. if (str)
  9107. XFREE (MTYPE_TMP, str);
  9108. if (ret < 0)
  9109. {
  9110. /* Display error string. */
  9111. community_list_perror (vty, ret);
  9112. return CMD_WARNING;
  9113. }
  9114. return CMD_SUCCESS;
  9115. }
  9116. /* Communiyt-list entry delete. */
  9117. static int
  9118. community_list_unset_vty (struct vty *vty, int argc, const char **argv,
  9119. int style)
  9120. {
  9121. int ret;
  9122. int direct = 0;
  9123. char *str = NULL;
  9124. if (argc > 1)
  9125. {
  9126. /* Check the list direct. */
  9127. if (strncmp (argv[1], "p", 1) == 0)
  9128. direct = COMMUNITY_PERMIT;
  9129. else if (strncmp (argv[1], "d", 1) == 0)
  9130. direct = COMMUNITY_DENY;
  9131. else
  9132. {
  9133. vty_out (vty, "%% Matching condition must be permit or deny%s",
  9134. VTY_NEWLINE);
  9135. return CMD_WARNING;
  9136. }
  9137. /* Concat community string argument. */
  9138. str = argv_concat (argv, argc, 2);
  9139. }
  9140. /* Unset community list. */
  9141. ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
  9142. /* Free temporary community list string allocated by
  9143. argv_concat(). */
  9144. if (str)
  9145. XFREE (MTYPE_TMP, str);
  9146. if (ret < 0)
  9147. {
  9148. community_list_perror (vty, ret);
  9149. return CMD_WARNING;
  9150. }
  9151. return CMD_SUCCESS;
  9152. }
  9153. /* "community-list" keyword help string. */
  9154. #define COMMUNITY_LIST_STR "Add a community list entry\n"
  9155. #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
  9156. DEFUN (ip_community_list_standard,
  9157. ip_community_list_standard_cmd,
  9158. "ip community-list <1-99> (deny|permit) .AA:NN",
  9159. IP_STR
  9160. COMMUNITY_LIST_STR
  9161. "Community list number (standard)\n"
  9162. "Specify community to reject\n"
  9163. "Specify community to accept\n"
  9164. COMMUNITY_VAL_STR)
  9165. {
  9166. return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
  9167. }
  9168. ALIAS (ip_community_list_standard,
  9169. ip_community_list_standard2_cmd,
  9170. "ip community-list <1-99> (deny|permit)",
  9171. IP_STR
  9172. COMMUNITY_LIST_STR
  9173. "Community list number (standard)\n"
  9174. "Specify community to reject\n"
  9175. "Specify community to accept\n")
  9176. DEFUN (ip_community_list_expanded,
  9177. ip_community_list_expanded_cmd,
  9178. "ip community-list <100-500> (deny|permit) .LINE",
  9179. IP_STR
  9180. COMMUNITY_LIST_STR
  9181. "Community list number (expanded)\n"
  9182. "Specify community to reject\n"
  9183. "Specify community to accept\n"
  9184. "An ordered list as a regular-expression\n")
  9185. {
  9186. return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
  9187. }
  9188. DEFUN (ip_community_list_name_standard,
  9189. ip_community_list_name_standard_cmd,
  9190. "ip community-list standard WORD (deny|permit) .AA:NN",
  9191. IP_STR
  9192. COMMUNITY_LIST_STR
  9193. "Add a standard community-list entry\n"
  9194. "Community list name\n"
  9195. "Specify community to reject\n"
  9196. "Specify community to accept\n"
  9197. COMMUNITY_VAL_STR)
  9198. {
  9199. return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
  9200. }
  9201. ALIAS (ip_community_list_name_standard,
  9202. ip_community_list_name_standard2_cmd,
  9203. "ip community-list standard WORD (deny|permit)",
  9204. IP_STR
  9205. COMMUNITY_LIST_STR
  9206. "Add a standard community-list entry\n"
  9207. "Community list name\n"
  9208. "Specify community to reject\n"
  9209. "Specify community to accept\n")
  9210. DEFUN (ip_community_list_name_expanded,
  9211. ip_community_list_name_expanded_cmd,
  9212. "ip community-list expanded WORD (deny|permit) .LINE",
  9213. IP_STR
  9214. COMMUNITY_LIST_STR
  9215. "Add an expanded community-list entry\n"
  9216. "Community list name\n"
  9217. "Specify community to reject\n"
  9218. "Specify community to accept\n"
  9219. "An ordered list as a regular-expression\n")
  9220. {
  9221. return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
  9222. }
  9223. DEFUN (no_ip_community_list_standard_all,
  9224. no_ip_community_list_standard_all_cmd,
  9225. "no ip community-list <1-99>",
  9226. NO_STR
  9227. IP_STR
  9228. COMMUNITY_LIST_STR
  9229. "Community list number (standard)\n")
  9230. {
  9231. return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
  9232. }
  9233. DEFUN (no_ip_community_list_expanded_all,
  9234. no_ip_community_list_expanded_all_cmd,
  9235. "no ip community-list <100-500>",
  9236. NO_STR
  9237. IP_STR
  9238. COMMUNITY_LIST_STR
  9239. "Community list number (expanded)\n")
  9240. {
  9241. return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
  9242. }
  9243. DEFUN (no_ip_community_list_name_standard_all,
  9244. n