-
Notifications
You must be signed in to change notification settings - Fork 8.2k
modem: cmux: Handle C/R bit from address field #96617
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
Conversation
105952e to
e09525a
Compare
e09525a to
a4bb1eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a test case for this?
a4bb1eb to
82f3719
Compare
Good idea. ZTEST(modem_cmux, test_modem_cmux_invalid_cr)
{
uint32_t events;
int ret;
/* We are initiator, so any CMD with CR set, should be dropped */
modem_backend_mock_put(&bus_mock, cmux_frame_control_cld_cmd,
sizeof(cmux_frame_control_cld_cmd));
modem_backend_mock_put(&bus_mock, cmux_frame_control_sabm_cmd,
sizeof(cmux_frame_control_sabm_cmd));
events = k_event_wait_all(&cmux_event, (MODEM_CMUX_EVENT_CONNECTED | MODEM_CMUX_EVENT_DISCONNECTED),
false, K_MSEC(100));
zassert_false(events, "Wrong CMD should have been ignored");
}So the mock tries to send Close-Down command and open command, but C/R bit set, so those should be ignored because in the test setup the mock is not an initiator, so C/R should be 0. |
6b374d7 to
63578b8
Compare
63578b8 to
ed88b81
Compare
ed88b81 to
82b2c3a
Compare
The C/R bit in the address field should be handled as explained in 5.2.1.2 in the spec (3GPP TS 127.010). To detect if the frame is a command or a response, we need to know who was the initiator of the CMUX channel. > Initiator is the station that take the initiative to initialize > the multiplexer (i.e. sends the SABM command at DLCI 0 ) See the table from given section of the specification. Also, on UIH frames 5.4.3.1 says > The frames sent by the initiating station have the C/R bit set to 1 > and those sent by the responding station have the C/R bit set to 0. NOTE: This is different than a C/R bit in the Type field. Signed-off-by: Seppo Takalo <[email protected]>
d5aa554
82b2c3a to
d5aa554
Compare
|
Fixed the comment like Tomi suggested. |
|



The C/R bit in the address field should be handled as explained in 5.2.1.2 in the spec (3GPP TS 127.010).
To detect if the frame is a command or a response, we need to know who was the initiator of the CMUX channel.
See the table from given section of the specification.
Also, on UIH frames 5.4.3.1 says
NOTE: This is different than a C/R bit in the Type field.