目录
quot;,"po[0-9]{4}
quot;,"po[0-9]{6}
quot;],"exclude_interface_regexes":[],"redistribute_interface_regexes":["lo1","lo2"]}],"listen_addr":"*","openr_ctrl_port":2018,"enable_v4":true,"prefix_forwarding_type":0,"prefix_forwarding_algorithm":0,"kvstore_config":{"key_ttl_ms":3600000,"ttl_decrement_ms":1,"sync_initial_backoff_ms":200,"sync_max_backoff_ms":400},"link_monitor_config":{"linkflap_initial_backoff_ms":60000,"linkflap_max_backoff_ms":300000,"use_rtt_metric":true,"enable_perf_measurement":true,"enable_link_status_measurement":true},"spark_config":{"neighbor_discovery_port":6666,"hello_time_s":20,"fastinit_hello_time_ms":500,"keepalive_time_s":3,"hold_time_s":30,"graceful_restart_time_s":30,"step_detector_conf":{"fast_window_size":10,"slow_window_size":60,"lower_threshold":2,"upper_threshold":5,"ads_threshold":500},"min_neighbor_discovery_interval_s":2,"max_neighbor_discovery_interval_s":15},"enable_watchdog":true,"watchdog_config":{"interval_s":20,"thread_timeout_s":300,"max_memory_mb":800},"fib_port":5912,"enable_rib_policy":false,"monitor_config":{"max_event_log":100,"enable_event_log_submission":true},"decision_config":{"debounce_min_ms":10,"debounce_max_ms":250,"save_rib_policy_min_ms":10000,"save_rib_policy_max_ms":60000,"unblock_initial_routes_ms":120000},"ip_tos":192,"thrift_server":{"listen_addr":"*","openr_ctrl_port":2018,"enable_secure_thrift_server":true,"x509_ca_path":"/var/facebook/rootcanal/ca.pem","x509_cert_path":"/mnt/fb/certs/fb-openr_server.pem","x509_key_path":"/mnt/fb/certs/fb-openr_server.pem","ecc_curve_name":"prime256v1","acceptable_peers":"svc:openr","ticket_seed_path":"/var/facebook/x509_svc/openr_server.pem.seeds","verify_client_type":1,"enable_non_default_vrf_thrift_server":true,"workers_join_timeout":4,"vrf_names":[]},"thrift_client":{"enable_secure_thrift_client":false,"verify_server_type":0},"assume_drained":true,"persistent_config_store_path":"/mnt/flash/openr_persistent_config_store.bin","enable_soft_drain":true,"softdrained_node_increment":100,"enable_best_route_selection":false,"adj_hold_time_s":4,"route_delete_delay_ms":1000,"enable_neighbor_monitor":false,"enable_clear_fib_state":false} E0411 18:29:57.947134 4860 PersistentStore.cpp:242] Failed to read Tlv-format file contents from '"/mnt/flash/openr_persistent_config_store.bin"'. Error: std::out_of_range: string underflow E0411 18:29:57.947169 4860 PersistentStore.cpp:54] Failed to load config-database from file: "/mnt/flash/openr_persistent_config_store.bin" I0411 18:29:58.049392 4860 LinkMonitor.cpp:231] [Drain Status] Failed to load persistent store from file system. Set node soft-drain increment value: 100 ``` Furthermore, due to another subtle bug in EBB Controller, Open/R syncer only checks if nodeMetricIncrementVal is > 0 on drained devices ([link](https://www.internalfb.com/code/fbsource/[7413e1a73ba3626a1c0673448c15e85176e764f5]/fbcode/nettools/ebb/openr/OpenrSyncer.cpp?lines=219)) and, if so, let node soft-drain increment unchanged. As a result, soft-drained EBB devices after reload end up with node increment of 100 (or 100msec worth of latency) which might not be enough to repel the traffic as EBB radius grows. **Why Open/R cant read persistent store?** PersistentStore uses a TLV (Type-Length-Value) binary format for its on-disk database file. The file must begin with a "TlvFormatMarker" header for `loadDatabaseFromDisk()` to parse it successfully. There are two write paths: 1. `saveDatabaseToDisk()` — full database flush that overwrites the entire file WITH the marker. Called on clean shutdown (destructor) and every 10,000 incremental writes (`kDbFlushRatio`). 2. `savePersistentObjectToDisk()` — incremental append of individual records WITHOUT the marker. Called on every `store()` operation. When a new file is created via the incremental append path (e.g. on first boot or after the file is deleted), the marker is never written. If the process then crashes or is killed before a clean shutdown triggers `saveDatabaseToDisk()`, the resulting file lacks the marker header. On the next startup, `loadDatabaseTlvFormat()` reads the first 15 bytes as the marker (consuming part of the first record), leaving the cursor misaligned. The subsequent `decodePersistentObject()` call interprets the misaligned bytes as a key length of ~1.9 billion, causing `readFixedString()` to throw `std::out_of_range: string underflow`. When loading fails, LinkMonitor falls back to `assumeDrained` config and applies the default soft-drain increment (e.g. 100), which may not reflect the node's actual drain state before the crash. **Fix** Fix: Add a `tlvMarkerWritten_` flag to track whether the marker exists in the file. In `savePersistentObjectToDisk()`, if the flag is false, prepend the marker to the IOBuf queue before appending records. The flag is set to true when: - `loadDatabaseTlvFormat()` successfully reads an existing file (marker present) - `saveDatabaseToDisk()` writes a full database flush (marker always included) - `savePersistentObjectToDisk()` writes the marker for the first time Reviewed By: xiangxu1121 Differential Revision: D100481342 fbshipit-source-id: 39dddafbc7b09be54230b9e4df0c4616c6c79ac5 " href="/mirrors/openr/commits/c6d3ab49e2">Write TlvFormatMarker before first incremental append
5天前
  • .prettierignoreAdd Prettier markdown + yaml autoformatter (#70)5年前
  • .prettierrc.jsonSync OSS Prettier settings with fbcode (#94)5年前
  • .readthedocs.ymlChange readthedocs Python Version to 35年前
  • CHANGELOG.mdadd CHANGELOG file7年前
  • CMakeLists.txtFix Open/R oss build with the getdeps tool1年前
  • CODE_OF_CONDUCT.mdAdd Prettier markdown + yaml autoformatter (#70)5年前
  • CONTRIBUTING.mdFix invalid JSON in example .conf (#133)3年前
  • DockerfileFix openr.thrift Python Module Build4年前
  • FBGenCMakeBuildInfo.cmakeUpdate copyright headers from Facebook to Meta4年前
  • LICENSEUpdate copyright headers from Facebook to Meta4年前
  • LICENSE-examplesUpdate copyright headers from Facebook to Meta4年前
  • README.mdRemove Support Ukraine banner from OpenR README1个月前
  • ThriftLibrary.cmakeAdd support for decoupled serialization to OSS8个月前
  • example_openr.confRemove mpls_route_delete_delay_s and prefix_min_nexthop thrift field from OpenrConfig1年前
  • OpenR: Open Routing

    Build Status Documentation Status

    Open Routing, OpenR, is Facebook’s internally designed and developed Interior Routing Protocol/Platform. OpenR was originally designed and built for performing routing on the Terragraph mesh network. OpenR’s flexible design has led to its adoption in other networks, including Facebook’s new WAN network, Express Backbone.

    Documentation


    Please refer to our extensive Documentation to get started with OpenR.

    Library Examples


    Please refer to the examples directory to see some useful ways to leverage the libraries to build software to run with OpenR.

    Resources


    Contribute


    Take a look at Developer Guide and CONTRIBUTING.md to get started contributing. The Developer Guide outlines best practices for code contribution and testing. Any single change should be well tested for regressions and version compatibility.

    Code of Conduct


    The code of conduct is described in CODE_OF_CONDUCT.md

    Requirements


    We have tried OpenR on Ubuntu-16.04, Ubuntu-18.04 and CentOS 7/8. OpenR should work on all Linux based platforms.

    • Compiler supporting C++17 or higher

    Build


    Repo Directory Structure

    At the top level of this repo are the build and openr directories. Under the former is a tool, gen, that contains scripts for building the project. The openr directory contains the source for the project.

    Dependencies

    OpenR requires these dependencies for your system and follows the traditional cmake build steps below.

    • cmake
    • gflags
    • gtest
    • libsodium
    • zstd
    • folly
    • fbthrift
    • re2-devel

    One Step Build - Ubuntu

    We’ve provided a script, build/build_openr.sh, tested on Ubuntu LTS releases. It uses gendeps.py to install all necessary dependencies, compile OpenR and install C++ binaries as well as python tools. Please modify the script as needed for your platform. Also, note that some library dependencies require a newer version than provided by the default package manager on the system and hence we are compiling them from source instead of installing via the package manager. Please see the script for those instances and the required versions.

    Build Steps

    # Install dependencies and build openr
    bash ./build/build_openr.sh
    
    # To Run tests (some tests requires sudo privileges)
    python3 build/fbcode_builder/getdeps.py test \
      --src-dir=. \
      --project-install-prefix openr:/opt/facebook \
      openr

    If you make any changes you can run cmake ../openr and make from the build directory to build openr with your changes.

    Installing

    openr builds both static and dynamic libraries and the install step installs libraries and all header files to /opt/facebook/openr/lib and /opt/facebook/openr/include/ along with python modules in your Python’s site-packages directory. Note: the build_openr.sh script will run this step for you

    • Manually you can drive getdeps.py to install elsewhere
      • refer to build_openr.sh

    Installing Python Libraries + CLI

    You will need python pip or setuptools to build and install python modules. All library dependencies will be automatically installed except the fbthrift-python module which you will need to install manually using steps similar to those described below. This will install breeze, a cli tool to interact with OpenR.

    • Python install requires a fbthrift / thrift1 compiler to be installed and in PATH
    cd openr/openr/py
    python setup.py build
    sudo python setup.py install

    Docker Building / Usage

    OpenR now has a Dockerfile. It uses gendeps.py to build all dependencies + OpenR.

    docker build --network host .

    Running

    You can specify a config file by bind mount a directory with a openr.cfg file in /config

    docker run --name openr --network host openr_ubuntu
    • To use a custom config bind mount /config into the container
      • OpenR binary will look for /config/openr.conf

    License

    OpenR is MIT licensed.

    邀请码
      Gitlink(确实开源)
    • 加入我们
    • 官网邮箱:gitlink@ccf.org.cn
    • QQ群
    • QQ群
    • 公众号
    • 公众号

    版权所有:中国计算机学会技术支持:开源发展技术委员会
    京ICP备13000930号-9 京公网安备 11010802032778号