appletalk: Reduce switch/case indent
Make the case labels the same indent as the switch. (git diff -w net/appletalk shows no difference) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4e985adaa5
commit
4a9e4b0932
|
@ -779,87 +779,87 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case AARP_REPLY:
|
case AARP_REPLY:
|
||||||
if (!unresolved_count) /* Speed up */
|
if (!unresolved_count) /* Speed up */
|
||||||
break;
|
|
||||||
|
|
||||||
/* Find the entry. */
|
|
||||||
a = __aarp_find_entry(unresolved[hash], dev, &sa);
|
|
||||||
if (!a || dev != a->dev)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* We can fill one in - this is good. */
|
|
||||||
memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
|
|
||||||
__aarp_resolved(&unresolved[hash], a, hash);
|
|
||||||
if (!unresolved_count)
|
|
||||||
mod_timer(&aarp_timer,
|
|
||||||
jiffies + sysctl_aarp_expiry_time);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AARP_REQUEST:
|
/* Find the entry. */
|
||||||
case AARP_PROBE:
|
a = __aarp_find_entry(unresolved[hash], dev, &sa);
|
||||||
|
if (!a || dev != a->dev)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* We can fill one in - this is good. */
|
||||||
|
memcpy(a->hwaddr, ea->hw_src, ETH_ALEN);
|
||||||
|
__aarp_resolved(&unresolved[hash], a, hash);
|
||||||
|
if (!unresolved_count)
|
||||||
|
mod_timer(&aarp_timer,
|
||||||
|
jiffies + sysctl_aarp_expiry_time);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AARP_REQUEST:
|
||||||
|
case AARP_PROBE:
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If it is my address set ma to my address and reply.
|
||||||
|
* We can treat probe and request the same. Probe
|
||||||
|
* simply means we shouldn't cache the querying host,
|
||||||
|
* as in a probe they are proposing an address not
|
||||||
|
* using one.
|
||||||
|
*
|
||||||
|
* Support for proxy-AARP added. We check if the
|
||||||
|
* address is one of our proxies before we toss the
|
||||||
|
* packet out.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sa.s_node = ea->pa_dst_node;
|
||||||
|
sa.s_net = ea->pa_dst_net;
|
||||||
|
|
||||||
|
/* See if we have a matching proxy. */
|
||||||
|
ma = __aarp_proxy_find(dev, &sa);
|
||||||
|
if (!ma)
|
||||||
|
ma = &ifa->address;
|
||||||
|
else { /* We need to make a copy of the entry. */
|
||||||
|
da.s_node = sa.s_node;
|
||||||
|
da.s_net = sa.s_net;
|
||||||
|
ma = &da;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function == AARP_PROBE) {
|
||||||
|
/*
|
||||||
|
* A probe implies someone trying to get an
|
||||||
|
* address. So as a precaution flush any
|
||||||
|
* entries we have for this address.
|
||||||
|
*/
|
||||||
|
a = __aarp_find_entry(resolved[sa.s_node %
|
||||||
|
(AARP_HASH_SIZE - 1)],
|
||||||
|
skb->dev, &sa);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it is my address set ma to my address and reply.
|
* Make it expire next tick - that avoids us
|
||||||
* We can treat probe and request the same. Probe
|
* getting into a probe/flush/learn/probe/
|
||||||
* simply means we shouldn't cache the querying host,
|
* flush/learn cycle during probing of a slow
|
||||||
* as in a probe they are proposing an address not
|
* to respond host addr.
|
||||||
* using one.
|
|
||||||
*
|
|
||||||
* Support for proxy-AARP added. We check if the
|
|
||||||
* address is one of our proxies before we toss the
|
|
||||||
* packet out.
|
|
||||||
*/
|
*/
|
||||||
|
if (a) {
|
||||||
sa.s_node = ea->pa_dst_node;
|
a->expires_at = jiffies - 1;
|
||||||
sa.s_net = ea->pa_dst_net;
|
mod_timer(&aarp_timer, jiffies +
|
||||||
|
sysctl_aarp_tick_time);
|
||||||
/* See if we have a matching proxy. */
|
|
||||||
ma = __aarp_proxy_find(dev, &sa);
|
|
||||||
if (!ma)
|
|
||||||
ma = &ifa->address;
|
|
||||||
else { /* We need to make a copy of the entry. */
|
|
||||||
da.s_node = sa.s_node;
|
|
||||||
da.s_net = sa.s_net;
|
|
||||||
ma = &da;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (function == AARP_PROBE) {
|
if (sa.s_node != ma->s_node)
|
||||||
/*
|
|
||||||
* A probe implies someone trying to get an
|
|
||||||
* address. So as a precaution flush any
|
|
||||||
* entries we have for this address.
|
|
||||||
*/
|
|
||||||
a = __aarp_find_entry(resolved[sa.s_node %
|
|
||||||
(AARP_HASH_SIZE - 1)],
|
|
||||||
skb->dev, &sa);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make it expire next tick - that avoids us
|
|
||||||
* getting into a probe/flush/learn/probe/
|
|
||||||
* flush/learn cycle during probing of a slow
|
|
||||||
* to respond host addr.
|
|
||||||
*/
|
|
||||||
if (a) {
|
|
||||||
a->expires_at = jiffies - 1;
|
|
||||||
mod_timer(&aarp_timer, jiffies +
|
|
||||||
sysctl_aarp_tick_time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sa.s_node != ma->s_node)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (sa.s_net && ma->s_net && sa.s_net != ma->s_net)
|
|
||||||
break;
|
|
||||||
|
|
||||||
sa.s_node = ea->pa_src_node;
|
|
||||||
sa.s_net = ea->pa_src_net;
|
|
||||||
|
|
||||||
/* aarp_my_address has found the address to use for us.
|
|
||||||
*/
|
|
||||||
aarp_send_reply(dev, ma, &sa, ea->hw_src);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (sa.s_net && ma->s_net && sa.s_net != ma->s_net)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sa.s_node = ea->pa_src_node;
|
||||||
|
sa.s_net = ea->pa_src_net;
|
||||||
|
|
||||||
|
/* aarp_my_address has found the address to use for us.
|
||||||
|
*/
|
||||||
|
aarp_send_reply(dev, ma, &sa, ea->hw_src);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
|
|
|
@ -684,192 +684,192 @@ static int atif_ioctl(int cmd, void __user *arg)
|
||||||
atif = atalk_find_dev(dev);
|
atif = atalk_find_dev(dev);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SIOCSIFADDR:
|
case SIOCSIFADDR:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
if (sa->sat_family != AF_APPLETALK)
|
if (sa->sat_family != AF_APPLETALK)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (dev->type != ARPHRD_ETHER &&
|
if (dev->type != ARPHRD_ETHER &&
|
||||||
dev->type != ARPHRD_LOOPBACK &&
|
dev->type != ARPHRD_LOOPBACK &&
|
||||||
dev->type != ARPHRD_LOCALTLK &&
|
dev->type != ARPHRD_LOCALTLK &&
|
||||||
dev->type != ARPHRD_PPP)
|
dev->type != ARPHRD_PPP)
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
|
|
||||||
nr = (struct atalk_netrange *)&sa->sat_zero[0];
|
nr = (struct atalk_netrange *)&sa->sat_zero[0];
|
||||||
add_route = 1;
|
add_route = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if this is a point-to-point iface, and we already
|
* if this is a point-to-point iface, and we already
|
||||||
* have an iface for this AppleTalk address, then we
|
* have an iface for this AppleTalk address, then we
|
||||||
* should not add a route
|
* should not add a route
|
||||||
*/
|
*/
|
||||||
if ((dev->flags & IFF_POINTOPOINT) &&
|
if ((dev->flags & IFF_POINTOPOINT) &&
|
||||||
atalk_find_interface(sa->sat_addr.s_net,
|
atalk_find_interface(sa->sat_addr.s_net,
|
||||||
sa->sat_addr.s_node)) {
|
sa->sat_addr.s_node)) {
|
||||||
printk(KERN_DEBUG "AppleTalk: point-to-point "
|
printk(KERN_DEBUG "AppleTalk: point-to-point "
|
||||||
"interface added with "
|
"interface added with "
|
||||||
"existing address\n");
|
"existing address\n");
|
||||||
add_route = 0;
|
add_route = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Phase 1 is fine on LocalTalk but we don't do
|
* Phase 1 is fine on LocalTalk but we don't do
|
||||||
* EtherTalk phase 1. Anyone wanting to add it go ahead.
|
* EtherTalk phase 1. Anyone wanting to add it go ahead.
|
||||||
*/
|
*/
|
||||||
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
||||||
return -EPROTONOSUPPORT;
|
return -EPROTONOSUPPORT;
|
||||||
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
||||||
sa->sat_addr.s_node == 254)
|
sa->sat_addr.s_node == 254)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (atif) {
|
if (atif) {
|
||||||
/* Already setting address */
|
/* Already setting address */
|
||||||
if (atif->status & ATIF_PROBE)
|
if (atif->status & ATIF_PROBE)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
atif->address.s_net = sa->sat_addr.s_net;
|
atif->address.s_net = sa->sat_addr.s_net;
|
||||||
atif->address.s_node = sa->sat_addr.s_node;
|
atif->address.s_node = sa->sat_addr.s_node;
|
||||||
atrtr_device_down(dev); /* Flush old routes */
|
atrtr_device_down(dev); /* Flush old routes */
|
||||||
} else {
|
} else {
|
||||||
atif = atif_add_device(dev, &sa->sat_addr);
|
atif = atif_add_device(dev, &sa->sat_addr);
|
||||||
if (!atif)
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
atif->nets = *nr;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the chosen address is used. If so we
|
|
||||||
* error and atalkd will try another.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!(dev->flags & IFF_LOOPBACK) &&
|
|
||||||
!(dev->flags & IFF_POINTOPOINT) &&
|
|
||||||
atif_probe_device(atif) < 0) {
|
|
||||||
atif_drop_device(dev);
|
|
||||||
return -EADDRINUSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hey it worked - add the direct routes */
|
|
||||||
sa = (struct sockaddr_at *)&rtdef.rt_gateway;
|
|
||||||
sa->sat_family = AF_APPLETALK;
|
|
||||||
sa->sat_addr.s_net = atif->address.s_net;
|
|
||||||
sa->sat_addr.s_node = atif->address.s_node;
|
|
||||||
sa = (struct sockaddr_at *)&rtdef.rt_dst;
|
|
||||||
rtdef.rt_flags = RTF_UP;
|
|
||||||
sa->sat_family = AF_APPLETALK;
|
|
||||||
sa->sat_addr.s_node = ATADDR_ANYNODE;
|
|
||||||
if (dev->flags & IFF_LOOPBACK ||
|
|
||||||
dev->flags & IFF_POINTOPOINT)
|
|
||||||
rtdef.rt_flags |= RTF_HOST;
|
|
||||||
|
|
||||||
/* Routerless initial state */
|
|
||||||
if (nr->nr_firstnet == htons(0) &&
|
|
||||||
nr->nr_lastnet == htons(0xFFFE)) {
|
|
||||||
sa->sat_addr.s_net = atif->address.s_net;
|
|
||||||
atrtr_create(&rtdef, dev);
|
|
||||||
atrtr_set_default(dev);
|
|
||||||
} else {
|
|
||||||
limit = ntohs(nr->nr_lastnet);
|
|
||||||
if (limit - ntohs(nr->nr_firstnet) > 4096) {
|
|
||||||
printk(KERN_WARNING "Too many routes/"
|
|
||||||
"iface.\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
if (add_route)
|
|
||||||
for (ct = ntohs(nr->nr_firstnet);
|
|
||||||
ct <= limit; ct++) {
|
|
||||||
sa->sat_addr.s_net = htons(ct);
|
|
||||||
atrtr_create(&rtdef, dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dev_mc_add_global(dev, aarp_mcast);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case SIOCGIFADDR:
|
|
||||||
if (!atif)
|
if (!atif)
|
||||||
return -EADDRNOTAVAIL;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
atif->nets = *nr;
|
||||||
|
|
||||||
sa->sat_family = AF_APPLETALK;
|
/*
|
||||||
sa->sat_addr = atif->address;
|
* Check if the chosen address is used. If so we
|
||||||
break;
|
* error and atalkd will try another.
|
||||||
|
*/
|
||||||
|
|
||||||
case SIOCGIFBRDADDR:
|
if (!(dev->flags & IFF_LOOPBACK) &&
|
||||||
if (!atif)
|
!(dev->flags & IFF_POINTOPOINT) &&
|
||||||
return -EADDRNOTAVAIL;
|
atif_probe_device(atif) < 0) {
|
||||||
|
atif_drop_device(dev);
|
||||||
|
return -EADDRINUSE;
|
||||||
|
}
|
||||||
|
|
||||||
sa->sat_family = AF_APPLETALK;
|
/* Hey it worked - add the direct routes */
|
||||||
|
sa = (struct sockaddr_at *)&rtdef.rt_gateway;
|
||||||
|
sa->sat_family = AF_APPLETALK;
|
||||||
|
sa->sat_addr.s_net = atif->address.s_net;
|
||||||
|
sa->sat_addr.s_node = atif->address.s_node;
|
||||||
|
sa = (struct sockaddr_at *)&rtdef.rt_dst;
|
||||||
|
rtdef.rt_flags = RTF_UP;
|
||||||
|
sa->sat_family = AF_APPLETALK;
|
||||||
|
sa->sat_addr.s_node = ATADDR_ANYNODE;
|
||||||
|
if (dev->flags & IFF_LOOPBACK ||
|
||||||
|
dev->flags & IFF_POINTOPOINT)
|
||||||
|
rtdef.rt_flags |= RTF_HOST;
|
||||||
|
|
||||||
|
/* Routerless initial state */
|
||||||
|
if (nr->nr_firstnet == htons(0) &&
|
||||||
|
nr->nr_lastnet == htons(0xFFFE)) {
|
||||||
sa->sat_addr.s_net = atif->address.s_net;
|
sa->sat_addr.s_net = atif->address.s_net;
|
||||||
sa->sat_addr.s_node = ATADDR_BCAST;
|
atrtr_create(&rtdef, dev);
|
||||||
break;
|
atrtr_set_default(dev);
|
||||||
|
} else {
|
||||||
case SIOCATALKDIFADDR:
|
limit = ntohs(nr->nr_lastnet);
|
||||||
case SIOCDIFADDR:
|
if (limit - ntohs(nr->nr_firstnet) > 4096) {
|
||||||
if (!capable(CAP_NET_ADMIN))
|
printk(KERN_WARNING "Too many routes/"
|
||||||
return -EPERM;
|
"iface.\n");
|
||||||
if (sa->sat_family != AF_APPLETALK)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
atalk_dev_down(dev);
|
}
|
||||||
break;
|
if (add_route)
|
||||||
|
for (ct = ntohs(nr->nr_firstnet);
|
||||||
|
ct <= limit; ct++) {
|
||||||
|
sa->sat_addr.s_net = htons(ct);
|
||||||
|
atrtr_create(&rtdef, dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dev_mc_add_global(dev, aarp_mcast);
|
||||||
|
return 0;
|
||||||
|
|
||||||
case SIOCSARP:
|
case SIOCGIFADDR:
|
||||||
if (!capable(CAP_NET_ADMIN))
|
if (!atif)
|
||||||
return -EPERM;
|
return -EADDRNOTAVAIL;
|
||||||
if (sa->sat_family != AF_APPLETALK)
|
|
||||||
return -EINVAL;
|
|
||||||
/*
|
|
||||||
* for now, we only support proxy AARP on ELAP;
|
|
||||||
* we should be able to do it for LocalTalk, too.
|
|
||||||
*/
|
|
||||||
if (dev->type != ARPHRD_ETHER)
|
|
||||||
return -EPROTONOSUPPORT;
|
|
||||||
|
|
||||||
/*
|
sa->sat_family = AF_APPLETALK;
|
||||||
* atif points to the current interface on this network;
|
sa->sat_addr = atif->address;
|
||||||
* we aren't concerned about its current status (at
|
break;
|
||||||
* least for now), but it has all the settings about
|
|
||||||
* the network we're going to probe. Consequently, it
|
|
||||||
* must exist.
|
|
||||||
*/
|
|
||||||
if (!atif)
|
|
||||||
return -EADDRNOTAVAIL;
|
|
||||||
|
|
||||||
nr = (struct atalk_netrange *)&(atif->nets);
|
case SIOCGIFBRDADDR:
|
||||||
/*
|
if (!atif)
|
||||||
* Phase 1 is fine on Localtalk but we don't do
|
return -EADDRNOTAVAIL;
|
||||||
* Ethertalk phase 1. Anyone wanting to add it go ahead.
|
|
||||||
*/
|
|
||||||
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
|
||||||
return -EPROTONOSUPPORT;
|
|
||||||
|
|
||||||
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
sa->sat_family = AF_APPLETALK;
|
||||||
sa->sat_addr.s_node == 254)
|
sa->sat_addr.s_net = atif->address.s_net;
|
||||||
return -EINVAL;
|
sa->sat_addr.s_node = ATADDR_BCAST;
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
case SIOCATALKDIFADDR:
|
||||||
* Check if the chosen address is used. If so we
|
case SIOCDIFADDR:
|
||||||
* error and ATCP will try another.
|
if (!capable(CAP_NET_ADMIN))
|
||||||
*/
|
return -EPERM;
|
||||||
if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
|
if (sa->sat_family != AF_APPLETALK)
|
||||||
return -EADDRINUSE;
|
return -EINVAL;
|
||||||
|
atalk_dev_down(dev);
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
case SIOCSARP:
|
||||||
* We now have an address on the local network, and
|
if (!capable(CAP_NET_ADMIN))
|
||||||
* the AARP code will defend it for us until we take it
|
return -EPERM;
|
||||||
* down. We don't set up any routes right now, because
|
if (sa->sat_family != AF_APPLETALK)
|
||||||
* ATCP will install them manually via SIOCADDRT.
|
return -EINVAL;
|
||||||
*/
|
/*
|
||||||
break;
|
* for now, we only support proxy AARP on ELAP;
|
||||||
|
* we should be able to do it for LocalTalk, too.
|
||||||
|
*/
|
||||||
|
if (dev->type != ARPHRD_ETHER)
|
||||||
|
return -EPROTONOSUPPORT;
|
||||||
|
|
||||||
case SIOCDARP:
|
/*
|
||||||
if (!capable(CAP_NET_ADMIN))
|
* atif points to the current interface on this network;
|
||||||
return -EPERM;
|
* we aren't concerned about its current status (at
|
||||||
if (sa->sat_family != AF_APPLETALK)
|
* least for now), but it has all the settings about
|
||||||
return -EINVAL;
|
* the network we're going to probe. Consequently, it
|
||||||
if (!atif)
|
* must exist.
|
||||||
return -EADDRNOTAVAIL;
|
*/
|
||||||
|
if (!atif)
|
||||||
|
return -EADDRNOTAVAIL;
|
||||||
|
|
||||||
/* give to aarp module to remove proxy entry */
|
nr = (struct atalk_netrange *)&(atif->nets);
|
||||||
aarp_proxy_remove(atif->dev, &(sa->sat_addr));
|
/*
|
||||||
return 0;
|
* Phase 1 is fine on Localtalk but we don't do
|
||||||
|
* Ethertalk phase 1. Anyone wanting to add it go ahead.
|
||||||
|
*/
|
||||||
|
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
||||||
|
return -EPROTONOSUPPORT;
|
||||||
|
|
||||||
|
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
||||||
|
sa->sat_addr.s_node == 254)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if the chosen address is used. If so we
|
||||||
|
* error and ATCP will try another.
|
||||||
|
*/
|
||||||
|
if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
|
||||||
|
return -EADDRINUSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We now have an address on the local network, and
|
||||||
|
* the AARP code will defend it for us until we take it
|
||||||
|
* down. We don't set up any routes right now, because
|
||||||
|
* ATCP will install them manually via SIOCADDRT.
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SIOCDARP:
|
||||||
|
if (!capable(CAP_NET_ADMIN))
|
||||||
|
return -EPERM;
|
||||||
|
if (sa->sat_family != AF_APPLETALK)
|
||||||
|
return -EINVAL;
|
||||||
|
if (!atif)
|
||||||
|
return -EADDRNOTAVAIL;
|
||||||
|
|
||||||
|
/* give to aarp module to remove proxy entry */
|
||||||
|
aarp_proxy_remove(atif->dev, &(sa->sat_addr));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0;
|
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0;
|
||||||
|
@ -884,25 +884,25 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SIOCDELRT:
|
case SIOCDELRT:
|
||||||
if (rt.rt_dst.sa_family != AF_APPLETALK)
|
if (rt.rt_dst.sa_family != AF_APPLETALK)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return atrtr_delete(&((struct sockaddr_at *)
|
return atrtr_delete(&((struct sockaddr_at *)
|
||||||
&rt.rt_dst)->sat_addr);
|
&rt.rt_dst)->sat_addr);
|
||||||
|
|
||||||
case SIOCADDRT: {
|
case SIOCADDRT: {
|
||||||
struct net_device *dev = NULL;
|
struct net_device *dev = NULL;
|
||||||
if (rt.rt_dev) {
|
if (rt.rt_dev) {
|
||||||
char name[IFNAMSIZ];
|
char name[IFNAMSIZ];
|
||||||
if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
|
if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
name[IFNAMSIZ-1] = '\0';
|
name[IFNAMSIZ-1] = '\0';
|
||||||
dev = __dev_get_by_name(&init_net, name);
|
dev = __dev_get_by_name(&init_net, name);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
return atrtr_create(&rt, dev);
|
|
||||||
}
|
}
|
||||||
|
return atrtr_create(&rt, dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue