diff options
author | Patrick McHardy <kaber@trash.net> | 2007-07-12 04:42:31 +0200 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-12 04:45:36 +0200 |
commit | 0e06877c6fdbc67b1132be895f995acd1ff30135 (patch) | |
tree | ddaba8cddc8a95d23ee18f812c6aba67dd9b1c6f /drivers/net/ifb.c | |
parent | [RTNETLINK]: rtnl_link API simplification (diff) | |
download | linux-0e06877c6fdbc67b1132be895f995acd1ff30135.tar.xz linux-0e06877c6fdbc67b1132be895f995acd1ff30135.zip |
[RTNETLINK]: rtnl_link: allow specifying initial device address
Drivers need to validate the initial addresses in their netlink attribute
validation function or manually reject them if they can't support this.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ifb.c')
-rw-r--r-- | drivers/net/ifb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index c8e7c8f6ba3e..f5c3598e59af 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -221,10 +221,22 @@ static int ifb_open(struct net_device *dev) return 0; } +static int ifb_validate(struct nlattr *tb[], struct nlattr *data[]) +{ + if (tb[IFLA_ADDRESS]) { + if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) + return -EINVAL; + if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) + return -EADDRNOTAVAIL; + } + return 0; +} + static struct rtnl_link_ops ifb_link_ops __read_mostly = { .kind = "ifb", .priv_size = sizeof(struct ifb_private), .setup = ifb_setup, + .validate = ifb_validate, }; /* Number of ifb devices to be set up by this module. */ |