zebra_vty.c 170 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533
  1. /* Zebra VTY functions
  2. * Copyright (C) 2002 Kunihiro Ishiguro
  3. *
  4. * This file is part of GNU Zebra.
  5. *
  6. * GNU Zebra is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2, or (at your option) any
  9. * later version.
  10. *
  11. * GNU Zebra is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GNU Zebra; see the file COPYING. If not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #include <zebra.h>
  22. #include "memory.h"
  23. #include "if.h"
  24. #include "prefix.h"
  25. #include "command.h"
  26. #include "table.h"
  27. #include "rib.h"
  28. #include "vrf.h"
  29. #include "nexthop.h"
  30. #include "zebra/zserv.h"
  31. #include "zebra/zebra_rnh.h"
  32. static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id);
  33. static void vty_show_ip_route_detail (struct vty *vty, struct route_node *rn,
  34. int mcast);
  35. static void vty_show_ip_route (struct vty *vty, struct route_node *rn,
  36. struct rib *rib);
  37. /* General function for static route. */
  38. static int
  39. zebra_static_ipv4_safi (struct vty *vty, safi_t safi, int add_cmd,
  40. const char *dest_str, const char *mask_str,
  41. const char *gate_str, const char *flag_str,
  42. const char *tag_str, const char *distance_str,
  43. const char *vrf_id_str)
  44. {
  45. int ret;
  46. u_char distance;
  47. struct prefix p;
  48. struct in_addr gate;
  49. struct in_addr mask;
  50. const char *ifname;
  51. u_char flag = 0;
  52. route_tag_t tag = 0;
  53. vrf_id_t vrf_id = VRF_DEFAULT;
  54. ret = str2prefix (dest_str, &p);
  55. if (ret <= 0)
  56. {
  57. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  58. return CMD_WARNING;
  59. }
  60. /* Cisco like mask notation. */
  61. if (mask_str)
  62. {
  63. ret = inet_aton (mask_str, &mask);
  64. if (ret == 0)
  65. {
  66. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  67. return CMD_WARNING;
  68. }
  69. p.prefixlen = ip_masklen (mask);
  70. }
  71. /* Apply mask for given prefix. */
  72. apply_mask (&p);
  73. /* Administrative distance. */
  74. if (distance_str)
  75. distance = atoi (distance_str);
  76. else
  77. distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
  78. /* tag */
  79. if (tag_str)
  80. tag = atoi (tag_str);
  81. /* VRF id */
  82. if (vrf_id_str)
  83. VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
  84. /* tag */
  85. if (tag_str)
  86. tag = atoi(tag_str);
  87. /* Null0 static route. */
  88. if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0))
  89. {
  90. if (flag_str)
  91. {
  92. vty_out (vty, "%% can not have flag %s with Null0%s", flag_str, VTY_NEWLINE);
  93. return CMD_WARNING;
  94. }
  95. if (add_cmd)
  96. static_add_ipv4_safi (safi, &p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, tag, distance, vrf_id);
  97. else
  98. static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id);
  99. return CMD_SUCCESS;
  100. }
  101. /* Route flags */
  102. if (flag_str) {
  103. switch(flag_str[0]) {
  104. case 'r':
  105. case 'R': /* XXX */
  106. SET_FLAG (flag, ZEBRA_FLAG_REJECT);
  107. break;
  108. case 'b':
  109. case 'B': /* XXX */
  110. SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
  111. break;
  112. default:
  113. vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
  114. return CMD_WARNING;
  115. }
  116. }
  117. if (gate_str == NULL)
  118. {
  119. if (add_cmd)
  120. static_add_ipv4_safi (safi, &p, NULL, NULL, flag, tag, distance, vrf_id);
  121. else
  122. static_delete_ipv4_safi (safi, &p, NULL, NULL, tag, distance, vrf_id);
  123. return CMD_SUCCESS;
  124. }
  125. /* When gateway is A.B.C.D format, gate is treated as nexthop
  126. address other case gate is treated as interface name. */
  127. ret = inet_aton (gate_str, &gate);
  128. if (ret)
  129. ifname = NULL;
  130. else
  131. ifname = gate_str;
  132. if (add_cmd)
  133. static_add_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, flag, tag, distance, vrf_id);
  134. else
  135. static_delete_ipv4_safi (safi, &p, ifname ? NULL : &gate, ifname, tag, distance, vrf_id);
  136. return CMD_SUCCESS;
  137. }
  138. /* Static unicast routes for multicast RPF lookup. */
  139. DEFUN (ip_mroute_dist,
  140. ip_mroute_dist_cmd,
  141. "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
  142. IP_STR
  143. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  144. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  145. "Nexthop address\n"
  146. "Nexthop interface name\n"
  147. "Distance\n")
  148. {
  149. VTY_WARN_EXPERIMENTAL();
  150. return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
  151. NULL, NULL, argc > 2 ? argv[2] : NULL, NULL);
  152. }
  153. ALIAS (ip_mroute_dist,
  154. ip_mroute_cmd,
  155. "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
  156. IP_STR
  157. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  158. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  159. "Nexthop address\n"
  160. "Nexthop interface name\n")
  161. DEFUN (ip_mroute_dist_vrf,
  162. ip_mroute_dist_vrf_cmd,
  163. "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
  164. IP_STR
  165. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  166. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  167. "Nexthop address\n"
  168. "Nexthop interface name\n"
  169. "Distance\n"
  170. VRF_CMD_HELP_STR)
  171. {
  172. VTY_WARN_EXPERIMENTAL();
  173. return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 1, argv[0], NULL, argv[1],
  174. NULL, NULL, argc > 3 ? argv[2] : NULL,
  175. argc > 3 ? argv[3] : argv[2]);
  176. }
  177. ALIAS (ip_mroute_dist_vrf,
  178. ip_mroute_vrf_cmd,
  179. "ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) "VRF_CMD_STR,
  180. IP_STR
  181. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  182. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  183. "Nexthop address\n"
  184. "Nexthop interface name\n"
  185. VRF_CMD_HELP_STR)
  186. DEFUN (no_ip_mroute_dist,
  187. no_ip_mroute_dist_cmd,
  188. "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255>",
  189. IP_STR
  190. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  191. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  192. "Nexthop address\n"
  193. "Nexthop interface name\n"
  194. "Distance\n")
  195. {
  196. VTY_WARN_EXPERIMENTAL();
  197. return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
  198. NULL, NULL, argc > 2 ? argv[2] : NULL, NULL);
  199. }
  200. ALIAS (no_ip_mroute_dist,
  201. no_ip_mroute_cmd,
  202. "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE)",
  203. NO_STR
  204. IP_STR
  205. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  206. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  207. "Nexthop address\n"
  208. "Nexthop interface name\n")
  209. DEFUN (no_ip_mroute_dist_vrf,
  210. no_ip_mroute_dist_vrf_cmd,
  211. "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) <1-255> " VRF_CMD_STR,
  212. IP_STR
  213. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  214. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  215. "Nexthop address\n"
  216. "Nexthop interface name\n"
  217. "Distance\n"
  218. VRF_CMD_HELP_STR)
  219. {
  220. VTY_WARN_EXPERIMENTAL();
  221. return zebra_static_ipv4_safi(vty, SAFI_MULTICAST, 0, argv[0], NULL, argv[1],
  222. NULL, NULL, argc > 3 ? argv[2] : NULL,
  223. argc > 3 ? argv[3] : argv[2]);
  224. }
  225. ALIAS (no_ip_mroute_dist_vrf,
  226. no_ip_mroute_vrf_cmd,
  227. "no ip mroute A.B.C.D/M (A.B.C.D|INTERFACE) " VRF_CMD_STR,
  228. NO_STR
  229. IP_STR
  230. "Configure static unicast route into MRIB for multicast RPF lookup\n"
  231. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  232. "Nexthop address\n"
  233. "Nexthop interface name\n"
  234. VRF_CMD_HELP_STR)
  235. DEFUN (ip_multicast_mode,
  236. ip_multicast_mode_cmd,
  237. "ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
  238. IP_STR
  239. "Multicast options\n"
  240. "RPF lookup behavior\n"
  241. "Lookup in unicast RIB only\n"
  242. "Lookup in multicast RIB only\n"
  243. "Try multicast RIB first, fall back to unicast RIB\n"
  244. "Lookup both, use entry with lower distance\n"
  245. "Lookup both, use entry with longer prefix\n")
  246. {
  247. VTY_WARN_EXPERIMENTAL();
  248. if (!strncmp (argv[0], "u", 1))
  249. multicast_mode_ipv4_set (MCAST_URIB_ONLY);
  250. else if (!strncmp (argv[0], "mrib-o", 6))
  251. multicast_mode_ipv4_set (MCAST_MRIB_ONLY);
  252. else if (!strncmp (argv[0], "mrib-t", 6))
  253. multicast_mode_ipv4_set (MCAST_MIX_MRIB_FIRST);
  254. else if (!strncmp (argv[0], "low", 3))
  255. multicast_mode_ipv4_set (MCAST_MIX_DISTANCE);
  256. else if (!strncmp (argv[0], "lon", 3))
  257. multicast_mode_ipv4_set (MCAST_MIX_PFXLEN);
  258. else
  259. {
  260. vty_out (vty, "Invalid mode specified%s", VTY_NEWLINE);
  261. return CMD_WARNING;
  262. }
  263. return CMD_SUCCESS;
  264. }
  265. DEFUN (no_ip_multicast_mode,
  266. no_ip_multicast_mode_cmd,
  267. "no ip multicast rpf-lookup-mode (urib-only|mrib-only|mrib-then-urib|lower-distance|longer-prefix)",
  268. NO_STR
  269. IP_STR
  270. "Multicast options\n"
  271. "RPF lookup behavior\n"
  272. "Lookup in unicast RIB only\n"
  273. "Lookup in multicast RIB only\n"
  274. "Try multicast RIB first, fall back to unicast RIB\n"
  275. "Lookup both, use entry with lower distance\n"
  276. "Lookup both, use entry with longer prefix\n")
  277. {
  278. multicast_mode_ipv4_set (MCAST_NO_CONFIG);
  279. return CMD_SUCCESS;
  280. }
  281. ALIAS (no_ip_multicast_mode,
  282. no_ip_multicast_mode_noarg_cmd,
  283. "no ip multicast rpf-lookup-mode",
  284. NO_STR
  285. IP_STR
  286. "Multicast options\n"
  287. "RPF lookup behavior\n")
  288. DEFUN (show_ip_rpf,
  289. show_ip_rpf_cmd,
  290. "show ip rpf",
  291. SHOW_STR
  292. IP_STR
  293. "Display RPF information for multicast source\n")
  294. {
  295. vrf_id_t vrf_id = VRF_DEFAULT;
  296. if (argc > 0)
  297. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  298. VTY_WARN_EXPERIMENTAL();
  299. return do_show_ip_route(vty, SAFI_MULTICAST, vrf_id);
  300. }
  301. ALIAS (show_ip_rpf,
  302. show_ip_rpf_vrf_cmd,
  303. "show ip rpf " VRF_CMD_STR,
  304. SHOW_STR
  305. IP_STR
  306. "Display RPF information for multicast source\n"
  307. VRF_CMD_HELP_STR)
  308. DEFUN (show_ip_rpf_addr,
  309. show_ip_rpf_addr_cmd,
  310. "show ip rpf A.B.C.D",
  311. SHOW_STR
  312. IP_STR
  313. "Display RPF information for multicast source\n"
  314. "IP multicast source address (e.g. 10.0.0.0)\n")
  315. {
  316. struct in_addr addr;
  317. struct route_node *rn;
  318. struct rib *rib;
  319. vrf_id_t vrf_id = VRF_DEFAULT;
  320. int ret;
  321. if (argc > 1)
  322. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  323. VTY_WARN_EXPERIMENTAL();
  324. ret = inet_aton (argv[0], &addr);
  325. if (ret == 0)
  326. {
  327. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  328. return CMD_WARNING;
  329. }
  330. rib = rib_match_ipv4_multicast (addr, &rn, vrf_id);
  331. if (rib)
  332. vty_show_ip_route_detail (vty, rn, 1);
  333. else
  334. vty_out (vty, "%% No match for RPF lookup%s", VTY_NEWLINE);
  335. return CMD_SUCCESS;
  336. }
  337. ALIAS (show_ip_rpf_addr,
  338. show_ip_rpf_addr_vrf_cmd,
  339. "show ip rpf A.B.C.D " VRF_CMD_STR,
  340. SHOW_STR
  341. IP_STR
  342. "Display RPF information for multicast source\n"
  343. "IP multicast source address (e.g. 10.0.0.0)\n"
  344. VRF_CMD_HELP_STR)
  345. DEFUN (show_ip_rpf_vrf_all,
  346. show_ip_rpf_vrf_all_cmd,
  347. "show ip rpf " VRF_ALL_CMD_STR,
  348. SHOW_STR
  349. IP_STR
  350. "Display RPF information for multicast source\n"
  351. VRF_ALL_CMD_HELP_STR)
  352. {
  353. struct zebra_vrf *zvrf;
  354. struct route_table *table;
  355. struct route_node *rn;
  356. struct rib *rib;
  357. vrf_iter_t iter;
  358. int first = 1;
  359. VTY_WARN_EXPERIMENTAL();
  360. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  361. {
  362. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  363. (table = zvrf->table[AFI_IP][SAFI_MULTICAST]) == NULL)
  364. continue;
  365. /* Show all IPv4 routes. */
  366. for (rn = route_top (table); rn; rn = route_next (rn))
  367. RNODE_FOREACH_RIB (rn, rib)
  368. {
  369. if (first)
  370. {
  371. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  372. first = 0;
  373. }
  374. vty_show_ip_route (vty, rn, rib);
  375. }
  376. }
  377. return CMD_SUCCESS;
  378. }
  379. DEFUN (show_ip_rpf_addr_vrf_all,
  380. show_ip_rpf_addr_vrf_all_cmd,
  381. "show ip rpf A.B.C.D " VRF_ALL_CMD_STR,
  382. SHOW_STR
  383. IP_STR
  384. "Display RPF information for multicast source\n"
  385. "IP multicast source address (e.g. 10.0.0.0)\n"
  386. VRF_ALL_CMD_HELP_STR)
  387. {
  388. struct in_addr addr;
  389. struct route_node *rn;
  390. vrf_iter_t iter;
  391. int ret;
  392. VTY_WARN_EXPERIMENTAL();
  393. ret = inet_aton (argv[0], &addr);
  394. if (ret == 0)
  395. {
  396. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  397. return CMD_WARNING;
  398. }
  399. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  400. {
  401. if (rib_match_ipv4_multicast (addr, &rn, vrf_iter2id (iter)))
  402. vty_show_ip_route_detail (vty, rn, 1);
  403. }
  404. return CMD_SUCCESS;
  405. }
  406. /* Static route configuration. */
  407. DEFUN (ip_route,
  408. ip_route_cmd,
  409. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
  410. IP_STR
  411. "Establish static routes\n"
  412. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  413. "IP gateway address\n"
  414. "IP gateway interface name\n"
  415. "Null interface\n")
  416. {
  417. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  418. NULL, NULL, NULL, NULL);
  419. }
  420. DEFUN (ip_route_tag,
  421. ip_route_tag_cmd,
  422. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
  423. IP_STR
  424. "Establish static routes\n"
  425. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  426. "IP gateway address\n"
  427. "IP gateway interface name\n"
  428. "Null interface\n"
  429. "Set tag for this route\n"
  430. "Tag value\n")
  431. {
  432. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  433. argv[1], NULL, argv[2], NULL, NULL);
  434. }
  435. DEFUN (ip_route_tag_vrf,
  436. ip_route_tag_vrf_cmd,
  437. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>" VRF_CMD_STR,
  438. IP_STR
  439. "Establish static routes\n"
  440. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  441. "IP gateway address\n"
  442. "IP gateway interface name\n"
  443. "Null interface\n"
  444. "Set tag for this route\n"
  445. "Tag value\n"
  446. VRF_CMD_HELP_STR)
  447. {
  448. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  449. argv[1], NULL, argv[2], NULL, argv[3]);
  450. }
  451. DEFUN (ip_route_flags,
  452. ip_route_flags_cmd,
  453. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
  454. IP_STR
  455. "Establish static routes\n"
  456. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  457. "IP gateway address\n"
  458. "IP gateway interface name\n"
  459. "Emit an ICMP unreachable when matched\n"
  460. "Silently discard pkts when matched\n")
  461. {
  462. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  463. argv[2], NULL, NULL, NULL);
  464. }
  465. DEFUN (ip_route_flags_tag,
  466. ip_route_flags_tag_cmd,
  467. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  468. IP_STR
  469. "Establish static routes\n"
  470. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  471. "IP gateway address\n"
  472. "IP gateway interface name\n"
  473. "Emit an ICMP unreachable when matched\n"
  474. "Silently discard pkts when matched\n"
  475. "Set tag for this route\n"
  476. "Tag value\n")
  477. {
  478. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  479. argv[2], argv[3], NULL, NULL);
  480. }
  481. DEFUN (ip_route_flags_tag_vrf,
  482. ip_route_flags_tag_vrf_cmd,
  483. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  484. IP_STR
  485. "Establish static routes\n"
  486. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  487. "IP gateway address\n"
  488. "IP gateway interface name\n"
  489. "Emit an ICMP unreachable when matched\n"
  490. "Silently discard pkts when matched\n"
  491. "Set tag for this route\n"
  492. "Tag value\n"
  493. VRF_CMD_HELP_STR)
  494. {
  495. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  496. argv[2], argv[3], NULL, argv[4]);
  497. }
  498. DEFUN (ip_route_flags2,
  499. ip_route_flags2_cmd,
  500. "ip route A.B.C.D/M (reject|blackhole)",
  501. IP_STR
  502. "Establish static routes\n"
  503. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  504. "Emit an ICMP unreachable when matched\n"
  505. "Silently discard pkts when matched\n")
  506. {
  507. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  508. NULL, argv[1], NULL, NULL, NULL);
  509. }
  510. DEFUN (ip_route_flags2_tag,
  511. ip_route_flags2_tag_cmd,
  512. "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>",
  513. IP_STR
  514. "Establish static routes\n"
  515. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  516. "Emit an ICMP unreachable when matched\n"
  517. "Silently discard pkts when matched\n"
  518. "Set tag for this route\n"
  519. "Tag value\n")
  520. {
  521. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL,
  522. argv[1], argv[2], NULL, NULL);
  523. }
  524. DEFUN (ip_route_flags2_tag_vrf,
  525. ip_route_flags2_tag_vrf_cmd,
  526. "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>",
  527. IP_STR
  528. "Establish static routes\n"
  529. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  530. "Emit an ICMP unreachable when matched\n"
  531. "Silently discard pkts when matched\n"
  532. "Set tag for this route\n"
  533. "Tag value\n"
  534. VRF_CMD_HELP_STR)
  535. {
  536. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, NULL,
  537. argv[1], argv[2], NULL, argv[3]);
  538. }
  539. /* Mask as A.B.C.D format. */
  540. DEFUN (ip_route_mask,
  541. ip_route_mask_cmd,
  542. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
  543. IP_STR
  544. "Establish static routes\n"
  545. "IP destination prefix\n"
  546. "IP destination prefix mask\n"
  547. "IP gateway address\n"
  548. "IP gateway interface name\n"
  549. "Null interface\n")
  550. {
  551. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  552. argv[2], NULL, NULL, NULL, NULL);
  553. }
  554. DEFUN (ip_route_mask_tag,
  555. ip_route_mask_tag_cmd,
  556. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
  557. IP_STR
  558. "Establish static routes\n"
  559. "IP destination prefix\n"
  560. "IP destination prefix mask\n"
  561. "IP gateway address\n"
  562. "IP gateway interface name\n"
  563. "Null interface\n"
  564. "Set tag for this route\n"
  565. "Tag value\n")
  566. {
  567. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  568. NULL, argv[3], NULL, NULL);
  569. }
  570. DEFUN (ip_route_mask_tag_vrf,
  571. ip_route_mask_tag_vrf_cmd,
  572. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295>" VRF_CMD_STR,
  573. IP_STR
  574. "Establish static routes\n"
  575. "IP destination prefix\n"
  576. "IP destination prefix mask\n"
  577. "IP gateway address\n"
  578. "IP gateway interface name\n"
  579. "Null interface\n"
  580. "Set tag for this route\n"
  581. "Tag value\n"
  582. VRF_CMD_HELP_STR)
  583. {
  584. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  585. NULL, argv[3], NULL, argv[4]);
  586. }
  587. DEFUN (ip_route_mask_flags,
  588. ip_route_mask_flags_cmd,
  589. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
  590. IP_STR
  591. "Establish static routes\n"
  592. "IP destination prefix\n"
  593. "IP destination prefix mask\n"
  594. "IP gateway address\n"
  595. "IP gateway interface name\n"
  596. "Emit an ICMP unreachable when matched\n"
  597. "Silently discard pkts when matched\n")
  598. {
  599. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  600. argv[2], argv[3], NULL, NULL, NULL);
  601. }
  602. DEFUN (ip_route_mask_flags_tag,
  603. ip_route_mask_flags_tag_cmd,
  604. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  605. IP_STR
  606. "Establish static routes\n"
  607. "IP destination prefix\n"
  608. "IP destination prefix mask\n"
  609. "IP gateway address\n"
  610. "IP gateway interface name\n"
  611. "Emit an ICMP unreachable when matched\n"
  612. "Silently discard pkts when matched\n"
  613. "Set tag for this route\n"
  614. "Tag value\n")
  615. {
  616. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  617. argv[2], argv[3], argv[4], NULL, NULL);
  618. }
  619. DEFUN (ip_route_mask_flags_tag_vrf,
  620. ip_route_mask_flags_tag_vrf_cmd,
  621. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  622. IP_STR
  623. "Establish static routes\n"
  624. "IP destination prefix\n"
  625. "IP destination prefix mask\n"
  626. "IP gateway address\n"
  627. "IP gateway interface name\n"
  628. "Emit an ICMP unreachable when matched\n"
  629. "Silently discard pkts when matched\n"
  630. "Set tag for this route\n"
  631. "Tag value\n"
  632. VRF_CMD_HELP_STR)
  633. {
  634. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  635. argv[2], argv[3], argv[4], NULL, argv[5]);
  636. }
  637. DEFUN (ip_route_mask_flags2,
  638. ip_route_mask_flags2_cmd,
  639. "ip route A.B.C.D A.B.C.D (reject|blackhole)",
  640. IP_STR
  641. "Establish static routes\n"
  642. "IP destination prefix\n"
  643. "IP destination prefix mask\n"
  644. "Emit an ICMP unreachable when matched\n"
  645. "Silently discard pkts when matched\n")
  646. {
  647. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  648. NULL, argv[2], NULL, NULL, NULL);
  649. }
  650. DEFUN (ip_route_mask_flags2_tag,
  651. ip_route_mask_flags2_tag_cmd,
  652. "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>",
  653. IP_STR
  654. "Establish static routes\n"
  655. "IP destination prefix\n"
  656. "IP destination prefix mask\n"
  657. "Emit an ICMP unreachable when matched\n"
  658. "Silently discard pkts when matched\n"
  659. "Set tag for this route\n"
  660. "Tag value\n")
  661. {
  662. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
  663. argv[2], argv[3], NULL, NULL);
  664. }
  665. DEFUN (ip_route_mask_flags2_tag_vrf,
  666. ip_route_mask_flags2_tag_vrf_cmd,
  667. "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  668. IP_STR
  669. "Establish static routes\n"
  670. "IP destination prefix\n"
  671. "IP destination prefix mask\n"
  672. "Emit an ICMP unreachable when matched\n"
  673. "Silently discard pkts when matched\n"
  674. "Set tag for this route\n"
  675. "Tag value\n"
  676. VRF_CMD_HELP_STR)
  677. {
  678. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
  679. argv[2], argv[3], NULL, argv[4]);
  680. }
  681. /* Distance option value. */
  682. DEFUN (ip_route_distance,
  683. ip_route_distance_cmd,
  684. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
  685. IP_STR
  686. "Establish static routes\n"
  687. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  688. "IP gateway address\n"
  689. "IP gateway interface name\n"
  690. "Null interface\n"
  691. "Distance value for this route\n")
  692. {
  693. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  694. argv[1], NULL, NULL, argv[2], NULL);
  695. }
  696. DEFUN (ip_route_tag_distance,
  697. ip_route_tag_distance_cmd,
  698. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
  699. IP_STR
  700. "Establish static routes\n"
  701. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  702. "IP gateway address\n"
  703. "IP gateway interface name\n"
  704. "Null interface\n"
  705. "Set tag for this route\n"
  706. "Tag value\n"
  707. "Distance value for this route\n")
  708. {
  709. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  710. argv[1], NULL, argv[2], argv[3], NULL);
  711. }
  712. DEFUN (ip_route_tag_distance_vrf,
  713. ip_route_tag_distance_vrf_cmd,
  714. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  715. IP_STR
  716. "Establish static routes\n"
  717. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  718. "IP gateway address\n"
  719. "IP gateway interface name\n"
  720. "Null interface\n"
  721. "Set tag for this route\n"
  722. "Tag value\n"
  723. "Distance value for this route\n"
  724. VRF_CMD_HELP_STR)
  725. {
  726. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  727. argv[1], NULL, argv[2], argv[3], argv[4]);
  728. }
  729. DEFUN (ip_route_flags_distance,
  730. ip_route_flags_distance_cmd,
  731. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
  732. IP_STR
  733. "Establish static routes\n"
  734. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  735. "IP gateway address\n"
  736. "IP gateway interface name\n"
  737. "Emit an ICMP unreachable when matched\n"
  738. "Silently discard pkts when matched\n"
  739. "Distance value for this route\n")
  740. {
  741. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  742. argv[2], NULL, argv[3], NULL);
  743. }
  744. DEFUN (ip_route_flags_tag_distance,
  745. ip_route_flags_tag_distance_cmd,
  746. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  747. IP_STR
  748. "Establish static routes\n"
  749. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  750. "IP gateway address\n"
  751. "IP gateway interface name\n"
  752. "Emit an ICMP unreachable when matched\n"
  753. "Silently discard pkts when matched\n"
  754. "Set tag for this route\n"
  755. "Tag value\n"
  756. "Distance value for this route\n")
  757. {
  758. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  759. argv[2], argv[3], argv[4], NULL);
  760. }
  761. DEFUN (ip_route_flags_tag_distance_vrf,
  762. ip_route_flags_tag_distance_vrf_cmd,
  763. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  764. IP_STR
  765. "Establish static routes\n"
  766. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  767. "IP gateway address\n"
  768. "IP gateway interface name\n"
  769. "Emit an ICMP unreachable when matched\n"
  770. "Silently discard pkts when matched\n"
  771. "Set tag for this route\n"
  772. "Tag value\n"
  773. "Distance value for this route\n"
  774. VRF_CMD_HELP_STR)
  775. {
  776. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL, argv[1],
  777. argv[2], argv[3], argv[4], argv[5]);
  778. }
  779. DEFUN (ip_route_flags_distance2,
  780. ip_route_flags_distance2_cmd,
  781. "ip route A.B.C.D/M (reject|blackhole) <1-255>",
  782. IP_STR
  783. "Establish static routes\n"
  784. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  785. "Emit an ICMP unreachable when matched\n"
  786. "Silently discard pkts when matched\n"
  787. "Distance value for this route\n")
  788. {
  789. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  790. NULL, argv[1], NULL, argv[2], NULL);
  791. }
  792. DEFUN (ip_route_flags_tag_distance2,
  793. ip_route_flags_tag_distance2_cmd,
  794. "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>",
  795. IP_STR
  796. "Establish static routes\n"
  797. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  798. "Emit an ICMP unreachable when matched\n"
  799. "Silently discard pkts when matched\n"
  800. "Set tag for this route\n"
  801. "Tag value\n"
  802. "Distance value for this route\n")
  803. {
  804. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  805. NULL, argv[1], argv[2], argv[3], NULL);
  806. }
  807. DEFUN (ip_route_flags_tag_distance2_vrf,
  808. ip_route_flags_tag_distance2_vrf_cmd,
  809. "ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  810. IP_STR
  811. "Establish static routes\n"
  812. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  813. "Emit an ICMP unreachable when matched\n"
  814. "Silently discard pkts when matched\n"
  815. "Set tag for this route\n"
  816. "Tag value\n"
  817. "Distance value for this route\n"
  818. VRF_CMD_HELP_STR)
  819. {
  820. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  821. NULL, argv[1], argv[2], argv[3], argv[4]);
  822. }
  823. DEFUN (ip_route_mask_distance,
  824. ip_route_mask_distance_cmd,
  825. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
  826. IP_STR
  827. "Establish static routes\n"
  828. "IP destination prefix\n"
  829. "IP destination prefix mask\n"
  830. "IP gateway address\n"
  831. "IP gateway interface name\n"
  832. "Null interface\n"
  833. "Distance value for this route\n")
  834. {
  835. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  836. NULL, NULL, argv[3], NULL);
  837. }
  838. DEFUN (ip_route_mask_tag_distance,
  839. ip_route_mask_tag_distance_cmd,
  840. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
  841. IP_STR
  842. "Establish static routes\n"
  843. "IP destination prefix\n"
  844. "IP destination prefix mask\n"
  845. "IP gateway address\n"
  846. "IP gateway interface name\n"
  847. "Null interface\n"
  848. "Set tag for this route\n"
  849. "Tag value\n"
  850. "Distance value for this route\n")
  851. {
  852. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  853. argv[2], NULL, argv[3], argv[4], NULL);
  854. }
  855. DEFUN (ip_route_mask_tag_distance_vrf,
  856. ip_route_mask_tag_distance_vrf_cmd,
  857. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  858. IP_STR
  859. "Establish static routes\n"
  860. "IP destination prefix\n"
  861. "IP destination prefix mask\n"
  862. "IP gateway address\n"
  863. "IP gateway interface name\n"
  864. "Null interface\n"
  865. "Set tag for this route\n"
  866. "Tag value\n"
  867. "Distance value for this route\n"
  868. VRF_CMD_HELP_STR)
  869. {
  870. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  871. argv[2], NULL, argv[3], argv[4], argv[5]);
  872. }
  873. DEFUN (ip_route_mask_flags_tag_distance,
  874. ip_route_mask_flags_tag_distance_cmd,
  875. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  876. IP_STR
  877. "Establish static routes\n"
  878. "IP destination prefix\n"
  879. "IP destination prefix mask\n"
  880. "IP gateway address\n"
  881. "IP gateway interface name\n"
  882. "Set tag for this route\n"
  883. "Tag value\n"
  884. "Distance value for this route\n"
  885. "Emit an ICMP unreachable when matched\n"
  886. "Silently discard pkts when matched\n")
  887. {
  888. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  889. argv[3], argv[4], argv[5], NULL);
  890. }
  891. DEFUN (ip_route_mask_flags_tag_distance_vrf,
  892. ip_route_mask_flags_tag_distance_vrf_cmd,
  893. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  894. IP_STR
  895. "Establish static routes\n"
  896. "IP destination prefix\n"
  897. "IP destination prefix mask\n"
  898. "IP gateway address\n"
  899. "IP gateway interface name\n"
  900. "Set tag for this route\n"
  901. "Tag value\n"
  902. "Distance value for this route\n"
  903. "Emit an ICMP unreachable when matched\n"
  904. "Silently discard pkts when matched\n"
  905. VRF_CMD_HELP_STR)
  906. {
  907. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  908. argv[3], argv[4], argv[5], argv[6]);
  909. }
  910. DEFUN (ip_route_mask_flags_distance,
  911. ip_route_mask_flags_distance_cmd,
  912. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
  913. IP_STR
  914. "Establish static routes\n"
  915. "IP destination prefix\n"
  916. "IP destination prefix mask\n"
  917. "IP gateway address\n"
  918. "IP gateway interface name\n"
  919. "Emit an ICMP unreachable when matched\n"
  920. "Silently discard pkts when matched\n"
  921. "Distance value for this route\n")
  922. {
  923. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], argv[2],
  924. argv[3], NULL, argv[4], NULL);
  925. }
  926. DEFUN (ip_route_mask_flags_distance2,
  927. ip_route_mask_flags_distance2_cmd,
  928. "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
  929. IP_STR
  930. "Establish static routes\n"
  931. "IP destination prefix\n"
  932. "IP destination prefix mask\n"
  933. "Emit an ICMP unreachable when matched\n"
  934. "Silently discard pkts when matched\n"
  935. "Distance value for this route\n")
  936. {
  937. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  938. NULL, argv[2], NULL, argv[3], NULL);
  939. }
  940. DEFUN (ip_route_mask_flags_tag_distance2,
  941. ip_route_mask_flags_tag_distance2_cmd,
  942. "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>",
  943. IP_STR
  944. "Establish static routes\n"
  945. "IP destination prefix\n"
  946. "IP destination prefix mask\n"
  947. "Set tag for this route\n"
  948. "Tag value\n"
  949. "Distance value for this route\n"
  950. "Emit an ICMP unreachable when matched\n"
  951. "Silently discard pkts when matched\n")
  952. {
  953. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
  954. argv[2], argv[3], argv[4], NULL);
  955. }
  956. DEFUN (ip_route_mask_flags_tag_distance2_vrf,
  957. ip_route_mask_flags_tag_distance2_vrf_cmd,
  958. "ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  959. IP_STR
  960. "Establish static routes\n"
  961. "IP destination prefix\n"
  962. "IP destination prefix mask\n"
  963. "Set tag for this route\n"
  964. "Tag value\n"
  965. "Distance value for this route\n"
  966. "Emit an ICMP unreachable when matched\n"
  967. "Silently discard pkts when matched\n"
  968. VRF_CMD_HELP_STR)
  969. {
  970. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1], NULL,
  971. argv[2], argv[3], argv[4], argv[5]);
  972. }
  973. DEFUN (no_ip_route,
  974. no_ip_route_cmd,
  975. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
  976. NO_STR
  977. IP_STR
  978. "Establish static routes\n"
  979. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  980. "IP gateway address\n"
  981. "IP gateway interface name\n"
  982. "Null interface\n")
  983. {
  984. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
  985. argv[1], NULL, NULL, NULL, NULL);
  986. }
  987. DEFUN (no_ip_route_tag,
  988. no_ip_route_tag_cmd,
  989. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
  990. NO_STR
  991. IP_STR
  992. "Establish static routes\n"
  993. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  994. "IP gateway address\n"
  995. "IP gateway interface name\n"
  996. "Null interface\n"
  997. "Tag of this route\n"
  998. "Tag value\n")
  999. {
  1000. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1001. NULL, argv[2], NULL, NULL);
  1002. }
  1003. DEFUN (no_ip_route_tag_vrf,
  1004. no_ip_route_tag_vrf_cmd,
  1005. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295>" VRF_CMD_STR,
  1006. NO_STR
  1007. IP_STR
  1008. "Establish static routes\n"
  1009. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1010. "IP gateway address\n"
  1011. "IP gateway interface name\n"
  1012. "Null interface\n"
  1013. "Tag of this route\n"
  1014. "Tag value\n"
  1015. VRF_CMD_HELP_STR)
  1016. {
  1017. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1018. NULL, argv[2], NULL, argv[3]);
  1019. }
  1020. ALIAS (no_ip_route,
  1021. no_ip_route_flags_cmd,
  1022. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole)",
  1023. NO_STR
  1024. IP_STR
  1025. "Establish static routes\n"
  1026. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1027. "IP gateway address\n"
  1028. "IP gateway interface name\n"
  1029. "Emit an ICMP unreachable when matched\n"
  1030. "Silently discard pkts when matched\n")
  1031. ALIAS (no_ip_route_tag,
  1032. no_ip_route_flags_tag_cmd,
  1033. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  1034. NO_STR
  1035. IP_STR
  1036. "Establish static routes\n"
  1037. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1038. "IP gateway address\n"
  1039. "IP gateway interface name\n"
  1040. "Emit an ICMP unreachable when matched\n"
  1041. "Silently discard pkts when matched\n"
  1042. "Tag of this route\n"
  1043. "Tag value\n")
  1044. DEFUN (no_ip_route_flags2,
  1045. no_ip_route_flags2_cmd,
  1046. "no ip route A.B.C.D/M (reject|blackhole)",
  1047. NO_STR
  1048. IP_STR
  1049. "Establish static routes\n"
  1050. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1051. "Emit an ICMP unreachable when matched\n"
  1052. "Silently discard pkts when matched\n")
  1053. {
  1054. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
  1055. NULL, NULL, NULL, NULL, NULL);
  1056. }
  1057. DEFUN (no_ip_route_flags2_tag,
  1058. no_ip_route_flags2_tag_cmd,
  1059. "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>",
  1060. NO_STR
  1061. IP_STR
  1062. "Establish static routes\n"
  1063. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1064. "Emit an ICMP unreachable when matched\n"
  1065. "Silently discard pkts when matched\n"
  1066. "Tag of this route\n"
  1067. "Tag value\n")
  1068. {
  1069. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1070. NULL, argv[1], NULL, NULL);
  1071. }
  1072. DEFUN (no_ip_route_flags2_tag_vrf,
  1073. no_ip_route_flags2_tag_vrf_cmd,
  1074. "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  1075. NO_STR
  1076. IP_STR
  1077. "Establish static routes\n"
  1078. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1079. "Emit an ICMP unreachable when matched\n"
  1080. "Silently discard pkts when matched\n"
  1081. "Tag of this route\n"
  1082. "Tag value\n"
  1083. VRF_CMD_HELP_STR)
  1084. {
  1085. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1086. NULL, argv[1], NULL, argv[2]);
  1087. }
  1088. DEFUN (no_ip_route_mask,
  1089. no_ip_route_mask_cmd,
  1090. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
  1091. NO_STR
  1092. IP_STR
  1093. "Establish static routes\n"
  1094. "IP destination prefix\n"
  1095. "IP destination prefix mask\n"
  1096. "IP gateway address\n"
  1097. "IP gateway interface name\n"
  1098. "Null interface\n")
  1099. {
  1100. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1101. argv[2], NULL, NULL, NULL, NULL);
  1102. }
  1103. DEFUN (no_ip_route_mask_tag,
  1104. no_ip_route_mask_tag_cmd,
  1105. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295>",
  1106. NO_STR
  1107. IP_STR
  1108. "Establish static routes\n"
  1109. "IP destination prefix\n"
  1110. "IP destination prefix mask\n"
  1111. "IP gateway address\n"
  1112. "IP gateway interface name\n"
  1113. "Null interface\n"
  1114. "Tag of this route\n"
  1115. "Tag value\n")
  1116. {
  1117. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
  1118. NULL, argv[3], NULL, NULL);
  1119. }
  1120. ALIAS (no_ip_route_mask,
  1121. no_ip_route_mask_flags_cmd,
  1122. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole)",
  1123. NO_STR
  1124. IP_STR
  1125. "Establish static routes\n"
  1126. "IP destination prefix\n"
  1127. "IP destination prefix mask\n"
  1128. "IP gateway address\n"
  1129. "IP gateway interface name\n"
  1130. "Emit an ICMP unreachable when matched\n"
  1131. "Silently discard pkts when matched\n")
  1132. ALIAS (no_ip_route_mask_tag,
  1133. no_ip_route_mask_flags_tag_cmd,
  1134. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  1135. NO_STR
  1136. IP_STR
  1137. "Establish static routes\n"
  1138. "IP destination prefix\n"
  1139. "IP destination prefix mask\n"
  1140. "IP gateway address\n"
  1141. "IP gateway interface name\n"
  1142. "Emit an ICMP unreachable when matched\n"
  1143. "Silently discard pkts when matched\n"
  1144. "Tag of this route\n"
  1145. "Tag value\n")
  1146. DEFUN (no_ip_route_mask_flags2,
  1147. no_ip_route_mask_flags2_cmd,
  1148. "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
  1149. NO_STR
  1150. IP_STR
  1151. "Establish static routes\n"
  1152. "IP destination prefix\n"
  1153. "IP destination prefix mask\n"
  1154. "Emit an ICMP unreachable when matched\n"
  1155. "Silently discard pkts when matched\n")
  1156. {
  1157. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1158. NULL, NULL, NULL, NULL, NULL);
  1159. }
  1160. DEFUN (no_ip_route_mask_flags2_tag,
  1161. no_ip_route_mask_flags2_tag_cmd,
  1162. "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>",
  1163. NO_STR
  1164. IP_STR
  1165. "Establish static routes\n"
  1166. "IP destination prefix\n"
  1167. "IP destination prefix mask\n"
  1168. "Emit an ICMP unreachable when matched\n"
  1169. "Silently discard pkts when matched\n"
  1170. "Tag of this route\n"
  1171. "Tag value\n")
  1172. {
  1173. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1174. NULL, NULL, argv[2], NULL, NULL);
  1175. }
  1176. DEFUN (no_ip_route_mask_flags2_tag_vrf,
  1177. no_ip_route_mask_flags2_tag_vrf_cmd,
  1178. "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  1179. NO_STR
  1180. IP_STR
  1181. "Establish static routes\n"
  1182. "IP destination prefix\n"
  1183. "IP destination prefix mask\n"
  1184. "Emit an ICMP unreachable when matched\n"
  1185. "Silently discard pkts when matched\n"
  1186. "Tag of this route\n"
  1187. "Tag value\n"
  1188. VRF_CMD_HELP_STR)
  1189. {
  1190. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1191. NULL, NULL, argv[2], NULL, argv[3]);
  1192. }
  1193. DEFUN (no_ip_route_distance,
  1194. no_ip_route_distance_cmd,
  1195. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
  1196. NO_STR
  1197. IP_STR
  1198. "Establish static routes\n"
  1199. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1200. "IP gateway address\n"
  1201. "IP gateway interface name\n"
  1202. "Null interface\n"
  1203. "Distance value for this route\n")
  1204. {
  1205. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
  1206. argv[1], NULL, NULL, argv[2], NULL);
  1207. }
  1208. DEFUN (no_ip_route_tag_distance,
  1209. no_ip_route_tag_distance_cmd,
  1210. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
  1211. NO_STR
  1212. IP_STR
  1213. "Establish static routes\n"
  1214. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1215. "IP gateway address\n"
  1216. "IP gateway interface name\n"
  1217. "Null interface\n"
  1218. "Tag of this route\n"
  1219. "Tag value\n"
  1220. "Distance value for this route\n")
  1221. {
  1222. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1223. NULL, argv[2], argv[3], NULL);
  1224. }
  1225. DEFUN (no_ip_route_tag_distance_vrf,
  1226. no_ip_route_tag_distance_vrf_cmd,
  1227. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1228. NO_STR
  1229. IP_STR
  1230. "Establish static routes\n"
  1231. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1232. "IP gateway address\n"
  1233. "IP gateway interface name\n"
  1234. "Null interface\n"
  1235. "Tag of this route\n"
  1236. "Tag value\n"
  1237. "Distance value for this route\n"
  1238. VRF_CMD_HELP_STR)
  1239. {
  1240. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1241. NULL, argv[2], argv[3], argv[4]);
  1242. }
  1243. DEFUN (no_ip_route_flags_distance,
  1244. no_ip_route_flags_distance_cmd,
  1245. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
  1246. NO_STR
  1247. IP_STR
  1248. "Establish static routes\n"
  1249. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1250. "IP gateway address\n"
  1251. "IP gateway interface name\n"
  1252. "Emit an ICMP unreachable when matched\n"
  1253. "Silently discard pkts when matched\n"
  1254. "Distance value for this route\n")
  1255. {
  1256. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
  1257. argv[1], argv[2], NULL, argv[3], NULL);
  1258. }
  1259. DEFUN (no_ip_route_flags_tag_distance,
  1260. no_ip_route_flags_tag_distance_cmd,
  1261. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  1262. NO_STR
  1263. IP_STR
  1264. "Establish static routes\n"
  1265. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1266. "IP gateway address\n"
  1267. "IP gateway interface name\n"
  1268. "Emit an ICMP unreachable when matched\n"
  1269. "Silently discard pkts when matched\n"
  1270. "Tag of this route\n"
  1271. "Tag value\n"
  1272. "Distance value for this route\n")
  1273. {
  1274. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1275. argv[2], argv[3], argv[4], NULL);
  1276. }
  1277. DEFUN (no_ip_route_flags_tag_distance_vrf,
  1278. no_ip_route_flags_tag_distance_vrf_cmd,
  1279. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1280. NO_STR
  1281. IP_STR
  1282. "Establish static routes\n"
  1283. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1284. "IP gateway address\n"
  1285. "IP gateway interface name\n"
  1286. "Emit an ICMP unreachable when matched\n"
  1287. "Silently discard pkts when matched\n"
  1288. "Tag of this route\n"
  1289. "Tag value\n"
  1290. "Distance value for this route\n"
  1291. VRF_CMD_HELP_STR)
  1292. {
  1293. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1294. argv[2], argv[3], argv[4], argv[5]);
  1295. }
  1296. DEFUN (no_ip_route_flags_distance2,
  1297. no_ip_route_flags_distance2_cmd,
  1298. "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
  1299. NO_STR
  1300. IP_STR
  1301. "Establish static routes\n"
  1302. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1303. "Emit an ICMP unreachable when matched\n"
  1304. "Silently discard pkts when matched\n"
  1305. "Distance value for this route\n")
  1306. {
  1307. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1308. argv[1], NULL, argv[2], NULL);
  1309. }
  1310. DEFUN (no_ip_route_flags_tag_distance2,
  1311. no_ip_route_flags_tag_distance2_cmd,
  1312. "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>",
  1313. NO_STR
  1314. IP_STR
  1315. "Establish static routes\n"
  1316. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1317. "Emit an ICMP unreachable when matched\n"
  1318. "Silently discard pkts when matched\n"
  1319. "Tag of this route\n"
  1320. "Tag value\n"
  1321. "Distance value for this route\n")
  1322. {
  1323. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1324. argv[1], argv[2] , argv[3], NULL);
  1325. }
  1326. DEFUN (no_ip_route_flags_tag_distance2_vrf,
  1327. no_ip_route_flags_tag_distance2_vrf_cmd,
  1328. "no ip route A.B.C.D/M (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1329. NO_STR
  1330. IP_STR
  1331. "Establish static routes\n"
  1332. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1333. "Emit an ICMP unreachable when matched\n"
  1334. "Silently discard pkts when matched\n"
  1335. "Tag of this route\n"
  1336. "Tag value\n"
  1337. "Distance value for this route\n"
  1338. VRF_CMD_HELP_STR)
  1339. {
  1340. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1341. argv[1], argv[2] , argv[3], argv[4]);
  1342. }
  1343. DEFUN (no_ip_route_mask_distance,
  1344. no_ip_route_mask_distance_cmd,
  1345. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
  1346. NO_STR
  1347. IP_STR
  1348. "Establish static routes\n"
  1349. "IP destination prefix\n"
  1350. "IP destination prefix mask\n"
  1351. "IP gateway address\n"
  1352. "IP gateway interface name\n"
  1353. "Null interface\n"
  1354. "Distance value for this route\n")
  1355. {
  1356. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1357. argv[2], NULL, NULL, argv[3], NULL);
  1358. }
  1359. DEFUN (no_ip_route_mask_tag_distance,
  1360. no_ip_route_mask_tag_distance_cmd,
  1361. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>",
  1362. NO_STR
  1363. IP_STR
  1364. "Establish static routes\n"
  1365. "IP destination prefix\n"
  1366. "IP destination prefix mask\n"
  1367. "IP gateway address\n"
  1368. "IP gateway interface name\n"
  1369. "Null interface\n"
  1370. "Tag of this route\n"
  1371. "Tag value\n"
  1372. "Distance value for this route\n")
  1373. {
  1374. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1375. argv[2], NULL, argv[3], argv[4], NULL);
  1376. }
  1377. DEFUN (no_ip_route_mask_tag_distance_vrf,
  1378. no_ip_route_mask_tag_distance_vrf_cmd,
  1379. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1380. NO_STR
  1381. IP_STR
  1382. "Establish static routes\n"
  1383. "IP destination prefix\n"
  1384. "IP destination prefix mask\n"
  1385. "IP gateway address\n"
  1386. "IP gateway interface name\n"
  1387. "Null interface\n"
  1388. "Tag of this route\n"
  1389. "Tag value\n"
  1390. "Distance value for this route\n"
  1391. VRF_CMD_HELP_STR)
  1392. {
  1393. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1394. argv[2], NULL, argv[3], argv[4], argv[5]);
  1395. }
  1396. DEFUN (no_ip_route_mask_flags_distance,
  1397. no_ip_route_mask_flags_distance_cmd,
  1398. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255>",
  1399. NO_STR
  1400. IP_STR
  1401. "Establish static routes\n"
  1402. "IP destination prefix\n"
  1403. "IP destination prefix mask\n"
  1404. "IP gateway address\n"
  1405. "IP gateway interface name\n"
  1406. "Emit an ICMP unreachable when matched\n"
  1407. "Silently discard pkts when matched\n"
  1408. "Distance value for this route\n")
  1409. {
  1410. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1411. argv[2], argv[3], NULL, argv[4], NULL);
  1412. }
  1413. DEFUN (no_ip_route_mask_flags_tag_distance,
  1414. no_ip_route_mask_flags_tag_distance_cmd,
  1415. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  1416. NO_STR
  1417. IP_STR
  1418. "Establish static routes\n"
  1419. "IP destination prefix\n"
  1420. "IP destination prefix mask\n"
  1421. "IP gateway address\n"
  1422. "IP gateway interface name\n"
  1423. "Emit an ICMP unreachable when matched\n"
  1424. "Silently discard pkts when matched\n"
  1425. "Tag of this route\n"
  1426. "Tag value\n"
  1427. "Distance value for this route\n")
  1428. {
  1429. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3],
  1430. argv[4], argv[5], NULL);
  1431. }
  1432. DEFUN (no_ip_route_mask_flags_tag_distance_vrf,
  1433. no_ip_route_mask_flags_tag_distance_vrf_cmd,
  1434. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1435. NO_STR
  1436. IP_STR
  1437. "Establish static routes\n"
  1438. "IP destination prefix\n"
  1439. "IP destination prefix mask\n"
  1440. "IP gateway address\n"
  1441. "IP gateway interface name\n"
  1442. "Emit an ICMP unreachable when matched\n"
  1443. "Silently discard pkts when matched\n"
  1444. "Tag of this route\n"
  1445. "Tag value\n"
  1446. "Distance value for this route\n"
  1447. VRF_CMD_HELP_STR)
  1448. {
  1449. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2], argv[3],
  1450. argv[4], argv[5], argv[6]);
  1451. }
  1452. DEFUN (no_ip_route_mask_flags_distance2,
  1453. no_ip_route_mask_flags_distance2_cmd,
  1454. "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
  1455. NO_STR
  1456. IP_STR
  1457. "Establish static routes\n"
  1458. "IP destination prefix\n"
  1459. "IP destination prefix mask\n"
  1460. "Emit an ICMP unreachable when matched\n"
  1461. "Silently discard pkts when matched\n"
  1462. "Distance value for this route\n")
  1463. {
  1464. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1465. NULL, argv[2], NULL, argv[3], NULL);
  1466. }
  1467. DEFUN (ip_route_vrf,
  1468. ip_route_vrf_cmd,
  1469. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
  1470. IP_STR
  1471. "Establish static routes\n"
  1472. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1473. "IP gateway address\n"
  1474. "IP gateway interface name\n"
  1475. "Null interface\n"
  1476. VRF_CMD_HELP_STR)
  1477. {
  1478. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1479. argv[1], NULL, NULL, NULL, argv[2]);
  1480. }
  1481. DEFUN (ip_route_flags_vrf,
  1482. ip_route_flags_vrf_cmd,
  1483. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  1484. IP_STR
  1485. "Establish static routes\n"
  1486. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1487. "IP gateway address\n"
  1488. "IP gateway interface name\n"
  1489. "Emit an ICMP unreachable when matched\n"
  1490. "Silently discard pkts when matched\n"
  1491. VRF_CMD_HELP_STR)
  1492. {
  1493. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1494. argv[1], argv[2], NULL, NULL, argv[3]);
  1495. }
  1496. DEFUN (ip_route_flags2_vrf,
  1497. ip_route_flags2_vrf_cmd,
  1498. "ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
  1499. IP_STR
  1500. "Establish static routes\n"
  1501. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1502. "Emit an ICMP unreachable when matched\n"
  1503. "Silently discard pkts when matched\n"
  1504. VRF_CMD_HELP_STR)
  1505. {
  1506. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1507. NULL, argv[1], NULL, NULL, argv[2]);
  1508. }
  1509. /* Mask as A.B.C.D format. */
  1510. DEFUN (ip_route_mask_vrf,
  1511. ip_route_mask_vrf_cmd,
  1512. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
  1513. IP_STR
  1514. "Establish static routes\n"
  1515. "IP destination prefix\n"
  1516. "IP destination prefix mask\n"
  1517. "IP gateway address\n"
  1518. "IP gateway interface name\n"
  1519. "Null interface\n"
  1520. VRF_CMD_HELP_STR)
  1521. {
  1522. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1523. argv[2], NULL, NULL, NULL, argv[3]);
  1524. }
  1525. DEFUN (ip_route_mask_flags_vrf,
  1526. ip_route_mask_flags_vrf_cmd,
  1527. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  1528. IP_STR
  1529. "Establish static routes\n"
  1530. "IP destination prefix\n"
  1531. "IP destination prefix mask\n"
  1532. "IP gateway address\n"
  1533. "IP gateway interface name\n"
  1534. "Emit an ICMP unreachable when matched\n"
  1535. "Silently discard pkts when matched\n"
  1536. VRF_CMD_HELP_STR)
  1537. {
  1538. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1539. argv[2], argv[3], NULL, NULL, argv[4]);
  1540. }
  1541. DEFUN (ip_route_mask_flags2_vrf,
  1542. ip_route_mask_flags2_vrf_cmd,
  1543. "ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
  1544. IP_STR
  1545. "Establish static routes\n"
  1546. "IP destination prefix\n"
  1547. "IP destination prefix mask\n"
  1548. "Emit an ICMP unreachable when matched\n"
  1549. "Silently discard pkts when matched\n"
  1550. VRF_CMD_HELP_STR)
  1551. {
  1552. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1553. NULL, argv[2], NULL, NULL, argv[3]);
  1554. }
  1555. /* Distance option value. */
  1556. DEFUN (ip_route_distance_vrf,
  1557. ip_route_distance_vrf_cmd,
  1558. "ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
  1559. IP_STR
  1560. "Establish static routes\n"
  1561. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1562. "IP gateway address\n"
  1563. "IP gateway interface name\n"
  1564. "Null interface\n"
  1565. "Distance value for this route\n"
  1566. VRF_CMD_HELP_STR)
  1567. {
  1568. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1569. argv[1], NULL, NULL, argv[2], argv[3]);
  1570. }
  1571. DEFUN (ip_route_flags_distance_vrf,
  1572. ip_route_flags_distance_vrf_cmd,
  1573. "ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  1574. IP_STR
  1575. "Establish static routes\n"
  1576. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1577. "IP gateway address\n"
  1578. "IP gateway interface name\n"
  1579. "Emit an ICMP unreachable when matched\n"
  1580. "Silently discard pkts when matched\n"
  1581. "Distance value for this route\n"
  1582. VRF_CMD_HELP_STR)
  1583. {
  1584. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1585. argv[1], argv[2], NULL, argv[3], argv[4]);
  1586. }
  1587. DEFUN (ip_route_flags_distance2_vrf,
  1588. ip_route_flags_distance2_vrf_cmd,
  1589. "ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
  1590. IP_STR
  1591. "Establish static routes\n"
  1592. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1593. "Emit an ICMP unreachable when matched\n"
  1594. "Silently discard pkts when matched\n"
  1595. "Distance value for this route\n"
  1596. VRF_CMD_HELP_STR)
  1597. {
  1598. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], NULL,
  1599. NULL, argv[1], NULL, argv[2], argv[3]);
  1600. }
  1601. DEFUN (ip_route_mask_distance_vrf,
  1602. ip_route_mask_distance_vrf_cmd,
  1603. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
  1604. IP_STR
  1605. "Establish static routes\n"
  1606. "IP destination prefix\n"
  1607. "IP destination prefix mask\n"
  1608. "IP gateway address\n"
  1609. "IP gateway interface name\n"
  1610. "Null interface\n"
  1611. "Distance value for this route\n"
  1612. VRF_CMD_HELP_STR)
  1613. {
  1614. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1615. argv[2], NULL, NULL, argv[3], argv[4]);
  1616. }
  1617. DEFUN (ip_route_mask_flags_distance_vrf,
  1618. ip_route_mask_flags_distance_vrf_cmd,
  1619. "ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  1620. IP_STR
  1621. "Establish static routes\n"
  1622. "IP destination prefix\n"
  1623. "IP destination prefix mask\n"
  1624. "IP gateway address\n"
  1625. "IP gateway interface name\n"
  1626. "Emit an ICMP unreachable when matched\n"
  1627. "Silently discard pkts when matched\n"
  1628. "Distance value for this route\n"
  1629. VRF_CMD_HELP_STR)
  1630. {
  1631. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1632. argv[2], argv[3], NULL, argv[4], argv[5]);
  1633. }
  1634. DEFUN (ip_route_mask_flags_distance2_vrf,
  1635. ip_route_mask_flags_distance2_vrf_cmd,
  1636. "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
  1637. IP_STR
  1638. "Establish static routes\n"
  1639. "IP destination prefix\n"
  1640. "IP destination prefix mask\n"
  1641. "Emit an ICMP unreachable when matched\n"
  1642. "Silently discard pkts when matched\n"
  1643. "Distance value for this route\n"
  1644. VRF_CMD_HELP_STR)
  1645. {
  1646. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 1, argv[0], argv[1],
  1647. NULL, argv[2], NULL, argv[3], argv[4]);
  1648. }
  1649. DEFUN (no_ip_route_vrf,
  1650. no_ip_route_vrf_cmd,
  1651. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
  1652. NO_STR
  1653. IP_STR
  1654. "Establish static routes\n"
  1655. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1656. "IP gateway address\n"
  1657. "IP gateway interface name\n"
  1658. "Null interface\n"
  1659. VRF_CMD_HELP_STR)
  1660. {
  1661. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0],
  1662. NULL, argv[1], NULL, NULL, NULL,
  1663. (argc > 3) ? argv[3] : argv[2]);
  1664. }
  1665. ALIAS (no_ip_route_vrf,
  1666. no_ip_route_flags_vrf_cmd,
  1667. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  1668. NO_STR
  1669. IP_STR
  1670. "Establish static routes\n"
  1671. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1672. "IP gateway address\n"
  1673. "IP gateway interface name\n"
  1674. "Emit an ICMP unreachable when matched\n"
  1675. "Silently discard pkts when matched\n"
  1676. VRF_CMD_HELP_STR)
  1677. DEFUN (no_ip_route_flags2_vrf,
  1678. no_ip_route_flags2_vrf_cmd,
  1679. "no ip route A.B.C.D/M (reject|blackhole) " VRF_CMD_STR,
  1680. NO_STR
  1681. IP_STR
  1682. "Establish static routes\n"
  1683. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1684. "Emit an ICMP unreachable when matched\n"
  1685. "Silently discard pkts when matched\n"
  1686. VRF_CMD_HELP_STR)
  1687. {
  1688. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0],
  1689. NULL, NULL, NULL, NULL, NULL, argv[2]);
  1690. }
  1691. DEFUN (no_ip_route_mask_vrf,
  1692. no_ip_route_mask_vrf_cmd,
  1693. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) " VRF_CMD_STR,
  1694. NO_STR
  1695. IP_STR
  1696. "Establish static routes\n"
  1697. "IP destination prefix\n"
  1698. "IP destination prefix mask\n"
  1699. "IP gateway address\n"
  1700. "IP gateway interface name\n"
  1701. "Null interface\n"
  1702. VRF_CMD_HELP_STR)
  1703. {
  1704. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1705. argv[2], NULL, NULL, NULL,
  1706. (argc > 4) ? argv[4] : argv[3]);
  1707. }
  1708. ALIAS (no_ip_route_mask_vrf,
  1709. no_ip_route_mask_flags_vrf_cmd,
  1710. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  1711. NO_STR
  1712. IP_STR
  1713. "Establish static routes\n"
  1714. "IP destination prefix\n"
  1715. "IP destination prefix mask\n"
  1716. "IP gateway address\n"
  1717. "IP gateway interface name\n"
  1718. "Emit an ICMP unreachable when matched\n"
  1719. "Silently discard pkts when matched\n"
  1720. VRF_CMD_HELP_STR)
  1721. DEFUN (no_ip_route_mask_flags2_vrf,
  1722. no_ip_route_mask_flags2_vrf_cmd,
  1723. "no ip route A.B.C.D A.B.C.D (reject|blackhole) " VRF_CMD_STR,
  1724. NO_STR
  1725. IP_STR
  1726. "Establish static routes\n"
  1727. "IP destination prefix\n"
  1728. "IP destination prefix mask\n"
  1729. "Emit an ICMP unreachable when matched\n"
  1730. "Silently discard pkts when matched\n"
  1731. VRF_CMD_HELP_STR)
  1732. {
  1733. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1734. NULL, NULL, NULL, NULL, argv[2]);
  1735. }
  1736. DEFUN (no_ip_route_distance_vrf,
  1737. no_ip_route_distance_vrf_cmd,
  1738. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
  1739. NO_STR
  1740. IP_STR
  1741. "Establish static routes\n"
  1742. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1743. "IP gateway address\n"
  1744. "IP gateway interface name\n"
  1745. "Null interface\n"
  1746. "Distance value for this route\n"
  1747. VRF_CMD_HELP_STR)
  1748. {
  1749. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL,
  1750. argv[1], NULL, NULL, argv[2], argv[3]);
  1751. }
  1752. DEFUN (no_ip_route_flags_distance_vrf,
  1753. no_ip_route_flags_distance_vrf_cmd,
  1754. "no ip route A.B.C.D/M (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  1755. NO_STR
  1756. IP_STR
  1757. "Establish static routes\n"
  1758. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1759. "IP gateway address\n"
  1760. "IP gateway interface name\n"
  1761. "Emit an ICMP unreachable when matched\n"
  1762. "Silently discard pkts when matched\n"
  1763. "Distance value for this route\n"
  1764. VRF_CMD_HELP_STR)
  1765. {
  1766. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, argv[1],
  1767. argv[2], NULL, argv[3], argv[4]);
  1768. }
  1769. DEFUN (no_ip_route_flags_distance2_vrf,
  1770. no_ip_route_flags_distance2_vrf_cmd,
  1771. "no ip route A.B.C.D/M (reject|blackhole) <1-255> " VRF_CMD_STR,
  1772. NO_STR
  1773. IP_STR
  1774. "Establish static routes\n"
  1775. "IP destination prefix (e.g. 10.0.0.0/8)\n"
  1776. "Emit an ICMP unreachable when matched\n"
  1777. "Silently discard pkts when matched\n"
  1778. "Distance value for this route\n"
  1779. VRF_CMD_HELP_STR)
  1780. {
  1781. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], NULL, NULL,
  1782. argv[1], NULL, argv[2], argv[3]);
  1783. }
  1784. DEFUN (no_ip_route_mask_distance_vrf,
  1785. no_ip_route_mask_distance_vrf_cmd,
  1786. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255> " VRF_CMD_STR,
  1787. NO_STR
  1788. IP_STR
  1789. "Establish static routes\n"
  1790. "IP destination prefix\n"
  1791. "IP destination prefix mask\n"
  1792. "IP gateway address\n"
  1793. "IP gateway interface name\n"
  1794. "Null interface\n"
  1795. "Distance value for this route\n"
  1796. VRF_CMD_HELP_STR)
  1797. {
  1798. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1],
  1799. argv[2], NULL, NULL, argv[3], argv[4]);
  1800. }
  1801. DEFUN (no_ip_route_mask_flags_distance_vrf,
  1802. no_ip_route_mask_flags_distance_vrf_cmd,
  1803. "no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  1804. NO_STR
  1805. IP_STR
  1806. "Establish static routes\n"
  1807. "IP destination prefix\n"
  1808. "IP destination prefix mask\n"
  1809. "IP gateway address\n"
  1810. "IP gateway interface name\n"
  1811. "Emit an ICMP unreachable when matched\n"
  1812. "Silently discard pkts when matched\n"
  1813. "Distance value for this route\n"
  1814. VRF_CMD_HELP_STR)
  1815. {
  1816. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], argv[2],
  1817. argv[3], NULL, argv[4], argv[5]);
  1818. }
  1819. DEFUN (no_ip_route_mask_flags_distance2_vrf,
  1820. no_ip_route_mask_flags_distance2_vrf_cmd,
  1821. "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255> " VRF_CMD_STR,
  1822. NO_STR
  1823. IP_STR
  1824. "Establish static routes\n"
  1825. "IP destination prefix\n"
  1826. "IP destination prefix mask\n"
  1827. "Emit an ICMP unreachable when matched\n"
  1828. "Silently discard pkts when matched\n"
  1829. "Distance value for this route\n"
  1830. VRF_CMD_HELP_STR)
  1831. {
  1832. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
  1833. argv[2], NULL, argv[3], argv[4]);
  1834. }
  1835. DEFUN (no_ip_route_mask_flags_tag_distance2,
  1836. no_ip_route_mask_flags_tag_distance2_cmd,
  1837. "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>",
  1838. NO_STR
  1839. IP_STR
  1840. "Establish static routes\n"
  1841. "IP destination prefix\n"
  1842. "IP destination prefix mask\n"
  1843. "Emit an ICMP unreachable when matched\n"
  1844. "Silently discard pkts when matched\n"
  1845. "Tag of this route\n"
  1846. "Tag value\n"
  1847. "Distance value for this route\n")
  1848. {
  1849. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
  1850. argv[2], argv[3], argv[4], NULL);
  1851. }
  1852. DEFUN (no_ip_route_mask_flags_tag_distance2_vrf,
  1853. no_ip_route_mask_flags_tag_distance2_vrf_cmd,
  1854. "no ip route A.B.C.D A.B.C.D (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  1855. NO_STR
  1856. IP_STR
  1857. "Establish static routes\n"
  1858. "IP destination prefix\n"
  1859. "IP destination prefix mask\n"
  1860. "Emit an ICMP unreachable when matched\n"
  1861. "Silently discard pkts when matched\n"
  1862. "Tag of this route\n"
  1863. "Tag value\n"
  1864. "Distance value for this route\n"
  1865. VRF_CMD_HELP_STR)
  1866. {
  1867. return zebra_static_ipv4_safi (vty, SAFI_UNICAST, 0, argv[0], argv[1], NULL,
  1868. argv[2], argv[3], argv[4], argv[5]);
  1869. }
  1870. char *proto_rm[AFI_MAX][ZEBRA_ROUTE_MAX+1]; /* "any" == ZEBRA_ROUTE_MAX */
  1871. DEFUN (ip_protocol,
  1872. ip_protocol_cmd,
  1873. "ip protocol PROTO route-map ROUTE-MAP",
  1874. NO_STR
  1875. "Apply route map to PROTO\n"
  1876. "Protocol name\n"
  1877. "Route map name\n")
  1878. {
  1879. int i;
  1880. if (strcasecmp(argv[0], "any") == 0)
  1881. i = ZEBRA_ROUTE_MAX;
  1882. else
  1883. i = proto_name2num(argv[0]);
  1884. if (i < 0)
  1885. {
  1886. vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
  1887. VTY_NEWLINE);
  1888. return CMD_WARNING;
  1889. }
  1890. if (proto_rm[AFI_IP][i])
  1891. XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
  1892. proto_rm[AFI_IP][i] = XSTRDUP (MTYPE_ROUTE_MAP_NAME, argv[1]);
  1893. return CMD_SUCCESS;
  1894. }
  1895. DEFUN (no_ip_protocol,
  1896. no_ip_protocol_cmd,
  1897. "no ip protocol PROTO",
  1898. NO_STR
  1899. "Remove route map from PROTO\n"
  1900. "Protocol name\n")
  1901. {
  1902. int i;
  1903. if (strcasecmp(argv[0], "any") == 0)
  1904. i = ZEBRA_ROUTE_MAX;
  1905. else
  1906. i = proto_name2num(argv[0]);
  1907. if (i < 0)
  1908. {
  1909. vty_out (vty, "invalid protocol name \"%s\"%s", argv[0] ? argv[0] : "",
  1910. VTY_NEWLINE);
  1911. return CMD_WARNING;
  1912. }
  1913. if (proto_rm[AFI_IP][i])
  1914. XFREE (MTYPE_ROUTE_MAP_NAME, proto_rm[AFI_IP][i]);
  1915. proto_rm[AFI_IP][i] = NULL;
  1916. return CMD_SUCCESS;
  1917. }
  1918. /* New RIB. Detailed information for IPv4 route. */
  1919. static void
  1920. vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
  1921. {
  1922. struct rib *rib;
  1923. struct nexthop *nexthop, *tnexthop;
  1924. int recursing;
  1925. char buf[PREFIX_STRLEN];
  1926. RNODE_FOREACH_RIB (rn, rib)
  1927. {
  1928. const char *mcast_info = "";
  1929. if (mcast)
  1930. {
  1931. rib_table_info_t *info = rn->table->info;
  1932. mcast_info = (info->safi == SAFI_MULTICAST)
  1933. ? " using Multicast RIB"
  1934. : " using Unicast RIB";
  1935. }
  1936. vty_out (vty, "Routing entry for %s%s%s",
  1937. prefix2str (&rn->p, buf, sizeof(buf)), mcast_info,
  1938. VTY_NEWLINE);
  1939. vty_out (vty, " Known via \"%s\"", zebra_route_string (rib->type));
  1940. vty_out (vty, ", distance %u, metric %u", rib->distance, rib->metric);
  1941. if (rib->mtu)
  1942. vty_out (vty, ", mtu %u", rib->mtu);
  1943. vty_out (vty, ", tag %d", rib->tag);
  1944. vty_out (vty, ", vrf %u", rib->vrf_id);
  1945. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
  1946. vty_out (vty, ", best");
  1947. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_FIB_OVERRIDE))
  1948. vty_out (vty, ", fib-override");
  1949. if (CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
  1950. vty_out (vty, ", fib");
  1951. if (rib->refcnt)
  1952. vty_out (vty, ", refcnt %ld", rib->refcnt);
  1953. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
  1954. vty_out (vty, ", blackhole");
  1955. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
  1956. vty_out (vty, ", reject");
  1957. vty_out (vty, "%s", VTY_NEWLINE);
  1958. #define ONE_DAY_SECOND 60*60*24
  1959. #define ONE_WEEK_SECOND 60*60*24*7
  1960. if (rib->type == ZEBRA_ROUTE_RIP
  1961. || rib->type == ZEBRA_ROUTE_RIPNG
  1962. || rib->type == ZEBRA_ROUTE_OSPF
  1963. || rib->type == ZEBRA_ROUTE_OSPF6
  1964. || rib->type == ZEBRA_ROUTE_BABEL
  1965. || rib->type == ZEBRA_ROUTE_ISIS
  1966. || rib->type == ZEBRA_ROUTE_NHRP
  1967. || rib->type == ZEBRA_ROUTE_BGP)
  1968. {
  1969. time_t uptime;
  1970. struct tm *tm;
  1971. uptime = time (NULL);
  1972. uptime -= rib->uptime;
  1973. tm = gmtime (&uptime);
  1974. vty_out (vty, " Last update ");
  1975. if (uptime < ONE_DAY_SECOND)
  1976. vty_out (vty, "%02d:%02d:%02d",
  1977. tm->tm_hour, tm->tm_min, tm->tm_sec);
  1978. else if (uptime < ONE_WEEK_SECOND)
  1979. vty_out (vty, "%dd%02dh%02dm",
  1980. tm->tm_yday, tm->tm_hour, tm->tm_min);
  1981. else
  1982. vty_out (vty, "%02dw%dd%02dh",
  1983. tm->tm_yday/7,
  1984. tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
  1985. vty_out (vty, " ago%s", VTY_NEWLINE);
  1986. }
  1987. for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
  1988. {
  1989. vty_out (vty, " %c%c%s",
  1990. CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? '>' : ' ',
  1991. CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) ? '*' : ' ',
  1992. recursing ? " " : "");
  1993. switch (nexthop->type)
  1994. {
  1995. case NEXTHOP_TYPE_IPV4:
  1996. case NEXTHOP_TYPE_IPV4_IFINDEX:
  1997. vty_out (vty, " %s", inet_ntoa (nexthop->gate.ipv4));
  1998. if (nexthop->ifindex)
  1999. vty_out (vty, ", via %s",
  2000. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2001. break;
  2002. case NEXTHOP_TYPE_IPV6:
  2003. case NEXTHOP_TYPE_IPV6_IFINDEX:
  2004. case NEXTHOP_TYPE_IPV6_IFNAME:
  2005. vty_out (vty, " %s",
  2006. inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, sizeof(buf)));
  2007. if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
  2008. vty_out (vty, ", %s", nexthop->ifname);
  2009. else if (nexthop->ifindex)
  2010. vty_out (vty, ", via %s",
  2011. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2012. break;
  2013. case NEXTHOP_TYPE_IFINDEX:
  2014. vty_out (vty, " directly connected, %s",
  2015. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2016. break;
  2017. case NEXTHOP_TYPE_IFNAME:
  2018. vty_out (vty, " directly connected, %s", nexthop->ifname);
  2019. break;
  2020. case NEXTHOP_TYPE_BLACKHOLE:
  2021. vty_out (vty, " directly connected, Null0");
  2022. break;
  2023. default:
  2024. break;
  2025. }
  2026. if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
  2027. vty_out (vty, " inactive");
  2028. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
  2029. vty_out (vty, " onlink");
  2030. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
  2031. vty_out (vty, " (recursive)");
  2032. switch (nexthop->type)
  2033. {
  2034. case NEXTHOP_TYPE_IPV4:
  2035. case NEXTHOP_TYPE_IPV4_IFINDEX:
  2036. case NEXTHOP_TYPE_IPV4_IFNAME:
  2037. if (nexthop->src.ipv4.s_addr)
  2038. {
  2039. if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
  2040. vty_out (vty, ", src %s", buf);
  2041. }
  2042. break;
  2043. #ifdef HAVE_IPV6
  2044. case NEXTHOP_TYPE_IPV6:
  2045. case NEXTHOP_TYPE_IPV6_IFINDEX:
  2046. case NEXTHOP_TYPE_IPV6_IFNAME:
  2047. if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
  2048. {
  2049. if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
  2050. vty_out (vty, ", src %s", buf);
  2051. }
  2052. break;
  2053. #endif /* HAVE_IPV6 */
  2054. default:
  2055. break;
  2056. }
  2057. vty_out (vty, "%s", VTY_NEWLINE);
  2058. }
  2059. vty_out (vty, "%s", VTY_NEWLINE);
  2060. }
  2061. }
  2062. static void
  2063. vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
  2064. {
  2065. struct nexthop *nexthop, *tnexthop;
  2066. int recursing;
  2067. int len = 0;
  2068. char buf[BUFSIZ];
  2069. /* Nexthop information. */
  2070. for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
  2071. {
  2072. if (nexthop == rib->nexthop)
  2073. {
  2074. /* Prefix information. */
  2075. len = vty_out (vty, "%c%c%c %s",
  2076. zebra_route_char (rib->type),
  2077. CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED)
  2078. ? '>' : ' ',
  2079. CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
  2080. ? '*' : ' ',
  2081. prefix2str (&rn->p, buf, sizeof buf));
  2082. /* Distance and metric display. */
  2083. if (rib->type != ZEBRA_ROUTE_CONNECT
  2084. && rib->type != ZEBRA_ROUTE_KERNEL)
  2085. len += vty_out (vty, " [%d/%d]", rib->distance,
  2086. rib->metric);
  2087. if (rib->vrf_id != VRF_DEFAULT)
  2088. len += vty_out (vty, " [vrf %u]", rib->vrf_id);
  2089. }
  2090. else
  2091. vty_out (vty, " %c%*c",
  2092. CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
  2093. ? '*' : ' ',
  2094. len - 3 + (2 * recursing), ' ');
  2095. switch (nexthop->type)
  2096. {
  2097. case NEXTHOP_TYPE_IPV4:
  2098. case NEXTHOP_TYPE_IPV4_IFINDEX:
  2099. vty_out (vty, " via %s", inet_ntoa (nexthop->gate.ipv4));
  2100. if (nexthop->ifindex)
  2101. vty_out (vty, ", %s",
  2102. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2103. break;
  2104. case NEXTHOP_TYPE_IPV6:
  2105. case NEXTHOP_TYPE_IPV6_IFINDEX:
  2106. case NEXTHOP_TYPE_IPV6_IFNAME:
  2107. vty_out (vty, " via %s",
  2108. inet_ntop (AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
  2109. if (nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
  2110. vty_out (vty, ", %s", nexthop->ifname);
  2111. else if (nexthop->ifindex)
  2112. vty_out (vty, ", %s",
  2113. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2114. break;
  2115. case NEXTHOP_TYPE_IFINDEX:
  2116. vty_out (vty, " is directly connected, %s",
  2117. ifindex2ifname_vrf (nexthop->ifindex, rib->vrf_id));
  2118. break;
  2119. case NEXTHOP_TYPE_IFNAME:
  2120. vty_out (vty, " is directly connected, %s", nexthop->ifname);
  2121. break;
  2122. case NEXTHOP_TYPE_BLACKHOLE:
  2123. vty_out (vty, " is directly connected, Null0");
  2124. break;
  2125. default:
  2126. break;
  2127. }
  2128. if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
  2129. vty_out (vty, " inactive");
  2130. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK))
  2131. vty_out (vty, " onlink");
  2132. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
  2133. vty_out (vty, " (recursive)");
  2134. switch (nexthop->type)
  2135. {
  2136. case NEXTHOP_TYPE_IPV4:
  2137. case NEXTHOP_TYPE_IPV4_IFINDEX:
  2138. case NEXTHOP_TYPE_IPV4_IFNAME:
  2139. if (nexthop->src.ipv4.s_addr)
  2140. {
  2141. if (inet_ntop(AF_INET, &nexthop->src.ipv4, buf, sizeof buf))
  2142. vty_out (vty, ", src %s", buf);
  2143. }
  2144. break;
  2145. #ifdef HAVE_IPV6
  2146. case NEXTHOP_TYPE_IPV6:
  2147. case NEXTHOP_TYPE_IPV6_IFINDEX:
  2148. case NEXTHOP_TYPE_IPV6_IFNAME:
  2149. if (!IPV6_ADDR_SAME(&nexthop->src.ipv6, &in6addr_any))
  2150. {
  2151. if (inet_ntop(AF_INET6, &nexthop->src.ipv6, buf, sizeof buf))
  2152. vty_out (vty, ", src %s", buf);
  2153. }
  2154. break;
  2155. #endif /* HAVE_IPV6 */
  2156. default:
  2157. break;
  2158. }
  2159. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE))
  2160. vty_out (vty, ", bh");
  2161. if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_REJECT))
  2162. vty_out (vty, ", rej");
  2163. if (rib->type == ZEBRA_ROUTE_RIP
  2164. || rib->type == ZEBRA_ROUTE_RIPNG
  2165. || rib->type == ZEBRA_ROUTE_OSPF
  2166. || rib->type == ZEBRA_ROUTE_OSPF6
  2167. || rib->type == ZEBRA_ROUTE_BABEL
  2168. || rib->type == ZEBRA_ROUTE_ISIS
  2169. || rib->type == ZEBRA_ROUTE_NHRP
  2170. || rib->type == ZEBRA_ROUTE_BGP)
  2171. {
  2172. time_t uptime;
  2173. struct tm *tm;
  2174. uptime = time (NULL);
  2175. uptime -= rib->uptime;
  2176. tm = gmtime (&uptime);
  2177. #define ONE_DAY_SECOND 60*60*24
  2178. #define ONE_WEEK_SECOND 60*60*24*7
  2179. if (uptime < ONE_DAY_SECOND)
  2180. vty_out (vty, ", %02d:%02d:%02d",
  2181. tm->tm_hour, tm->tm_min, tm->tm_sec);
  2182. else if (uptime < ONE_WEEK_SECOND)
  2183. vty_out (vty, ", %dd%02dh%02dm",
  2184. tm->tm_yday, tm->tm_hour, tm->tm_min);
  2185. else
  2186. vty_out (vty, ", %02dw%dd%02dh",
  2187. tm->tm_yday/7,
  2188. tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
  2189. }
  2190. vty_out (vty, "%s", VTY_NEWLINE);
  2191. }
  2192. }
  2193. DEFUN (show_ip_route,
  2194. show_ip_route_cmd,
  2195. "show ip route",
  2196. SHOW_STR
  2197. IP_STR
  2198. "IP routing table\n")
  2199. {
  2200. vrf_id_t vrf_id = VRF_DEFAULT;
  2201. if (argc > 0)
  2202. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  2203. return do_show_ip_route(vty, SAFI_UNICAST, vrf_id);
  2204. }
  2205. static int do_show_ip_route(struct vty *vty, safi_t safi, vrf_id_t vrf_id)
  2206. {
  2207. struct route_table *table;
  2208. struct route_node *rn;
  2209. struct rib *rib;
  2210. int first = 1;
  2211. table = zebra_vrf_table (AFI_IP, safi, vrf_id);
  2212. if (! table)
  2213. return CMD_SUCCESS;
  2214. /* Show all IPv4 routes. */
  2215. for (rn = route_top (table); rn; rn = route_next (rn))
  2216. RNODE_FOREACH_RIB (rn, rib)
  2217. {
  2218. if (first)
  2219. {
  2220. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2221. first = 0;
  2222. }
  2223. vty_show_ip_route (vty, rn, rib);
  2224. }
  2225. return CMD_SUCCESS;
  2226. }
  2227. ALIAS (show_ip_route,
  2228. show_ip_route_vrf_cmd,
  2229. "show ip route " VRF_CMD_STR,
  2230. SHOW_STR
  2231. IP_STR
  2232. "IP routing table\n"
  2233. VRF_CMD_HELP_STR)
  2234. DEFUN (show_ip_nht,
  2235. show_ip_nht_cmd,
  2236. "show ip nht",
  2237. SHOW_STR
  2238. IP_STR
  2239. "IP nexthop tracking table\n")
  2240. {
  2241. zebra_print_rnh_table(0, AF_INET, vty);
  2242. return CMD_SUCCESS;
  2243. }
  2244. DEFUN (show_ipv6_nht,
  2245. show_ipv6_nht_cmd,
  2246. "show ipv6 nht",
  2247. SHOW_STR
  2248. IP_STR
  2249. "IPv6 nexthop tracking table\n")
  2250. {
  2251. zebra_print_rnh_table(0, AF_INET6, vty);
  2252. return CMD_SUCCESS;
  2253. }
  2254. DEFUN (show_ip_route_tag,
  2255. show_ip_route_tag_cmd,
  2256. "show ip route tag <1-4294967295>",
  2257. SHOW_STR
  2258. IP_STR
  2259. "IP routing table\n"
  2260. "Show only routes with tag\n"
  2261. "Tag value\n")
  2262. {
  2263. struct route_table *table;
  2264. struct route_node *rn;
  2265. struct rib *rib;
  2266. int first = 1;
  2267. route_tag_t tag = 0;
  2268. vrf_id_t vrf_id = VRF_DEFAULT;
  2269. if (argv[0])
  2270. tag = atoi(argv[0]);
  2271. if (argc == 2)
  2272. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  2273. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2274. if (! table)
  2275. return CMD_SUCCESS;
  2276. /* Show all IPv4 routes with matching tag value. */
  2277. for (rn = route_top (table); rn; rn = route_next (rn))
  2278. RNODE_FOREACH_RIB (rn, rib)
  2279. {
  2280. if (rib->tag != tag)
  2281. continue;
  2282. if (first)
  2283. {
  2284. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2285. first = 0;
  2286. }
  2287. vty_show_ip_route (vty, rn, rib);
  2288. }
  2289. return CMD_SUCCESS;
  2290. }
  2291. ALIAS (show_ip_route_tag,
  2292. show_ip_route_tag_vrf_cmd,
  2293. "show ip route tag <1-4294967295>" VRF_CMD_STR,
  2294. SHOW_STR
  2295. IP_STR
  2296. "IP routing table\n"
  2297. "Show only routes with tag\n"
  2298. "Tag value\n"
  2299. VRF_CMD_HELP_STR)
  2300. DEFUN (show_ip_route_prefix_longer,
  2301. show_ip_route_prefix_longer_cmd,
  2302. "show ip route A.B.C.D/M longer-prefixes",
  2303. SHOW_STR
  2304. IP_STR
  2305. "IP routing table\n"
  2306. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
  2307. "Show route matching the specified Network/Mask pair only\n")
  2308. {
  2309. struct route_table *table;
  2310. struct route_node *rn;
  2311. struct rib *rib;
  2312. struct prefix p;
  2313. int ret;
  2314. int first = 1;
  2315. vrf_id_t vrf_id = VRF_DEFAULT;
  2316. ret = str2prefix (argv[0], &p);
  2317. if (! ret)
  2318. {
  2319. vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
  2320. return CMD_WARNING;
  2321. }
  2322. if (argc > 1)
  2323. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  2324. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2325. if (! table)
  2326. return CMD_SUCCESS;
  2327. /* Show matched type IPv4 routes. */
  2328. for (rn = route_top (table); rn; rn = route_next (rn))
  2329. RNODE_FOREACH_RIB (rn, rib)
  2330. if (prefix_match (&p, &rn->p))
  2331. {
  2332. if (first)
  2333. {
  2334. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2335. first = 0;
  2336. }
  2337. vty_show_ip_route (vty, rn, rib);
  2338. }
  2339. return CMD_SUCCESS;
  2340. }
  2341. ALIAS (show_ip_route_prefix_longer,
  2342. show_ip_route_prefix_longer_vrf_cmd,
  2343. "show ip route A.B.C.D/M longer-prefixes " VRF_CMD_STR,
  2344. SHOW_STR
  2345. IP_STR
  2346. "IP routing table\n"
  2347. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
  2348. "Show route matching the specified Network/Mask pair only\n"
  2349. VRF_CMD_HELP_STR)
  2350. DEFUN (show_ip_route_supernets,
  2351. show_ip_route_supernets_cmd,
  2352. "show ip route supernets-only",
  2353. SHOW_STR
  2354. IP_STR
  2355. "IP routing table\n"
  2356. "Show supernet entries only\n")
  2357. {
  2358. struct route_table *table;
  2359. struct route_node *rn;
  2360. struct rib *rib;
  2361. u_int32_t addr;
  2362. int first = 1;
  2363. vrf_id_t vrf_id = VRF_DEFAULT;
  2364. if (argc > 0)
  2365. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  2366. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2367. if (! table)
  2368. return CMD_SUCCESS;
  2369. /* Show matched type IPv4 routes. */
  2370. for (rn = route_top (table); rn; rn = route_next (rn))
  2371. RNODE_FOREACH_RIB (rn, rib)
  2372. {
  2373. addr = ntohl (rn->p.u.prefix4.s_addr);
  2374. if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
  2375. || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
  2376. || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
  2377. {
  2378. if (first)
  2379. {
  2380. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2381. first = 0;
  2382. }
  2383. vty_show_ip_route (vty, rn, rib);
  2384. }
  2385. }
  2386. return CMD_SUCCESS;
  2387. }
  2388. ALIAS (show_ip_route_supernets,
  2389. show_ip_route_supernets_vrf_cmd,
  2390. "show ip route supernets-only " VRF_CMD_STR,
  2391. SHOW_STR
  2392. IP_STR
  2393. "IP routing table\n"
  2394. "Show supernet entries only\n"
  2395. VRF_CMD_HELP_STR)
  2396. DEFUN (show_ip_route_protocol,
  2397. show_ip_route_protocol_cmd,
  2398. "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
  2399. SHOW_STR
  2400. IP_STR
  2401. "IP routing table\n"
  2402. QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
  2403. {
  2404. int type;
  2405. struct route_table *table;
  2406. struct route_node *rn;
  2407. struct rib *rib;
  2408. int first = 1;
  2409. vrf_id_t vrf_id = VRF_DEFAULT;
  2410. type = proto_redistnum (AFI_IP, argv[0]);
  2411. if (type < 0)
  2412. {
  2413. vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
  2414. return CMD_WARNING;
  2415. }
  2416. if (argc > 1)
  2417. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  2418. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2419. if (! table)
  2420. return CMD_SUCCESS;
  2421. /* Show matched type IPv4 routes. */
  2422. for (rn = route_top (table); rn; rn = route_next (rn))
  2423. RNODE_FOREACH_RIB (rn, rib)
  2424. if (rib->type == type)
  2425. {
  2426. if (first)
  2427. {
  2428. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2429. first = 0;
  2430. }
  2431. vty_show_ip_route (vty, rn, rib);
  2432. }
  2433. return CMD_SUCCESS;
  2434. }
  2435. ALIAS (show_ip_route_protocol,
  2436. show_ip_route_protocol_vrf_cmd,
  2437. "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_CMD_STR,
  2438. SHOW_STR
  2439. IP_STR
  2440. "IP routing table\n"
  2441. QUAGGA_IP_REDIST_HELP_STR_ZEBRA
  2442. VRF_CMD_HELP_STR)
  2443. DEFUN (show_ip_route_addr,
  2444. show_ip_route_addr_cmd,
  2445. "show ip route A.B.C.D",
  2446. SHOW_STR
  2447. IP_STR
  2448. "IP routing table\n"
  2449. "Network in the IP routing table to display\n")
  2450. {
  2451. int ret;
  2452. struct prefix_ipv4 p;
  2453. struct route_table *table;
  2454. struct route_node *rn;
  2455. vrf_id_t vrf_id = VRF_DEFAULT;
  2456. ret = str2prefix_ipv4 (argv[0], &p);
  2457. if (ret <= 0)
  2458. {
  2459. vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
  2460. return CMD_WARNING;
  2461. }
  2462. if (argc > 1)
  2463. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  2464. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2465. if (! table)
  2466. return CMD_SUCCESS;
  2467. rn = route_node_match (table, (struct prefix *) &p);
  2468. if (! rn)
  2469. {
  2470. vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
  2471. return CMD_WARNING;
  2472. }
  2473. vty_show_ip_route_detail (vty, rn, 0);
  2474. route_unlock_node (rn);
  2475. return CMD_SUCCESS;
  2476. }
  2477. ALIAS (show_ip_route_addr,
  2478. show_ip_route_addr_vrf_cmd,
  2479. "show ip route A.B.C.D " VRF_CMD_STR,
  2480. SHOW_STR
  2481. IP_STR
  2482. "IP routing table\n"
  2483. "Network in the IP routing table to display\n"
  2484. VRF_CMD_HELP_STR)
  2485. DEFUN (show_ip_route_prefix,
  2486. show_ip_route_prefix_cmd,
  2487. "show ip route A.B.C.D/M",
  2488. SHOW_STR
  2489. IP_STR
  2490. "IP routing table\n"
  2491. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
  2492. {
  2493. int ret;
  2494. struct prefix_ipv4 p;
  2495. struct route_table *table;
  2496. struct route_node *rn;
  2497. vrf_id_t vrf_id = VRF_DEFAULT;
  2498. ret = str2prefix_ipv4 (argv[0], &p);
  2499. if (ret <= 0)
  2500. {
  2501. vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
  2502. return CMD_WARNING;
  2503. }
  2504. if (argc > 1)
  2505. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  2506. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2507. if (! table)
  2508. return CMD_SUCCESS;
  2509. rn = route_node_match (table, (struct prefix *) &p);
  2510. if (! rn || rn->p.prefixlen != p.prefixlen)
  2511. {
  2512. vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
  2513. if (rn)
  2514. route_unlock_node (rn);
  2515. return CMD_WARNING;
  2516. }
  2517. vty_show_ip_route_detail (vty, rn, 0);
  2518. route_unlock_node (rn);
  2519. return CMD_SUCCESS;
  2520. }
  2521. ALIAS (show_ip_route_prefix,
  2522. show_ip_route_prefix_vrf_cmd,
  2523. "show ip route A.B.C.D/M " VRF_CMD_STR,
  2524. SHOW_STR
  2525. IP_STR
  2526. "IP routing table\n"
  2527. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
  2528. VRF_CMD_HELP_STR)
  2529. static void
  2530. vty_show_ip_route_summary (struct vty *vty, struct route_table *table)
  2531. {
  2532. struct route_node *rn;
  2533. struct rib *rib;
  2534. struct nexthop *nexthop;
  2535. #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
  2536. #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
  2537. u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
  2538. u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
  2539. u_int32_t i;
  2540. memset (&rib_cnt, 0, sizeof(rib_cnt));
  2541. memset (&fib_cnt, 0, sizeof(fib_cnt));
  2542. for (rn = route_top (table); rn; rn = route_next (rn))
  2543. RNODE_FOREACH_RIB (rn, rib)
  2544. for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
  2545. {
  2546. rib_cnt[ZEBRA_ROUTE_TOTAL]++;
  2547. rib_cnt[rib->type]++;
  2548. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
  2549. || nexthop_has_fib_child(nexthop))
  2550. {
  2551. fib_cnt[ZEBRA_ROUTE_TOTAL]++;
  2552. fib_cnt[rib->type]++;
  2553. }
  2554. if (rib->type == ZEBRA_ROUTE_BGP &&
  2555. CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
  2556. {
  2557. rib_cnt[ZEBRA_ROUTE_IBGP]++;
  2558. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB)
  2559. || nexthop_has_fib_child(nexthop))
  2560. fib_cnt[ZEBRA_ROUTE_IBGP]++;
  2561. }
  2562. }
  2563. vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
  2564. "Route Source", "Routes", "FIB",
  2565. ((rib_table_info_t *)table->info)->zvrf->vrf_id,
  2566. VTY_NEWLINE);
  2567. for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
  2568. {
  2569. if (rib_cnt[i] > 0)
  2570. {
  2571. if (i == ZEBRA_ROUTE_BGP)
  2572. {
  2573. vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
  2574. rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
  2575. fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
  2576. VTY_NEWLINE);
  2577. vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
  2578. rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
  2579. VTY_NEWLINE);
  2580. }
  2581. else
  2582. vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
  2583. rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
  2584. }
  2585. }
  2586. vty_out (vty, "------%s", VTY_NEWLINE);
  2587. vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
  2588. fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
  2589. vty_out (vty, "%s", VTY_NEWLINE);
  2590. }
  2591. /*
  2592. * Implementation of the ip route summary prefix command.
  2593. *
  2594. * This command prints the primary prefixes that have been installed by various
  2595. * protocols on the box.
  2596. *
  2597. */
  2598. static void
  2599. vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table)
  2600. {
  2601. struct route_node *rn;
  2602. struct rib *rib;
  2603. struct nexthop *nexthop;
  2604. #define ZEBRA_ROUTE_IBGP ZEBRA_ROUTE_MAX
  2605. #define ZEBRA_ROUTE_TOTAL (ZEBRA_ROUTE_IBGP + 1)
  2606. u_int32_t rib_cnt[ZEBRA_ROUTE_TOTAL + 1];
  2607. u_int32_t fib_cnt[ZEBRA_ROUTE_TOTAL + 1];
  2608. u_int32_t i;
  2609. int cnt;
  2610. memset (&rib_cnt, 0, sizeof(rib_cnt));
  2611. memset (&fib_cnt, 0, sizeof(fib_cnt));
  2612. for (rn = route_top (table); rn; rn = route_next (rn))
  2613. RNODE_FOREACH_RIB (rn, rib)
  2614. {
  2615. /*
  2616. * In case of ECMP, count only once.
  2617. */
  2618. cnt = 0;
  2619. for (nexthop = rib->nexthop; (!cnt && nexthop); nexthop = nexthop->next)
  2620. {
  2621. cnt++;
  2622. rib_cnt[ZEBRA_ROUTE_TOTAL]++;
  2623. rib_cnt[rib->type]++;
  2624. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
  2625. {
  2626. fib_cnt[ZEBRA_ROUTE_TOTAL]++;
  2627. fib_cnt[rib->type]++;
  2628. }
  2629. if (rib->type == ZEBRA_ROUTE_BGP &&
  2630. CHECK_FLAG (rib->flags, ZEBRA_FLAG_IBGP))
  2631. {
  2632. rib_cnt[ZEBRA_ROUTE_IBGP]++;
  2633. if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
  2634. fib_cnt[ZEBRA_ROUTE_IBGP]++;
  2635. }
  2636. }
  2637. }
  2638. vty_out (vty, "%-20s %-20s %s (vrf %u)%s",
  2639. "Route Source", "Prefix Routes", "FIB",
  2640. ((rib_table_info_t *)table->info)->zvrf->vrf_id,
  2641. VTY_NEWLINE);
  2642. for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
  2643. {
  2644. if (rib_cnt[i] > 0)
  2645. {
  2646. if (i == ZEBRA_ROUTE_BGP)
  2647. {
  2648. vty_out (vty, "%-20s %-20d %-20d %s", "ebgp",
  2649. rib_cnt[ZEBRA_ROUTE_BGP] - rib_cnt[ZEBRA_ROUTE_IBGP],
  2650. fib_cnt[ZEBRA_ROUTE_BGP] - fib_cnt[ZEBRA_ROUTE_IBGP],
  2651. VTY_NEWLINE);
  2652. vty_out (vty, "%-20s %-20d %-20d %s", "ibgp",
  2653. rib_cnt[ZEBRA_ROUTE_IBGP], fib_cnt[ZEBRA_ROUTE_IBGP],
  2654. VTY_NEWLINE);
  2655. }
  2656. else
  2657. vty_out (vty, "%-20s %-20d %-20d %s", zebra_route_string(i),
  2658. rib_cnt[i], fib_cnt[i], VTY_NEWLINE);
  2659. }
  2660. }
  2661. vty_out (vty, "------%s", VTY_NEWLINE);
  2662. vty_out (vty, "%-20s %-20d %-20d %s", "Totals", rib_cnt[ZEBRA_ROUTE_TOTAL],
  2663. fib_cnt[ZEBRA_ROUTE_TOTAL], VTY_NEWLINE);
  2664. vty_out (vty, "%s", VTY_NEWLINE);
  2665. }
  2666. /* Show route summary. */
  2667. DEFUN (show_ip_route_summary,
  2668. show_ip_route_summary_cmd,
  2669. "show ip route summary",
  2670. SHOW_STR
  2671. IP_STR
  2672. "IP routing table\n"
  2673. "Summary of all routes\n")
  2674. {
  2675. struct route_table *table;
  2676. vrf_id_t vrf_id = VRF_DEFAULT;
  2677. if (argc > 0)
  2678. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  2679. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2680. if (! table)
  2681. return CMD_SUCCESS;
  2682. vty_show_ip_route_summary (vty, table);
  2683. return CMD_SUCCESS;
  2684. }
  2685. ALIAS (show_ip_route_summary,
  2686. show_ip_route_summary_vrf_cmd,
  2687. "show ip route summary " VRF_CMD_STR,
  2688. SHOW_STR
  2689. IP_STR
  2690. "IP routing table\n"
  2691. "Summary of all routes\n"
  2692. VRF_CMD_HELP_STR)
  2693. /* Show route summary prefix. */
  2694. DEFUN (show_ip_route_summary_prefix,
  2695. show_ip_route_summary_prefix_cmd,
  2696. "show ip route summary prefix",
  2697. SHOW_STR
  2698. IP_STR
  2699. "IP routing table\n"
  2700. "Summary of all routes\n"
  2701. "Prefix routes\n")
  2702. {
  2703. struct route_table *table;
  2704. vrf_id_t vrf_id = VRF_DEFAULT;
  2705. if (argc > 0)
  2706. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  2707. table = zebra_vrf_table (AFI_IP, SAFI_UNICAST, vrf_id);
  2708. if (! table)
  2709. return CMD_SUCCESS;
  2710. vty_show_ip_route_summary_prefix (vty, table);
  2711. return CMD_SUCCESS;
  2712. }
  2713. ALIAS (show_ip_route_summary_prefix,
  2714. show_ip_route_summary_prefix_vrf_cmd,
  2715. "show ip route summary prefix " VRF_CMD_STR,
  2716. SHOW_STR
  2717. IP_STR
  2718. "IP routing table\n"
  2719. "Summary of all routes\n"
  2720. "Prefix routes\n"
  2721. VRF_CMD_HELP_STR)
  2722. DEFUN (show_ip_route_vrf_all,
  2723. show_ip_route_vrf_all_cmd,
  2724. "show ip route " VRF_ALL_CMD_STR,
  2725. SHOW_STR
  2726. IP_STR
  2727. "IP routing table\n"
  2728. VRF_ALL_CMD_HELP_STR)
  2729. {
  2730. struct route_table *table;
  2731. struct route_node *rn;
  2732. struct rib *rib;
  2733. struct zebra_vrf *zvrf;
  2734. vrf_iter_t iter;
  2735. int first = 1;
  2736. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2737. {
  2738. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2739. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2740. continue;
  2741. /* Show all IPv4 routes. */
  2742. for (rn = route_top (table); rn; rn = route_next (rn))
  2743. RNODE_FOREACH_RIB (rn, rib)
  2744. {
  2745. if (first)
  2746. {
  2747. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2748. first = 0;
  2749. }
  2750. vty_show_ip_route (vty, rn, rib);
  2751. }
  2752. }
  2753. return CMD_SUCCESS;
  2754. }
  2755. DEFUN (show_ip_route_prefix_longer_vrf_all,
  2756. show_ip_route_prefix_longer_vrf_all_cmd,
  2757. "show ip route A.B.C.D/M longer-prefixes " VRF_ALL_CMD_STR,
  2758. SHOW_STR
  2759. IP_STR
  2760. "IP routing table\n"
  2761. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
  2762. "Show route matching the specified Network/Mask pair only\n"
  2763. VRF_ALL_CMD_HELP_STR)
  2764. {
  2765. struct route_table *table;
  2766. struct route_node *rn;
  2767. struct rib *rib;
  2768. struct prefix p;
  2769. struct zebra_vrf *zvrf;
  2770. vrf_iter_t iter;
  2771. int ret;
  2772. int first = 1;
  2773. ret = str2prefix (argv[0], &p);
  2774. if (! ret)
  2775. {
  2776. vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
  2777. return CMD_WARNING;
  2778. }
  2779. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2780. {
  2781. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2782. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2783. continue;
  2784. /* Show matched type IPv4 routes. */
  2785. for (rn = route_top (table); rn; rn = route_next (rn))
  2786. RNODE_FOREACH_RIB (rn, rib)
  2787. if (prefix_match (&p, &rn->p))
  2788. {
  2789. if (first)
  2790. {
  2791. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2792. first = 0;
  2793. }
  2794. vty_show_ip_route (vty, rn, rib);
  2795. }
  2796. }
  2797. return CMD_SUCCESS;
  2798. }
  2799. DEFUN (show_ip_route_supernets_vrf_all,
  2800. show_ip_route_supernets_vrf_all_cmd,
  2801. "show ip route supernets-only " VRF_ALL_CMD_STR,
  2802. SHOW_STR
  2803. IP_STR
  2804. "IP routing table\n"
  2805. "Show supernet entries only\n"
  2806. VRF_ALL_CMD_HELP_STR)
  2807. {
  2808. struct route_table *table;
  2809. struct route_node *rn;
  2810. struct rib *rib;
  2811. struct zebra_vrf *zvrf;
  2812. vrf_iter_t iter;
  2813. u_int32_t addr;
  2814. int first = 1;
  2815. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2816. {
  2817. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2818. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2819. continue;
  2820. /* Show matched type IPv4 routes. */
  2821. for (rn = route_top (table); rn; rn = route_next (rn))
  2822. RNODE_FOREACH_RIB (rn, rib)
  2823. {
  2824. addr = ntohl (rn->p.u.prefix4.s_addr);
  2825. if ((IN_CLASSC (addr) && rn->p.prefixlen < 24)
  2826. || (IN_CLASSB (addr) && rn->p.prefixlen < 16)
  2827. || (IN_CLASSA (addr) && rn->p.prefixlen < 8))
  2828. {
  2829. if (first)
  2830. {
  2831. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2832. first = 0;
  2833. }
  2834. vty_show_ip_route (vty, rn, rib);
  2835. }
  2836. }
  2837. }
  2838. return CMD_SUCCESS;
  2839. }
  2840. DEFUN (show_ip_route_protocol_vrf_all,
  2841. show_ip_route_protocol_vrf_all_cmd,
  2842. "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
  2843. SHOW_STR
  2844. IP_STR
  2845. "IP routing table\n"
  2846. QUAGGA_IP_REDIST_HELP_STR_ZEBRA
  2847. VRF_ALL_CMD_HELP_STR)
  2848. {
  2849. int type;
  2850. struct route_table *table;
  2851. struct route_node *rn;
  2852. struct rib *rib;
  2853. struct zebra_vrf *zvrf;
  2854. vrf_iter_t iter;
  2855. int first = 1;
  2856. type = proto_redistnum (AFI_IP, argv[0]);
  2857. if (type < 0)
  2858. {
  2859. vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
  2860. return CMD_WARNING;
  2861. }
  2862. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2863. {
  2864. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2865. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2866. continue;
  2867. /* Show matched type IPv4 routes. */
  2868. for (rn = route_top (table); rn; rn = route_next (rn))
  2869. RNODE_FOREACH_RIB (rn, rib)
  2870. if (rib->type == type)
  2871. {
  2872. if (first)
  2873. {
  2874. vty_out (vty, SHOW_ROUTE_V4_HEADER);
  2875. first = 0;
  2876. }
  2877. vty_show_ip_route (vty, rn, rib);
  2878. }
  2879. }
  2880. return CMD_SUCCESS;
  2881. }
  2882. DEFUN (show_ip_route_addr_vrf_all,
  2883. show_ip_route_addr_vrf_all_cmd,
  2884. "show ip route A.B.C.D " VRF_ALL_CMD_STR,
  2885. SHOW_STR
  2886. IP_STR
  2887. "IP routing table\n"
  2888. "Network in the IP routing table to display\n"
  2889. VRF_ALL_CMD_HELP_STR)
  2890. {
  2891. int ret;
  2892. struct prefix_ipv4 p;
  2893. struct route_table *table;
  2894. struct route_node *rn;
  2895. struct zebra_vrf *zvrf;
  2896. vrf_iter_t iter;
  2897. ret = str2prefix_ipv4 (argv[0], &p);
  2898. if (ret <= 0)
  2899. {
  2900. vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
  2901. return CMD_WARNING;
  2902. }
  2903. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2904. {
  2905. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2906. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2907. continue;
  2908. rn = route_node_match (table, (struct prefix *) &p);
  2909. if (! rn)
  2910. continue;
  2911. vty_show_ip_route_detail (vty, rn, 0);
  2912. route_unlock_node (rn);
  2913. }
  2914. return CMD_SUCCESS;
  2915. }
  2916. DEFUN (show_ip_route_prefix_vrf_all,
  2917. show_ip_route_prefix_vrf_all_cmd,
  2918. "show ip route A.B.C.D/M " VRF_ALL_CMD_STR,
  2919. SHOW_STR
  2920. IP_STR
  2921. "IP routing table\n"
  2922. "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
  2923. VRF_ALL_CMD_HELP_STR)
  2924. {
  2925. int ret;
  2926. struct prefix_ipv4 p;
  2927. struct route_table *table;
  2928. struct route_node *rn;
  2929. struct zebra_vrf *zvrf;
  2930. vrf_iter_t iter;
  2931. ret = str2prefix_ipv4 (argv[0], &p);
  2932. if (ret <= 0)
  2933. {
  2934. vty_out (vty, "%% Malformed IPv4 address%s", VTY_NEWLINE);
  2935. return CMD_WARNING;
  2936. }
  2937. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2938. {
  2939. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  2940. (table = zvrf->table[AFI_IP][SAFI_UNICAST]) == NULL)
  2941. continue;
  2942. rn = route_node_match (table, (struct prefix *) &p);
  2943. if (! rn)
  2944. continue;
  2945. if (rn->p.prefixlen != p.prefixlen)
  2946. {
  2947. route_unlock_node (rn);
  2948. continue;
  2949. }
  2950. vty_show_ip_route_detail (vty, rn, 0);
  2951. route_unlock_node (rn);
  2952. }
  2953. return CMD_SUCCESS;
  2954. }
  2955. DEFUN (show_ip_route_summary_vrf_all,
  2956. show_ip_route_summary_vrf_all_cmd,
  2957. "show ip route summary " VRF_ALL_CMD_STR,
  2958. SHOW_STR
  2959. IP_STR
  2960. "IP routing table\n"
  2961. "Summary of all routes\n"
  2962. VRF_ALL_CMD_HELP_STR)
  2963. {
  2964. struct zebra_vrf *zvrf;
  2965. vrf_iter_t iter;
  2966. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2967. if ((zvrf = vrf_iter2info (iter)) != NULL)
  2968. vty_show_ip_route_summary (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
  2969. return CMD_SUCCESS;
  2970. }
  2971. DEFUN (show_ip_route_summary_prefix_vrf_all,
  2972. show_ip_route_summary_prefix_vrf_all_cmd,
  2973. "show ip route summary prefix " VRF_ALL_CMD_STR,
  2974. SHOW_STR
  2975. IP_STR
  2976. "IP routing table\n"
  2977. "Summary of all routes\n"
  2978. "Prefix routes\n"
  2979. VRF_ALL_CMD_HELP_STR)
  2980. {
  2981. struct zebra_vrf *zvrf;
  2982. vrf_iter_t iter;
  2983. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  2984. if ((zvrf = vrf_iter2info (iter)) != NULL)
  2985. vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP][SAFI_UNICAST]);
  2986. return CMD_SUCCESS;
  2987. }
  2988. /* Write IPv4 static route configuration. */
  2989. static int
  2990. static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
  2991. {
  2992. struct route_node *rn;
  2993. struct static_route *si;
  2994. struct route_table *stable;
  2995. struct zebra_vrf *zvrf;
  2996. vrf_iter_t iter;
  2997. int write;
  2998. write = 0;
  2999. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  3000. {
  3001. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  3002. (stable = zvrf->stable[AFI_IP][safi]) == NULL)
  3003. continue;
  3004. for (rn = route_top (stable); rn; rn = route_next (rn))
  3005. for (si = rn->info; si; si = si->next)
  3006. {
  3007. vty_out (vty, "%s %s/%d", cmd, inet_ntoa (rn->p.u.prefix4),
  3008. rn->p.prefixlen);
  3009. switch (si->type)
  3010. {
  3011. case STATIC_IPV4_GATEWAY:
  3012. vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
  3013. break;
  3014. case STATIC_IPV4_IFNAME:
  3015. vty_out (vty, " %s", si->ifname);
  3016. break;
  3017. case STATIC_IPV4_BLACKHOLE:
  3018. vty_out (vty, " Null0");
  3019. break;
  3020. }
  3021. /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
  3022. if (si->type != STATIC_IPV4_BLACKHOLE)
  3023. {
  3024. if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
  3025. vty_out (vty, " %s", "reject");
  3026. if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
  3027. vty_out (vty, " %s", "blackhole");
  3028. }
  3029. if (si->tag)
  3030. vty_out (vty, " tag %d", si->tag);
  3031. if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
  3032. vty_out (vty, " %d", si->distance);
  3033. if (si->vrf_id != VRF_DEFAULT)
  3034. vty_out (vty, " vrf %u", si->vrf_id);
  3035. vty_out (vty, "%s", VTY_NEWLINE);
  3036. write = 1;
  3037. }
  3038. }
  3039. return write;
  3040. }
  3041. DEFUN (show_ip_protocol,
  3042. show_ip_protocol_cmd,
  3043. "show ip protocol",
  3044. SHOW_STR
  3045. IP_STR
  3046. "IP protocol filtering status\n")
  3047. {
  3048. int i;
  3049. vty_out(vty, "Protocol : route-map %s", VTY_NEWLINE);
  3050. vty_out(vty, "------------------------%s", VTY_NEWLINE);
  3051. for (i=0;i<ZEBRA_ROUTE_MAX;i++)
  3052. {
  3053. if (proto_rm[AFI_IP][i])
  3054. vty_out (vty, "%-10s : %-10s%s", zebra_route_string(i),
  3055. proto_rm[AFI_IP][i],
  3056. VTY_NEWLINE);
  3057. else
  3058. vty_out (vty, "%-10s : none%s", zebra_route_string(i), VTY_NEWLINE);
  3059. }
  3060. if (proto_rm[AFI_IP][i])
  3061. vty_out (vty, "%-10s : %-10s%s", "any", proto_rm[AFI_IP][i],
  3062. VTY_NEWLINE);
  3063. else
  3064. vty_out (vty, "%-10s : none%s", "any", VTY_NEWLINE);
  3065. return CMD_SUCCESS;
  3066. }
  3067. /* General fucntion for IPv6 static route. */
  3068. static int
  3069. static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
  3070. const char *gate_str, const char *ifname,
  3071. const char *flag_str, const char *tag_str,
  3072. const char *distance_str, const char *vrf_id_str)
  3073. {
  3074. int ret;
  3075. u_char distance;
  3076. struct prefix p;
  3077. struct in6_addr *gate = NULL;
  3078. struct in6_addr gate_addr;
  3079. u_char type = 0;
  3080. vrf_id_t vrf_id = VRF_DEFAULT;
  3081. u_char flag = 0;
  3082. route_tag_t tag = 0;
  3083. ret = str2prefix (dest_str, &p);
  3084. if (ret <= 0)
  3085. {
  3086. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  3087. return CMD_WARNING;
  3088. }
  3089. /* Apply mask for given prefix. */
  3090. apply_mask (&p);
  3091. /* Route flags */
  3092. if (flag_str) {
  3093. switch(flag_str[0]) {
  3094. case 'r':
  3095. case 'R': /* XXX */
  3096. SET_FLAG (flag, ZEBRA_FLAG_REJECT);
  3097. break;
  3098. case 'b':
  3099. case 'B': /* XXX */
  3100. SET_FLAG (flag, ZEBRA_FLAG_BLACKHOLE);
  3101. break;
  3102. default:
  3103. vty_out (vty, "%% Malformed flag %s %s", flag_str, VTY_NEWLINE);
  3104. return CMD_WARNING;
  3105. }
  3106. }
  3107. /* Administrative distance. */
  3108. if (distance_str)
  3109. distance = atoi (distance_str);
  3110. else
  3111. distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
  3112. /* tag */
  3113. if (tag_str)
  3114. tag = atoi (tag_str);
  3115. /* tag */
  3116. if (tag_str)
  3117. tag = atoi(tag_str);
  3118. /* When gateway is valid IPv6 addrees, then gate is treated as
  3119. nexthop address other case gate is treated as interface name. */
  3120. ret = inet_pton (AF_INET6, gate_str, &gate_addr);
  3121. if (ifname)
  3122. {
  3123. /* When ifname is specified. It must be come with gateway
  3124. address. */
  3125. if (ret != 1)
  3126. {
  3127. vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
  3128. return CMD_WARNING;
  3129. }
  3130. type = STATIC_IPV6_GATEWAY_IFNAME;
  3131. gate = &gate_addr;
  3132. }
  3133. else
  3134. {
  3135. if (ret == 1)
  3136. {
  3137. type = STATIC_IPV6_GATEWAY;
  3138. gate = &gate_addr;
  3139. }
  3140. else
  3141. {
  3142. type = STATIC_IPV6_IFNAME;
  3143. ifname = gate_str;
  3144. }
  3145. }
  3146. /* VRF id */
  3147. if (vrf_id_str)
  3148. VTY_GET_INTEGER ("VRF ID", vrf_id, vrf_id_str);
  3149. if (add_cmd)
  3150. static_add_ipv6 (&p, type, gate, ifname, flag, tag, distance, vrf_id);
  3151. else
  3152. static_delete_ipv6 (&p, type, gate, ifname, tag, distance, vrf_id);
  3153. return CMD_SUCCESS;
  3154. }
  3155. DEFUN (ipv6_route,
  3156. ipv6_route_cmd,
  3157. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
  3158. IP_STR
  3159. "Establish static routes\n"
  3160. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3161. "IPv6 gateway address\n"
  3162. "IPv6 gateway interface name\n")
  3163. {
  3164. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL,
  3165. NULL, NULL);
  3166. }
  3167. DEFUN (ipv6_route_tag,
  3168. ipv6_route_tag_cmd,
  3169. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295>",
  3170. IP_STR
  3171. "Establish static routes\n"
  3172. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3173. "IPv6 gateway address\n"
  3174. "IPv6 gateway interface name\n"
  3175. "Set tag for this route\n"
  3176. "Tag value\n")
  3177. {
  3178. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
  3179. }
  3180. DEFUN (ipv6_route_tag_vrf,
  3181. ipv6_route_tag_vrf_cmd,
  3182. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295>" VRF_CMD_STR,
  3183. IP_STR
  3184. "Establish static routes\n"
  3185. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3186. "IPv6 gateway address\n"
  3187. "IPv6 gateway interface name\n"
  3188. "Set tag for this route\n"
  3189. "Tag value\n"
  3190. VRF_CMD_HELP_STR)
  3191. {
  3192. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
  3193. }
  3194. DEFUN (ipv6_route_flags,
  3195. ipv6_route_flags_cmd,
  3196. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
  3197. IP_STR
  3198. "Establish static routes\n"
  3199. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3200. "IPv6 gateway address\n"
  3201. "IPv6 gateway interface name\n"
  3202. "Emit an ICMP unreachable when matched\n"
  3203. "Silently discard pkts when matched\n")
  3204. {
  3205. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL,
  3206. NULL, NULL);
  3207. }
  3208. DEFUN (ipv6_route_flags_tag,
  3209. ipv6_route_flags_tag_cmd,
  3210. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  3211. IP_STR
  3212. "Establish static routes\n"
  3213. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3214. "IPv6 gateway address\n"
  3215. "IPv6 gateway interface name\n"
  3216. "Emit an ICMP unreachable when matched\n"
  3217. "Silently discard pkts when matched\n"
  3218. "Set tag for this route\n"
  3219. "Tag value\n")
  3220. {
  3221. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, NULL);
  3222. }
  3223. DEFUN (ipv6_route_flags_tag_vrf,
  3224. ipv6_route_flags_tag_vrf_cmd,
  3225. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  3226. IP_STR
  3227. "Establish static routes\n"
  3228. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3229. "IPv6 gateway address\n"
  3230. "IPv6 gateway interface name\n"
  3231. "Emit an ICMP unreachable when matched\n"
  3232. "Silently discard pkts when matched\n"
  3233. "Set tag for this route\n"
  3234. "Tag value\n"
  3235. VRF_CMD_HELP_STR)
  3236. {
  3237. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], NULL, argv[4]);
  3238. }
  3239. DEFUN (ipv6_route_ifname,
  3240. ipv6_route_ifname_cmd,
  3241. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
  3242. IP_STR
  3243. "Establish static routes\n"
  3244. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3245. "IPv6 gateway address\n"
  3246. "IPv6 gateway interface name\n")
  3247. {
  3248. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL,
  3249. NULL, NULL);
  3250. }
  3251. DEFUN (ipv6_route_ifname_tag,
  3252. ipv6_route_ifname_tag_cmd,
  3253. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>",
  3254. IP_STR
  3255. "Establish static routes\n"
  3256. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3257. "IPv6 gateway address\n"
  3258. "IPv6 gateway interface name\n"
  3259. "Set tag for this route\n"
  3260. "Tag value\n")
  3261. {
  3262. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
  3263. }
  3264. DEFUN (ipv6_route_ifname_tag_vrf,
  3265. ipv6_route_ifname_tag_vrf_cmd,
  3266. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>" VRF_CMD_STR,
  3267. IP_STR
  3268. "Establish static routes\n"
  3269. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3270. "IPv6 gateway address\n"
  3271. "IPv6 gateway interface name\n"
  3272. "Set tag for this route\n"
  3273. "Tag value\n"
  3274. VRF_CMD_HELP_STR)
  3275. {
  3276. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
  3277. }
  3278. DEFUN (ipv6_route_ifname_flags,
  3279. ipv6_route_ifname_flags_cmd,
  3280. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
  3281. IP_STR
  3282. "Establish static routes\n"
  3283. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3284. "IPv6 gateway address\n"
  3285. "IPv6 gateway interface name\n"
  3286. "Emit an ICMP unreachable when matched\n"
  3287. "Silently discard pkts when matched\n")
  3288. {
  3289. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL,
  3290. NULL, NULL);
  3291. }
  3292. DEFUN (ipv6_route_ifname_flags_tag,
  3293. ipv6_route_ifname_flags_tag_cmd,
  3294. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295>",
  3295. IP_STR
  3296. "Establish static routes\n"
  3297. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3298. "IPv6 gateway address\n"
  3299. "IPv6 gateway interface name\n"
  3300. "Emit an ICMP unreachable when matched\n"
  3301. "Silently discard pkts when matched\n"
  3302. "Set tag for this route\n"
  3303. "Tag value\n")
  3304. {
  3305. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, NULL);
  3306. }
  3307. DEFUN (ipv6_route_ifname_flags_tag_vrf,
  3308. ipv6_route_ifname_flags_tag_vrf_cmd,
  3309. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295>" VRF_CMD_STR,
  3310. IP_STR
  3311. "Establish static routes\n"
  3312. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3313. "IPv6 gateway address\n"
  3314. "IPv6 gateway interface name\n"
  3315. "Emit an ICMP unreachable when matched\n"
  3316. "Silently discard pkts when matched\n"
  3317. "Set tag for this route\n"
  3318. "Tag value\n"
  3319. VRF_CMD_HELP_STR)
  3320. {
  3321. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], NULL, argv[5]);
  3322. }
  3323. DEFUN (ipv6_route_pref,
  3324. ipv6_route_pref_cmd,
  3325. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
  3326. IP_STR
  3327. "Establish static routes\n"
  3328. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3329. "IPv6 gateway address\n"
  3330. "IPv6 gateway interface name\n"
  3331. "Distance value for this prefix\n")
  3332. {
  3333. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
  3334. NULL);
  3335. }
  3336. DEFUN (ipv6_route_pref_tag,
  3337. ipv6_route_pref_tag_cmd,
  3338. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255>",
  3339. IP_STR
  3340. "Establish static routes\n"
  3341. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3342. "IPv6 gateway address\n"
  3343. "IPv6 gateway interface name\n"
  3344. "Set tag for this route\n"
  3345. "Tag value\n"
  3346. "Distance value for this prefix\n")
  3347. {
  3348. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
  3349. }
  3350. DEFUN (ipv6_route_pref_tag_vrf,
  3351. ipv6_route_pref_tag_vrf_cmd,
  3352. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3353. IP_STR
  3354. "Establish static routes\n"
  3355. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3356. "IPv6 gateway address\n"
  3357. "IPv6 gateway interface name\n"
  3358. "Set tag for this route\n"
  3359. "Tag value\n"
  3360. "Distance value for this prefix\n"
  3361. VRF_CMD_HELP_STR)
  3362. {
  3363. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
  3364. }
  3365. DEFUN (ipv6_route_flags_pref,
  3366. ipv6_route_flags_pref_cmd,
  3367. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
  3368. IP_STR
  3369. "Establish static routes\n"
  3370. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3371. "IPv6 gateway address\n"
  3372. "IPv6 gateway interface name\n"
  3373. "Emit an ICMP unreachable when matched\n"
  3374. "Silently discard pkts when matched\n"
  3375. "Distance value for this prefix\n")
  3376. {
  3377. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
  3378. NULL);
  3379. }
  3380. DEFUN (ipv6_route_flags_pref_tag,
  3381. ipv6_route_flags_pref_tag_cmd,
  3382. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  3383. IP_STR
  3384. "Establish static routes\n"
  3385. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3386. "IPv6 gateway address\n"
  3387. "IPv6 gateway interface name\n"
  3388. "Emit an ICMP unreachable when matched\n"
  3389. "Silently discard pkts when matched\n"
  3390. "Set tag for this route\n"
  3391. "Tag value\n"
  3392. "Distance value for this prefix\n")
  3393. {
  3394. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
  3395. }
  3396. DEFUN (ipv6_route_flags_pref_tag_vrf,
  3397. ipv6_route_flags_pref_tag_vrf_cmd,
  3398. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3399. IP_STR
  3400. "Establish static routes\n"
  3401. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3402. "IPv6 gateway address\n"
  3403. "IPv6 gateway interface name\n"
  3404. "Emit an ICMP unreachable when matched\n"
  3405. "Silently discard pkts when matched\n"
  3406. "Set tag for this route\n"
  3407. "Tag value\n"
  3408. "Distance value for this prefix\n"
  3409. VRF_CMD_HELP_STR)
  3410. {
  3411. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
  3412. }
  3413. DEFUN (ipv6_route_ifname_pref,
  3414. ipv6_route_ifname_pref_cmd,
  3415. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
  3416. IP_STR
  3417. "Establish static routes\n"
  3418. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3419. "IPv6 gateway address\n"
  3420. "IPv6 gateway interface name\n"
  3421. "Distance value for this prefix\n")
  3422. {
  3423. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
  3424. NULL);
  3425. }
  3426. DEFUN (ipv6_route_ifname_pref_tag,
  3427. ipv6_route_ifname_pref_tag_cmd,
  3428. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>",
  3429. IP_STR
  3430. "Establish static routes\n"
  3431. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3432. "IPv6 gateway address\n"
  3433. "IPv6 gateway interface name\n"
  3434. "Set tag for this route\n"
  3435. "Tag value\n"
  3436. "Distance value for this prefix\n")
  3437. {
  3438. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
  3439. }
  3440. DEFUN (ipv6_route_ifname_pref_tag_vrf,
  3441. ipv6_route_ifname_pref_tag_vrf_cmd,
  3442. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3443. IP_STR
  3444. "Establish static routes\n"
  3445. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3446. "IPv6 gateway address\n"
  3447. "IPv6 gateway interface name\n"
  3448. "Set tag for this route\n"
  3449. "Tag value\n"
  3450. "Distance value for this prefix\n"
  3451. VRF_CMD_HELP_STR)
  3452. {
  3453. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
  3454. }
  3455. DEFUN (ipv6_route_ifname_flags_pref,
  3456. ipv6_route_ifname_flags_pref_cmd,
  3457. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
  3458. IP_STR
  3459. "Establish static routes\n"
  3460. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3461. "IPv6 gateway address\n"
  3462. "IPv6 gateway interface name\n"
  3463. "Emit an ICMP unreachable when matched\n"
  3464. "Silently discard pkts when matched\n"
  3465. "Distance value for this prefix\n")
  3466. {
  3467. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
  3468. NULL);
  3469. }
  3470. DEFUN (ipv6_route_ifname_flags_pref_tag,
  3471. ipv6_route_ifname_flags_pref_tag_cmd,
  3472. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>",
  3473. IP_STR
  3474. "Establish static routes\n"
  3475. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3476. "IPv6 gateway address\n"
  3477. "IPv6 gateway interface name\n"
  3478. "Emit an ICMP unreachable when matched\n"
  3479. "Silently discard pkts when matched\n"
  3480. "Set tag for this route\n"
  3481. "Tag value\n"
  3482. "Distance value for this prefix\n")
  3483. {
  3484. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
  3485. }
  3486. DEFUN (ipv6_route_ifname_flags_pref_tag_vrf,
  3487. ipv6_route_ifname_flags_pref_tag_vrf_cmd,
  3488. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3489. IP_STR
  3490. "Establish static routes\n"
  3491. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3492. "IPv6 gateway address\n"
  3493. "IPv6 gateway interface name\n"
  3494. "Emit an ICMP unreachable when matched\n"
  3495. "Silently discard pkts when matched\n"
  3496. "Set tag for this route\n"
  3497. "Tag value\n"
  3498. "Distance value for this prefix\n"
  3499. VRF_CMD_HELP_STR)
  3500. {
  3501. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
  3502. }
  3503. DEFUN (no_ipv6_route,
  3504. no_ipv6_route_cmd,
  3505. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE)",
  3506. NO_STR
  3507. IP_STR
  3508. "Establish static routes\n"
  3509. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3510. "IPv6 gateway address\n"
  3511. "IPv6 gateway interface name\n")
  3512. {
  3513. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
  3514. NULL);
  3515. }
  3516. DEFUN (no_ipv6_route_tag,
  3517. no_ipv6_route_tag_cmd,
  3518. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295>",
  3519. NO_STR
  3520. IP_STR
  3521. "Establish static routes\n"
  3522. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3523. "IPv6 gateway address\n"
  3524. "IPv6 gateway interface name\n"
  3525. "Set tag for this route\n"
  3526. "Tag value\n")
  3527. {
  3528. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, NULL);
  3529. }
  3530. DEFUN (no_ipv6_route_tag_vrf,
  3531. no_ipv6_route_tag_vrf_cmd,
  3532. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295>" VRF_CMD_STR,
  3533. NO_STR
  3534. IP_STR
  3535. "Establish static routes\n"
  3536. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3537. "IPv6 gateway address\n"
  3538. "IPv6 gateway interface name\n"
  3539. "Set tag for this route\n"
  3540. "Tag value\n"
  3541. VRF_CMD_HELP_STR)
  3542. {
  3543. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], NULL, argv[3]);
  3544. }
  3545. ALIAS (no_ipv6_route,
  3546. no_ipv6_route_flags_cmd,
  3547. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole)",
  3548. NO_STR
  3549. IP_STR
  3550. "Establish static routes\n"
  3551. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3552. "IPv6 gateway address\n"
  3553. "IPv6 gateway interface name\n"
  3554. "Emit an ICMP unreachable when matched\n"
  3555. "Silently discard pkts when matched\n")
  3556. ALIAS (no_ipv6_route_tag,
  3557. no_ipv6_route_flags_tag_cmd,
  3558. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295>",
  3559. NO_STR
  3560. IP_STR
  3561. "Establish static routes\n"
  3562. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3563. "IPv6 gateway address\n"
  3564. "IPv6 gateway interface name\n"
  3565. "Emit an ICMP unreachable when matched\n"
  3566. "Silently discard pkts when matched\n"
  3567. "Set tag for this route\n"
  3568. "Tag value\n")
  3569. DEFUN (no_ipv6_route_ifname,
  3570. no_ipv6_route_ifname_cmd,
  3571. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE",
  3572. NO_STR
  3573. IP_STR
  3574. "Establish static routes\n"
  3575. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3576. "IPv6 gateway address\n"
  3577. "IPv6 gateway interface name\n")
  3578. {
  3579. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
  3580. NULL);
  3581. }
  3582. DEFUN (no_ipv6_route_ifname_tag,
  3583. no_ipv6_route_ifname_tag_cmd,
  3584. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>",
  3585. NO_STR
  3586. IP_STR
  3587. "Establish static routes\n"
  3588. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3589. "IPv6 gateway address\n"
  3590. "IPv6 gateway interface name\n"
  3591. "Set tag for this route\n"
  3592. "Tag value\n")
  3593. {
  3594. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, NULL);
  3595. }
  3596. DEFUN (no_ipv6_route_ifname_tag_vrf,
  3597. no_ipv6_route_ifname_tag_vrf_cmd,
  3598. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295>" VRF_CMD_STR,
  3599. NO_STR
  3600. IP_STR
  3601. "Establish static routes\n"
  3602. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3603. "IPv6 gateway address\n"
  3604. "IPv6 gateway interface name\n"
  3605. "Set tag for this route\n"
  3606. "Tag value\n"
  3607. VRF_CMD_HELP_STR)
  3608. {
  3609. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], NULL, argv[4]);
  3610. }
  3611. ALIAS (no_ipv6_route_ifname,
  3612. no_ipv6_route_ifname_flags_cmd,
  3613. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole)",
  3614. NO_STR
  3615. IP_STR
  3616. "Establish static routes\n"
  3617. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3618. "IPv6 gateway address\n"
  3619. "IPv6 gateway interface name\n"
  3620. "Emit an ICMP unreachable when matched\n"
  3621. "Silently discard pkts when matched\n")
  3622. ALIAS (no_ipv6_route_ifname_tag,
  3623. no_ipv6_route_ifname_flags_tag_cmd,
  3624. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295>",
  3625. NO_STR
  3626. IP_STR
  3627. "Establish static routes\n"
  3628. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3629. "IPv6 gateway address\n"
  3630. "IPv6 gateway interface name\n"
  3631. "Emit an ICMP unreachable when matched\n"
  3632. "Silently discard pkts when matched\n"
  3633. "Set tag for this route\n"
  3634. "Tag value\n")
  3635. DEFUN (no_ipv6_route_pref,
  3636. no_ipv6_route_pref_cmd,
  3637. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255>",
  3638. NO_STR
  3639. IP_STR
  3640. "Establish static routes\n"
  3641. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3642. "IPv6 gateway address\n"
  3643. "IPv6 gateway interface name\n"
  3644. "Distance value for this prefix\n")
  3645. {
  3646. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
  3647. NULL);
  3648. }
  3649. DEFUN (no_ipv6_route_pref_tag,
  3650. no_ipv6_route_pref_tag_cmd,
  3651. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255>",
  3652. NO_STR
  3653. IP_STR
  3654. "Establish static routes\n"
  3655. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3656. "IPv6 gateway address\n"
  3657. "IPv6 gateway interface name\n"
  3658. "Set tag for this route\n"
  3659. "Tag value\n"
  3660. "Distance value for this prefix\n")
  3661. {
  3662. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], NULL);
  3663. }
  3664. DEFUN (no_ipv6_route_pref_tag_vrf,
  3665. no_ipv6_route_pref_tag_vrf_cmd,
  3666. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3667. NO_STR
  3668. IP_STR
  3669. "Establish static routes\n"
  3670. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3671. "IPv6 gateway address\n"
  3672. "IPv6 gateway interface name\n"
  3673. "Set tag for this route\n"
  3674. "Tag value\n"
  3675. "Distance value for this prefix\n"
  3676. VRF_CMD_HELP_STR)
  3677. {
  3678. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, argv[2], argv[3], argv[4]);
  3679. }
  3680. DEFUN (no_ipv6_route_flags_pref,
  3681. no_ipv6_route_flags_pref_cmd,
  3682. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255>",
  3683. NO_STR
  3684. IP_STR
  3685. "Establish static routes\n"
  3686. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3687. "IPv6 gateway address\n"
  3688. "IPv6 gateway interface name\n"
  3689. "Emit an ICMP unreachable when matched\n"
  3690. "Silently discard pkts when matched\n"
  3691. "Distance value for this prefix\n")
  3692. {
  3693. /* We do not care about argv[2] */
  3694. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
  3695. NULL);
  3696. }
  3697. DEFUN (no_ipv6_route_flags_pref_tag,
  3698. no_ipv6_route_flags_pref_tag_cmd,
  3699. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>",
  3700. NO_STR
  3701. IP_STR
  3702. "Establish static routes\n"
  3703. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3704. "IPv6 gateway address\n"
  3705. "IPv6 gateway interface name\n"
  3706. "Emit an ICMP unreachable when matched\n"
  3707. "Silently discard pkts when matched\n"
  3708. "Set tag for this route\n"
  3709. "Tag value\n"
  3710. "Distance value for this prefix\n")
  3711. {
  3712. /* We do not care about argv[2] */
  3713. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], NULL);
  3714. }
  3715. DEFUN (no_ipv6_route_flags_pref_tag_vrf,
  3716. no_ipv6_route_flags_pref_tag_vrf_cmd,
  3717. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3718. NO_STR
  3719. IP_STR
  3720. "Establish static routes\n"
  3721. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3722. "IPv6 gateway address\n"
  3723. "IPv6 gateway interface name\n"
  3724. "Emit an ICMP unreachable when matched\n"
  3725. "Silently discard pkts when matched\n"
  3726. "Set tag for this route\n"
  3727. "Tag value\n"
  3728. "Distance value for this prefix\n"
  3729. VRF_CMD_HELP_STR)
  3730. {
  3731. /* We do not care about argv[2] */
  3732. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3], argv[4], argv[5]);
  3733. }
  3734. DEFUN (no_ipv6_route_ifname_pref,
  3735. no_ipv6_route_ifname_pref_cmd,
  3736. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255>",
  3737. NO_STR
  3738. IP_STR
  3739. "Establish static routes\n"
  3740. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3741. "IPv6 gateway address\n"
  3742. "IPv6 gateway interface name\n"
  3743. "Distance value for this prefix\n")
  3744. {
  3745. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
  3746. NULL);
  3747. }
  3748. DEFUN (no_ipv6_route_ifname_pref_tag,
  3749. no_ipv6_route_ifname_pref_tag_cmd,
  3750. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>",
  3751. NO_STR
  3752. IP_STR
  3753. "Establish static routes\n"
  3754. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3755. "IPv6 gateway address\n"
  3756. "IPv6 gateway interface name\n"
  3757. "Set tag for this route\n"
  3758. "Tag value\n"
  3759. "Distance value for this prefix\n")
  3760. {
  3761. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], NULL);
  3762. }
  3763. DEFUN (no_ipv6_route_ifname_pref_tag_vrf,
  3764. no_ipv6_route_ifname_pref_tag_vrf_cmd,
  3765. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3766. NO_STR
  3767. IP_STR
  3768. "Establish static routes\n"
  3769. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3770. "IPv6 gateway address\n"
  3771. "IPv6 gateway interface name\n"
  3772. "Set tag for this route\n"
  3773. "Tag value\n"
  3774. "Distance value for this prefix\n"
  3775. VRF_CMD_HELP_STR)
  3776. {
  3777. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, argv[3], argv[4], argv[5]);
  3778. }
  3779. DEFUN (no_ipv6_route_ifname_flags_pref,
  3780. no_ipv6_route_ifname_flags_pref_cmd,
  3781. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255>",
  3782. NO_STR
  3783. IP_STR
  3784. "Establish static routes\n"
  3785. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3786. "IPv6 gateway address\n"
  3787. "IPv6 gateway interface name\n"
  3788. "Emit an ICMP unreachable when matched\n"
  3789. "Silently discard pkts when matched\n"
  3790. "Distance value for this prefix\n")
  3791. {
  3792. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
  3793. NULL);
  3794. }
  3795. DEFUN (no_ipv6_route_ifname_flags_pref_tag,
  3796. no_ipv6_route_ifname_flags_pref_tag_cmd,
  3797. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>",
  3798. NO_STR
  3799. IP_STR
  3800. "Establish static routes\n"
  3801. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3802. "IPv6 gateway address\n"
  3803. "IPv6 gateway interface name\n"
  3804. "Emit an ICMP unreachable when matched\n"
  3805. "Silently discard pkts when matched\n"
  3806. "Set tag for this route\n"
  3807. "Tag value\n"
  3808. "Distance value for this prefix\n")
  3809. {
  3810. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], NULL);
  3811. }
  3812. DEFUN (no_ipv6_route_ifname_flags_pref_tag_vrf,
  3813. no_ipv6_route_ifname_flags_pref_tag_vrf_cmd,
  3814. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) tag <1-4294967295> <1-255>" VRF_CMD_STR,
  3815. NO_STR
  3816. IP_STR
  3817. "Establish static routes\n"
  3818. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3819. "IPv6 gateway address\n"
  3820. "IPv6 gateway interface name\n"
  3821. "Emit an ICMP unreachable when matched\n"
  3822. "Silently discard pkts when matched\n"
  3823. "Set tag for this route\n"
  3824. "Tag value\n"
  3825. "Distance value for this prefix\n"
  3826. VRF_CMD_HELP_STR)
  3827. {
  3828. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
  3829. }
  3830. DEFUN (ipv6_route_vrf,
  3831. ipv6_route_vrf_cmd,
  3832. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
  3833. IP_STR
  3834. "Establish static routes\n"
  3835. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3836. "IPv6 gateway address\n"
  3837. "IPv6 gateway interface name\n"
  3838. VRF_CMD_HELP_STR)
  3839. {
  3840. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, NULL,
  3841. argv[2]);
  3842. }
  3843. DEFUN (ipv6_route_flags_vrf,
  3844. ipv6_route_flags_vrf_cmd,
  3845. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  3846. IP_STR
  3847. "Establish static routes\n"
  3848. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3849. "IPv6 gateway address\n"
  3850. "IPv6 gateway interface name\n"
  3851. "Emit an ICMP unreachable when matched\n"
  3852. "Silently discard pkts when matched\n"
  3853. VRF_CMD_HELP_STR)
  3854. {
  3855. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, NULL,
  3856. argv[3]);
  3857. }
  3858. DEFUN (ipv6_route_ifname_vrf,
  3859. ipv6_route_ifname_vrf_cmd,
  3860. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
  3861. IP_STR
  3862. "Establish static routes\n"
  3863. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3864. "IPv6 gateway address\n"
  3865. "IPv6 gateway interface name\n"
  3866. VRF_CMD_HELP_STR)
  3867. {
  3868. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, NULL,
  3869. argv[3]);
  3870. }
  3871. DEFUN (ipv6_route_ifname_flags_vrf,
  3872. ipv6_route_ifname_flags_vrf_cmd,
  3873. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
  3874. IP_STR
  3875. "Establish static routes\n"
  3876. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3877. "IPv6 gateway address\n"
  3878. "IPv6 gateway interface name\n"
  3879. "Emit an ICMP unreachable when matched\n"
  3880. "Silently discard pkts when matched\n"
  3881. VRF_CMD_HELP_STR)
  3882. {
  3883. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, NULL,
  3884. argv[4]);
  3885. }
  3886. DEFUN (ipv6_route_pref_vrf,
  3887. ipv6_route_pref_vrf_cmd,
  3888. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
  3889. IP_STR
  3890. "Establish static routes\n"
  3891. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3892. "IPv6 gateway address\n"
  3893. "IPv6 gateway interface name\n"
  3894. "Distance value for this prefix\n"
  3895. VRF_CMD_HELP_STR)
  3896. {
  3897. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, NULL, NULL, argv[2],
  3898. argv[3]);
  3899. }
  3900. DEFUN (ipv6_route_flags_pref_vrf,
  3901. ipv6_route_flags_pref_vrf_cmd,
  3902. "ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  3903. IP_STR
  3904. "Establish static routes\n"
  3905. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3906. "IPv6 gateway address\n"
  3907. "IPv6 gateway interface name\n"
  3908. "Emit an ICMP unreachable when matched\n"
  3909. "Silently discard pkts when matched\n"
  3910. "Distance value for this prefix\n"
  3911. VRF_CMD_HELP_STR)
  3912. {
  3913. return static_ipv6_func (vty, 1, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
  3914. argv[4]);
  3915. }
  3916. DEFUN (ipv6_route_ifname_pref_vrf,
  3917. ipv6_route_ifname_pref_vrf_cmd,
  3918. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
  3919. IP_STR
  3920. "Establish static routes\n"
  3921. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3922. "IPv6 gateway address\n"
  3923. "IPv6 gateway interface name\n"
  3924. "Distance value for this prefix\n"
  3925. VRF_CMD_HELP_STR)
  3926. {
  3927. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
  3928. argv[4]);
  3929. }
  3930. DEFUN (ipv6_route_ifname_flags_pref_vrf,
  3931. ipv6_route_ifname_flags_pref_vrf_cmd,
  3932. "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
  3933. IP_STR
  3934. "Establish static routes\n"
  3935. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3936. "IPv6 gateway address\n"
  3937. "IPv6 gateway interface name\n"
  3938. "Emit an ICMP unreachable when matched\n"
  3939. "Silently discard pkts when matched\n"
  3940. "Distance value for this prefix\n"
  3941. VRF_CMD_HELP_STR)
  3942. {
  3943. return static_ipv6_func (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
  3944. argv[5]);
  3945. }
  3946. DEFUN (no_ipv6_route_vrf,
  3947. no_ipv6_route_vrf_cmd,
  3948. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) " VRF_CMD_STR,
  3949. NO_STR
  3950. IP_STR
  3951. "Establish static routes\n"
  3952. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3953. "IPv6 gateway address\n"
  3954. "IPv6 gateway interface name\n"
  3955. VRF_CMD_HELP_STR)
  3956. {
  3957. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, NULL,
  3958. (argc > 3) ? argv[3] : argv[2]);
  3959. }
  3960. ALIAS (no_ipv6_route_vrf,
  3961. no_ipv6_route_flags_vrf_cmd,
  3962. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) " VRF_CMD_STR,
  3963. NO_STR
  3964. IP_STR
  3965. "Establish static routes\n"
  3966. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3967. "IPv6 gateway address\n"
  3968. "IPv6 gateway interface name\n"
  3969. "Emit an ICMP unreachable when matched\n"
  3970. "Silently discard pkts when matched\n"
  3971. VRF_CMD_HELP_STR)
  3972. DEFUN (no_ipv6_route_ifname_vrf,
  3973. no_ipv6_route_ifname_vrf_cmd,
  3974. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE " VRF_CMD_STR,
  3975. NO_STR
  3976. IP_STR
  3977. "Establish static routes\n"
  3978. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3979. "IPv6 gateway address\n"
  3980. "IPv6 gateway interface name\n"
  3981. VRF_CMD_HELP_STR)
  3982. {
  3983. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, NULL,
  3984. (argc > 4) ? argv[4] : argv[3]);
  3985. }
  3986. ALIAS (no_ipv6_route_ifname_vrf,
  3987. no_ipv6_route_ifname_flags_vrf_cmd,
  3988. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) " VRF_CMD_STR,
  3989. NO_STR
  3990. IP_STR
  3991. "Establish static routes\n"
  3992. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  3993. "IPv6 gateway address\n"
  3994. "IPv6 gateway interface name\n"
  3995. "Emit an ICMP unreachable when matched\n"
  3996. "Silently discard pkts when matched\n"
  3997. VRF_CMD_HELP_STR)
  3998. DEFUN (no_ipv6_route_pref_vrf,
  3999. no_ipv6_route_pref_vrf_cmd,
  4000. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) <1-255> " VRF_CMD_STR,
  4001. NO_STR
  4002. IP_STR
  4003. "Establish static routes\n"
  4004. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  4005. "IPv6 gateway address\n"
  4006. "IPv6 gateway interface name\n"
  4007. "Distance value for this prefix\n"
  4008. VRF_CMD_HELP_STR)
  4009. {
  4010. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, NULL, NULL, argv[2],
  4011. argv[3]);
  4012. }
  4013. DEFUN (no_ipv6_route_flags_pref_vrf,
  4014. no_ipv6_route_flags_pref_vrf_cmd,
  4015. "no ipv6 route X:X::X:X/M (X:X::X:X|INTERFACE) (reject|blackhole) <1-255> " VRF_CMD_STR,
  4016. NO_STR
  4017. IP_STR
  4018. "Establish static routes\n"
  4019. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  4020. "IPv6 gateway address\n"
  4021. "IPv6 gateway interface name\n"
  4022. "Emit an ICMP unreachable when matched\n"
  4023. "Silently discard pkts when matched\n"
  4024. "Distance value for this prefix\n"
  4025. VRF_CMD_HELP_STR)
  4026. {
  4027. /* We do not care about argv[2] */
  4028. return static_ipv6_func (vty, 0, argv[0], argv[1], NULL, argv[2], NULL, argv[3],
  4029. argv[4]);
  4030. }
  4031. DEFUN (no_ipv6_route_ifname_pref_vrf,
  4032. no_ipv6_route_ifname_pref_vrf_cmd,
  4033. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE <1-255> " VRF_CMD_STR,
  4034. NO_STR
  4035. IP_STR
  4036. "Establish static routes\n"
  4037. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  4038. "IPv6 gateway address\n"
  4039. "IPv6 gateway interface name\n"
  4040. "Distance value for this prefix\n"
  4041. VRF_CMD_HELP_STR)
  4042. {
  4043. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], NULL, NULL, argv[3],
  4044. argv[4]);
  4045. }
  4046. DEFUN (no_ipv6_route_ifname_flags_pref_vrf,
  4047. no_ipv6_route_ifname_flags_pref_vrf_cmd,
  4048. "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (reject|blackhole) <1-255> " VRF_CMD_STR,
  4049. NO_STR
  4050. IP_STR
  4051. "Establish static routes\n"
  4052. "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
  4053. "IPv6 gateway address\n"
  4054. "IPv6 gateway interface name\n"
  4055. "Emit an ICMP unreachable when matched\n"
  4056. "Silently discard pkts when matched\n"
  4057. "Distance value for this prefix\n"
  4058. VRF_CMD_HELP_STR)
  4059. {
  4060. return static_ipv6_func (vty, 0, argv[0], argv[1], argv[2], argv[3], NULL, argv[4],
  4061. argv[5]);
  4062. }
  4063. DEFUN (show_ipv6_route,
  4064. show_ipv6_route_cmd,
  4065. "show ipv6 route",
  4066. SHOW_STR
  4067. IP_STR
  4068. "IPv6 routing table\n")
  4069. {
  4070. struct route_table *table;
  4071. struct route_node *rn;
  4072. struct rib *rib;
  4073. int first = 1;
  4074. vrf_id_t vrf_id = VRF_DEFAULT;
  4075. if (argc > 0)
  4076. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  4077. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4078. if (! table)
  4079. return CMD_SUCCESS;
  4080. /* Show all IPv6 route. */
  4081. for (rn = route_top (table); rn; rn = route_next (rn))
  4082. RNODE_FOREACH_RIB (rn, rib)
  4083. {
  4084. if (first)
  4085. {
  4086. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4087. first = 0;
  4088. }
  4089. vty_show_ip_route (vty, rn, rib);
  4090. }
  4091. return CMD_SUCCESS;
  4092. }
  4093. ALIAS (show_ipv6_route,
  4094. show_ipv6_route_vrf_cmd,
  4095. "show ipv6 route " VRF_CMD_STR,
  4096. SHOW_STR
  4097. IP_STR
  4098. "IPv6 routing table\n"
  4099. VRF_CMD_HELP_STR)
  4100. DEFUN (show_ipv6_route_tag,
  4101. show_ipv6_route_tag_cmd,
  4102. "show ipv6 route tag <1-4294967295>",
  4103. SHOW_STR
  4104. IP_STR
  4105. "IPv6 routing table\n"
  4106. "Show only routes with tag\n"
  4107. "Tag value\n")
  4108. {
  4109. struct route_table *table;
  4110. struct route_node *rn;
  4111. struct rib *rib;
  4112. int first = 1;
  4113. route_tag_t tag = 0;
  4114. vrf_id_t vrf_id = VRF_DEFAULT;
  4115. if (argv[0])
  4116. tag = atoi(argv[0]);
  4117. if (argc == 2)
  4118. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  4119. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4120. if (! table)
  4121. return CMD_SUCCESS;
  4122. /* Show all IPv6 routes with matching tag value. */
  4123. for (rn = route_top (table); rn; rn = route_next (rn))
  4124. RNODE_FOREACH_RIB (rn, rib)
  4125. {
  4126. if (rib->tag != tag)
  4127. continue;
  4128. if (first)
  4129. {
  4130. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4131. first = 0;
  4132. }
  4133. vty_show_ip_route (vty, rn, rib);
  4134. }
  4135. return CMD_SUCCESS;
  4136. }
  4137. ALIAS (show_ipv6_route_tag,
  4138. show_ipv6_route_tag_vrf_cmd,
  4139. "show ipv6 route tag <1-4294967295>" VRF_CMD_STR,
  4140. SHOW_STR
  4141. IP_STR
  4142. "IPv6 routing table\n"
  4143. "Show only routes with tag\n"
  4144. "Tag value\n"
  4145. VRF_CMD_HELP_STR)
  4146. DEFUN (show_ipv6_route_prefix_longer,
  4147. show_ipv6_route_prefix_longer_cmd,
  4148. "show ipv6 route X:X::X:X/M longer-prefixes",
  4149. SHOW_STR
  4150. IP_STR
  4151. "IPv6 routing table\n"
  4152. "IPv6 prefix\n"
  4153. "Show route matching the specified Network/Mask pair only\n")
  4154. {
  4155. struct route_table *table;
  4156. struct route_node *rn;
  4157. struct rib *rib;
  4158. struct prefix p;
  4159. int ret;
  4160. int first = 1;
  4161. vrf_id_t vrf_id = VRF_DEFAULT;
  4162. ret = str2prefix (argv[0], &p);
  4163. if (! ret)
  4164. {
  4165. vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
  4166. return CMD_WARNING;
  4167. }
  4168. if (argc > 1)
  4169. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  4170. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4171. if (! table)
  4172. return CMD_SUCCESS;
  4173. /* Show matched type IPv6 routes. */
  4174. for (rn = route_top (table); rn; rn = route_next (rn))
  4175. RNODE_FOREACH_RIB (rn, rib)
  4176. if (prefix_match (&p, &rn->p))
  4177. {
  4178. if (first)
  4179. {
  4180. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4181. first = 0;
  4182. }
  4183. vty_show_ip_route (vty, rn, rib);
  4184. }
  4185. return CMD_SUCCESS;
  4186. }
  4187. ALIAS (show_ipv6_route_prefix_longer,
  4188. show_ipv6_route_prefix_longer_vrf_cmd,
  4189. "show ipv6 route X:X::X:X/M longer-prefixes " VRF_CMD_STR,
  4190. SHOW_STR
  4191. IP_STR
  4192. "IPv6 routing table\n"
  4193. "IPv6 prefix\n"
  4194. "Show route matching the specified Network/Mask pair only\n"
  4195. VRF_CMD_HELP_STR)
  4196. DEFUN (show_ipv6_route_protocol,
  4197. show_ipv6_route_protocol_cmd,
  4198. "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
  4199. SHOW_STR
  4200. IP_STR
  4201. "IP routing table\n"
  4202. QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
  4203. {
  4204. int type;
  4205. struct route_table *table;
  4206. struct route_node *rn;
  4207. struct rib *rib;
  4208. int first = 1;
  4209. vrf_id_t vrf_id = VRF_DEFAULT;
  4210. type = proto_redistnum (AFI_IP6, argv[0]);
  4211. if (type < 0)
  4212. {
  4213. vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
  4214. return CMD_WARNING;
  4215. }
  4216. if (argc > 1)
  4217. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  4218. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4219. if (! table)
  4220. return CMD_SUCCESS;
  4221. /* Show matched type IPv6 routes. */
  4222. for (rn = route_top (table); rn; rn = route_next (rn))
  4223. RNODE_FOREACH_RIB (rn, rib)
  4224. if (rib->type == type)
  4225. {
  4226. if (first)
  4227. {
  4228. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4229. first = 0;
  4230. }
  4231. vty_show_ip_route (vty, rn, rib);
  4232. }
  4233. return CMD_SUCCESS;
  4234. }
  4235. ALIAS (show_ipv6_route_protocol,
  4236. show_ipv6_route_protocol_vrf_cmd,
  4237. "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_CMD_STR,
  4238. SHOW_STR
  4239. IP_STR
  4240. "IP routing table\n"
  4241. QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
  4242. VRF_CMD_HELP_STR)
  4243. DEFUN (show_ipv6_route_addr,
  4244. show_ipv6_route_addr_cmd,
  4245. "show ipv6 route X:X::X:X",
  4246. SHOW_STR
  4247. IP_STR
  4248. "IPv6 routing table\n"
  4249. "IPv6 Address\n")
  4250. {
  4251. int ret;
  4252. struct prefix_ipv6 p;
  4253. struct route_table *table;
  4254. struct route_node *rn;
  4255. vrf_id_t vrf_id = VRF_DEFAULT;
  4256. ret = str2prefix_ipv6 (argv[0], &p);
  4257. if (ret <= 0)
  4258. {
  4259. vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
  4260. return CMD_WARNING;
  4261. }
  4262. if (argc > 1)
  4263. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  4264. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4265. if (! table)
  4266. return CMD_SUCCESS;
  4267. rn = route_node_match (table, (struct prefix *) &p);
  4268. if (! rn)
  4269. {
  4270. vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
  4271. return CMD_WARNING;
  4272. }
  4273. vty_show_ip_route_detail (vty, rn, 0);
  4274. route_unlock_node (rn);
  4275. return CMD_SUCCESS;
  4276. }
  4277. ALIAS (show_ipv6_route_addr,
  4278. show_ipv6_route_addr_vrf_cmd,
  4279. "show ipv6 route X:X::X:X " VRF_CMD_STR,
  4280. SHOW_STR
  4281. IP_STR
  4282. "IPv6 routing table\n"
  4283. "IPv6 Address\n"
  4284. VRF_CMD_HELP_STR)
  4285. DEFUN (show_ipv6_route_prefix,
  4286. show_ipv6_route_prefix_cmd,
  4287. "show ipv6 route X:X::X:X/M",
  4288. SHOW_STR
  4289. IP_STR
  4290. "IPv6 routing table\n"
  4291. "IPv6 prefix\n")
  4292. {
  4293. int ret;
  4294. struct prefix_ipv6 p;
  4295. struct route_table *table;
  4296. struct route_node *rn;
  4297. vrf_id_t vrf_id = VRF_DEFAULT;
  4298. ret = str2prefix_ipv6 (argv[0], &p);
  4299. if (ret <= 0)
  4300. {
  4301. vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
  4302. return CMD_WARNING;
  4303. }
  4304. if (argc > 1)
  4305. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]);
  4306. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4307. if (! table)
  4308. return CMD_SUCCESS;
  4309. rn = route_node_match (table, (struct prefix *) &p);
  4310. if (! rn || rn->p.prefixlen != p.prefixlen)
  4311. {
  4312. vty_out (vty, "%% Network not in table%s", VTY_NEWLINE);
  4313. if (rn)
  4314. route_unlock_node (rn);
  4315. return CMD_WARNING;
  4316. }
  4317. vty_show_ip_route_detail (vty, rn, 0);
  4318. route_unlock_node (rn);
  4319. return CMD_SUCCESS;
  4320. }
  4321. ALIAS (show_ipv6_route_prefix,
  4322. show_ipv6_route_prefix_vrf_cmd,
  4323. "show ipv6 route X:X::X:X/M " VRF_CMD_STR,
  4324. SHOW_STR
  4325. IP_STR
  4326. "IPv6 routing table\n"
  4327. "IPv6 prefix\n"
  4328. VRF_CMD_HELP_STR)
  4329. /* Show route summary. */
  4330. DEFUN (show_ipv6_route_summary,
  4331. show_ipv6_route_summary_cmd,
  4332. "show ipv6 route summary",
  4333. SHOW_STR
  4334. IP_STR
  4335. "IPv6 routing table\n"
  4336. "Summary of all IPv6 routes\n")
  4337. {
  4338. struct route_table *table;
  4339. vrf_id_t vrf_id = VRF_DEFAULT;
  4340. if (argc > 0)
  4341. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  4342. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4343. if (! table)
  4344. return CMD_SUCCESS;
  4345. vty_show_ip_route_summary (vty, table);
  4346. return CMD_SUCCESS;
  4347. }
  4348. ALIAS (show_ipv6_route_summary,
  4349. show_ipv6_route_summary_vrf_cmd,
  4350. "show ipv6 route summary " VRF_CMD_STR,
  4351. SHOW_STR
  4352. IP_STR
  4353. "IPv6 routing table\n"
  4354. "Summary of all IPv6 routes\n"
  4355. VRF_CMD_HELP_STR)
  4356. /* Show ipv6 route summary prefix. */
  4357. DEFUN (show_ipv6_route_summary_prefix,
  4358. show_ipv6_route_summary_prefix_cmd,
  4359. "show ipv6 route summary prefix",
  4360. SHOW_STR
  4361. IP_STR
  4362. "IPv6 routing table\n"
  4363. "Summary of all IPv6 routes\n"
  4364. "Prefix routes\n")
  4365. {
  4366. struct route_table *table;
  4367. vrf_id_t vrf_id = VRF_DEFAULT;
  4368. if (argc > 0)
  4369. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  4370. table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, vrf_id);
  4371. if (! table)
  4372. return CMD_SUCCESS;
  4373. vty_show_ip_route_summary_prefix (vty, table);
  4374. return CMD_SUCCESS;
  4375. }
  4376. ALIAS (show_ipv6_route_summary_prefix,
  4377. show_ipv6_route_summary_prefix_vrf_cmd,
  4378. "show ipv6 route summary prefix " VRF_CMD_STR,
  4379. SHOW_STR
  4380. IP_STR
  4381. "IPv6 routing table\n"
  4382. "Summary of all IPv6 routes\n"
  4383. "Prefix routes\n"
  4384. VRF_CMD_HELP_STR)
  4385. /*
  4386. * Show IPv6 mroute command.Used to dump
  4387. * the Multicast routing table.
  4388. */
  4389. DEFUN (show_ipv6_mroute,
  4390. show_ipv6_mroute_cmd,
  4391. "show ipv6 mroute",
  4392. SHOW_STR
  4393. IP_STR
  4394. "IPv6 Multicast routing table\n")
  4395. {
  4396. struct route_table *table;
  4397. struct route_node *rn;
  4398. struct rib *rib;
  4399. int first = 1;
  4400. vrf_id_t vrf_id = VRF_DEFAULT;
  4401. if (argc > 0)
  4402. VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]);
  4403. table = zebra_vrf_table (AFI_IP6, SAFI_MULTICAST, vrf_id);
  4404. if (! table)
  4405. return CMD_SUCCESS;
  4406. /* Show all IPv6 route. */
  4407. for (rn = route_top (table); rn; rn = route_next (rn))
  4408. RNODE_FOREACH_RIB (rn, rib)
  4409. {
  4410. if (first)
  4411. {
  4412. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4413. first = 0;
  4414. }
  4415. vty_show_ip_route (vty, rn, rib);
  4416. }
  4417. return CMD_SUCCESS;
  4418. }
  4419. ALIAS (show_ipv6_mroute,
  4420. show_ipv6_mroute_vrf_cmd,
  4421. "show ipv6 mroute " VRF_CMD_STR,
  4422. SHOW_STR
  4423. IP_STR
  4424. "IPv6 Multicast routing table\n"
  4425. VRF_CMD_HELP_STR)
  4426. DEFUN (show_ipv6_route_vrf_all,
  4427. show_ipv6_route_vrf_all_cmd,
  4428. "show ipv6 route " VRF_ALL_CMD_STR,
  4429. SHOW_STR
  4430. IP_STR
  4431. "IPv6 routing table\n"
  4432. VRF_ALL_CMD_HELP_STR)
  4433. {
  4434. struct route_table *table;
  4435. struct route_node *rn;
  4436. struct rib *rib;
  4437. struct zebra_vrf *zvrf;
  4438. vrf_iter_t iter;
  4439. int first = 1;
  4440. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4441. {
  4442. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4443. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4444. continue;
  4445. /* Show all IPv6 route. */
  4446. for (rn = route_top (table); rn; rn = route_next (rn))
  4447. RNODE_FOREACH_RIB (rn, rib)
  4448. {
  4449. if (first)
  4450. {
  4451. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4452. first = 0;
  4453. }
  4454. vty_show_ip_route (vty, rn, rib);
  4455. }
  4456. }
  4457. return CMD_SUCCESS;
  4458. }
  4459. DEFUN (show_ipv6_route_prefix_longer_vrf_all,
  4460. show_ipv6_route_prefix_longer_vrf_all_cmd,
  4461. "show ipv6 route X:X::X:X/M longer-prefixes " VRF_ALL_CMD_STR,
  4462. SHOW_STR
  4463. IP_STR
  4464. "IPv6 routing table\n"
  4465. "IPv6 prefix\n"
  4466. "Show route matching the specified Network/Mask pair only\n"
  4467. VRF_ALL_CMD_HELP_STR)
  4468. {
  4469. struct route_table *table;
  4470. struct route_node *rn;
  4471. struct rib *rib;
  4472. struct prefix p;
  4473. struct zebra_vrf *zvrf;
  4474. vrf_iter_t iter;
  4475. int ret;
  4476. int first = 1;
  4477. ret = str2prefix (argv[0], &p);
  4478. if (! ret)
  4479. {
  4480. vty_out (vty, "%% Malformed Prefix%s", VTY_NEWLINE);
  4481. return CMD_WARNING;
  4482. }
  4483. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4484. {
  4485. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4486. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4487. continue;
  4488. /* Show matched type IPv6 routes. */
  4489. for (rn = route_top (table); rn; rn = route_next (rn))
  4490. RNODE_FOREACH_RIB (rn, rib)
  4491. if (prefix_match (&p, &rn->p))
  4492. {
  4493. if (first)
  4494. {
  4495. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4496. first = 0;
  4497. }
  4498. vty_show_ip_route (vty, rn, rib);
  4499. }
  4500. }
  4501. return CMD_SUCCESS;
  4502. }
  4503. DEFUN (show_ipv6_route_protocol_vrf_all,
  4504. show_ipv6_route_protocol_vrf_all_cmd,
  4505. "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA " " VRF_ALL_CMD_STR,
  4506. SHOW_STR
  4507. IP_STR
  4508. "IP routing table\n"
  4509. QUAGGA_IP6_REDIST_HELP_STR_ZEBRA
  4510. VRF_ALL_CMD_HELP_STR)
  4511. {
  4512. int type;
  4513. struct route_table *table;
  4514. struct route_node *rn;
  4515. struct rib *rib;
  4516. struct zebra_vrf *zvrf;
  4517. vrf_iter_t iter;
  4518. int first = 1;
  4519. type = proto_redistnum (AFI_IP6, argv[0]);
  4520. if (type < 0)
  4521. {
  4522. vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
  4523. return CMD_WARNING;
  4524. }
  4525. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4526. {
  4527. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4528. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4529. continue;
  4530. /* Show matched type IPv6 routes. */
  4531. for (rn = route_top (table); rn; rn = route_next (rn))
  4532. RNODE_FOREACH_RIB (rn, rib)
  4533. if (rib->type == type)
  4534. {
  4535. if (first)
  4536. {
  4537. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4538. first = 0;
  4539. }
  4540. vty_show_ip_route (vty, rn, rib);
  4541. }
  4542. }
  4543. return CMD_SUCCESS;
  4544. }
  4545. DEFUN (show_ipv6_route_addr_vrf_all,
  4546. show_ipv6_route_addr_vrf_all_cmd,
  4547. "show ipv6 route X:X::X:X " VRF_ALL_CMD_STR,
  4548. SHOW_STR
  4549. IP_STR
  4550. "IPv6 routing table\n"
  4551. "IPv6 Address\n"
  4552. VRF_ALL_CMD_HELP_STR)
  4553. {
  4554. int ret;
  4555. struct prefix_ipv6 p;
  4556. struct route_table *table;
  4557. struct route_node *rn;
  4558. struct zebra_vrf *zvrf;
  4559. vrf_iter_t iter;
  4560. ret = str2prefix_ipv6 (argv[0], &p);
  4561. if (ret <= 0)
  4562. {
  4563. vty_out (vty, "Malformed IPv6 address%s", VTY_NEWLINE);
  4564. return CMD_WARNING;
  4565. }
  4566. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4567. {
  4568. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4569. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4570. continue;
  4571. rn = route_node_match (table, (struct prefix *) &p);
  4572. if (! rn)
  4573. continue;
  4574. vty_show_ip_route_detail (vty, rn, 0);
  4575. route_unlock_node (rn);
  4576. }
  4577. return CMD_SUCCESS;
  4578. }
  4579. DEFUN (show_ipv6_route_prefix_vrf_all,
  4580. show_ipv6_route_prefix_vrf_all_cmd,
  4581. "show ipv6 route X:X::X:X/M " VRF_ALL_CMD_STR,
  4582. SHOW_STR
  4583. IP_STR
  4584. "IPv6 routing table\n"
  4585. "IPv6 prefix\n"
  4586. VRF_ALL_CMD_HELP_STR)
  4587. {
  4588. int ret;
  4589. struct prefix_ipv6 p;
  4590. struct route_table *table;
  4591. struct route_node *rn;
  4592. struct zebra_vrf *zvrf;
  4593. vrf_iter_t iter;
  4594. ret = str2prefix_ipv6 (argv[0], &p);
  4595. if (ret <= 0)
  4596. {
  4597. vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
  4598. return CMD_WARNING;
  4599. }
  4600. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4601. {
  4602. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4603. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4604. continue;
  4605. rn = route_node_match (table, (struct prefix *) &p);
  4606. if (! rn)
  4607. continue;
  4608. if (rn->p.prefixlen != p.prefixlen)
  4609. {
  4610. route_unlock_node (rn);
  4611. continue;
  4612. }
  4613. vty_show_ip_route_detail (vty, rn, 0);
  4614. route_unlock_node (rn);
  4615. }
  4616. return CMD_SUCCESS;
  4617. }
  4618. /* Show route summary. */
  4619. DEFUN (show_ipv6_route_summary_vrf_all,
  4620. show_ipv6_route_summary_vrf_all_cmd,
  4621. "show ipv6 route summary " VRF_ALL_CMD_STR,
  4622. SHOW_STR
  4623. IP_STR
  4624. "IPv6 routing table\n"
  4625. "Summary of all IPv6 routes\n"
  4626. VRF_ALL_CMD_HELP_STR)
  4627. {
  4628. struct zebra_vrf *zvrf;
  4629. vrf_iter_t iter;
  4630. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4631. if ((zvrf = vrf_iter2info (iter)) != NULL)
  4632. vty_show_ip_route_summary (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
  4633. return CMD_SUCCESS;
  4634. }
  4635. DEFUN (show_ipv6_mroute_vrf_all,
  4636. show_ipv6_mroute_vrf_all_cmd,
  4637. "show ipv6 mroute " VRF_ALL_CMD_STR,
  4638. SHOW_STR
  4639. IP_STR
  4640. "IPv6 Multicast routing table\n"
  4641. VRF_ALL_CMD_HELP_STR)
  4642. {
  4643. struct route_table *table;
  4644. struct route_node *rn;
  4645. struct rib *rib;
  4646. struct zebra_vrf *zvrf;
  4647. vrf_iter_t iter;
  4648. int first = 1;
  4649. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4650. {
  4651. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4652. (table = zvrf->table[AFI_IP6][SAFI_UNICAST]) == NULL)
  4653. continue;
  4654. /* Show all IPv6 route. */
  4655. for (rn = route_top (table); rn; rn = route_next (rn))
  4656. RNODE_FOREACH_RIB (rn, rib)
  4657. {
  4658. if (first)
  4659. {
  4660. vty_out (vty, SHOW_ROUTE_V6_HEADER);
  4661. first = 0;
  4662. }
  4663. vty_show_ip_route (vty, rn, rib);
  4664. }
  4665. }
  4666. return CMD_SUCCESS;
  4667. }
  4668. DEFUN (show_ipv6_route_summary_prefix_vrf_all,
  4669. show_ipv6_route_summary_prefix_vrf_all_cmd,
  4670. "show ipv6 route summary prefix " VRF_ALL_CMD_STR,
  4671. SHOW_STR
  4672. IP_STR
  4673. "IPv6 routing table\n"
  4674. "Summary of all IPv6 routes\n"
  4675. "Prefix routes\n"
  4676. VRF_ALL_CMD_HELP_STR)
  4677. {
  4678. struct zebra_vrf *zvrf;
  4679. vrf_iter_t iter;
  4680. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4681. if ((zvrf = vrf_iter2info (iter)) != NULL)
  4682. vty_show_ip_route_summary_prefix (vty, zvrf->table[AFI_IP6][SAFI_UNICAST]);
  4683. return CMD_SUCCESS;
  4684. }
  4685. /* Write IPv6 static route configuration. */
  4686. static int
  4687. static_config_ipv6 (struct vty *vty)
  4688. {
  4689. struct route_node *rn;
  4690. struct static_route *si;
  4691. int write;
  4692. char buf[BUFSIZ];
  4693. struct route_table *stable;
  4694. struct zebra_vrf *zvrf;
  4695. vrf_iter_t iter;
  4696. write = 0;
  4697. for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
  4698. {
  4699. if ((zvrf = vrf_iter2info (iter)) == NULL ||
  4700. (stable = zvrf->stable[AFI_IP6][SAFI_UNICAST]) == NULL)
  4701. continue;
  4702. for (rn = route_top (stable); rn; rn = route_next (rn))
  4703. for (si = rn->info; si; si = si->next)
  4704. {
  4705. vty_out (vty, "ipv6 route %s", prefix2str (&rn->p, buf, sizeof buf));
  4706. switch (si->type)
  4707. {
  4708. case STATIC_IPV6_GATEWAY:
  4709. vty_out (vty, " %s",
  4710. inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
  4711. break;
  4712. case STATIC_IPV6_IFNAME:
  4713. vty_out (vty, " %s", si->ifname);
  4714. break;
  4715. case STATIC_IPV6_GATEWAY_IFNAME:
  4716. vty_out (vty, " %s %s",
  4717. inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
  4718. si->ifname);
  4719. break;
  4720. }
  4721. if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
  4722. vty_out (vty, " %s", "reject");
  4723. if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
  4724. vty_out (vty, " %s", "blackhole");
  4725. if (si->tag)
  4726. vty_out (vty, " tag %d", si->tag);
  4727. if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
  4728. vty_out (vty, " %d", si->distance);
  4729. if (si->vrf_id != VRF_DEFAULT)
  4730. vty_out (vty, " vrf %u", si->vrf_id);
  4731. vty_out (vty, "%s", VTY_NEWLINE);
  4732. write = 1;
  4733. }
  4734. }
  4735. return write;
  4736. }
  4737. /* Static ip route configuration write function. */
  4738. static int
  4739. zebra_ip_config (struct vty *vty)
  4740. {
  4741. int write = 0;
  4742. write += static_config_ipv4 (vty, SAFI_UNICAST, "ip route");
  4743. write += static_config_ipv4 (vty, SAFI_MULTICAST, "ip mroute");
  4744. #ifdef HAVE_IPV6
  4745. write += static_config_ipv6 (vty);
  4746. #endif /* HAVE_IPV6 */
  4747. return write;
  4748. }
  4749. static int config_write_vty(struct vty *vty)
  4750. {
  4751. int i;
  4752. enum multicast_mode ipv4_multicast_mode = multicast_mode_ipv4_get ();
  4753. if (ipv4_multicast_mode != MCAST_NO_CONFIG)
  4754. vty_out (vty, "ip multicast rpf-lookup-mode %s%s",
  4755. ipv4_multicast_mode == MCAST_URIB_ONLY ? "urib-only" :
  4756. ipv4_multicast_mode == MCAST_MRIB_ONLY ? "mrib-only" :
  4757. ipv4_multicast_mode == MCAST_MIX_MRIB_FIRST ? "mrib-then-urib" :
  4758. ipv4_multicast_mode == MCAST_MIX_DISTANCE ? "lower-distance" :
  4759. "longer-prefix",
  4760. VTY_NEWLINE);
  4761. for (i=0;i<ZEBRA_ROUTE_MAX;i++)
  4762. {
  4763. if (proto_rm[AFI_IP][i])
  4764. vty_out (vty, "ip protocol %s route-map %s%s", zebra_route_string(i),
  4765. proto_rm[AFI_IP][i], VTY_NEWLINE);
  4766. }
  4767. if (proto_rm[AFI_IP][ZEBRA_ROUTE_MAX])
  4768. vty_out (vty, "ip protocol %s route-map %s%s", "any",
  4769. proto_rm[AFI_IP][ZEBRA_ROUTE_MAX], VTY_NEWLINE);
  4770. return 1;
  4771. }
  4772. /* table node for protocol filtering */
  4773. static struct cmd_node protocol_node = { PROTOCOL_NODE, "", 1 };
  4774. /* IP node for static routes. */
  4775. static struct cmd_node ip_node = { IP_NODE, "", 1 };
  4776. /* Route VTY. */
  4777. void
  4778. zebra_vty_init (void)
  4779. {
  4780. install_node (&ip_node, zebra_ip_config);
  4781. install_node (&protocol_node, config_write_vty);
  4782. install_element (CONFIG_NODE, &ip_mroute_cmd);
  4783. install_element (CONFIG_NODE, &ip_mroute_dist_cmd);
  4784. install_element (CONFIG_NODE, &no_ip_mroute_cmd);
  4785. install_element (CONFIG_NODE, &no_ip_mroute_dist_cmd);
  4786. install_element (CONFIG_NODE, &ip_multicast_mode_cmd);
  4787. install_element (CONFIG_NODE, &no_ip_multicast_mode_cmd);
  4788. install_element (CONFIG_NODE, &no_ip_multicast_mode_noarg_cmd);
  4789. install_element (CONFIG_NODE, &ip_protocol_cmd);
  4790. install_element (CONFIG_NODE, &no_ip_protocol_cmd);
  4791. install_element (VIEW_NODE, &show_ip_protocol_cmd);
  4792. install_element (CONFIG_NODE, &ip_route_cmd);
  4793. install_element (CONFIG_NODE, &ip_route_tag_cmd);
  4794. install_element (CONFIG_NODE, &ip_route_tag_vrf_cmd);
  4795. install_element (CONFIG_NODE, &ip_route_flags_cmd);
  4796. install_element (CONFIG_NODE, &ip_route_flags_tag_cmd);
  4797. install_element (CONFIG_NODE, &ip_route_flags_tag_vrf_cmd);
  4798. install_element (CONFIG_NODE, &ip_route_flags2_cmd);
  4799. install_element (CONFIG_NODE, &ip_route_flags2_tag_cmd);
  4800. install_element (CONFIG_NODE, &ip_route_flags2_tag_vrf_cmd);
  4801. install_element (CONFIG_NODE, &ip_route_mask_cmd);
  4802. install_element (CONFIG_NODE, &ip_route_mask_tag_cmd);
  4803. install_element (CONFIG_NODE, &ip_route_mask_tag_vrf_cmd);
  4804. install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
  4805. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_cmd);
  4806. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_vrf_cmd);
  4807. install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd);
  4808. install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_cmd);
  4809. install_element (CONFIG_NODE, &ip_route_mask_flags2_tag_vrf_cmd);
  4810. install_element (CONFIG_NODE, &no_ip_route_cmd);
  4811. install_element (CONFIG_NODE, &no_ip_route_tag_cmd);
  4812. install_element (CONFIG_NODE, &no_ip_route_tag_vrf_cmd);
  4813. install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
  4814. install_element (CONFIG_NODE, &no_ip_route_flags_tag_cmd);
  4815. install_element (CONFIG_NODE, &no_ip_route_flags2_cmd);
  4816. install_element (CONFIG_NODE, &no_ip_route_flags2_tag_cmd);
  4817. install_element (CONFIG_NODE, &no_ip_route_flags2_tag_vrf_cmd);
  4818. install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
  4819. install_element (CONFIG_NODE, &no_ip_route_mask_tag_cmd);
  4820. install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
  4821. install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_cmd);
  4822. install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd);
  4823. install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_cmd);
  4824. install_element (CONFIG_NODE, &no_ip_route_mask_flags2_tag_vrf_cmd);
  4825. install_element (CONFIG_NODE, &ip_route_distance_cmd);
  4826. install_element (CONFIG_NODE, &ip_route_tag_distance_cmd);
  4827. install_element (CONFIG_NODE, &ip_route_tag_distance_vrf_cmd);
  4828. install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
  4829. install_element (CONFIG_NODE, &ip_route_flags_tag_distance_cmd);
  4830. install_element (CONFIG_NODE, &ip_route_flags_tag_distance_vrf_cmd);
  4831. install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd);
  4832. install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_cmd);
  4833. install_element (CONFIG_NODE, &ip_route_flags_tag_distance2_vrf_cmd);
  4834. install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
  4835. install_element (CONFIG_NODE, &ip_route_mask_tag_distance_cmd);
  4836. install_element (CONFIG_NODE, &ip_route_mask_tag_distance_vrf_cmd);
  4837. install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
  4838. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_cmd);
  4839. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance_vrf_cmd);
  4840. install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd);
  4841. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_cmd);
  4842. install_element (CONFIG_NODE, &ip_route_mask_flags_tag_distance2_vrf_cmd);
  4843. install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
  4844. install_element (CONFIG_NODE, &no_ip_route_tag_distance_cmd);
  4845. install_element (CONFIG_NODE, &no_ip_route_tag_distance_vrf_cmd);
  4846. install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
  4847. install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_cmd);
  4848. install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance_vrf_cmd);
  4849. install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd);
  4850. install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_cmd);
  4851. install_element (CONFIG_NODE, &no_ip_route_flags_tag_distance2_vrf_cmd);
  4852. install_element (CONFIG_NODE, &no_ip_route_mask_distance_cmd);
  4853. install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_cmd);
  4854. install_element (CONFIG_NODE, &no_ip_route_mask_tag_distance_vrf_cmd);
  4855. install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
  4856. install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_cmd);
  4857. install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance_vrf_cmd);
  4858. install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd);
  4859. install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_cmd);
  4860. install_element (CONFIG_NODE, &no_ip_route_mask_flags_tag_distance2_vrf_cmd);
  4861. install_element (VIEW_NODE, &show_ip_route_cmd);
  4862. install_element (VIEW_NODE, &show_ip_route_tag_cmd);
  4863. install_element (VIEW_NODE, &show_ip_route_tag_vrf_cmd);
  4864. install_element (VIEW_NODE, &show_ip_nht_cmd);
  4865. install_element (VIEW_NODE, &show_ipv6_nht_cmd);
  4866. install_element (VIEW_NODE, &show_ip_route_addr_cmd);
  4867. install_element (VIEW_NODE, &show_ip_route_prefix_cmd);
  4868. install_element (VIEW_NODE, &show_ip_route_prefix_longer_cmd);
  4869. install_element (VIEW_NODE, &show_ip_route_protocol_cmd);
  4870. install_element (VIEW_NODE, &show_ip_route_supernets_cmd);
  4871. install_element (VIEW_NODE, &show_ip_route_summary_cmd);
  4872. install_element (VIEW_NODE, &show_ip_route_summary_prefix_cmd);
  4873. install_element (VIEW_NODE, &show_ip_rpf_cmd);
  4874. install_element (VIEW_NODE, &show_ip_rpf_addr_cmd);
  4875. /* Commands for VRF */
  4876. install_element (CONFIG_NODE, &ip_mroute_vrf_cmd);
  4877. install_element (CONFIG_NODE, &ip_mroute_dist_vrf_cmd);
  4878. install_element (CONFIG_NODE, &no_ip_mroute_vrf_cmd);
  4879. install_element (CONFIG_NODE, &no_ip_mroute_dist_vrf_cmd);
  4880. install_element (CONFIG_NODE, &ip_route_vrf_cmd);
  4881. install_element (CONFIG_NODE, &ip_route_flags_vrf_cmd);
  4882. install_element (CONFIG_NODE, &ip_route_flags2_vrf_cmd);
  4883. install_element (CONFIG_NODE, &ip_route_mask_vrf_cmd);
  4884. install_element (CONFIG_NODE, &ip_route_mask_flags_vrf_cmd);
  4885. install_element (CONFIG_NODE, &ip_route_mask_flags2_vrf_cmd);
  4886. install_element (CONFIG_NODE, &no_ip_route_vrf_cmd);
  4887. install_element (CONFIG_NODE, &no_ip_route_flags_vrf_cmd);
  4888. install_element (CONFIG_NODE, &no_ip_route_flags2_vrf_cmd);
  4889. install_element (CONFIG_NODE, &no_ip_route_mask_vrf_cmd);
  4890. install_element (CONFIG_NODE, &no_ip_route_mask_flags_vrf_cmd);
  4891. install_element (CONFIG_NODE, &no_ip_route_mask_flags2_vrf_cmd);
  4892. install_element (CONFIG_NODE, &ip_route_distance_vrf_cmd);
  4893. install_element (CONFIG_NODE, &ip_route_flags_distance_vrf_cmd);
  4894. install_element (CONFIG_NODE, &ip_route_flags_distance2_vrf_cmd);
  4895. install_element (CONFIG_NODE, &ip_route_mask_distance_vrf_cmd);
  4896. install_element (CONFIG_NODE, &ip_route_mask_flags_distance_vrf_cmd);
  4897. install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_vrf_cmd);
  4898. install_element (CONFIG_NODE, &no_ip_route_distance_vrf_cmd);
  4899. install_element (CONFIG_NODE, &no_ip_route_flags_distance_vrf_cmd);
  4900. install_element (CONFIG_NODE, &no_ip_route_flags_distance2_vrf_cmd);
  4901. install_element (CONFIG_NODE, &no_ip_route_mask_distance_vrf_cmd);
  4902. install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_vrf_cmd);
  4903. install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_vrf_cmd);
  4904. install_element (VIEW_NODE, &show_ip_route_vrf_cmd);
  4905. install_element (VIEW_NODE, &show_ip_route_addr_vrf_cmd);
  4906. install_element (VIEW_NODE, &show_ip_route_prefix_vrf_cmd);
  4907. install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_cmd);
  4908. install_element (VIEW_NODE, &show_ip_route_protocol_vrf_cmd);
  4909. install_element (VIEW_NODE, &show_ip_route_supernets_vrf_cmd);
  4910. install_element (VIEW_NODE, &show_ip_route_summary_vrf_cmd);
  4911. install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_cmd);
  4912. install_element (VIEW_NODE, &show_ip_route_vrf_all_cmd);
  4913. install_element (VIEW_NODE, &show_ip_route_addr_vrf_all_cmd);
  4914. install_element (VIEW_NODE, &show_ip_route_prefix_vrf_all_cmd);
  4915. install_element (VIEW_NODE, &show_ip_route_prefix_longer_vrf_all_cmd);
  4916. install_element (VIEW_NODE, &show_ip_route_protocol_vrf_all_cmd);
  4917. install_element (VIEW_NODE, &show_ip_route_supernets_vrf_all_cmd);
  4918. install_element (VIEW_NODE, &show_ip_route_summary_vrf_all_cmd);
  4919. install_element (VIEW_NODE, &show_ip_route_summary_prefix_vrf_all_cmd);
  4920. install_element (VIEW_NODE, &show_ip_rpf_vrf_cmd);
  4921. install_element (VIEW_NODE, &show_ip_rpf_vrf_all_cmd);
  4922. install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_cmd);
  4923. install_element (VIEW_NODE, &show_ip_rpf_addr_vrf_all_cmd);
  4924. install_element (CONFIG_NODE, &ipv6_route_cmd);
  4925. install_element (CONFIG_NODE, &ipv6_route_flags_cmd);
  4926. install_element (CONFIG_NODE, &ipv6_route_ifname_cmd);
  4927. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_cmd);
  4928. install_element (CONFIG_NODE, &no_ipv6_route_cmd);
  4929. install_element (CONFIG_NODE, &no_ipv6_route_flags_cmd);
  4930. install_element (CONFIG_NODE, &no_ipv6_route_ifname_cmd);
  4931. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_cmd);
  4932. install_element (CONFIG_NODE, &ipv6_route_pref_cmd);
  4933. install_element (CONFIG_NODE, &ipv6_route_flags_pref_cmd);
  4934. install_element (CONFIG_NODE, &ipv6_route_ifname_pref_cmd);
  4935. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_cmd);
  4936. install_element (CONFIG_NODE, &no_ipv6_route_pref_cmd);
  4937. install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_cmd);
  4938. install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_cmd);
  4939. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_cmd);
  4940. install_element (CONFIG_NODE, &ipv6_route_tag_cmd);
  4941. install_element (CONFIG_NODE, &ipv6_route_tag_vrf_cmd);
  4942. install_element (CONFIG_NODE, &ipv6_route_flags_tag_cmd);
  4943. install_element (CONFIG_NODE, &ipv6_route_flags_tag_vrf_cmd);
  4944. install_element (CONFIG_NODE, &ipv6_route_ifname_tag_cmd);
  4945. install_element (CONFIG_NODE, &ipv6_route_ifname_tag_vrf_cmd);
  4946. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_cmd);
  4947. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_tag_vrf_cmd);
  4948. install_element (CONFIG_NODE, &ipv6_route_pref_tag_cmd);
  4949. install_element (CONFIG_NODE, &ipv6_route_pref_tag_vrf_cmd);
  4950. install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_cmd);
  4951. install_element (CONFIG_NODE, &ipv6_route_flags_pref_tag_vrf_cmd);
  4952. install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_cmd);
  4953. install_element (CONFIG_NODE, &ipv6_route_ifname_pref_tag_vrf_cmd);
  4954. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_cmd);
  4955. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_tag_vrf_cmd);
  4956. install_element (CONFIG_NODE, &no_ipv6_route_tag_cmd);
  4957. install_element (CONFIG_NODE, &no_ipv6_route_tag_vrf_cmd);
  4958. install_element (CONFIG_NODE, &no_ipv6_route_flags_tag_cmd);
  4959. install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_cmd);
  4960. install_element (CONFIG_NODE, &no_ipv6_route_ifname_tag_vrf_cmd);
  4961. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_tag_cmd);
  4962. install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_cmd);
  4963. install_element (CONFIG_NODE, &no_ipv6_route_pref_tag_vrf_cmd);
  4964. install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_cmd);
  4965. install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_tag_vrf_cmd);
  4966. install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_cmd);
  4967. install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_tag_vrf_cmd);
  4968. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_cmd);
  4969. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_tag_vrf_cmd);
  4970. install_element (VIEW_NODE, &show_ipv6_route_cmd);
  4971. install_element (VIEW_NODE, &show_ipv6_route_tag_cmd);
  4972. install_element (VIEW_NODE, &show_ipv6_route_tag_vrf_cmd);
  4973. install_element (VIEW_NODE, &show_ipv6_route_summary_cmd);
  4974. install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_cmd);
  4975. install_element (VIEW_NODE, &show_ipv6_route_protocol_cmd);
  4976. install_element (VIEW_NODE, &show_ipv6_route_addr_cmd);
  4977. install_element (VIEW_NODE, &show_ipv6_route_prefix_cmd);
  4978. install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_cmd);
  4979. install_element (VIEW_NODE, &show_ipv6_mroute_cmd);
  4980. /* Commands for VRF */
  4981. install_element (CONFIG_NODE, &ipv6_route_vrf_cmd);
  4982. install_element (CONFIG_NODE, &ipv6_route_flags_vrf_cmd);
  4983. install_element (CONFIG_NODE, &ipv6_route_ifname_vrf_cmd);
  4984. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_vrf_cmd);
  4985. install_element (CONFIG_NODE, &no_ipv6_route_vrf_cmd);
  4986. install_element (CONFIG_NODE, &no_ipv6_route_flags_vrf_cmd);
  4987. install_element (CONFIG_NODE, &no_ipv6_route_ifname_vrf_cmd);
  4988. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_vrf_cmd);
  4989. install_element (CONFIG_NODE, &ipv6_route_pref_vrf_cmd);
  4990. install_element (CONFIG_NODE, &ipv6_route_flags_pref_vrf_cmd);
  4991. install_element (CONFIG_NODE, &ipv6_route_ifname_pref_vrf_cmd);
  4992. install_element (CONFIG_NODE, &ipv6_route_ifname_flags_pref_vrf_cmd);
  4993. install_element (CONFIG_NODE, &no_ipv6_route_pref_vrf_cmd);
  4994. install_element (CONFIG_NODE, &no_ipv6_route_flags_pref_vrf_cmd);
  4995. install_element (CONFIG_NODE, &no_ipv6_route_ifname_pref_vrf_cmd);
  4996. install_element (CONFIG_NODE, &no_ipv6_route_ifname_flags_pref_vrf_cmd);
  4997. install_element (VIEW_NODE, &show_ipv6_route_vrf_cmd);
  4998. install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_cmd);
  4999. install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_cmd);
  5000. install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_cmd);
  5001. install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_cmd);
  5002. install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_cmd);
  5003. install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_cmd);
  5004. install_element (VIEW_NODE, &show_ipv6_route_vrf_all_cmd);
  5005. install_element (VIEW_NODE, &show_ipv6_route_summary_vrf_all_cmd);
  5006. install_element (VIEW_NODE, &show_ipv6_route_summary_prefix_vrf_all_cmd);
  5007. install_element (VIEW_NODE, &show_ipv6_route_protocol_vrf_all_cmd);
  5008. install_element (VIEW_NODE, &show_ipv6_route_addr_vrf_all_cmd);
  5009. install_element (VIEW_NODE, &show_ipv6_route_prefix_vrf_all_cmd);
  5010. install_element (VIEW_NODE, &show_ipv6_route_prefix_longer_vrf_all_cmd);
  5011. install_element (VIEW_NODE, &show_ipv6_mroute_vrf_cmd);
  5012. install_element (VIEW_NODE, &show_ipv6_mroute_vrf_all_cmd);
  5013. install_element (ENABLE_NODE, &show_ipv6_mroute_vrf_all_cmd);
  5014. }