Originally published at https://blog.pathvector.dev/protocol-in-code-bgp-05/ — part of the free Protocol Lab series.

This post is part of Protocol in Code, a free series that reads network protocols not as configuration examples but as logic with inputs, state, and branches — actual code you can read and run. The whole series lives here: github.com/pathvector-studio/protocol-in-code. If you're newer to this material and want a more hands-on, guided on-ramp first, start with the companion Protocol Lab series and come back.

Today's module is from the BGP track, Session 05. The source file is src/protocol_in_code/bgp/policy.py, and it builds directly on the origin-validation logic from Session 04.

The question to keep in your head

Here's the one thing to turn over as you read: