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

address refactor #429

Merged
merged 10 commits into from
Feb 8, 2017
Merged

address refactor #429

merged 10 commits into from
Feb 8, 2017

Conversation

mattklein123
Copy link
Member

This is a large refactor that moves away from representing addresses
internally as strings of "URL" form into proper objects. With this
change in place, it should be very straightforward to add IPv6
support, as most places in the code no longer need to understand
anything about the underlying address. Additionally, adding NT support
in the future should also be easier.

There are still some unfortunate legacy aspects, such as the fact that
when loading from configuration we still parse tcp:// as well as unix://
style addresses. In the future this should likely become ip:// as well
as pipe:// but we will probably need to continue to support both.

Note that although this change is huge in number of lines, most of it is
very straightforward, and certain portions of the code have become
substantially simpler such as listener handling and client connection
handling.

Fixes #390

This is a large refactor that moves away from representing addresses
internally as strings of "URL" form into proper objects. With this
change in place, it should be very straightforward to add IPv6
support, as most places in the code no longer need to understand
anything about the underlying address. Additionally, adding NT support
in the future should also be easier.

There are still some unfortunate legacy aspects, such as the fact that
when loading from configuration we still parse tcp:// as well as unix://
style addresses. In the future this should likely become ip:// as well
as pipe:// but we will probably need to continue to support both.

Note that although this change is huge in number of lines, most of it is
very straightforward, and certain portions of the code have become
substantially simpler such as listener handling and client connection
handling.

Fixes #390
@mattklein123
Copy link
Member Author

@lyft/network-team @jamessynge I will be OOO tomorrow and am probably going to add some more tests and possibly do a little more cleanup, but this should be ready for a first pass. As I said in the title, though this change is a huge number of lines, most of it is very straightforward.

@mattklein123 mattklein123 reopened this Feb 6, 2017
virtual const std::string& asString() const PURE;

/**
* Bind a socket to to this address. The socket should have been created with a call to socket()
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate to

* @param url supplies the url to resolve.
* @return EventAddrInfoPtr the resolved address.
* @return a resolved address.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: return type instead of a


/**
* Retrieve the original destination address from an accepted fd.
* The address (IP and port) may be not local and the port may differ from
* the listener port if the packets were redirected using iptables
* @param fd is the descriptor returned by accept()
* @param orig_addr is the data structure that contains the original address
* @return true if the operation succeeded, false otherwise
* @return the original destination or nullptr not available.
Copy link
Contributor

Choose a reason for hiding this comment

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

nullptr if not...

// TODO: Currently the DNS interface does not consider port. We need to make a new
// address that has port in it. We need to both support IPv6 as well as potentially
// move port handling into the DNS interface itself, which would work better for
// SRV.
Copy link
Contributor

Choose a reason for hiding this comment

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

general knowledge question: What does SRV stand for?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mattklein123
Copy link
Member Author

@ccaraman updated

* Bind a socket to this address. The socket should have been created with a call to socket() on
* this object.
* @param fd supplies the platform socket handle.
* @return the platform error code.
Copy link
Member

Choose a reason for hiding this comment

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

and zero if no errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's platform specific. The idea is we can use this eventually to support NT.

* Connect a socket to this address. The socket should have been created with a call to socket()
* on this object.
* @param fd supplies the platform socket handle.
* @return the platform error code.
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Member Author

Choose a reason for hiding this comment

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

same

@@ -94,7 +95,7 @@ void AsyncStreamImpl::encodeTrailers(HeaderMapPtr&& trailers) {

void AsyncStreamImpl::sendHeaders(HeaderMap& headers, bool end_stream) {
headers.insertEnvoyInternalRequest().value(Headers::get().EnvoyInternalRequestValues.True);
headers.insertForwardedFor().value(parent_.config_.local_info_.address());
Utility::appendXff(headers, *parent_.config_.local_info_.address());
Copy link
Member

@RomanDzhabarov RomanDzhabarov Feb 8, 2017

Choose a reason for hiding this comment

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

Is that intended to add address to XFF instead of rewriting one? iirc, if we have 2 addresses in xff, isInternal and other things will not work as expected on the upstream Envoy side, but i might be missing something

Copy link
Member Author

Choose a reason for hiding this comment

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

appendXff now has logic to deal with not appending if not IP address type. Sharing code.

@mattklein123 mattklein123 merged commit 86219a4 into master Feb 8, 2017
@mattklein123 mattklein123 deleted the address_refactor branch February 12, 2017 22:52
rshriram pushed a commit to rshriram/envoy that referenced this pull request Oct 30, 2018
Automatic merge from submit-queue.

[DO NOT MERGE] Auto PR to update dependencies of mixerclient

This PR will be merged automatically once checks are successful.
```release-note
none
```
PiotrSikora added a commit to PiotrSikora/envoy that referenced this pull request Feb 26, 2020
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
istio-testing pushed a commit to istio/envoy that referenced this pull request Feb 27, 2020
… (#166)

* Make callout responses accessible from stream context. (envoyproxy#429)

Signed-off-by: Piotr Sikora <piotrsikora@google.com>

* review: Kick CI.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
jplevyak pushed a commit to jplevyak/envoy that referenced this pull request Apr 13, 2020
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
jpsim pushed a commit that referenced this pull request Nov 28, 2022
Signed-off-by: Mike Schore <mike.schore@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
Signed-off-by: Mike Schore <mike.schore@gmail.com>
Signed-off-by: JP Simard <jp@jpsim.com>
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