forked from luck/tmp_suning_uos_patched
[IPV4]: cleanup
Add whitespace around keywords. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1ac58ee37f
commit
132adf5463
|
@ -1339,7 +1339,7 @@ static int __init inet_init(void)
|
|||
* Initialise per-cpu ipv4 mibs
|
||||
*/
|
||||
|
||||
if(init_ipv4_mibs())
|
||||
if (init_ipv4_mibs())
|
||||
printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); ;
|
||||
|
||||
ipv4_proc_init();
|
||||
|
|
|
@ -1178,7 +1178,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
|
|||
goto out;
|
||||
}
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case SIOCDARP:
|
||||
err = arp_req_delete(&r, dev);
|
||||
break;
|
||||
|
|
|
@ -1174,7 +1174,7 @@ static int cipso_v4_map_cat_rng_ntoh(const struct cipso_v4_doi *doi_def,
|
|||
u16 cat_low;
|
||||
u16 cat_high;
|
||||
|
||||
for(net_iter = 0; net_iter < net_cat_len; net_iter += 4) {
|
||||
for (net_iter = 0; net_iter < net_cat_len; net_iter += 4) {
|
||||
cat_high = ntohs(*((__be16 *)&net_cat[net_iter]));
|
||||
if ((net_iter + 4) <= net_cat_len)
|
||||
cat_low = ntohs(*((__be16 *)&net_cat[net_iter + 2]));
|
||||
|
|
|
@ -633,7 +633,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
|||
dev_load(ifr.ifr_name);
|
||||
#endif
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case SIOCGIFADDR: /* Get interface address */
|
||||
case SIOCGIFBRDADDR: /* Get the broadcast address */
|
||||
case SIOCGIFDSTADDR: /* Get the destination address */
|
||||
|
@ -708,7 +708,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
|||
if (!ifa && cmd != SIOCSIFADDR && cmd != SIOCSIFFLAGS)
|
||||
goto done;
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case SIOCGIFADDR: /* Get interface address */
|
||||
sin->sin_addr.s_addr = ifa->ifa_local;
|
||||
goto rarok;
|
||||
|
|
|
@ -350,11 +350,10 @@ static void __tnode_free_rcu(struct rcu_head *head)
|
|||
|
||||
static inline void tnode_free(struct tnode *tn)
|
||||
{
|
||||
if(IS_LEAF(tn)) {
|
||||
if (IS_LEAF(tn)) {
|
||||
struct leaf *l = (struct leaf *) tn;
|
||||
call_rcu_bh(&l->rcu, __leaf_free_rcu);
|
||||
}
|
||||
else
|
||||
} else
|
||||
call_rcu(&tn->rcu, __tnode_free_rcu);
|
||||
}
|
||||
|
||||
|
@ -553,7 +552,7 @@ static struct node *resize(struct trie *t, struct tnode *tn)
|
|||
|
||||
/* Keep root node larger */
|
||||
|
||||
if(!tn->parent)
|
||||
if (!tn->parent)
|
||||
inflate_threshold_use = inflate_threshold_root;
|
||||
else
|
||||
inflate_threshold_use = inflate_threshold;
|
||||
|
@ -584,7 +583,7 @@ static struct node *resize(struct trie *t, struct tnode *tn)
|
|||
|
||||
/* Keep root node larger */
|
||||
|
||||
if(!tn->parent)
|
||||
if (!tn->parent)
|
||||
halve_threshold_use = halve_threshold_root;
|
||||
else
|
||||
halve_threshold_use = halve_threshold;
|
||||
|
@ -2039,12 +2038,12 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter,
|
|||
{
|
||||
struct node *n ;
|
||||
|
||||
if(!t)
|
||||
if (!t)
|
||||
return NULL;
|
||||
|
||||
n = rcu_dereference(t->trie);
|
||||
|
||||
if(!iter)
|
||||
if (!iter)
|
||||
return NULL;
|
||||
|
||||
if (n) {
|
||||
|
@ -2084,7 +2083,7 @@ static void trie_collect_stats(struct trie *t, struct trie_stat *s)
|
|||
int i;
|
||||
|
||||
s->tnodes++;
|
||||
if(tn->bits < MAX_STAT_DEPTH)
|
||||
if (tn->bits < MAX_STAT_DEPTH)
|
||||
s->nodesizes[tn->bits]++;
|
||||
|
||||
for (i = 0; i < (1<<tn->bits); i++)
|
||||
|
@ -2250,7 +2249,7 @@ static inline const char *rtn_scope(enum rt_scope_t s)
|
|||
{
|
||||
static char buf[32];
|
||||
|
||||
switch(s) {
|
||||
switch (s) {
|
||||
case RT_SCOPE_UNIVERSE: return "universe";
|
||||
case RT_SCOPE_SITE: return "site";
|
||||
case RT_SCOPE_LINK: return "link";
|
||||
|
|
|
@ -184,7 +184,7 @@ static __inline__ struct ipq *frag_alloc_queue(void)
|
|||
{
|
||||
struct ipq *qp = kmalloc(sizeof(struct ipq), GFP_ATOMIC);
|
||||
|
||||
if(!qp)
|
||||
if (!qp)
|
||||
return NULL;
|
||||
atomic_add(sizeof(struct ipq), &ip_frag_mem);
|
||||
return qp;
|
||||
|
@ -321,11 +321,11 @@ static struct ipq *ip_frag_intern(struct ipq *qp_in)
|
|||
* promoted read lock to write lock.
|
||||
*/
|
||||
hlist_for_each_entry(qp, n, &ipq_hash[hash], list) {
|
||||
if(qp->id == qp_in->id &&
|
||||
qp->saddr == qp_in->saddr &&
|
||||
qp->daddr == qp_in->daddr &&
|
||||
qp->protocol == qp_in->protocol &&
|
||||
qp->user == qp_in->user) {
|
||||
if (qp->id == qp_in->id &&
|
||||
qp->saddr == qp_in->saddr &&
|
||||
qp->daddr == qp_in->daddr &&
|
||||
qp->protocol == qp_in->protocol &&
|
||||
qp->user == qp_in->user) {
|
||||
atomic_inc(&qp->refcnt);
|
||||
write_unlock(&ipfrag_lock);
|
||||
qp_in->last_in |= COMPLETE;
|
||||
|
@ -398,11 +398,11 @@ static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
|
|||
read_lock(&ipfrag_lock);
|
||||
hash = ipqhashfn(id, saddr, daddr, protocol);
|
||||
hlist_for_each_entry(qp, n, &ipq_hash[hash], list) {
|
||||
if(qp->id == id &&
|
||||
qp->saddr == saddr &&
|
||||
qp->daddr == daddr &&
|
||||
qp->protocol == protocol &&
|
||||
qp->user == user) {
|
||||
if (qp->id == id &&
|
||||
qp->saddr == saddr &&
|
||||
qp->daddr == daddr &&
|
||||
qp->protocol == protocol &&
|
||||
qp->user == user) {
|
||||
atomic_inc(&qp->refcnt);
|
||||
read_unlock(&ipfrag_lock);
|
||||
return qp;
|
||||
|
@ -524,7 +524,7 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
|
|||
* this fragment, right?
|
||||
*/
|
||||
prev = NULL;
|
||||
for(next = qp->fragments; next != NULL; next = next->next) {
|
||||
for (next = qp->fragments; next != NULL; next = next->next) {
|
||||
if (FRAG_CB(next)->offset >= offset)
|
||||
break; /* bingo! */
|
||||
prev = next;
|
||||
|
@ -627,7 +627,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
|
|||
ihlen = head->nh.iph->ihl*4;
|
||||
len = ihlen + qp->len;
|
||||
|
||||
if(len > 65535)
|
||||
if (len > 65535)
|
||||
goto out_oversize;
|
||||
|
||||
/* Head of list must not be cloned. */
|
||||
|
|
|
@ -566,7 +566,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
|
|||
* Keep copying data until we run out.
|
||||
*/
|
||||
|
||||
while(left > 0) {
|
||||
while (left > 0) {
|
||||
len = left;
|
||||
/* IF: it doesn't fit, use 'mtu' - the data space left */
|
||||
if (len > mtu)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -782,7 +782,7 @@ static void __init ic_do_bootp_ext(u8 *ext)
|
|||
u8 *c;
|
||||
|
||||
printk("DHCP/BOOTP: Got extension %d:",*ext);
|
||||
for(c=ext+2; c<ext+2+ext[1]; c++)
|
||||
for (c=ext+2; c<ext+2+ext[1]; c++)
|
||||
printk(" %02x", *c);
|
||||
printk("\n");
|
||||
#endif
|
||||
|
@ -1094,7 +1094,7 @@ static int __init ic_dynamic(void)
|
|||
retries = CONF_SEND_RETRIES;
|
||||
get_random_bytes(&timeout, sizeof(timeout));
|
||||
timeout = CONF_BASE_TIMEOUT + (timeout % (unsigned) CONF_TIMEOUT_RANDOM);
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
#ifdef IPCONFIG_BOOTP
|
||||
if (do_bootp && (d->able & IC_BOOTP))
|
||||
ic_bootp_send_if(d, jiffies - start_jiffies);
|
||||
|
|
303
net/ipv4/ipmr.c
303
net/ipv4/ipmr.c
|
@ -302,7 +302,7 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
|
|||
|
||||
atomic_dec(&cache_resolve_queue_len);
|
||||
|
||||
while((skb=skb_dequeue(&c->mfc_un.unres.unresolved))) {
|
||||
while ((skb=skb_dequeue(&c->mfc_un.unres.unresolved))) {
|
||||
if (skb->nh.iph->version == 0) {
|
||||
struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
|
||||
nlh->nlmsg_type = NLMSG_ERROR;
|
||||
|
@ -479,7 +479,7 @@ static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
|
|||
static struct mfc_cache *ipmr_cache_alloc(void)
|
||||
{
|
||||
struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
|
||||
if(c==NULL)
|
||||
if (c==NULL)
|
||||
return NULL;
|
||||
c->mfc_un.res.minvif = MAXVIFS;
|
||||
return c;
|
||||
|
@ -488,7 +488,7 @@ static struct mfc_cache *ipmr_cache_alloc(void)
|
|||
static struct mfc_cache *ipmr_cache_alloc_unres(void)
|
||||
{
|
||||
struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
|
||||
if(c==NULL)
|
||||
if (c==NULL)
|
||||
return NULL;
|
||||
skb_queue_head_init(&c->mfc_un.unres.unresolved);
|
||||
c->mfc_un.unres.expires = jiffies + 10*HZ;
|
||||
|
@ -508,7 +508,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
|
|||
* Play the pending entries through our router
|
||||
*/
|
||||
|
||||
while((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) {
|
||||
while ((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) {
|
||||
if (skb->nh.iph->version == 0) {
|
||||
struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
|
||||
|
||||
|
@ -551,7 +551,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
|
|||
#endif
|
||||
skb = alloc_skb(128, GFP_ATOMIC);
|
||||
|
||||
if(!skb)
|
||||
if (!skb)
|
||||
return -ENOBUFS;
|
||||
|
||||
#ifdef CONFIG_IP_PIMSM
|
||||
|
@ -734,7 +734,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!MULTICAST(mfc->mfcc_mcastgrp.s_addr))
|
||||
if (!MULTICAST(mfc->mfcc_mcastgrp.s_addr))
|
||||
return -EINVAL;
|
||||
|
||||
c=ipmr_cache_alloc();
|
||||
|
@ -788,7 +788,7 @@ static void mroute_clean_tables(struct sock *sk)
|
|||
/*
|
||||
* Shut down all active vif entries
|
||||
*/
|
||||
for(i=0; i<maxvif; i++) {
|
||||
for (i=0; i<maxvif; i++) {
|
||||
if (!(vif_table[i].flags&VIFF_STATIC))
|
||||
vif_delete(i);
|
||||
}
|
||||
|
@ -858,119 +858,117 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
|
|||
struct vifctl vif;
|
||||
struct mfcctl mfc;
|
||||
|
||||
if(optname!=MRT_INIT)
|
||||
{
|
||||
if(sk!=mroute_socket && !capable(CAP_NET_ADMIN))
|
||||
if (optname != MRT_INIT) {
|
||||
if (sk != mroute_socket && !capable(CAP_NET_ADMIN))
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
switch(optname)
|
||||
{
|
||||
case MRT_INIT:
|
||||
if (sk->sk_type != SOCK_RAW ||
|
||||
inet_sk(sk)->num != IPPROTO_IGMP)
|
||||
return -EOPNOTSUPP;
|
||||
if(optlen!=sizeof(int))
|
||||
return -ENOPROTOOPT;
|
||||
switch (optname) {
|
||||
case MRT_INIT:
|
||||
if (sk->sk_type != SOCK_RAW ||
|
||||
inet_sk(sk)->num != IPPROTO_IGMP)
|
||||
return -EOPNOTSUPP;
|
||||
if (optlen!=sizeof(int))
|
||||
return -ENOPROTOOPT;
|
||||
|
||||
rtnl_lock();
|
||||
if (mroute_socket) {
|
||||
rtnl_unlock();
|
||||
return -EADDRINUSE;
|
||||
}
|
||||
|
||||
ret = ip_ra_control(sk, 1, mrtsock_destruct);
|
||||
if (ret == 0) {
|
||||
write_lock_bh(&mrt_lock);
|
||||
mroute_socket=sk;
|
||||
write_unlock_bh(&mrt_lock);
|
||||
|
||||
ipv4_devconf.mc_forwarding++;
|
||||
}
|
||||
rtnl_lock();
|
||||
if (mroute_socket) {
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
case MRT_DONE:
|
||||
if (sk!=mroute_socket)
|
||||
return -EACCES;
|
||||
return ip_ra_control(sk, 0, NULL);
|
||||
case MRT_ADD_VIF:
|
||||
case MRT_DEL_VIF:
|
||||
if(optlen!=sizeof(vif))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&vif,optval,sizeof(vif)))
|
||||
return -EFAULT;
|
||||
if(vif.vifc_vifi >= MAXVIFS)
|
||||
return -ENFILE;
|
||||
rtnl_lock();
|
||||
if (optname==MRT_ADD_VIF) {
|
||||
ret = vif_add(&vif, sk==mroute_socket);
|
||||
} else {
|
||||
ret = vif_delete(vif.vifc_vifi);
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
return -EADDRINUSE;
|
||||
}
|
||||
|
||||
ret = ip_ra_control(sk, 1, mrtsock_destruct);
|
||||
if (ret == 0) {
|
||||
write_lock_bh(&mrt_lock);
|
||||
mroute_socket=sk;
|
||||
write_unlock_bh(&mrt_lock);
|
||||
|
||||
ipv4_devconf.mc_forwarding++;
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
case MRT_DONE:
|
||||
if (sk!=mroute_socket)
|
||||
return -EACCES;
|
||||
return ip_ra_control(sk, 0, NULL);
|
||||
case MRT_ADD_VIF:
|
||||
case MRT_DEL_VIF:
|
||||
if (optlen!=sizeof(vif))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&vif,optval,sizeof(vif)))
|
||||
return -EFAULT;
|
||||
if (vif.vifc_vifi >= MAXVIFS)
|
||||
return -ENFILE;
|
||||
rtnl_lock();
|
||||
if (optname==MRT_ADD_VIF) {
|
||||
ret = vif_add(&vif, sk==mroute_socket);
|
||||
} else {
|
||||
ret = vif_delete(vif.vifc_vifi);
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Manipulate the forwarding caches. These live
|
||||
* in a sort of kernel/user symbiosis.
|
||||
*/
|
||||
case MRT_ADD_MFC:
|
||||
case MRT_DEL_MFC:
|
||||
if(optlen!=sizeof(mfc))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&mfc,optval, sizeof(mfc)))
|
||||
return -EFAULT;
|
||||
rtnl_lock();
|
||||
if (optname==MRT_DEL_MFC)
|
||||
ret = ipmr_mfc_delete(&mfc);
|
||||
else
|
||||
ret = ipmr_mfc_add(&mfc, sk==mroute_socket);
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
case MRT_ADD_MFC:
|
||||
case MRT_DEL_MFC:
|
||||
if (optlen!=sizeof(mfc))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&mfc,optval, sizeof(mfc)))
|
||||
return -EFAULT;
|
||||
rtnl_lock();
|
||||
if (optname==MRT_DEL_MFC)
|
||||
ret = ipmr_mfc_delete(&mfc);
|
||||
else
|
||||
ret = ipmr_mfc_add(&mfc, sk==mroute_socket);
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
/*
|
||||
* Control PIM assert.
|
||||
*/
|
||||
case MRT_ASSERT:
|
||||
{
|
||||
int v;
|
||||
if(get_user(v,(int __user *)optval))
|
||||
return -EFAULT;
|
||||
mroute_do_assert=(v)?1:0;
|
||||
return 0;
|
||||
}
|
||||
case MRT_ASSERT:
|
||||
{
|
||||
int v;
|
||||
if (get_user(v,(int __user *)optval))
|
||||
return -EFAULT;
|
||||
mroute_do_assert=(v)?1:0;
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_IP_PIMSM
|
||||
case MRT_PIM:
|
||||
{
|
||||
int v, ret;
|
||||
if(get_user(v,(int __user *)optval))
|
||||
return -EFAULT;
|
||||
v = (v)?1:0;
|
||||
rtnl_lock();
|
||||
ret = 0;
|
||||
if (v != mroute_do_pim) {
|
||||
mroute_do_pim = v;
|
||||
mroute_do_assert = v;
|
||||
case MRT_PIM:
|
||||
{
|
||||
int v, ret;
|
||||
if (get_user(v,(int __user *)optval))
|
||||
return -EFAULT;
|
||||
v = (v)?1:0;
|
||||
rtnl_lock();
|
||||
ret = 0;
|
||||
if (v != mroute_do_pim) {
|
||||
mroute_do_pim = v;
|
||||
mroute_do_assert = v;
|
||||
#ifdef CONFIG_IP_PIMSM_V2
|
||||
if (mroute_do_pim)
|
||||
ret = inet_add_protocol(&pim_protocol,
|
||||
IPPROTO_PIM);
|
||||
else
|
||||
ret = inet_del_protocol(&pim_protocol,
|
||||
IPPROTO_PIM);
|
||||
if (ret < 0)
|
||||
ret = -EAGAIN;
|
||||
if (mroute_do_pim)
|
||||
ret = inet_add_protocol(&pim_protocol,
|
||||
IPPROTO_PIM);
|
||||
else
|
||||
ret = inet_del_protocol(&pim_protocol,
|
||||
IPPROTO_PIM);
|
||||
if (ret < 0)
|
||||
ret = -EAGAIN;
|
||||
#endif
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Spurious command, or MRT_VERSION which you cannot
|
||||
* set.
|
||||
*/
|
||||
default:
|
||||
return -ENOPROTOOPT;
|
||||
/*
|
||||
* Spurious command, or MRT_VERSION which you cannot
|
||||
* set.
|
||||
*/
|
||||
default:
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -983,7 +981,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
|
|||
int olr;
|
||||
int val;
|
||||
|
||||
if(optname!=MRT_VERSION &&
|
||||
if (optname!=MRT_VERSION &&
|
||||
#ifdef CONFIG_IP_PIMSM
|
||||
optname!=MRT_PIM &&
|
||||
#endif
|
||||
|
@ -997,17 +995,17 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
|
|||
if (olr < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if(put_user(olr,optlen))
|
||||
if (put_user(olr,optlen))
|
||||
return -EFAULT;
|
||||
if(optname==MRT_VERSION)
|
||||
if (optname==MRT_VERSION)
|
||||
val=0x0305;
|
||||
#ifdef CONFIG_IP_PIMSM
|
||||
else if(optname==MRT_PIM)
|
||||
else if (optname==MRT_PIM)
|
||||
val=mroute_do_pim;
|
||||
#endif
|
||||
else
|
||||
val=mroute_do_assert;
|
||||
if(copy_to_user(optval,&val,olr))
|
||||
if (copy_to_user(optval,&val,olr))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1023,48 +1021,47 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
|
|||
struct vif_device *vif;
|
||||
struct mfc_cache *c;
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
case SIOCGETVIFCNT:
|
||||
if (copy_from_user(&vr,arg,sizeof(vr)))
|
||||
return -EFAULT;
|
||||
if(vr.vifi>=maxvif)
|
||||
return -EINVAL;
|
||||
read_lock(&mrt_lock);
|
||||
vif=&vif_table[vr.vifi];
|
||||
if(VIF_EXISTS(vr.vifi)) {
|
||||
vr.icount=vif->pkt_in;
|
||||
vr.ocount=vif->pkt_out;
|
||||
vr.ibytes=vif->bytes_in;
|
||||
vr.obytes=vif->bytes_out;
|
||||
read_unlock(&mrt_lock);
|
||||
|
||||
if (copy_to_user(arg,&vr,sizeof(vr)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
switch (cmd) {
|
||||
case SIOCGETVIFCNT:
|
||||
if (copy_from_user(&vr,arg,sizeof(vr)))
|
||||
return -EFAULT;
|
||||
if (vr.vifi>=maxvif)
|
||||
return -EINVAL;
|
||||
read_lock(&mrt_lock);
|
||||
vif=&vif_table[vr.vifi];
|
||||
if (VIF_EXISTS(vr.vifi)) {
|
||||
vr.icount=vif->pkt_in;
|
||||
vr.ocount=vif->pkt_out;
|
||||
vr.ibytes=vif->bytes_in;
|
||||
vr.obytes=vif->bytes_out;
|
||||
read_unlock(&mrt_lock);
|
||||
return -EADDRNOTAVAIL;
|
||||
case SIOCGETSGCNT:
|
||||
if (copy_from_user(&sr,arg,sizeof(sr)))
|
||||
|
||||
if (copy_to_user(arg,&vr,sizeof(vr)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
read_unlock(&mrt_lock);
|
||||
return -EADDRNOTAVAIL;
|
||||
case SIOCGETSGCNT:
|
||||
if (copy_from_user(&sr,arg,sizeof(sr)))
|
||||
return -EFAULT;
|
||||
|
||||
read_lock(&mrt_lock);
|
||||
c = ipmr_cache_find(sr.src.s_addr, sr.grp.s_addr);
|
||||
if (c) {
|
||||
sr.pktcnt = c->mfc_un.res.pkt;
|
||||
sr.bytecnt = c->mfc_un.res.bytes;
|
||||
sr.wrong_if = c->mfc_un.res.wrong_if;
|
||||
read_unlock(&mrt_lock);
|
||||
|
||||
if (copy_to_user(arg,&sr,sizeof(sr)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
read_lock(&mrt_lock);
|
||||
c = ipmr_cache_find(sr.src.s_addr, sr.grp.s_addr);
|
||||
if (c) {
|
||||
sr.pktcnt = c->mfc_un.res.pkt;
|
||||
sr.bytecnt = c->mfc_un.res.bytes;
|
||||
sr.wrong_if = c->mfc_un.res.wrong_if;
|
||||
read_unlock(&mrt_lock);
|
||||
return -EADDRNOTAVAIL;
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
|
||||
if (copy_to_user(arg,&sr,sizeof(sr)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
read_unlock(&mrt_lock);
|
||||
return -EADDRNOTAVAIL;
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1073,7 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
|
|||
if (event != NETDEV_UNREGISTER)
|
||||
return NOTIFY_DONE;
|
||||
v=&vif_table[0];
|
||||
for(ct=0;ct<maxvif;ct++,v++) {
|
||||
for (ct=0;ct<maxvif;ct++,v++) {
|
||||
if (v->dev==ptr)
|
||||
vif_delete(ct);
|
||||
}
|
||||
|
@ -1625,7 +1622,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
|
|||
loff_t pos)
|
||||
{
|
||||
for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) {
|
||||
if(!VIF_EXISTS(iter->ct))
|
||||
if (!VIF_EXISTS(iter->ct))
|
||||
continue;
|
||||
if (pos-- == 0)
|
||||
return &vif_table[iter->ct];
|
||||
|
@ -1649,7 +1646,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
|||
return ipmr_vif_seq_idx(iter, 0);
|
||||
|
||||
while (++iter->ct < maxvif) {
|
||||
if(!VIF_EXISTS(iter->ct))
|
||||
if (!VIF_EXISTS(iter->ct))
|
||||
continue;
|
||||
return &vif_table[iter->ct];
|
||||
}
|
||||
|
@ -1732,14 +1729,14 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
|
|||
it->cache = mfc_cache_array;
|
||||
read_lock(&mrt_lock);
|
||||
for (it->ct = 0; it->ct < MFC_LINES; it->ct++)
|
||||
for(mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next)
|
||||
for (mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next)
|
||||
if (pos-- == 0)
|
||||
return mfc;
|
||||
read_unlock(&mrt_lock);
|
||||
|
||||
it->cache = &mfc_unres_queue;
|
||||
spin_lock_bh(&mfc_unres_lock);
|
||||
for(mfc = mfc_unres_queue; mfc; mfc = mfc->next)
|
||||
for (mfc = mfc_unres_queue; mfc; mfc = mfc->next)
|
||||
if (pos-- == 0)
|
||||
return mfc;
|
||||
spin_unlock_bh(&mfc_unres_lock);
|
||||
|
@ -1829,9 +1826,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
|
|||
mfc->mfc_un.res.wrong_if);
|
||||
|
||||
if (it->cache != &mfc_unres_queue) {
|
||||
for(n = mfc->mfc_un.res.minvif;
|
||||
n < mfc->mfc_un.res.maxvif; n++ ) {
|
||||
if(VIF_EXISTS(n)
|
||||
for (n = mfc->mfc_un.res.minvif;
|
||||
n < mfc->mfc_un.res.maxvif; n++ ) {
|
||||
if (VIF_EXISTS(n)
|
||||
&& mfc->mfc_un.res.ttls[n] < 255)
|
||||
seq_printf(seq,
|
||||
" %2d:%-3d",
|
||||
|
|
|
@ -93,7 +93,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||
struct iphdr *iph = skb->nh.iph;
|
||||
int err = -EINVAL;
|
||||
|
||||
switch(iph->protocol){
|
||||
switch (iph->protocol){
|
||||
case IPPROTO_IPIP:
|
||||
break;
|
||||
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
|
|
|
@ -119,7 +119,7 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
|
|||
|
||||
if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) {
|
||||
unsigned short encap_family = xfrm[i]->props.family;
|
||||
switch(encap_family) {
|
||||
switch (encap_family) {
|
||||
case AF_INET:
|
||||
fl_tunnel.fl4_dst = xfrm[i]->id.daddr.a4;
|
||||
fl_tunnel.fl4_src = xfrm[i]->props.saddr.a4;
|
||||
|
|
Loading…
Reference in New Issue
Block a user