You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Chao Xu <xu...@gmail.com> on 2016/04/23 04:28:08 UTC

Proposal: NetVC Context

As a proxy, there has two side: client side ( Client <-> Proxy ) and server
side ( Proxy <-> Server ).

Add a new member 'netvc_context' into class NetVConnection to indicate
which side the NetVC working on.

And remove member 'server_addr' from UnixNetVConnection:

{code}
246   // amc - what is this for? Why not use remote_addr or con.addr?
247   IpEndpoint server_addr; /// Server address and port.
{code}

implement new methods get_client_addr() and get_server_addr() on
NetVConnection to instead server_addr. these two methods could get the
right server/client address value by get_local_addr() or get_remote_addr()
depend on netvc_context.

Any Suggestion?

Thanks!

Oknet Xu

Re: Proposal: NetVC Context

Posted by Chao Xu <xu...@gmail.com>.
Hi, dev team

I'm implement the netvc context and remove server_addr from netvc.

The code to evaluate:
https://github.com/apache/trafficserver/compare/master...oknet:patch-8?diff=split&expand=1&name=patch-8

Any suggestion, please.

Thanks!

Oknet Xu

2016-04-25 4:18 GMT+08:00 James Peach <jp...@apache.org>:

>
> > On Apr 22, 2016, at 7:28 PM, Chao Xu <xu...@gmail.com> wrote:
> >
> > As a proxy, there has two side: client side ( Client <-> Proxy ) and
> server
> > side ( Proxy <-> Server ).
>
> Each side would be a separate NetVConnection.
>
> > Add a new member 'netvc_context' into class NetVConnection to indicate
> > which side the NetVC working on.
> >
> > And remove member 'server_addr' from UnixNetVConnection:
> >
> > {code}
> > 246   // amc - what is this for? Why not use remote_addr or con.addr?
> > 247   IpEndpoint server_addr; /// Server address and port.
> > {code}
>
> It looks to me that “server_addr” is set when you connect(2) an outbound
> vc. I think I agree with Alan’s comment that this should probably be
> get_remote_addr().
>
> > implement new methods get_client_addr() and get_server_addr() on
> > NetVConnection to instead server_addr. these two methods could get the
> > right server/client address value by get_local_addr() or
> get_remote_addr()
> > depend on netvc_context.
>
> What problem is this solving? I can see that it would work, but would it
> noticeably clarify anything?
>
> J

Re: Proposal: NetVC Context

Posted by Chao Xu <xu...@gmail.com>.
Hi James,

> Each side would be a separate NetVConnection.

Yes, Each side is a separate NetVC and Socket FD, thus every side has
client and server.

for Client Side Context:

1. if no transparent enabled:
  get_client_addr() = get_remote_addr() is client ip address.
  get_server_addr() = get_local_addr() is ATS service ip address.

2. if tr-in or tr-full enabled:
  get_client_addr() = get_remote_addr() is client ip address.
  get_server_addr() = get_local_addr() is original server ip address.

get_client_addr() always return client ip address in Client Side Context
but get_server_addr() not.

for Server Side Context:

1. if no transparent enabled:
  get_client_addr() = get_local_addr() is ATS service ip address.
  get_server_addr() = get_remote_addr() is original server ip address.

2. if tr-out or tr-full enabled:
  get_client_addr() = get_local_addr() is client ip address.
  get_server_addr() = get_remote_addr() is original server ip address.

get_server_addr() always return original server ip address in Server Side
Context but get_client_addr() not.


> What problem is this solving? I can see that it would work, but would it
noticeably clarify anything?

1. reduce memory space used by NetVConnection. (by remove member
server_addr)
2. it is a wrap to get_local_addr() and get_remote_addr()
3. NetVConnection Context is used to mark a NetVC direction / situation, it
is friendly in Proxy SM design for HttpSM, SpdySM and H2SM.
4. more clearly to get client/oserver ip address:
  we can call CliNetVC->get_client_addr() if we want get client ip in a
server side.
  we can call SvrNetVC->get_server_addr() if we want get original server ip
in a client side.



2016-04-25 4:18 GMT+08:00 James Peach <jp...@apache.org>:

>
> > On Apr 22, 2016, at 7:28 PM, Chao Xu <xu...@gmail.com> wrote:
> >
> > As a proxy, there has two side: client side ( Client <-> Proxy ) and
> server
> > side ( Proxy <-> Server ).
>
> Each side would be a separate NetVConnection.
>
> > Add a new member 'netvc_context' into class NetVConnection to indicate
> > which side the NetVC working on.
> >
> > And remove member 'server_addr' from UnixNetVConnection:
> >
> > {code}
> > 246   // amc - what is this for? Why not use remote_addr or con.addr?
> > 247   IpEndpoint server_addr; /// Server address and port.
> > {code}
>
> It looks to me that “server_addr” is set when you connect(2) an outbound
> vc. I think I agree with Alan’s comment that this should probably be
> get_remote_addr().
>
> > implement new methods get_client_addr() and get_server_addr() on
> > NetVConnection to instead server_addr. these two methods could get the
> > right server/client address value by get_local_addr() or
> get_remote_addr()
> > depend on netvc_context.
>
> What problem is this solving? I can see that it would work, but would it
> noticeably clarify anything?
>
> J

Re: Proposal: NetVC Context

Posted by James Peach <jp...@apache.org>.
> On Apr 22, 2016, at 7:28 PM, Chao Xu <xu...@gmail.com> wrote:
> 
> As a proxy, there has two side: client side ( Client <-> Proxy ) and server
> side ( Proxy <-> Server ).

Each side would be a separate NetVConnection.

> Add a new member 'netvc_context' into class NetVConnection to indicate
> which side the NetVC working on.
> 
> And remove member 'server_addr' from UnixNetVConnection:
> 
> {code}
> 246   // amc - what is this for? Why not use remote_addr or con.addr?
> 247   IpEndpoint server_addr; /// Server address and port.
> {code}

It looks to me that “server_addr” is set when you connect(2) an outbound vc. I think I agree with Alan’s comment that this should probably be get_remote_addr().

> implement new methods get_client_addr() and get_server_addr() on
> NetVConnection to instead server_addr. these two methods could get the
> right server/client address value by get_local_addr() or get_remote_addr()
> depend on netvc_context.

What problem is this solving? I can see that it would work, but would it noticeably clarify anything?

J

Re: Proposal: NetVC Context

Posted by Chao Xu <xu...@gmail.com>.
Hi All,

I have opened a pull request about the NetVC Context proposal to evaluate.

Thanks

Oknet

2016-04-23 10:28 GMT+08:00 Chao Xu <xu...@gmail.com>:

> As a proxy, there has two side: client side ( Client <-> Proxy ) and
> server side ( Proxy <-> Server ).
>
> Add a new member 'netvc_context' into class NetVConnection to indicate
> which side the NetVC working on.
>
> And remove member 'server_addr' from UnixNetVConnection:
>
> {code}
> 246   // amc - what is this for? Why not use remote_addr or con.addr?
> 247   IpEndpoint server_addr; /// Server address and port.
> {code}
>
> implement new methods get_client_addr() and get_server_addr() on
> NetVConnection to instead server_addr. these two methods could get the
> right server/client address value by get_local_addr() or get_remote_addr()
> depend on netvc_context.
>
> Any Suggestion?
>
> Thanks!
>
> Oknet Xu
>