Skip to contentSkip to conversation

can-gw: add a variable limit for CAN frame routings

PATCH In review Oliver Hartkopp 1 participant 3 messages Jan 9, 2013 – Jan 11, 2013

Subsystems (2)
lore
Share & tools
lore

Oliver Hartkopp

author maintainer
#0 lore raw

PATCH v3 1/1 can-gw: add a variable limit for CAN frame routings

To prevent a possible misconfiguration (e.g. circular CAN frame routings) limit the number of routings of a single CAN frame to a small variable value.

The limit can be specified by the module parameter 'max_hops' (1..6). The default value is 1 (one hop), according to the original can-gw behaviour.

---

Having the possibility of only a single CAN frame routing (one hop) hinders use-cases for some complex application setups. To enable more than one CAN frame routing process with a single CAN frame (skb) a counter needed to be implemented to prevent an endless frame processing (e.g. due to some kind of misconfiguration).

As the skb control buffer (cb) potentially gets modified by net/sched in the tx path the csum element for IP checksums is re-used for the counter, as CAN frame skbs (ARPHRD_CAN) never contain any kind of checksums (see src comment).

v2: use clamp_t() function from kernel.h to sanitize the new module parameter
v3: use __stringify() to code value definitions only once and use pr_info()

include/uapi/linux/can/gw.h +1 -0
index 8e1db18..ba87697 100644
@@ -44,6 +44,7 @@ enum {
 	CGW_SRC_IF,	/* ifindex of source network interface */
 	CGW_DST_IF,	/* ifindex of destination network interface */
 	CGW_FILTER,	/* specify struct can_filter on source CAN device */
+	CGW_DELETED,	/* number of deleted CAN frames (see max_hops param) */
 	__CGW_MAX
 };
 
net/can/gw.c +50 -16

119 lines not on this page · raw message

author maintainer
#1 lore raw

Hello Marc,

once you applied this patch to your can-next tree, please tell me the git URL before asking Dave to pull it.

I turned out that this extension for can-gw hops enables an additional configuration possibility, i would like to add for the pull request too.

Tnx,
Oliver

Quoted 10 lines · Oliver Hartkopp

To prevent a possible misconfiguration (e.g. circular CAN frame routings) limit the number of routings of a single CAN frame to a small variable value.

The limit can be specified by the module parameter 'max_hops' (1..6). The default value is 1 (one hop), according to the original can-gw behaviour.

---

(..)

author maintainer
#2 lore raw

It fits in the original patch and context very well (only 4 lines more).

I'll send a v4 instead after testing.

Sorry for the noise.

Oliver

Quoted 31 lines · Oliver Hartkopp

Hello Marc,

once you applied this patch to your can-next tree, please tell me the git URL before asking Dave to pull it.

I turned out that this extension for can-gw hops enables an additional configuration possibility, i would like to add for the pull request too.

Tnx,
Oliver

Quoted 10 lines · Oliver Hartkopp

To prevent a possible misconfiguration (e.g. circular CAN frame routings) limit the number of routings of a single CAN frame to a small variable value.

The limit can be specified by the module parameter 'max_hops' (1..6). The default value is 1 (one hop), according to the original can-gw behaviour.

---

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