Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=51055be81c3cb14d0165a7432b787098b817fd35
Commit:     51055be81c3cb14d0165a7432b787098b817fd35
Parent:     ef7c79ed645f52bcbdd88f8d54a9702c4d3fd15d
Author:     Patrick McHardy <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 5 12:40:01 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Jun 7 13:40:11 2007 -0700

    [RTNETLINK]: ifindex 0 does not exist
    
    ifindex == 0 does not exist and implies we should do a lookup by name if
    one was given.
    
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/core/rtnetlink.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a8a5093..02e8bf0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -580,7 +580,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct 
nlmsghdr *nlh, void *arg)
 
        err = -EINVAL;
        ifm = nlmsg_data(nlh);
-       if (ifm->ifi_index >= 0)
+       if (ifm->ifi_index > 0)
                dev = dev_get_by_index(ifm->ifi_index);
        else if (tb[IFLA_IFNAME])
                dev = dev_get_by_name(ifname);
@@ -672,7 +672,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct 
nlmsghdr *nlh, void *arg)
         * name provided implies that a name change has been
         * requested.
         */
-       if (ifm->ifi_index >= 0 && ifname[0]) {
+       if (ifm->ifi_index > 0 && ifname[0]) {
                err = dev_change_name(dev, ifname);
                if (err < 0)
                        goto errout_dev;
@@ -740,7 +740,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct 
nlmsghdr* nlh, void *arg)
                return err;
 
        ifm = nlmsg_data(nlh);
-       if (ifm->ifi_index >= 0) {
+       if (ifm->ifi_index > 0) {
                dev = dev_get_by_index(ifm->ifi_index);
                if (dev == NULL)
                        return -ENODEV;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to