"Owned" fallout

Stef Walter stefw at redhat.com
Thu Jun 18 13:01:00 UTC 2015


This is really the sorta thing we should discuss on cockpit-devel. I'll
CC the email.

For anyone following along, there was an addition to the dbus-json3
channel in the cockpit transport protocol that broke connecting from
earlier versions cockpit.js to later versions of cockpit-bridge.

On 18.06.2015 03:17, Marius Vollmer wrote:
> Peter Volpe <pvolpe at redhat.com> writes:
> 
>> As Stef brought up on IRC we already have channel options for optional
>> behavior so my plan is
>>
>> 1) Add a permissive_client boolean with a default value of false to
>> the dbus channel options here:
>> https://github.com/cockpit-project/cockpit/blob/master/src/bridge/cockpitdbusjson.c#L1918.
>> Only when that is true will we send the owned message.
> 
> Hmm, I was thinking that we add a flag explicitly for the "owner"
> protocol addition.
> 
> Once we have feature negotiation, I think we should not ignore unknown
> messages anymore.  It is better to know whether or not your peer will
> understand a specific message and adapt to it.

The entire protocol is based around ignoring stuff it doesn't know
about. This starts with fields in JSON open messages ... new control
messages and so on.

For stuff that is defined, the behavior is usually strictly defined, but
unknown stuff is ignored.

Hence the need for a 'caps' or 'capabilities' field so that the caller
can enforce that the callee understands some new aspect of a payload or
protocol.

> For the "owner" message, this doesn't make a big difference, but for
> other protocol additions, the bridge or the JS might want to choose
> between alternatives based on the capabilities of the peer.

Right exactly. This case seems not to require that the callee
understands about it.

It seems to me that this is primarily a bug fix, first and foremost. The
cockpit.js code should not have thrown a fit when it got an unknown message.

>> 2) Add a capabilities property to cockpitchannel and close the channel
>> if there is no match in cockpit_channel_real_prepare
> 
> Do we need to have generic logic for detecting incompatibilities once we
> have feature/capabilities exchange?  In fact, the point is to avoid
> incompatibilities, and there should ideally never be a reason to close a
> channel, no?

Not sure I understand. It's the same mechanism.

> So, without actually digging into it and verifying the feasibility, what
> about this:
> 
> - DBusClient adds { notify_owner: true } to the open command and
>   understands "owner" messages.  It still aborts on unknown messages.
> 
> - The bridge only sends "owner" messages when "notify_owner" is true.
> 
> This ought to fix the immediate problem, no?  (Old bridges will ignore
> "notify_owner", and old clients wont set it.)

Right, that's what Peter was talking about earlier. Although he was
suggesting we fix at a lower level. Fixing the dbus-json3 protocol to
have better behavior about ignoring unknown messages.

> With this in place, we can design a more general solution more
> carefully.  It would require two way feature exchange, I think, and we
> probably want to do it in a generic way for all payloads.

That's exactly what the "caps" stuff is.

> Features would be static and per payload for a given bridge executable
> and a given cockpit.js file.
> 
> For example, the bridge might announce "can-notify-owner" for the
> dbus-json3 payload so that the client knows whether it will actually get
> the notifications or not.  (And the client announces "want-notify-owner"
> to tell the bridge to actually send them.)
> 
> What about inventing a new payload type just for feature exchange?  Old
> bridges without features will reject that payload, which we can
> interpret that as "no features".

I think that's exactly what the "caps" stuff is. Except for to keep it
simple, it's just one way. The caller tells the callee what it requires
... and the callee closes the channel if it doesn't understand one of
the requirements.

We don't need to get more complicated than that, as we already have
optional/ignored fields in open messages that can be used in cases where
the feature is requested but not required.

Stef



More information about the cockpit-devel mailing list