Skip to content

Commit

Permalink
[RTNETLINK] Fix RTM_MAX to represent the maximum valid message type
Browse files Browse the repository at this point in the history
RTM_MAX is currently set to the maximum reserverd message type plus one
thus being the cause of two bugs for new types being assigned a) given the
new family registers only the NEW command in its reserved block the array
size for per family entries is calculated one entry short and b) given the
new family registers all commands RTM_MAX would point to the first entry
of the block following this one and the rtnetlink receive path would accept
a message type for a nonexisting family.

This patch changes RTM_MAX to point to the maximum valid message type
by aligning it to the start of the next block and subtracting one.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Thomas Graf authored and David S. Miller committed May 3, 2005
1 parent 492b558 commit d775fc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/linux/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ enum {
RTM_GETANYCAST = 62,
#define RTM_GETANYCAST RTM_GETANYCAST

RTM_MAX,
#define RTM_MAX RTM_MAX
__RTM_MAX,
#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
};

/*
Expand Down

0 comments on commit d775fc0

Please sign in to comment.