bgp_vty.c 321 KB

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