fuchsia.net.routes

Added: 7

PROTOCOLS

RuleWatcherV4

Defined in fuchsia.net.routes/ipv4.fidl

An observer protocol for changes in the system's IPv4 rules table.

Added: HEAD

Watch

Hanging-Get style API for observing routing rule changes.

Clients must only have one pending Watch call at a time. Calling Watch while a request is already pending will cause the protocol to close.

The first N events will always be existing where N is the number of IPv4 rules that already existed when the server-end of the protocol was initialized. The following event will be idle signaling the end of the existing events. At this point the client has watched all existing state and will never again observe an existing event.

  • response events A vector of at most MAX_EVENTS events.

Request

<EMPTY>

Response

NameType
events vector<RuleEventV4>:512

RuleWatcherV6

Defined in fuchsia.net.routes/ipv6.fidl

An observer protocol for changes in the system's IPv6 rules table.

Added: HEAD

Watch

Hanging-Get style API for observing routing rule changes.

Clients must only have one pending Watch call at a time. Calling Watch while a request is already pending will cause the protocol to close.

The first N events will always be existing where N is the number of IPv6 rules that already existed when the server-end of the protocol was initialized. The following event will be idle signaling the end of the existing events. At this point the client has watched all existing state and will never again observe an existing event.

  • response events A vector of at most MAX_EVENTS events.

Request

<EMPTY>

Response

NameType
events vector<RuleEventV6>:512

State

Defined in fuchsia.net.routes/routes.fidl

Provides access to the system's routing state.

GetRouteTableName

Gets the route table name by its ID.

  • request table_id the ID of the route table in question.
  • response table_name the name of the route table, if the route table does not have a name, an empty string is returned.
  • error NO_TABLE if the route table does not exist.
Added: HEAD

Request

NameType
table_id TableId

Response

NameType
payload State_GetRouteTableName_Result

Resolve

Resolves the route to a destination.

  • request destination the IP address to resolve a route to. If the unspecified address (all zeroes) is provided, the default route will be returned. The variant of destination determines variant of fuchsia.net/IpAddress fields in the resolved route.
  • response result contains the resolved route to destination.
  • error ZX_ERR_ADDRESS_UNREACHABLE if destination can't be resolved.

Request

NameType
destination fuchsia.net/IpAddress

Response

NameType
payload State_Resolve_Result

StateV4

Defined in fuchsia.net.routes/ipv4.fidl

Provides observability to the system's IPv4 routing state.

Added: HEAD

GetRuleWatcherV4

Initialize a watcher for IPv4 rules state.

  • request 'watcher' grants access to the RuleWatcherV4 Protocol.
  • request watch_options specifies the behavior of the RuleWatcherV4.

Request

NameType
watcher server_end:RuleWatcherV4
options RuleWatcherOptionsV4

GetWatcherV4

Initialize a watcher for IPv4 routing state.

  • request 'watcher' grants access to the WatcherV4 Protocol.
  • request watch_options specifies the behavior of the WatcherV4.

Request

NameType
watcher server_end:WatcherV4
options WatcherOptionsV4

StateV6

Defined in fuchsia.net.routes/ipv6.fidl

Provides observability to the system's IPv6 routing state.

Added: HEAD

GetRuleWatcherV6

Initialize a watcher for IPv6 rules state.

  • request 'watcher' grants access to the RuleWatcherV6 Protocol.
  • request watch_options specifies the behavior of the RuleWatcherV6.

Request

NameType
watcher server_end:RuleWatcherV6
options RuleWatcherOptionsV6

GetWatcherV6

Initialize a watcher for IPv6 routing state.

  • request 'watcher' grants access to the WatcherV6 Protocol.
  • request watch_options specifies the behavior of the WatcherV6.

Request

NameType
watcher server_end:WatcherV6
options WatcherOptionsV6

WatcherV4

Defined in fuchsia.net.routes/ipv4.fidl

An observer protocol for changes in system's IPv4 routing state.

Added: HEAD

Watch

Hanging-Get style API for observing routing changes.

Clients must only have one pending Watch call at a time. Calling Watch while a request is already pending will cause the protocol to close.

The first N events will always be existing where N is the number of IPv4 routes that already existed when the server-end of the protocol was initialized. The following event will be idle signaling the end of the existing events. At this point the client has watched all existing state and will never again observe an existing event.

Events are returned in batches of up to MAX_EVENTS events. There is no correlation between the batch size/boundary and it's contents: it is perfectly valid for the server to split the block of existing events, across several batches. Clients should view this API as providing a stream of events, where batches are used to reduce IPC load on the system.

  • response events A vector of at most MAX_EVENTS events.

Request

<EMPTY>

Response

NameType
events vector<EventV4>:512

WatcherV6

Defined in fuchsia.net.routes/ipv6.fidl

An observer protocol for changes in system's IPv6 routing state.

Added: HEAD

Watch

Hanging-Get style API for observing routing changes.

Clients must only have one pending Watch call at a time. Calling Watch while a request is already pending will cause the protocol to close.

The first N events will always be existing where N is the number of IPv6 routes that already existed when the server-end of the protocol was initialized. The following event will be idle signaling the end of the existing events. At this point the client has watched all existing state and will never again observe an existing event.

Events are returned in batches of up to MAX_EVENTS events. There is no correlation between the batch size/boundary and it's contents: it is perfectly valid for the server to split the block of existing events, across several batches. Clients should view this API as providing a stream of events, where batches are used to reduce IPC load on the system.

  • response events A vector of at most MAX_EVENTS events.

Request

<EMPTY>

Response

NameType
events vector<EventV6>:512

STRUCTS

All

Defined in fuchsia.net.routes/routes.fidl

<EMPTY>

Between

Defined in fuchsia.net.routes/rules.fidl

FieldTypeDescriptionDefault
start uint32

start of the range, inclusive.

No default
end uint32

end of the range, inclusive.

No default

Empty

Defined in fuchsia.net.routes/routes.fidl

A placeholder for empty values.

Added: HEAD

<EMPTY>

InstalledRuleV4

Defined in fuchsia.net.routes/ipv4.fidl

An installed IPv4 routing rule.

Added: HEAD

FieldTypeDescriptionDefault
rule_set_priority RuleSetPriority

Rule sets are ordered by the rule set priority, rule sets are disjoint and don’t have interleaving rules among them.

No default
rule_index RuleIndex

Rules within a rule set are locally ordered, together with the rule set priority, this defines a global order for all installed rules.

No default
matcher RuleMatcherV4

The matcher part of the rule, the rule is a no-op if the matcher does not match the packet.

No default
action RuleAction

The action part of the rule that describes what to do if the matcher matches the packet.

No default

InstalledRuleV6

Defined in fuchsia.net.routes/ipv6.fidl

An installed IPv6 routing rule.

Added: HEAD

FieldTypeDescriptionDefault
rule_set_priority RuleSetPriority

Rule sets are ordered by the rule set priority, rule sets are disjoint and don’t have interleaving rules among them.

No default
rule_index RuleIndex

Rules within a rule set are locally ordered, together with the rule set priority, this defines a global order for all installed rules.

No default
matcher RuleMatcherV6

The matcher part of the rule, the rule is a no-op if the matcher does not match the packet.

No default
action RuleAction

The action part of the rule that describes what to do if the matcher matches the packet.

No default

Main

Defined in fuchsia.net.routes/routes.fidl

<EMPTY>

Marked

Defined in fuchsia.net.routes/rules.fidl

FieldTypeDescriptionDefault
mask uint32

Mask to apply before comparing to the range in between.

No default
between Between

The mark is between the given range.

No default

RouteTargetV4

Defined in fuchsia.net.routes/ipv4.fidl

FieldTypeDescriptionDefault
outbound_interface fuchsia.net/InterfaceId

The interface ID of the target's outbound interface.

No default
next_hop fuchsia.net/Ipv4Address?

The optional next-hop of the target. If provided, the address must be a unicast address.

No default

RouteTargetV6

Defined in fuchsia.net.routes/ipv6.fidl

FieldTypeDescriptionDefault
outbound_interface fuchsia.net/InterfaceId

The interface ID of the target's outbound interface.

No default
next_hop fuchsia.net/Ipv6Address?

The optional next-hop of the target. If provided, the address must be a unicast address.

No default

RouteV4

Defined in fuchsia.net.routes/ipv4.fidl

A RouteV4 specifies an IPv4 network route.

Added: HEAD

FieldTypeDescriptionDefault
destination fuchsia.net/Ipv4AddressWithPrefix

The destination subnet of the route. When making a routing decision for a given packet the route whose destination forms the longest matching prefix will be selected, with ties being broken by the route's metric.

No default
action RouteActionV4

Packets matching this route will have the specified action applied to them.

No default
properties RoutePropertiesV4

The additional properties of the IPv4 route.

No default

RouteV6

Defined in fuchsia.net.routes/ipv6.fidl

A RouteV6 specifies an IPv6 network route.

Added: HEAD

FieldTypeDescriptionDefault
destination fuchsia.net/Ipv6AddressWithPrefix

The destination subnet of the route. When making a routing decision for a given packet the route whose destination forms the longest matching prefix will be selected, with ties being broken by the route's metric.

No default
action RouteActionV6

Packets matching this route will have the specified action applied to them.

No default
properties RoutePropertiesV6

The additional properties of the IPv6 route.

No default

State_GetRouteTableName_Response

Defined in fuchsia.net.routes/routes.fidl

FieldTypeDescriptionDefault
table_name TableName No default

State_Resolve_Response

Defined in fuchsia.net.routes/routes.fidl

FieldTypeDescriptionDefault
result Resolved

A resolved route.

Contains the information for the "next-hop" or immediate-destination that is the result of a route resolution. A resolved route is only meaningful in the context of a requested destination.

No default

Unmarked

Defined in fuchsia.net.routes/rules.fidl

<EMPTY>

Unreachable

Defined in fuchsia.net.routes/rules.fidl

<EMPTY>

ENUMS

State_GetRouteTableName_Error strict

Type: uint32

Defined in fuchsia.net.routes/routes.fidl

NameValueDescription
1

TABLES

BaseMatcher

Defined in fuchsia.net.routes/rules.fidl

The common matcher that can be matched to both IPv4 and IPv6 packets.

A matcher matches a packet if all of the present fields match the corresponding properties.

Added: HEAD

OrdinalFieldTypeDescription
locally_generated bool

Matches the packet iff the packet was locally generated.

bound_device InterfaceMatcher

Matches the packet iff the packet is sent with SO_BINDTODEVICE.

mark_1 MarkMatcher

Matches the MARK_1 domain.

mark_2 MarkMatcher

Matches for the MARK_2 domain.

Destination

Defined in fuchsia.net.routes/routes.fidl

Collection of addresses and identifiers describing a network destination.

A Destination is the "next-hop" for a routed packet.

OrdinalFieldTypeDescription
address fuchsia.net/IpAddress

The IP address of the destination.

mac fuchsia.net/MacAddress

The MAC address of the destination. Only set if the destination is on a link that requires a MAC address.

interface_id fuchsia.net/InterfaceId

The interface identifier over which the destination can be reached.

source_address fuchsia.net/IpAddress

The preferred local IP address used to communicate with the destination.

EffectiveRouteProperties

Defined in fuchsia.net.routes/routes.fidl

The effective properties of a route installed in the system.

Added: HEAD

OrdinalFieldTypeDescription
metric fuchsia.net/RouteMetric

The route's effective metric, dependent on the value of the route's SpecifiedRouteProperties. If the specified_metric is explicit_metric, this value will be identical to the provided value; if the specified_metric is inherited_from_interface this value will be the interface's routing metric.

InstalledRouteV4

Defined in fuchsia.net.routes/ipv4.fidl

An InstalledRouteV4 specifies an IPv4 network route that is installed in the system's routing table.

Added: HEAD

OrdinalFieldTypeDescription
route RouteV4

The route.

effective_properties EffectiveRouteProperties

The route's effective properties.

table_id TableId

The ID of the table to which this route belongs.

InstalledRouteV6

Defined in fuchsia.net.routes/ipv6.fidl

An InstalledRouteV6 specifies an IPv6 network route that is installed in the system's routing table.

Added: HEAD

OrdinalFieldTypeDescription
route RouteV6

The route.

effective_properties EffectiveRouteProperties

The route's effective properties.

table_id TableId

The ID of the table to which this route belongs.

RoutePropertiesV4

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalFieldTypeDescription
specified_properties SpecifiedRouteProperties

The route's specified properties.

RoutePropertiesV6

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalFieldTypeDescription
specified_properties SpecifiedRouteProperties

The route's specified properties.

RuleMatcherV4

Defined in fuchsia.net.routes/ipv4.fidl

The matcher part of the rule that is used to match packets.

A matcher matches a packet if all of the present fields match the corresponding properties.

Added: HEAD

OrdinalFieldTypeDescription
from fuchsia.net/Ipv4AddressWithPrefix

Matches whether the source address of the packet is from the subnet.

base BaseMatcher

The rest of the matcher that is common between IP versions.

RuleMatcherV6

Defined in fuchsia.net.routes/ipv6.fidl

The matcher part of the rule that is used to match packets.

A matcher matches a packet if all of the present fields match the corresponding properties.

Added: HEAD

OrdinalFieldTypeDescription
from fuchsia.net/Ipv6AddressWithPrefix

Matches whether the source address of the packet is from the subnet.

base BaseMatcher

The rest of the matchers that is common between IP versions.

RuleWatcherOptionsV4

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalFieldTypeDescription

RuleWatcherOptionsV6

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalFieldTypeDescription

SpecifiedRouteProperties

Defined in fuchsia.net.routes/routes.fidl

The properties of the route that were explicitly specified at the time the route was created.

Added: HEAD

OrdinalFieldTypeDescription
metric SpecifiedMetric

The route's effective metric will be determined by whichever value is specified below.

WatcherOptionsV4

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalFieldTypeDescription
table_interest TableInterest

Filter events on tables matching table_interest.

Interpreted as all if absent. The server does not validate if TableInterest contains valid table IDs.

WatcherOptionsV6

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalFieldTypeDescription
table_interest TableInterest

Filter events on tables matching table_interest.

Interpreted as all if absent. The server does not validate if TableInterest contains valid table IDs.

UNIONS

EventV4 flexible

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalVariantTypeDescription
existing InstalledRouteV4

A route that already existed when watching started.

idle Empty

Sentinel value indicating no more existing events will be received.

added InstalledRouteV4

A route that was added while watching.

removed InstalledRouteV4

A route that was removed while watching.

EventV6 flexible

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalVariantTypeDescription
existing InstalledRouteV6

A route that already existed when watching started.

idle Empty

Sentinel value indicating no more existing events will be received.

added InstalledRouteV6

A route that was added while watching.

removed InstalledRouteV6

A route that was removed while watching.

InterfaceMatcher flexible

Defined in fuchsia.net.routes/rules.fidl

Matches on the originating interface of the outgoing packet.

Added: HEAD
OrdinalVariantTypeDescription
device_name fuchsia.net.interfaces/Name

Matches the device iff the names match.

The name is not a pattern or regex, it needs to be an exact match for the rule to be chosen.

MarkMatcher flexible

Defined in fuchsia.net.routes/rules.fidl

Matches the mark value of a packet.

Added: HEAD
OrdinalVariantTypeDescription
unmarked Unmarked

This mark domain does not have a mark.

marked Marked

Resolved strict

Defined in fuchsia.net.routes/routes.fidl

OrdinalVariantTypeDescription
direct Destination

The requested destination is directly reachable.

gateway Destination

The requested destination is reachable through a gateway, thus the next hop is the gateway.

RouteActionV4 flexible

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalVariantTypeDescription
forward RouteTargetV4

Forward the packet to the specified target.

RouteActionV6 flexible

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalVariantTypeDescription
forward RouteTargetV6

Forward the packet to the specified target.

RuleAction flexible

Defined in fuchsia.net.routes/rules.fidl

Actions of a rule if the matcher matches.

Added: HEAD
OrdinalVariantTypeDescription
lookup TableId

Look for a route in the indicated route table. If there is no matching route in the target table, the lookup will continue to consider the next rule.

unreachable Unreachable

Return network is unreachable. This is contrary to if a lookup table is empty or no matching routes, this decision is terminal and stops the lookup process from continuing.

RuleEventV4 flexible

Defined in fuchsia.net.routes/ipv4.fidl

OrdinalVariantTypeDescription
existing InstalledRuleV4

A rule that already existed when watching started.

idle Empty

Sentinel value indicating no more existing events will be received.

added InstalledRuleV4

A rule that was added while watching.

removed InstalledRuleV4

A rule that was removed while watching.

RuleEventV6 flexible

Defined in fuchsia.net.routes/ipv6.fidl

OrdinalVariantTypeDescription
existing InstalledRuleV6

A rule that already existed when watching started.

idle Empty

Sentinel value indicating no more existing events will be received.

added InstalledRuleV6

A rule that was added while watching.

removed InstalledRuleV6

A rule that was removed while watching.

SpecifiedMetric strict

Defined in fuchsia.net.routes/routes.fidl

OrdinalVariantTypeDescription
explicit_metric fuchsia.net/RouteMetric

The route's metric will be this explicitly specified value.

inherited_from_interface Empty

The route's metric is inherited from its outbound interface, and will track this value as it changes throughout the route's lifetime. Clients may prefer this approach if they wish to offload the responsibility of "which route is best" to the system.

State_GetRouteTableName_Result strict

Defined in fuchsia.net.routes/routes.fidl

OrdinalVariantTypeDescription
response State_GetRouteTableName_Response
err State_GetRouteTableName_Error

State_Resolve_Result strict

Defined in fuchsia.net.routes/routes.fidl

OrdinalVariantTypeDescription
response State_Resolve_Response
err zx/Status

TableInterest flexible

Defined in fuchsia.net.routes/routes.fidl

Specifies which table(s) the watcher is interested in.

Added: HEAD
OrdinalVariantTypeDescription
only TableId

Only watch for events on the specified table.

main Main

Watches on the main table without knowing the table ID.

all All

Watches for all routing tables.

CONSTANTS

NameValueTypeDescription
DEFAULT_RULE_SET_PRIORITY 4294967295 uint32

A reserved rule set priority for the netstack.

This is used by the network stack for installing default rules.

Added: HEAD
MAX_EVENTS 512 uint16

The maximum number of events that can be returned by one call to Watch().

Added: HEAD
MAX_TABLE_NAME_LEN 255 uint64

Maximum length of a table name.

Added: HEAD

ALIASES

NameValueDescription
RuleIndex uint32

The index of a rule within a provided rule set.

Rules within the same RuleSet are oredered based on the index. Rule at index 0 is evaluated first among the entire set.

Added: HEAD
RuleSetPriority uint32

The priority of the rule set, all rule sets are linearized based on this.

Rules of a RuleSet with a smaller RuleSetPriority are executed before rules of a RuleSet with a larger RuleSetPriority. That is, RuleSet with priority 0 has the top priority.

Added: HEAD
TableId uint32

The ID of a route table.

TableIds are globally unique non-reusable identifiers for a route table.

Added: HEAD
TableName string[MAX_TABLE_NAME_LEN]

The name of a route table.

Added: HEAD