Commit 833da12
af_vsock: Assign the vsock transport considering the vsock address flags
[ Upstream commit 7f816984f439dfe24da25032254cb10512900346 ]
The vsock flags field can be set in the connect path (user space app)
and the (listen) receive path (kernel space logic).
When the vsock transport is assigned, the remote CID is used to
distinguish between types of connection.
Use the vsock flags value (in addition to the CID) from the remote
address to decide which vsock transport to assign. For the sibling VMs
use case, all the vsock packets need to be forwarded to the host, so
always assign the guest->host transport if the VMADDR_FLAG_TO_HOST flag
is set. For the other use cases, the vsock transport assignment logic is
not changed.
Changelog
v3 -> v4
* Update the "remote_flags" local variable type to reflect the change of
the "svm_flags" field to be 1 byte in size.
v2 -> v3
* Update bitwise check logic to not compare result to the flag value.
v1 -> v2
* Use bitwise operator to check the vsock flag.
* Use the updated "VMADDR_FLAG_TO_HOST" flag naming.
* Merge the checks for the g2h transport assignment in one "if" block.
Signed-off-by: Andra Paraschiv <[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Stable-dep-of: 687aa0c5581b ("vsock: Fix transport_* TOCTOU")
Signed-off-by: Sasha Levin <[email protected]>1 parent 0e7a8ad commit 833da12
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
| 434 | + | |
| 435 | + | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
| 443 | + | |
442 | 444 | | |
443 | 445 | | |
444 | 446 | | |
| |||
453 | 455 | | |
454 | 456 | | |
455 | 457 | | |
| 458 | + | |
| 459 | + | |
456 | 460 | | |
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
460 | 464 | | |
461 | 465 | | |
462 | 466 | | |
463 | | - | |
| 467 | + | |
| 468 | + | |
464 | 469 | | |
465 | 470 | | |
466 | 471 | | |
| |||
0 commit comments