aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index fdfc4b6a6448..e91390533999 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -954,6 +954,29 @@ rollback:
954} 954}
955 955
956/** 956/**
957 * dev_set_alias - change ifalias of a device
958 * @dev: device
959 * @alias: name up to IFALIASZ
960 *
961 * Set ifalias for a device,
962 */
963int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
964{
965 ASSERT_RTNL();
966
967 if (len >= IFALIASZ)
968 return -EINVAL;
969
970 dev->ifalias = krealloc(dev->ifalias, len+1, GFP_KERNEL);
971 if (!dev->ifalias)
972 return -ENOMEM;
973
974 strlcpy(dev->ifalias, alias, len+1);
975 return len;
976}
977
978
979/**
957 * netdev_features_change - device changes features 980 * netdev_features_change - device changes features
958 * @dev: device to cause notification 981 * @dev: device to cause notification
959 * 982 *