Skip to content

Commit

Permalink
Add options to egress InterestMode::Final messages to distinguish liv…
Browse files Browse the repository at this point in the history
…eliness subscriber undeclarations
  • Loading branch information
oteffahi committed Nov 14, 2024
1 parent 3f64d15 commit f390321
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
4 changes: 3 additions & 1 deletion zenoh/src/net/routing/hat/client/interests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ impl HatInterestTrait for HatCode {
Interest {
id,
mode: InterestMode::Final,
options: InterestOptions::empty(),
// Note: InterestMode::Final options are undefined in the current protocol specification,
// they are initialized here for internal use by local egress interceptors.
options: interest.options,
wire_expr: None,
ext_qos: ext::QoSType::DECLARE,
ext_tstamp: None,
Expand Down
4 changes: 3 additions & 1 deletion zenoh/src/net/routing/hat/p2p_peer/interests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ impl HatInterestTrait for HatCode {
Interest {
id,
mode: InterestMode::Final,
options: InterestOptions::empty(),
// Note: InterestMode::Final options are undefined in the current protocol specification,
// they are initialized here for internal use by local egress interceptors.
options: interest.options,
wire_expr: None,
ext_qos: ext::QoSType::DECLARE,
ext_tstamp: None,
Expand Down
28 changes: 7 additions & 21 deletions zenoh/src/net/routing/interceptor/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,8 @@ impl InterceptorTrait for IngressAclEnforcer {
}
}
NetworkBody::Interest(Interest { mode, .. }) if mode.eq(&InterestMode::Final) => {
// FIXME: This can match Interest<Final> of message types other than liveliness

// Undeclaration filtering diverges between ingress and egress:
// Undeclarations in ingress are only filtered if the ext_wire_expr is set.
// If it's not set, we let the undeclaration pass, it will be rejected by the routing logic
// if its associated declaration was denied.
if let Some(key_expr) = key_expr {
if !key_expr.is_empty()
&& self.action(
AclMessage::DeclareLivelinessSubscriber,
"Undeclare Liveliness Subscriber (ingress)",
key_expr,
) == Permission::Deny
{
return None;
}
}
// InterestMode::Final filtering diverges between ingress and egress:
// InterestMode::Final ingress is always allowed, it will be rejected by routing logic if its associated Interest was denied
}
// Unfiltered Declare messages
NetworkBody::Declare(Declare {
Expand Down Expand Up @@ -598,10 +583,11 @@ impl InterceptorTrait for EgressAclEnforcer {
return None;
}
}
NetworkBody::Interest(Interest { mode, .. }) if mode.eq(&InterestMode::Final) => {
// FIXME: This can match Interest<Final> of message types other than liveliness

// Undeclaration filtering diverges between ingress and egress:
NetworkBody::Interest(Interest { mode, options, .. })
// options are set for InterestMode::Final for internal use only by egress interceptors
if mode.eq(&InterestMode::Final) && options.tokens() =>
{
// InterestMode::Final filtering diverges between ingress and egress:
// in egress the keyexpr has to be provided in the RoutingContext
if self.action(
AclMessage::DeclareLivelinessSubscriber,
Expand Down

0 comments on commit f390321

Please sign in to comment.