aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-07-11 22:42:31 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 22:45:36 -0400
commit0e06877c6fdbc67b1132be895f995acd1ff30135 (patch)
treeddaba8cddc8a95d23ee18f812c6aba67dd9b1c6f /net/core
parent2d85cba2b272a5201a60966a65a4f8c0bcc0bb71 (diff)
[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 'net/core')
-rw-r--r--net/core/rtnetlink.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7b6b16396745..864cbdf31ed7 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1032,8 +1032,7 @@ replay:
1032 1032
1033 if (ifm->ifi_index || ifm->ifi_flags || ifm->ifi_change) 1033 if (ifm->ifi_index || ifm->ifi_flags || ifm->ifi_change)
1034 return -EOPNOTSUPP; 1034 return -EOPNOTSUPP;
1035 if (tb[IFLA_ADDRESS] || tb[IFLA_BROADCAST] || tb[IFLA_MAP] || 1035 if (tb[IFLA_MAP] || tb[IFLA_MASTER] || tb[IFLA_PROTINFO])
1036 tb[IFLA_MASTER] || tb[IFLA_PROTINFO])
1037 return -EOPNOTSUPP; 1036 return -EOPNOTSUPP;
1038 1037
1039 if (!ops) { 1038 if (!ops) {
@@ -1065,6 +1064,12 @@ replay:
1065 1064
1066 if (tb[IFLA_MTU]) 1065 if (tb[IFLA_MTU])
1067 dev->mtu = nla_get_u32(tb[IFLA_MTU]); 1066 dev->mtu = nla_get_u32(tb[IFLA_MTU]);
1067 if (tb[IFLA_ADDRESS])
1068 memcpy(dev->dev_addr, nla_data(tb[IFLA_ADDRESS]),
1069 nla_len(tb[IFLA_ADDRESS]));
1070 if (tb[IFLA_BROADCAST])
1071 memcpy(dev->broadcast, nla_data(tb[IFLA_BROADCAST]),
1072 nla_len(tb[IFLA_BROADCAST]));
1068 if (tb[IFLA_TXQLEN]) 1073 if (tb[IFLA_TXQLEN])
1069 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 1074 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
1070 if (tb[IFLA_WEIGHT]) 1075 if (tb[IFLA_WEIGHT])