diff mbox series

[net-next,01/47] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag

Message ID 20230206131620.2758724-2-mkl@pengutronix.de (mailing list archive)
State Accepted
Commit 2a30b2bd01c23a7eeace3a3f82c2817227099805
Delegated to: Netdev Maintainers
Headers show
Series [net-next,01/47] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Pull request is its own cover letter
netdev/patch_count warning Series longer than 15 patches
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 2 maintainers not CCed: edumazet@google.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marc Kleine-Budde Feb. 6, 2023, 1:15 p.m. UTC
From: Oliver Hartkopp <socketcan@hartkopp.net>

To send CAN traffic back to the incoming interface a special flag has to
be set. When creating a routing job for identical interfaces without this
flag the rule is created but has no effect.

This patch adds an error return value in the case that the CAN interfaces
are identical but the CGW_FLAGS_CAN_IIF_TX_OK flag was not set.

Reported-by: Jannik Hartung <jannik.hartung@tu-bs.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230125055407.2053-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/gw.c | 7 +++++++
 1 file changed, 7 insertions(+)


base-commit: 609aa68d60965f70485655def733d533f99b341b

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 7, 2023, 3:30 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Mon,  6 Feb 2023 14:15:34 +0100 you wrote:
> From: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> To send CAN traffic back to the incoming interface a special flag has to
> be set. When creating a routing job for identical interfaces without this
> flag the rule is created but has no effect.
> 
> This patch adds an error return value in the case that the CAN interfaces
> are identical but the CGW_FLAGS_CAN_IIF_TX_OK flag was not set.
> 
> [...]

Here is the summary with links:
  - [net-next,01/47] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag
    https://git.kernel.org/netdev/net-next/c/2a30b2bd01c2
  - [net-next,02/47] can: isotp: check CAN address family in isotp_bind()
    https://git.kernel.org/netdev/net-next/c/c6adf659a8ba
  - [net-next,03/47] can: mcp251xfd: regmap: optimizing transfer size for CRC transfers size 1
    https://git.kernel.org/netdev/net-next/c/2e8ca20b40e5
  - [net-next,04/47] dt-bindings: can: renesas,rcar-canfd: R-Car V3U is R-Car Gen4
    https://git.kernel.org/netdev/net-next/c/e8b98168761f
  - [net-next,05/47] dt-bindings: can: renesas,rcar-canfd: Document R-Car V4H support
    https://git.kernel.org/netdev/net-next/c/3e17dc91c8a3
  - [net-next,06/47] dt-bindings: can: renesas,rcar-canfd: Add transceiver support
    https://git.kernel.org/netdev/net-next/c/a707d44dfb47
  - [net-next,07/47] can: rcar_canfd: Fix R-Car V3U CAN mode selection
    https://git.kernel.org/netdev/net-next/c/0a016639ef92
  - [net-next,08/47] can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses
    https://git.kernel.org/netdev/net-next/c/9be8c5583581
  - [net-next,09/47] can: rcar_canfd: Abstract out DCFG address differences
    https://git.kernel.org/netdev/net-next/c/bbf6681d1f0f
  - [net-next,10/47] can: rcar_canfd: Add support for R-Car Gen4
    https://git.kernel.org/netdev/net-next/c/8716e6e79a14
  - [net-next,11/47] can: rcar_canfd: Fix R-Car Gen4 DCFG.DSJW field width
    https://git.kernel.org/netdev/net-next/c/0424281688f1
  - [net-next,12/47] can: rcar_canfd: Fix R-Car Gen4 CFCC.CFTML field width
    https://git.kernel.org/netdev/net-next/c/3e73d3df4d38
  - [net-next,13/47] can: rcar_canfd: Sort included header files
    https://git.kernel.org/netdev/net-next/c/d506b151bb95
  - [net-next,14/47] can: rcar_canfd: Add helper variable dev
    https://git.kernel.org/netdev/net-next/c/114246e81fc6
  - [net-next,15/47] can: ems_pci: Fix code style, copyright and email address
    https://git.kernel.org/netdev/net-next/c/2b9ed3b9aaee
  - [net-next,16/47] can: ems_pci: Add Asix AX99100 definitions
    https://git.kernel.org/netdev/net-next/c/f5ef4d4f5365
  - [net-next,17/47] can: ems_pci: Initialize BAR registers
    https://git.kernel.org/netdev/net-next/c/f94a4f97f001
  - [net-next,18/47] can: ems_pci: Add read/write register and post irq functions
    https://git.kernel.org/netdev/net-next/c/bb89159ce331
  - [net-next,19/47] can: ems_pci: Initialize CAN controller base addresses
    https://git.kernel.org/netdev/net-next/c/79ca81e700f4
  - [net-next,20/47] can: ems_pci: Add IRQ enable
    https://git.kernel.org/netdev/net-next/c/8b4339f76da7
  - [net-next,21/47] can: ems_pci: Deassert hardware reset
    https://git.kernel.org/netdev/net-next/c/946c4135fd48
  - [net-next,22/47] can: ems_pci: Add myself as module author
    https://git.kernel.org/netdev/net-next/c/d5cd5d7fbd8c
  - [net-next,23/47] can: peak_usb: rename device_id to CAN channel ID
    https://git.kernel.org/netdev/net-next/c/404ffaa95a3e
  - [net-next,24/47] can: peak_usb: add callback to read CAN channel ID of PEAK CAN-FD devices
    https://git.kernel.org/netdev/net-next/c/517ad5e6761f
  - [net-next,25/47] can: peak_usb: allow flashing of the CAN channel ID
    https://git.kernel.org/netdev/net-next/c/e7a7b3d22503
  - [net-next,26/47] can: peak_usb: replace unregister_netdev() with unregister_candev()
    https://git.kernel.org/netdev/net-next/c/e1bd88225243
  - [net-next,27/47] can: peak_usb: add ethtool interface to user-configurable CAN channel identifier
    https://git.kernel.org/netdev/net-next/c/36d007c6fc79
  - [net-next,28/47] can: peak_usb: export PCAN CAN channel ID as sysfs device attribute
    https://git.kernel.org/netdev/net-next/c/6d02f6daeb44
  - [net-next,29/47] can: peak_usb: align CAN channel ID format in log with sysfs attribute
    https://git.kernel.org/netdev/net-next/c/09ce908e50c9
  - [net-next,30/47] can: peak_usb: Reorder include directives alphabetically
    https://git.kernel.org/netdev/net-next/c/73019de17732
  - [net-next,31/47] can: bittiming(): replace open coded variants of can_bit_time()
    https://git.kernel.org/netdev/net-next/c/89cfa6356560
  - [net-next,32/47] can: bittiming: can_fixup_bittiming(): use CAN_SYNC_SEG instead of 1
    https://git.kernel.org/netdev/net-next/c/9cf670dbe69d
  - [net-next,33/47] can: bittiming: can_fixup_bittiming(): set effective tq
    https://git.kernel.org/netdev/net-next/c/52375446f2b5
  - [net-next,34/47] can: bittiming: can_get_bittiming(): use direct return and remove unneeded else
    https://git.kernel.org/netdev/net-next/c/8e0a0b32c4ff
  - [net-next,35/47] can: dev: register_candev(): ensure that bittiming const are valid
    https://git.kernel.org/netdev/net-next/c/d58ac89d0d38
  - [net-next,36/47] can: dev: register_candev(): bail out if both fixed bit rates and bit timing constants are provided
    https://git.kernel.org/netdev/net-next/c/a3db542410af
  - [net-next,37/47] can: netlink: can_validate(): validate sample point for CAN and CAN-FD
    https://git.kernel.org/netdev/net-next/c/73335cfab7fd
  - [net-next,38/47] can: netlink: can_changelink(): convert from netdev_err() to NL_SET_ERR_MSG_FMT()
    https://git.kernel.org/netdev/net-next/c/1494d27f64f0
  - [net-next,39/47] can: bittiming: can_changelink() pass extack down callstack
    https://git.kernel.org/netdev/net-next/c/286c0e09e8e0
  - [net-next,40/47] can: bittiming: factor out can_sjw_set_default() and can_sjw_check()
    https://git.kernel.org/netdev/net-next/c/5988bf737dee
  - [net-next,41/47] can: bittiming: can_fixup_bittiming(): report error via netlink and harmonize error value
    https://git.kernel.org/netdev/net-next/c/de82d6185b82
  - [net-next,42/47] can: bittiming: can_sjw_check(): report error via netlink and harmonize error value
    https://git.kernel.org/netdev/net-next/c/0c017f0910a7
  - [net-next,43/47] can: bittiming: can_sjw_check(): check that SJW is not longer than either Phase Buffer Segment
    https://git.kernel.org/netdev/net-next/c/b5a3d0864ee7
  - [net-next,44/47] can: bittiming: can_sjw_set_default(): use Phase Seg2 / 2 as default for SJW
    https://git.kernel.org/netdev/net-next/c/80bcf5ec9927
  - [net-next,45/47] can: bittiming: can_calc_bittiming(): clean up SJW handling
    https://git.kernel.org/netdev/net-next/c/c7650728a702
  - [net-next,46/47] can: bittiming: can_calc_bittiming(): convert from netdev_err() to NL_SET_ERR_MSG_FMT()
    https://git.kernel.org/netdev/net-next/c/06742086a3d2
  - [net-next,47/47] can: bittiming: can_validate_bitrate(): report error via netlink
    https://git.kernel.org/netdev/net-next/c/6d7934719f26

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/can/gw.c b/net/can/gw.c
index 23a3d89cad81..37528826935e 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -1139,6 +1139,13 @@  static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
 	if (gwj->dst.dev->type != ARPHRD_CAN)
 		goto out;
 
+	/* is sending the skb back to the incoming interface intended? */
+	if (gwj->src.dev == gwj->dst.dev &&
+	    !(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK)) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	ASSERT_RTNL();
 
 	err = cgw_register_filter(net, gwj);