Skip to contentSkip to conversation

determining client and server on a connection

DISCUSSION Jeff Layton 2 participants 7 messages Jun 20, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

Is there a simpler way to do this that I'm missing?

Also, it looks like this shouldn't be a problem for the msgr2 protocol since the initial exchange doesn't involve sending addresses. Is that the case?

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>
#1 lore raw
Quoted 14 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Quoted 4 lines

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

I'm not sure I follow. The client is the one initiating the connection and the server is the one accepting. Does wireshark not let you tell that?

The addrs are exchanged so that each end can learn what their effective address is, but this is a bit of a hack and not really ideal--hoping to reduce our reliance on this (or drop it entirely) with msgr2.

Quoted 5 lines

Is there a simpler way to do this that I'm missing?

Also, it looks like this shouldn't be a problem for the msgr2 protocol since the initial exchange doesn't involve sending addresses. Is that the case?

It's true that it doesn't include the addr exchange. It doesn't have any other explicit indication in the data flow that tells you who is the client vs server, though, either...

sage

#2 lore raw
Quoted 20 lines · Sage Weil
Quoted 10 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

     http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client

Quoted 8 lines

often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

Quoted 4 lines

I'm not sure I follow.  The client is the one initiating the connection and the server is the one accepting.  Does wireshark not let you tell that?

I don't think so, at least not that I can tell. I'll double-check though.

Quoted 5 lines

The addrs are exchanged so that each end can learn what their effective address is, but this is a bit of a hack and not really ideal--hoping to reduce our reliance on this (or drop it entirely) with msgr2.

Good.

If we do need something along those lines, it would be best to make each peer send the same thing. Right now, the server sends its address and then the address of the client, but the client only sends its own address.

An impartial observer that doesn't see the socket connection has no way to know which end is going to send what. If we had the client and server both send both addresses (or neither) then that makes things _much_ simpler for the dissector.

Quoted 9 lines
Quoted 5 lines

Is there a simpler way to do this that I'm missing?

Also, it looks like this shouldn't be a problem for the msgr2 protocol since the initial exchange doesn't involve sending addresses. Is that the case?

It's true that it doesn't include the addr exchange.  It doesn't have any other explicit indication in the data flow that tells you who is the client vs server, though, either...

If we can avoid sending addresses at all in the initial negotiation, then I think that takes care of the problem.

Signature · 5 lines
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 42 lines · Jeff Layton
Quoted 20 lines · Sage Weil
Quoted 10 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

     http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client

Quoted 8 lines

often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

Quoted 4 lines

I'm not sure I follow.  The client is the one initiating the connection and the server is the one accepting.  Does wireshark not let you tell that?

I don't think so, at least not that I can tell. I'll double-check though.

Quoted 5 lines

The addrs are exchanged so that each end can learn what their effective address is, but this is a bit of a hack and not really ideal--hoping to reduce our reliance on this (or drop it entirely) with msgr2.

Good.

If we do need something along those lines, it would be best to make each peer send the same thing. Right now, the server sends its address and then the address of the client, but the client only sends its own address.

Quoted 4 lines

An impartial observer that doesn't see the socket connection has no way to know which end is going to send what. If we had the client and server both send both addresses (or neither) then that makes things _much_ simpler for the dissector.

Let's maybe change teh msgr2 banner to be 'ceph accept %llx %llx' and 'ceph connect %llx %llx' or similar so that we don't have this problem there?

sage

Quoted 17 lines
Quoted 9 lines
Quoted 5 lines

Is there a simpler way to do this that I'm missing?

Also, it looks like this shouldn't be a problem for the msgr2 protocol since the initial exchange doesn't involve sending addresses. Is that the case?

It's true that it doesn't include the addr exchange.  It doesn't have any other explicit indication in the data flow that tells you who is the client vs server, though, either...

If we can avoid sending addresses at all in the initial negotiation, then I think that takes care of the problem.

Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw
Quoted 48 lines · Sage Weil
Quoted 34 lines · Jeff Layton
Quoted 19 lines · Sage Weil
Quoted 10 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

     http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client

Quoted 8 lines

often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

Quoted 5 lines


I'm not sure I follow.  The client is the one initiating the connection and the server is the one accepting.  Does wireshark not let you tell that?


I don't think so, at least not that I can tell. I'll double-check though.

Quoted 5 lines

The addrs are exchanged so that each end can learn what their effective address is, but this is a bit of a hack and not really ideal--hoping to reduce our reliance on this (or drop it entirely) with msgr2.

Quoted 12 lines


Good.

If we do need something along those lines, it would be best to make each peer send the same thing. Right now, the server sends its address and then the address of the client, but the client only sends its own address.

An impartial observer that doesn't see the socket connection has no way to know which end is going to send what. If we had the client and server both send both addresses (or neither) then that makes things _much_ simpler for the dissector.

Quoted 6 lines

Let's maybe change teh msgr2 banner to be 'ceph accept %llx %llx' and 'ceph connect %llx %llx' or similar so that we don't have this problem there?

sage

Yeah, that'd be fine too.

OTOH, does the connector/acceptor distinction really make any difference? The only time that wireshark cares is when it's dissecting the initial negotiation, because the inital message lengths are different.

I guess it might be nice to know just for informational purposes though...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Is there a simpler way to do this that I'm missing?

Also, it looks like this shouldn't be a problem for the msgr2 protocol since the initial exchange doesn't involve sending addresses. Is that the case?

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines


It's true that it doesn't include the addr exchange.  It doesn't have any other explicit indication in the data flow that tells you who is the client vs server, though, either...


If we can avoid sending addresses at all in the initial negotiation, then I think that takes care of the problem.

--
Jeff Layton <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
Quoted 56 lines · Jeff Layton
Quoted 48 lines · Sage Weil
Quoted 34 lines · Jeff Layton
Quoted 19 lines · Sage Weil
Quoted 10 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

     http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client

Quoted 8 lines

often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Given the way the protocol works, the only way I can see to reliably determine client and server is to read enough bytes to get to the client's address when the server sends it, and see whether it matches the receiver's address/port.

Quoted 5 lines


I'm not sure I follow.  The client is the one initiating the connection and the server is the one accepting.  Does wireshark not let you tell that?


I don't think so, at least not that I can tell. I'll double-check though.

Quoted 5 lines

The addrs are exchanged so that each end can learn what their effective address is, but this is a bit of a hack and not really ideal--hoping to reduce our reliance on this (or drop it entirely) with msgr2.

Quoted 12 lines


Good.

If we do need something along those lines, it would be best to make each peer send the same thing. Right now, the server sends its address and then the address of the client, but the client only sends its own address.

An impartial observer that doesn't see the socket connection has no way to know which end is going to send what. If we had the client and server both send both addresses (or neither) then that makes things _much_ simpler for the dissector.

Quoted 6 lines

Let's maybe change teh msgr2 banner to be 'ceph accept %llx %llx' and 'ceph connect %llx %llx' or similar so that we don't have this problem there?

sage

Quoted 6 lines

Yeah, that'd be fine too.

OTOH, does the connector/acceptor distinction really make any difference? The only time that wireshark cares is when it's dissecting the initial negotiation, because the inital message lengths are different.

Yeah, maybe not...

Quoted 2 lines

I guess it might be nice to know just for informational purposes though...

That's what I'm thinking. The client vs server behave differently, but you'd need to infer it from context. This way it'd be explicit.

sage

A message that is not in the archive (sent off-list or not yet received): CACJqLyYbr1CvSe3svthj9YVSNh9NgNfV-+4rfdjbLjueLtw2Wg@mail.gmail.com

#7 lore raw
Quoted 11 lines · Haomai Wang
Quoted 8 lines · Jeff Layton

Hi! I'm just getting started working with ceph, and decided to tackle fixing up the wireshark dissector which isn't working properly when you use the kernel's fs client.

This page says that the server always sends its banner first:

    http://docs.ceph.com/docs/master/dev/network-protocol/?highlight=protocol

Quoted 8 lines
Quoted 5 lines

...but that's not true with the Linux kernel client. The client and server send their banners and addresses concurrently, and the client often gets there first. The wireshark dissector relies on the server sending its banner first however, so it quickly mixes the two up and things go south from there.

Hmm, actually I also modify this behavior in async msgr(https://github.com/ceph/ceph/pull/9802 last commit). Because I found there is no real logic difference in ordering.

Yeah, sending them concurrently does seem like the right thing to do. There's no reason to serialize them at all, AFAICT. The first draft of the patch is here:

    https://code.wireshark.org/review/#/c/16043/1

It seems to work for me when sniffing both the kernel and FUSE mounts now.

The patch is not terribly pretty, but I think we'll have more work to do in the dissector once msgr2 starts getting closer to being finalized.

Signature · 6 lines
Jeff Layton <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html