bgp_vty.c 358 KB

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