Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351696
b: refs/heads/master
c: e6afa00
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Hartkopp authored and Marc Kleine-Budde committed Jan 26, 2013
1 parent 8df5075 commit 1daf1f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be286bafe1f4069094865264f29805854c5788bf
refs/heads/master: e6afa00a1409bc3bceed9ccb33111519463dfe7b
1 change: 1 addition & 0 deletions trunk/include/uapi/linux/can/gw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
12 changes: 11 additions & 1 deletion trunk/net/can/gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct cgw_job {
struct rcu_head rcu;
u32 handled_frames;
u32 dropped_frames;
u32 deleted_frames;
struct cf_mod mod;
union {
/* CAN frame data source */
Expand Down Expand Up @@ -367,8 +368,11 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)

BUG_ON(skb->ip_summed != CHECKSUM_UNNECESSARY);

if (cgw_hops(skb) >= max_hops)
if (cgw_hops(skb) >= max_hops) {
/* indicate deleted frames due to misconfiguration */
gwj->deleted_frames++;
return;
}

if (!(gwj->dst.dev->flags & IFF_UP)) {
gwj->dropped_frames++;
Expand Down Expand Up @@ -500,6 +504,11 @@ static int cgw_put_job(struct sk_buff *skb, struct cgw_job *gwj, int type,
goto cancel;
}

if (gwj->deleted_frames) {
if (nla_put_u32(skb, CGW_DELETED, gwj->deleted_frames) < 0)
goto cancel;
}

/* check non default settings of attributes */

if (gwj->mod.modtype.and) {
Expand Down Expand Up @@ -799,6 +808,7 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh,

gwj->handled_frames = 0;
gwj->dropped_frames = 0;
gwj->deleted_frames = 0;
gwj->flags = r->flags;
gwj->gwtype = r->gwtype;

Expand Down

0 comments on commit 1daf1f2

Please sign in to comment.