BIRD Internet Routing Daemon

repository·master·Indexed 41 days ago

https://github.com/cz-nic/bird

A dynamic IP routing daemon for Linux and UNIX-like systems supporting BGP, OSPF, and RIP. It features a powerful route filtering language, a command-line interface (birdc) for real-time inspection, and a textual CLI protocol for daemon interaction.

Tokens
3.1K
Snippets
10
Records
19
Agent score
53%

What's inside BIRD

  1. Overview of the BMP (BGP Monitoring Protocol) implementation

    master

    The proto/bmp/* package provides a basic implementation of the BGP Monitoring Protocol (BMP) for BIRD. This implementation was initiated as a pilot program by Akamai Technologies to evaluate the feasibility of BMP within BIRD.

    Note: This package provides only the basic features of the BMP specification required for evaluation and is not a full implementation of the protocol. The content was originally provided as a patch for BIRD release v2.0.7.

  2. Create a source package from the current repository commit

    master

    To create a compressed TGZ archive of the current repository state, use the make archive command or the tools/make-archive script.

    To create Debian (.deb) or Red Hat (.rpm) packages for the current system, use the following commands:

    • For DEBs: make deb or tools/make-deb
    • For RPMs: make rpm or tools/make-rpm
    # Create a TGZ archive
    make archive
    
    # Create DEB packages
    make deb
    
    # Create RPM packages
    make rpm
  3. Understand the BIRD CLI protocol and response codes

    master

    The BIRD CLI uses a simple textual protocol over a stream connection (e.g., a UNIX domain socket on UNIX systems). Sessions consist of a sequence of requests and replies, similar to FTP or SMTP.

    Request Format

    Commands are encoded as a single line of text.

    Reply Format

    Replies consist of lines starting with a four-digit numeric code:

    • XXXX (space): The last line of the reply.
    • XXXX- (minus sign): A continuation line, indicating more data follows.
    • XXXX (space, same code as previous): If a line has the same code as the previous one and is a continuation, the prefix can be replaced by a single whitespace character.

    Numeric Reply Codes

    • 0xxx: Action successfully completed.
    • 1xxx: Table entry.
    • 8xxx: Runtime error.
    • 9xxx: Syntax error.
  4. Understand BIRD client return codes

    master

    When executing commands via the BIRD client, the exit status of the process reflects the result of the last command executed by the server.

    • A return code below 8000 typically indicates success or a standard BIRD response.
    • A return code 8000 or higher indicates an error or failure condition.
  5. Internal CLI Interface and Command Handling

    master

    The BIRD CLI interface is designed for command-line interaction with the routing daemon. It supports both synchronous and asynchronous message handling.

    Key characteristics for developers interacting with the CLI layer:

    • Restricted Mode: The CLI can be configured in a restricted state, which limits access to read-only commands. If a command is attempted in this mode, the system returns an access denied error (code 8007).
    • Logging and Output: Commands can output messages using cli_msg or cli_printf. The CLI supports log masking (log_mask) and thresholds (log_threshold) to manage message volume.
    • Asynchronous Messaging: The CLI uses a ring buffer for asynchronous messages, allowing the daemon to send information to the CLI without blocking.
    • Time Formatting: Time output can be customized via cli_set_timeformat using a timeformat structure.
  6. Get User Support and Report Issues

    master

    General Support and Discussion

    For general questions, debugging assistance, or to follow development, subscribe to the BIRD users mailing list at bird-users@network.cz. To subscribe, send subscribe to bird-request@network.cz or visit https://bird.nic.cz/lists/bird-users/.

    Security Issues

    Do not send security vulnerabilities to the public mailing list. Instead, contact the team privately at bird-support@network.cz. This address is also used for commercial support inquiries.

    Issue Tracking

    While core development work is partially tracked on GitLab, the team does not use GitLab issues for official bug reporting.

  7. Access BIRD Documentation

    master

    You can access BIRD documentation in several formats:

    • Online Documentation: The latest version is available at https://bird.nic.cz/doc/latest/.
    • PDF Version: A formatted PDF version is available for download (packed in TGZ) from the online documentation page.
    • Local Build: If you have SGMLtools and LaTeX installed, you can build local HTML or PDF documentation from the doc directory using the following commands:
    make docs
    make install-docs
  8. Install BIRD

    master

    BIRD can be installed using several methods depending on your operating system and requirements:

  9. Use the BIRD client CLI

    master

    The BIRD client is a command-line interface used to interact with the BIRD routing daemon via a control socket. It comes in two variants: a regular variant (depending on readline and ncurses) and a light variant (using only libc).

    Usage

    You can run the client in interactive mode or pass commands directly as arguments.

    # Interactive mode
    birdc
    
    # Direct command execution
    birdc show protocols
    # Example usage patterns
    birdc
    birdc show protocols
    birdc -s /path/to/socket show protocols
  10. Configure CLI access restrictions

    master
    The CLI can be restricted to read-only operations. This is controlled by the restricted field in the cli structure. When restricted is true, the cli_access_restricted() function will return 1 and print an access denied error (code 8007) if a restricted command is attempted.
  11. Manage BIRD client input and output lifecycle

    master

    The client API provides functions to manage the input/output state, such as handling terminal lines, pagination (the more command), and input notification.

    • input_init: Initializes the input subsystem.
    • input_read: Reads input from the user.
    • input_notify: Notifies the input system of a prompt change.
    • more_begin / more_end: Controls pagination/paging behavior for long outputs.
    • cleanup: Performs necessary cleanup of client resources.
  12. Use BIRD client command completion and expansion

    master

    The BIRD client provides utilities for command-line interaction, including tab-completion and command expansion.

    • cmd_complete: Attempts to complete a command buffer. It takes the current command string, its length, a buffer to store the result, and an again flag.
    • cmd_expand: Expands a command string (e.g., handling aliases or shorthand).
    • cmd_help: Displays help information for a specific command.
    // Example of how completion might be invoked internally
    char buffer[256];
    int result = cmd_complete(input_buffer, len, buffer, 0);