BIRD-1.3.6 - show bgp summary command

Alexander V. Chernikov melifaro at yandex-team.ru
Tue Mar 6 19:14:21 CET 2012


On 28.02.2012 14:35, Alexander Shikoff wrote:
> Hello!
>
> On Mon, Feb 27, 2012 at 10:07:26PM +0400, Alexander V. Chernikov wrote:
>> On 27.02.2012 21:31, Alexander Shikoff wrote:
>>> Hello List,
>>>
>>> On Mon, Feb 27, 2012 at 11:41:53AM +0100, Ondrej Zajicek wrote:
>>>> On Sat, Feb 25, 2012 at 03:33:13PM +0200, Alexander Shikoff wrote:
>>>>> On Thu, Feb 23, 2012 at 04:48:00PM +0200, Dean Belev wrote:
>>>>>> Hi there,
>>>>>>
>>>>>> Is the patch for 1.3.4
>>>>>> (http://marc.info/?l=bird-users&m=132155489919052&w=2
>>>>>> <http://marc.info/?l=bird-users&m=132155489919052&w=2>) usable for 1.3.6 ?
>>>>>>
>>>>>> We have a strange behavior when we tried to implement it for 1.3.6 - the
>>>>>> process stops right after the Enter is triggered.
>>>>>> But the "?" function works correctly.
>>>>>
>>>>> Old patch does not fit the source code and bird architecture as well.
>>>>> I've changed it in order to more comply to a birdc syntax.
>>>>
>>>> To fit better with BIRD architecture, it would be perhaps better to
>>>> remove that from hooks and global code and move it completely to BGP
>>>> code (like 'show ospf' is in OSPF code) and name it something like
>>>> 'show bgp summary'.
>>>
>>> Yes, you're right. I'm going to modify a patch, but I'm wondering
>>> what is the best way to get a list of all BGP protocols?
>>>
>>> The only way I know at a moment is just walking through proto_list
>>> and comparing proto name to "BGP". Is there a better way?
>> You have to walk through all protocols, yes. However, comparison is a
>> bit simpler. You can take a look into bgp_incoming_connection() for more
>> details.
>
> Thank you Ondrej and Alexander for pointing me.
> Universal patch for both IPv4 and IPv6 sources is attached.
> Reviews and comments are kindly appreciated.

bird is based on protocol instances and it its reasonable to name 
protocols explicitly in config file.
'show bgp sum proto' gives us mapping for proto -> peer address, but 
what about reverse mapping?

Like this:
bird> show bgp summary
Proto      Peer                    AS Last state change   Prefixes 
rcvd/best   State/Last error
b_7204     10.2.33.4            65001 22:00               0/0 
        Idle          Received: No supported AFI/SAFI
b_7206     10.2.33.6            65001 22:00               8/3 
        Established
b_mega     10.0.0.1             42678 22:00               0/0 
        Connect

The rest of the patch is fine (to me).

P.S.
I've changed style a bit, new version attached.
>
>
> Example outputs:
>
> # birdc6
> BIRD 1.3.6 ready.
> bird>  show protocols
> name     proto    table    state  since       info
> device1  Device   master   up     2012-02-28 12:29:44
> ITCONSULTING BGP      master   up     2012-02-28 12:30:16  Established
> CITYNET  BGP      master   start  2012-02-28 12:29:44  Passive
> bird>  show bgp ?
> show bgp summary [<name>]                      Show BGP peers summary
> bird>  show bgp summary CITYNET
> Peer
>           AS Last state change   Prefixes rcvd/best   State/Last error
> 2001:7f8:63::39
>        16066 2012-02-28 12:29:43 0/0                  Passive
> bird>  show bgp summary
> Peer
>           AS Last state change   Prefixes rcvd/best   State/Last error
> 2001:7f8:63::11
>        25372 2012-02-28 12:30:15 1/1                  Established
> 2001:7f8:63::39
>        16066 2012-02-28 12:29:43 0/0                  Passive
> bird>
>
>
> # birdc
> BIRD 1.3.6 ready.
> bird>  show protocols
> name     proto    table    state  since       info
> device1  Device   master   up     2012-02-28 12:31:44
> ITCONS   BGP      master   up     2012-02-28 12:33:00  Established
> UOS      BGP      master   start  2012-02-28 12:33:29  Passive       Received: Peer de-configured
> BOOM     Static   master   up     2012-02-28 12:31:44
> bird>  show bgp summary BOOM
> BOOM: Not a BGP protocol
> bird>  show bgp summary ITCONS
> Peer                    AS Last state change   Prefixes rcvd/best   State/Last error
> 193.25.180.17        25372 2012-02-28 12:33:00 2/2                  Established
> bird>  show bgp summary
> Peer                    AS Last state change   Prefixes rcvd/best   State/Last error
> 193.25.180.17        25372 2012-02-28 12:33:00 2/2                  Established
> 193.25.180.26        42546 2012-02-28 12:33:29 0/0                  Passive       Received: Peer de-configured
> bird>
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bgp_sum2.diff
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20120306/ae3d6b4a/attachment.diff>


More information about the Bird-users mailing list