Skip to content

Flowspec action "Redirect to ip" #305

Open

Description

@aztec102

Good afternoon!
Prefixd currently lacks the ability to implement a Flowspec "redirect to ip" (ip nexthop) action—for instance, to forward incoming traffic to one's own scrubbing solution, such as Tempesta xFW.
I noticed that this is mentioned in your roadmap; am I correct in understanding that you plan to add this feature?

Activity

  1. added
    enhancement
    on Oct 22, 2026
  2. aztec102 commented on Oct 22, 2026

    @aztec102
    Author

    In addition to the "redirect to IP" option itself, it might also be necessary to implement the functionality described in RFC 8955 (Section 4.2.2.2) / RFC 8956 (Section 3.2) regarding "Source Prefix."
    Having the ability to route a portion of traffic—specifically for filtering purposes—via Flowspec would be highly beneficial.

  3. lance0 commented on Oct 22, 2026

    @lance0
    Owner

    Will work on these as soon as I can!

  4. aztec102 commented on Oct 23, 2026

    @aztec102
    Author

    Tested the functionality with the Source Prefix specified – it works perfectly!

  5. aztec102 commented on Oct 27, 2026

    @aztec102
    Author

    @lance0 I’m not quite sure why the issue was closed, since, as I understand it, the redirect hasn’t been added yet?

  6. reopened this on Oct 27, 2026
  7. lance0 commented on Oct 27, 2026

    @lance0
    Owner

    Sorry about that I think a PR auto closed it. @aztec102

  8. lance0 commented on Nov 8, 2026

    @lance0
    Owner

    Just and update @aztec102 I am working hard to get a major update out soon.

  9. aztec102 commented on Nov 9, 2026

    @aztec102
    Author

    @lance0 Thanks, I’m following the news )

  10. lance0 commented on Nov 10, 2026

    @lance0
    Owner

    Thanks for following this one — v0.25.0 is out: https://github.com/lance0/prefixd/releases/tag/v0.25.0

    Quick summary for your two asks:

    Two deliberate limits: the target comes from the configured profile, not an arbitrary API value; and detector/playbook actions still cannot request redirect. prefixd only controls the FlowSpec intent — it does not configure Tempesta, the VRF or the return path, so please qualify the redirect action and forwarding on your router/scrubber.

    VPN-scoped redirect-to-VRF is also available on rustbgpd 0.82.0. There is no new database migration; upgrade steps are here: https://github.com/lance0/prefixd/blob/v0.25.0/docs/how-to/upgrading.md#v0240--0250

    If you specifically need detector-triggered redirect, that piece is still open — happy to keep this issue focused on it.

  11. self-assigned this
    on Nov 10, 2026
  12. aztec102 commented on Nov 12, 2026

    @aztec102
    Author

    I’ve seen the changes; it’s fairly clear how it was implemented. The only point is the verification—that might be a bit tricky, but I’ll do my best to check it.

  13. aztec102 commented on Nov 12, 2026

    @aztec102
    Author

    Ideally, of course, we would get a scheme like this

    изображение
  14. lance0 commented on Nov 12, 2026

    @lance0
    Owner

    Thanks for the diagram, that makes the use case clear. Today's diversion is deliberately one-directional: a single host-destination rule toward a configured ingress peer set, with the return path kept outside the redirect. Your scheme needs three things prefixd doesn't have yet: a TCP-flags match, a return-direction rule keyed on the victim as source, and a second rule exported only to the client-side router, admitted and withdrawn together with the first. That's a design change rather than a config option, so I'm tracking it as a separate piece of work and will update here when there's something to test. For verifying the current inbound-only redirect, a received FlowSpec route on the router isn't enough on its own; check the router's installed FlowSpec state and counters, and a canary flow through the scrubber.

  15. lance0 commented on Nov 12, 2026

    @lance0
    Owner

    Your diagram is now supported in v0.26.0: https://github.com/lance0/prefixd/releases/tag/v0.26.0

    A global IP-target scrubber profile can carry an optional return_leg. For a TCP diversion, prefixd then admits a pair of rules as one unit, matching your example:

    • Router A: destination 203.0.113.1/32, tcp → redirect 192.0.2.99 (the existing inbound leg)
    • Router B: source 203.0.113.1/32, tcp, tcp-flags syn-ack → redirect 192.0.2.99 (the new return leg, with no destination component)
    scrubber:
      profiles:
        - id: scrubber-a
          revision: qualified-v2
          ipv4_target: 192.0.2.99
          router_peers: [<router A peer>]
          policy_binding: ingress-only-v2
          max_active: 10            # a pair counts as two rules, so at least 2
          # ...other fields as before
          return_leg:
            router_peers: [<router B peer>]
            policy_binding: client-side-only-v1
            export_community: "64496:100"
            tcp_flags: syn_ack      # optional; omit it to divert all of the victim's TCP from those ports

    The return leg carries export_community, and that is what your rustbgpd export policy uses to send it only to router B and keep it away from router A. The guide has a ready-made inbound-only / return-only policy example. Both legs share one lease, one readiness state and one latch. A diversion only shows active once both legs are confirmed, and a failed, missing or mis-exported leg withdraws both. UDP and other protocols still get the inbound leg only. TCP flags are also available on ordinary manual rules now (guardrails.allow_tcp_flags_match).

    Setup and details: https://github.com/lance0/prefixd/blob/v0.26.0/docs/how-to/scrubber-diversion.md#add-a-symmetric-return-leg

    On verification, which you mentioned: prefixd's tests prove the control plane against rustbgpd 0.81.0 and 0.82.0. That covers the exact rule bytes, read-back, and the community keeping the return leg to router B only. They can't prove what your routers do. Before relying on it, I'd check:

    • that router B accepts and installs a FlowSpec rule with no destination component (receivers differ under RFC 8955 §6 / RFC 9117);
    • installed-rule counters on both routers while a canary TCP connection completes its handshake through the scrubber;
    • that the scrubber's clean output re-enters outside each leg's ingress scope, so return traffic isn't redirected again;
    • if you also run other destination-keyed rules, which rule router B prefers when they overlap.

    The readiness monitor report needs a return_leg object for these profiles (binding, export isolation and a canary), which is a natural place to automate those checks.

    Upgrading from 0.25.0 needs no migration: https://github.com/lance0/prefixd/blob/v0.26.0/docs/how-to/upgrading.md#v0250--0260. Before downgrading, withdraw any diversions on a return_leg profile, because an older controller refuses to start while they are outstanding.

    If you get a chance to try it on your routers, I'd really like to hear how router B handles the destination-less rule.

  16. aztec102 commented on Nov 17, 2026

    @aztec102
    Author

    @lance0 Thank you very much for the added functionality; I will try testing it in the lab.

  17. lance0 commented on Nov 18, 2026

    @lance0
    Owner

    Sounds great. Eager to hear the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions