Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added AllowedSourceAddress info to events channel output #686

Closed
wants to merge 2 commits into from

Conversation

r-caamano
Copy link
Member

No description provided.

@r-caamano r-caamano requested a review from a team as a code owner July 5, 2023 14:06
@@ -82,6 +86,7 @@ XX(Id, string, none, Id, __VA_ARGS__) \
XX(Name, string, none, Name, __VA_ARGS__) \
XX(Protocols, string, array, Protocols, __VA_ARGS__) \
XX(Addresses, tunnel_address, array, Addresses, __VA_ARGS__) \
XX(AllowedSourceAddresses, allowed_source_address, array, AllowedSourceAddresses, __VA_ARGS__) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it a list -- it is easier to deal with

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use ziti_address instead of a new type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear to me how I would do that. Seems all the items in the tunnel events are newly defined types in model/dtos.h which in some cases are populated with information from ziti_address i.e tunnel_address. However they do not use it as a type directly. Maybe I'm not interpreting your suggestion correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also seems all the other multi item entries in model/dtos.h associated with a TUNNEL_SERVICE are defined as arrays i.e.
XX(Protocols, string, array, Protocols, VA_ARGS)
XX(Addresses, tunnel_address, array, Addresses, VA_ARGS)
XX(Ports, tunnel_port_range, array, Ports, VA_ARGS)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event models were created before the model utilities supported list containers and before the ziti_address model existed. Personally I think it makes sense to follow the existing patterns for consistency and some day we can modernize the event models.

@scareything
Copy link
Member

Could the tunnel_address model type be used to express the allowed source addresses (in combination with the tunnel_port_range model (and a string array for protocols)? It would be nice to avoid proliferation of the model for the event responses.

Also, should the other fields from hosted service configurations be represented in tunnel_service? Either way, it starts to feel like the host and intercept fields should be separated somehow.

@r-caamano
Copy link
Member Author

r-caamano commented Jul 6, 2023

Yes we could reuse the tunnel_address model type and assign that to the AllowedSourceAddress key.

}
allowed_src_addr_arr = calloc(n + 1, sizeof(tunnel_address *));
for (int i = 0; i < n; i++) {
if (allowed_src_addrs[i]->type != ziti_address_cidr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: if this test happened in the loop above where n is calculated, you could allocate precisely enough memory for allowed_src_addr_arr.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did not was because I would have to run the same test again in the second loop since I don't have a way to know which entries were discarded from the original array and did not want redundant code and assumed it should be rare that someone actually puts a hostname instead of a prefix since it would be in error. If you prefer it I can add it. let me know.

@r-caamano
Copy link
Member Author

Closing PR due to commits not being signed. Will submit as new PR shortly

@r-caamano r-caamano closed this Jul 7, 2023
@scareything scareything deleted the rc-add-allowed-source-addr-to-events branch August 18, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants