提交 e905a9ed 编写于 作者: Y YOSHIFUJI Hideaki 提交者: David S. Miller

[NET] IPV4: Fix whitespace errors.

Signed-off-by: NYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 64265651
...@@ -550,7 +550,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, ...@@ -550,7 +550,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
if (err < 0) if (err < 0)
goto out; goto out;
sock->state = SS_CONNECTING; sock->state = SS_CONNECTING;
/* Just entered SS_CONNECTING state; the only /* Just entered SS_CONNECTING state; the only
* difference is that return value in non-blocking * difference is that return value in non-blocking
...@@ -878,36 +878,36 @@ static struct net_proto_family inet_family_ops = { ...@@ -878,36 +878,36 @@ static struct net_proto_family inet_family_ops = {
*/ */
static struct inet_protosw inetsw_array[] = static struct inet_protosw inetsw_array[] =
{ {
{ {
.type = SOCK_STREAM, .type = SOCK_STREAM,
.protocol = IPPROTO_TCP, .protocol = IPPROTO_TCP,
.prot = &tcp_prot, .prot = &tcp_prot,
.ops = &inet_stream_ops, .ops = &inet_stream_ops,
.capability = -1, .capability = -1,
.no_check = 0, .no_check = 0,
.flags = INET_PROTOSW_PERMANENT | .flags = INET_PROTOSW_PERMANENT |
INET_PROTOSW_ICSK, INET_PROTOSW_ICSK,
}, },
{ {
.type = SOCK_DGRAM, .type = SOCK_DGRAM,
.protocol = IPPROTO_UDP, .protocol = IPPROTO_UDP,
.prot = &udp_prot, .prot = &udp_prot,
.ops = &inet_dgram_ops, .ops = &inet_dgram_ops,
.capability = -1, .capability = -1,
.no_check = UDP_CSUM_DEFAULT, .no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_PERMANENT, .flags = INET_PROTOSW_PERMANENT,
}, },
{ {
.type = SOCK_RAW, .type = SOCK_RAW,
.protocol = IPPROTO_IP, /* wild card */ .protocol = IPPROTO_IP, /* wild card */
.prot = &raw_prot, .prot = &raw_prot,
.ops = &inet_sockraw_ops, .ops = &inet_sockraw_ops,
.capability = CAP_NET_RAW, .capability = CAP_NET_RAW,
.no_check = UDP_CSUM_DEFAULT, .no_check = UDP_CSUM_DEFAULT,
.flags = INET_PROTOSW_REUSE, .flags = INET_PROTOSW_REUSE,
} }
}; };
...@@ -946,7 +946,7 @@ void inet_register_protosw(struct inet_protosw *p) ...@@ -946,7 +946,7 @@ void inet_register_protosw(struct inet_protosw *p)
/* Add the new entry after the last permanent entry if any, so that /* Add the new entry after the last permanent entry if any, so that
* the new entry does not override a permanent entry when matched with * the new entry does not override a permanent entry when matched with
* a wild-card protocol. But it is allowed to override any existing * a wild-card protocol. But it is allowed to override any existing
* non-permanent entry. This means that when we remove this entry, the * non-permanent entry. This means that when we remove this entry, the
* system automatically returns to the old behavior. * system automatically returns to the old behavior.
*/ */
list_add_rcu(&p->list, last_perm); list_add_rcu(&p->list, last_perm);
...@@ -1073,7 +1073,7 @@ int inet_sk_rebuild_header(struct sock *sk) ...@@ -1073,7 +1073,7 @@ int inet_sk_rebuild_header(struct sock *sk)
}, },
}, },
}; };
security_sk_classify_flow(sk, &fl); security_sk_classify_flow(sk, &fl);
err = ip_route_output_flow(&rt, &fl, sk, 0); err = ip_route_output_flow(&rt, &fl, sk, 0);
} }
...@@ -1273,10 +1273,10 @@ static int __init inet_init(void) ...@@ -1273,10 +1273,10 @@ static int __init inet_init(void)
goto out_unregister_udp_proto; goto out_unregister_udp_proto;
/* /*
* Tell SOCKET that we are alive... * Tell SOCKET that we are alive...
*/ */
(void)sock_register(&inet_family_ops); (void)sock_register(&inet_family_ops);
/* /*
* Add all the base protocols. * Add all the base protocols.
...@@ -1306,9 +1306,9 @@ static int __init inet_init(void) ...@@ -1306,9 +1306,9 @@ static int __init inet_init(void)
arp_init(); arp_init();
/* /*
* Set the IP module up * Set the IP module up
*/ */
ip_init(); ip_init();
...@@ -1334,11 +1334,11 @@ static int __init inet_init(void) ...@@ -1334,11 +1334,11 @@ static int __init inet_init(void)
#endif #endif
/* /*
* Initialise per-cpu ipv4 mibs * Initialise per-cpu ipv4 mibs
*/ */
if(init_ipv4_mibs()) if(init_ipv4_mibs())
printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); ; printk(KERN_CRIT "inet_init: Cannot init ipv4 mibs\n"); ;
ipv4_proc_init(); ipv4_proc_init();
ipfrag_init(); ipfrag_init();
......
...@@ -91,7 +91,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -91,7 +91,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
top_iph->check = 0; top_iph->check = 0;
ahp = x->data; ahp = x->data;
ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ah->hdrlen = (XFRM_ALIGN8(sizeof(struct ip_auth_hdr) +
ahp->icv_trunc_len) >> 2) - 2; ahp->icv_trunc_len) >> 2) - 2;
ah->reserved = 0; ah->reserved = 0;
...@@ -135,9 +135,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -135,9 +135,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
ah = (struct ip_auth_hdr*)skb->data; ah = (struct ip_auth_hdr*)skb->data;
ahp = x->data; ahp = x->data;
ah_hlen = (ah->hdrlen + 2) << 2; ah_hlen = (ah->hdrlen + 2) << 2;
if (ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_full_len) && if (ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_full_len) &&
ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len)) ah_hlen != XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len))
goto out; goto out;
if (!pskb_may_pull(skb, ah_hlen)) if (!pskb_may_pull(skb, ah_hlen))
...@@ -166,9 +166,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -166,9 +166,9 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
if (ip_clear_mutable_options(iph, &dummy)) if (ip_clear_mutable_options(iph, &dummy))
goto out; goto out;
} }
{ {
u8 auth_data[MAX_AH_AUTH_LEN]; u8 auth_data[MAX_AH_AUTH_LEN];
memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len); memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
skb_push(skb, ihl); skb_push(skb, ihl);
err = ah_mac_digest(ahp, skb, ah->auth_data); err = ah_mac_digest(ahp, skb, ah->auth_data);
...@@ -237,7 +237,7 @@ static int ah_init_state(struct xfrm_state *x) ...@@ -237,7 +237,7 @@ static int ah_init_state(struct xfrm_state *x)
ahp->tfm = tfm; ahp->tfm = tfm;
if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len)) if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len))
goto error; goto error;
/* /*
* Lookup the algorithm description maintained by xfrm_algo, * Lookup the algorithm description maintained by xfrm_algo,
* verify crypto transform properties, and store information * verify crypto transform properties, and store information
...@@ -254,16 +254,16 @@ static int ah_init_state(struct xfrm_state *x) ...@@ -254,16 +254,16 @@ static int ah_init_state(struct xfrm_state *x)
aalg_desc->uinfo.auth.icv_fullbits/8); aalg_desc->uinfo.auth.icv_fullbits/8);
goto error; goto error;
} }
ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN); BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL); ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL);
if (!ahp->work_icv) if (!ahp->work_icv)
goto error; goto error;
x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len); x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + ahp->icv_trunc_len);
if (x->props.mode == XFRM_MODE_TUNNEL) if (x->props.mode == XFRM_MODE_TUNNEL)
x->props.header_len += sizeof(struct iphdr); x->props.header_len += sizeof(struct iphdr);
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
* Fixes: * Fixes:
* Alan Cox : Removed the Ethernet assumptions in * Alan Cox : Removed the Ethernet assumptions in
* Florian's code * Florian's code
* Alan Cox : Fixed some small errors in the ARP * Alan Cox : Fixed some small errors in the ARP
* logic * logic
* Alan Cox : Allow >4K in /proc * Alan Cox : Allow >4K in /proc
* Alan Cox : Make ARP add its own protocol entry * Alan Cox : Make ARP add its own protocol entry
...@@ -39,18 +39,18 @@ ...@@ -39,18 +39,18 @@
* Jonathan Naylor : Only lookup the hardware address for * Jonathan Naylor : Only lookup the hardware address for
* the correct hardware type. * the correct hardware type.
* Germano Caronni : Assorted subtle races. * Germano Caronni : Assorted subtle races.
* Craig Schlenter : Don't modify permanent entry * Craig Schlenter : Don't modify permanent entry
* during arp_rcv. * during arp_rcv.
* Russ Nelson : Tidied up a few bits. * Russ Nelson : Tidied up a few bits.
* Alexey Kuznetsov: Major changes to caching and behaviour, * Alexey Kuznetsov: Major changes to caching and behaviour,
* eg intelligent arp probing and * eg intelligent arp probing and
* generation * generation
* of host down events. * of host down events.
* Alan Cox : Missing unlock in device events. * Alan Cox : Missing unlock in device events.
* Eckes : ARP ioctl control errors. * Eckes : ARP ioctl control errors.
* Alexey Kuznetsov: Arp free fix. * Alexey Kuznetsov: Arp free fix.
* Manuel Rodriguez: Gratuitous ARP. * Manuel Rodriguez: Gratuitous ARP.
* Jonathan Layes : Added arpd support through kerneld * Jonathan Layes : Added arpd support through kerneld
* message queue (960314) * message queue (960314)
* Mike Shaver : /proc/sys/net/ipv4/arp_* support * Mike Shaver : /proc/sys/net/ipv4/arp_* support
* Mike McLagan : Routing by source * Mike McLagan : Routing by source
...@@ -210,7 +210,7 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir) ...@@ -210,7 +210,7 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir)
case ARPHRD_FDDI: case ARPHRD_FDDI:
case ARPHRD_IEEE802: case ARPHRD_IEEE802:
ip_eth_mc_map(addr, haddr); ip_eth_mc_map(addr, haddr);
return 0; return 0;
case ARPHRD_IEEE802_TR: case ARPHRD_IEEE802_TR:
ip_tr_mc_map(addr, haddr); ip_tr_mc_map(addr, haddr);
return 0; return 0;
...@@ -288,7 +288,7 @@ static int arp_constructor(struct neighbour *neigh) ...@@ -288,7 +288,7 @@ static int arp_constructor(struct neighbour *neigh)
switch (dev->type) { switch (dev->type) {
default: default:
break; break;
case ARPHRD_ROSE: case ARPHRD_ROSE:
#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
case ARPHRD_AX25: case ARPHRD_AX25:
#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) #if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
...@@ -425,18 +425,18 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) ...@@ -425,18 +425,18 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip,
.saddr = tip } } }; .saddr = tip } } };
struct rtable *rt; struct rtable *rt;
int flag = 0; int flag = 0;
/*unsigned long now; */ /*unsigned long now; */
if (ip_route_output_key(&rt, &fl) < 0) if (ip_route_output_key(&rt, &fl) < 0)
return 1; return 1;
if (rt->u.dst.dev != dev) { if (rt->u.dst.dev != dev) {
NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
flag = 1; flag = 1;
} }
ip_rt_put(rt); ip_rt_put(rt);
return flag; return flag;
} }
/* OBSOLETE FUNCTIONS */ /* OBSOLETE FUNCTIONS */
...@@ -490,7 +490,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb) ...@@ -490,7 +490,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
n->used = jiffies; n->used = jiffies;
if (n->nud_state&NUD_VALID || neigh_event_send(n, skb) == 0) { if (n->nud_state&NUD_VALID || neigh_event_send(n, skb) == 0) {
read_lock_bh(&n->lock); read_lock_bh(&n->lock);
memcpy(haddr, n->ha, dev->addr_len); memcpy(haddr, n->ha, dev->addr_len);
read_unlock_bh(&n->lock); read_unlock_bh(&n->lock);
neigh_release(n); neigh_release(n);
return 0; return 0;
...@@ -572,7 +572,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, ...@@ -572,7 +572,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
/* /*
* Allocate a buffer * Allocate a buffer
*/ */
skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4) skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4)
+ LL_RESERVED_SPACE(dev), GFP_ATOMIC); + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
if (skb == NULL) if (skb == NULL)
...@@ -685,7 +685,7 @@ void arp_send(int type, int ptype, __be32 dest_ip, ...@@ -685,7 +685,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
/* /*
* No arp on this interface. * No arp on this interface.
*/ */
if (dev->flags&IFF_NOARP) if (dev->flags&IFF_NOARP)
return; return;
...@@ -725,7 +725,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -725,7 +725,7 @@ static int arp_process(struct sk_buff *skb)
arp = skb->nh.arph; arp = skb->nh.arph;
switch (dev_type) { switch (dev_type) {
default: default:
if (arp->ar_pro != htons(ETH_P_IP) || if (arp->ar_pro != htons(ETH_P_IP) ||
htons(dev_type) != arp->ar_hrd) htons(dev_type) != arp->ar_hrd)
goto out; goto out;
...@@ -792,7 +792,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -792,7 +792,7 @@ static int arp_process(struct sk_buff *skb)
tha = arp_ptr; tha = arp_ptr;
arp_ptr += dev->addr_len; arp_ptr += dev->addr_len;
memcpy(&tip, arp_ptr, 4); memcpy(&tip, arp_ptr, 4);
/* /*
* Check for bad requests for 127.x.x.x and requests for multicast * Check for bad requests for 127.x.x.x and requests for multicast
* addresses. If this is one such, delete it. * addresses. If this is one such, delete it.
*/ */
...@@ -809,16 +809,16 @@ static int arp_process(struct sk_buff *skb) ...@@ -809,16 +809,16 @@ static int arp_process(struct sk_buff *skb)
* Process entry. The idea here is we want to send a reply if it is a * Process entry. The idea here is we want to send a reply if it is a
* request for us or if it is a request for someone else that we hold * request for us or if it is a request for someone else that we hold
* a proxy for. We want to add an entry to our cache if it is a reply * a proxy for. We want to add an entry to our cache if it is a reply
* to us or if it is a request for our address. * to us or if it is a request for our address.
* (The assumption for this last is that if someone is requesting our * (The assumption for this last is that if someone is requesting our
* address, they are probably intending to talk to us, so it saves time * address, they are probably intending to talk to us, so it saves time
* if we cache their address. Their address is also probably not in * if we cache their address. Their address is also probably not in
* our cache, since ours is not in their cache.) * our cache, since ours is not in their cache.)
* *
* Putting this another way, we only care about replies if they are to * Putting this another way, we only care about replies if they are to
* us, in which case we add them to the cache. For requests, we care * us, in which case we add them to the cache. For requests, we care
* about those for us and those for our proxies. We reply to both, * about those for us and those for our proxies. We reply to both,
* and in the case of requests for us we add the requester to the arp * and in the case of requests for us we add the requester to the arp
* cache. * cache.
*/ */
...@@ -845,7 +845,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -845,7 +845,7 @@ static int arp_process(struct sk_buff *skb)
if (!dont_send) if (!dont_send)
dont_send |= arp_ignore(in_dev,dev,sip,tip); dont_send |= arp_ignore(in_dev,dev,sip,tip);
if (!dont_send && IN_DEV_ARPFILTER(in_dev)) if (!dont_send && IN_DEV_ARPFILTER(in_dev))
dont_send |= arp_filter(sip,tip,dev); dont_send |= arp_filter(sip,tip,dev);
if (!dont_send) if (!dont_send)
arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
...@@ -860,7 +860,7 @@ static int arp_process(struct sk_buff *skb) ...@@ -860,7 +860,7 @@ static int arp_process(struct sk_buff *skb)
if (n) if (n)
neigh_release(n); neigh_release(n);
if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED || if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED ||
skb->pkt_type == PACKET_HOST || skb->pkt_type == PACKET_HOST ||
in_dev->arp_parms->proxy_delay == 0) { in_dev->arp_parms->proxy_delay == 0) {
arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
...@@ -1039,7 +1039,7 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev) ...@@ -1039,7 +1039,7 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
if (r->arp_flags & ATF_PERM) if (r->arp_flags & ATF_PERM)
state = NUD_PERMANENT; state = NUD_PERMANENT;
err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? err = neigh_update(neigh, (r->arp_flags&ATF_COM) ?
r->arp_ha.sa_data : NULL, state, r->arp_ha.sa_data : NULL, state,
NEIGH_UPDATE_F_OVERRIDE| NEIGH_UPDATE_F_OVERRIDE|
NEIGH_UPDATE_F_ADMIN); NEIGH_UPDATE_F_ADMIN);
neigh_release(neigh); neigh_release(neigh);
...@@ -1121,7 +1121,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) ...@@ -1121,7 +1121,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
neigh = neigh_lookup(&arp_tbl, &ip, dev); neigh = neigh_lookup(&arp_tbl, &ip, dev);
if (neigh) { if (neigh) {
if (neigh->nud_state&~NUD_NOARP) if (neigh->nud_state&~NUD_NOARP)
err = neigh_update(neigh, NULL, NUD_FAILED, err = neigh_update(neigh, NULL, NUD_FAILED,
NEIGH_UPDATE_F_OVERRIDE| NEIGH_UPDATE_F_OVERRIDE|
NEIGH_UPDATE_F_ADMIN); NEIGH_UPDATE_F_ADMIN);
neigh_release(neigh); neigh_release(neigh);
...@@ -1181,7 +1181,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg) ...@@ -1181,7 +1181,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
switch(cmd) { switch(cmd) {
case SIOCDARP: case SIOCDARP:
err = arp_req_delete(&r, dev); err = arp_req_delete(&r, dev);
break; break;
case SIOCSARP: case SIOCSARP:
err = arp_req_set(&r, dev); err = arp_req_set(&r, dev);
...@@ -1268,14 +1268,14 @@ static char *ax2asc2(ax25_address *a, char *buf) ...@@ -1268,14 +1268,14 @@ static char *ax2asc2(ax25_address *a, char *buf)
if (c != ' ') *s++ = c; if (c != ' ') *s++ = c;
} }
*s++ = '-'; *s++ = '-';
if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
*s++ = '1'; *s++ = '1';
n -= 10; n -= 10;
} }
*s++ = n + '0'; *s++ = n + '0';
*s++ = '\0'; *s++ = '\0';
...@@ -1373,7 +1373,7 @@ static int arp_seq_open(struct inode *inode, struct file *file) ...@@ -1373,7 +1373,7 @@ static int arp_seq_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL); struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;
......
...@@ -29,12 +29,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -29,12 +29,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
int oif; int oif;
int err; int err;
if (addr_len < sizeof(*usin))
return -EINVAL;
if (usin->sin_family != AF_INET) if (addr_len < sizeof(*usin))
return -EAFNOSUPPORT; return -EINVAL;
if (usin->sin_family != AF_INET)
return -EAFNOSUPPORT;
sk_dst_reset(sk); sk_dst_reset(sk);
...@@ -56,8 +56,8 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) ...@@ -56,8 +56,8 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
ip_rt_put(rt); ip_rt_put(rt);
return -EACCES; return -EACCES;
} }
if (!inet->saddr) if (!inet->saddr)
inet->saddr = rt->rt_src; /* Update source address */ inet->saddr = rt->rt_src; /* Update source address */
if (!inet->rcv_saddr) if (!inet->rcv_saddr)
inet->rcv_saddr = rt->rt_src; inet->rcv_saddr = rt->rt_src;
inet->daddr = rt->rt_dst; inet->daddr = rt->rt_dst;
......
...@@ -252,7 +252,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, ...@@ -252,7 +252,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
ASSERT_RTNL(); ASSERT_RTNL();
/* 1. Deleting primary ifaddr forces deletion all secondaries /* 1. Deleting primary ifaddr forces deletion all secondaries
* unless alias promotion is set * unless alias promotion is set
**/ **/
...@@ -260,7 +260,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, ...@@ -260,7 +260,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
struct in_ifaddr **ifap1 = &ifa1->ifa_next; struct in_ifaddr **ifap1 = &ifa1->ifa_next;
while ((ifa = *ifap1) != NULL) { while ((ifa = *ifap1) != NULL) {
if (!(ifa->ifa_flags & IFA_F_SECONDARY) && if (!(ifa->ifa_flags & IFA_F_SECONDARY) &&
ifa1->ifa_scope <= ifa->ifa_scope) ifa1->ifa_scope <= ifa->ifa_scope)
last_prim = ifa; last_prim = ifa;
...@@ -583,8 +583,8 @@ static __inline__ int inet_abc_len(__be32 addr) ...@@ -583,8 +583,8 @@ static __inline__ int inet_abc_len(__be32 addr)
{ {
int rc = -1; /* Something else, probably a multicast. */ int rc = -1; /* Something else, probably a multicast. */
if (ZERONET(addr)) if (ZERONET(addr))
rc = 0; rc = 0;
else { else {
__u32 haddr = ntohl(addr); __u32 haddr = ntohl(addr);
...@@ -596,7 +596,7 @@ static __inline__ int inet_abc_len(__be32 addr) ...@@ -596,7 +596,7 @@ static __inline__ int inet_abc_len(__be32 addr)
rc = 24; rc = 24;
} }
return rc; return rc;
} }
...@@ -1020,29 +1020,29 @@ int unregister_inetaddr_notifier(struct notifier_block *nb) ...@@ -1020,29 +1020,29 @@ int unregister_inetaddr_notifier(struct notifier_block *nb)
* alias numbering and to create unique labels if possible. * alias numbering and to create unique labels if possible.
*/ */
static void inetdev_changename(struct net_device *dev, struct in_device *in_dev) static void inetdev_changename(struct net_device *dev, struct in_device *in_dev)
{ {
struct in_ifaddr *ifa; struct in_ifaddr *ifa;
int named = 0; int named = 0;
for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
char old[IFNAMSIZ], *dot; char old[IFNAMSIZ], *dot;
memcpy(old, ifa->ifa_label, IFNAMSIZ); memcpy(old, ifa->ifa_label, IFNAMSIZ);
memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
if (named++ == 0) if (named++ == 0)
continue; continue;
dot = strchr(ifa->ifa_label, ':'); dot = strchr(ifa->ifa_label, ':');
if (dot == NULL) { if (dot == NULL) {
sprintf(old, ":%d", named); sprintf(old, ":%d", named);
dot = old; dot = old;
} }
if (strlen(dot) + strlen(dev->name) < IFNAMSIZ) { if (strlen(dot) + strlen(dev->name) < IFNAMSIZ) {
strcat(ifa->ifa_label, dot); strcat(ifa->ifa_label, dot);
} else { } else {
strcpy(ifa->ifa_label + (IFNAMSIZ - strlen(dot) - 1), dot); strcpy(ifa->ifa_label + (IFNAMSIZ - strlen(dot) - 1), dot);
} }
} }
} }
/* Called only under RTNL semaphore */ /* Called only under RTNL semaphore */
...@@ -1539,7 +1539,7 @@ static struct devinet_sysctl_table { ...@@ -1539,7 +1539,7 @@ static struct devinet_sysctl_table {
}, },
}, },
.devinet_conf_dir = { .devinet_conf_dir = {
{ {
.ctl_name = NET_IPV4_CONF, .ctl_name = NET_IPV4_CONF,
.procname = "conf", .procname = "conf",
.mode = 0555, .mode = 0555,
...@@ -1581,18 +1581,18 @@ static void devinet_sysctl_register(struct in_device *in_dev, ...@@ -1581,18 +1581,18 @@ static void devinet_sysctl_register(struct in_device *in_dev,
} }
if (dev) { if (dev) {
dev_name = dev->name; dev_name = dev->name;
t->devinet_dev[0].ctl_name = dev->ifindex; t->devinet_dev[0].ctl_name = dev->ifindex;
} else { } else {
dev_name = "default"; dev_name = "default";
t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT; t->devinet_dev[0].ctl_name = NET_PROTO_CONF_DEFAULT;
} }
/* /*
* Make a copy of dev_name, because '.procname' is regarded as const * Make a copy of dev_name, because '.procname' is regarded as const
* by sysctl and we wouldn't want anyone to change it under our feet * by sysctl and we wouldn't want anyone to change it under our feet
* (see SIOCSIFNAME). * (see SIOCSIFNAME).
*/ */
dev_name = kstrdup(dev_name, GFP_KERNEL); dev_name = kstrdup(dev_name, GFP_KERNEL);
if (!dev_name) if (!dev_name)
goto free; goto free;
......
...@@ -215,7 +215,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -215,7 +215,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
if (padlen+2 >= elen) if (padlen+2 >= elen)
goto out; goto out;
/* ... check padding bits here. Silly. :-) */ /* ... check padding bits here. Silly. :-) */
iph = skb->nh.iph; iph = skb->nh.iph;
ihl = iph->ihl * 4; ihl = iph->ihl * 4;
...@@ -236,7 +236,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -236,7 +236,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
ipaddr.a4 = iph->saddr; ipaddr.a4 = iph->saddr;
km_new_mapping(x, &ipaddr, uh->source); km_new_mapping(x, &ipaddr, uh->source);
/* XXX: perhaps add an extra /* XXX: perhaps add an extra
* policy check here, to see * policy check here, to see
* if we should allow or * if we should allow or
...@@ -245,7 +245,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -245,7 +245,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
* address/port. * address/port.
*/ */
} }
/* /*
* 2) ignore UDP/TCP checksums in case * 2) ignore UDP/TCP checksums in case
* of NAT-T in Transport Mode, or * of NAT-T in Transport Mode, or
...@@ -284,7 +284,7 @@ static u32 esp4_get_max_size(struct xfrm_state *x, int mtu) ...@@ -284,7 +284,7 @@ static u32 esp4_get_max_size(struct xfrm_state *x, int mtu)
mtu = ALIGN(mtu + 2, 4) + blksize - 4; mtu = ALIGN(mtu + 2, 4) + blksize - 4;
break; break;
case XFRM_MODE_BEET: case XFRM_MODE_BEET:
/* The worst case. */ /* The worst case. */
enclen = IPV4_BEET_PHMAXLEN; enclen = IPV4_BEET_PHMAXLEN;
mtu = ALIGN(mtu + enclen + 2, blksize); mtu = ALIGN(mtu + enclen + 2, blksize);
break; break;
......
...@@ -160,7 +160,7 @@ unsigned inet_addr_type(__be32 addr) ...@@ -160,7 +160,7 @@ unsigned inet_addr_type(__be32 addr)
#ifdef CONFIG_IP_MULTIPLE_TABLES #ifdef CONFIG_IP_MULTIPLE_TABLES
res.r = NULL; res.r = NULL;
#endif #endif
if (ip_fib_local_table) { if (ip_fib_local_table) {
ret = RTN_UNICAST; ret = RTN_UNICAST;
if (!ip_fib_local_table->tb_lookup(ip_fib_local_table, if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
...@@ -378,7 +378,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, ...@@ -378,7 +378,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
int len = 0; int len = 0;
mx = kzalloc(3 * nla_total_size(4), GFP_KERNEL); mx = kzalloc(3 * nla_total_size(4), GFP_KERNEL);
if (mx == NULL) if (mx == NULL)
return -ENOMEM; return -ENOMEM;
if (rt->rt_flags & RTF_MTU) if (rt->rt_flags & RTF_MTU)
...@@ -400,7 +400,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt, ...@@ -400,7 +400,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
/* /*
* Handle IP routing ioctl calls. These are used to manipulate the routing tables * Handle IP routing ioctl calls. These are used to manipulate the routing tables
*/ */
int ip_rt_ioctl(unsigned int cmd, void __user *arg) int ip_rt_ioctl(unsigned int cmd, void __user *arg)
{ {
struct fib_config cfg; struct fib_config cfg;
...@@ -600,7 +600,7 @@ int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -600,7 +600,7 @@ int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
goto next; goto next;
if (dumped) if (dumped)
memset(&cb->args[2], 0, sizeof(cb->args) - memset(&cb->args[2], 0, sizeof(cb->args) -
2 * sizeof(cb->args[0])); 2 * sizeof(cb->args[0]));
if (tb->tb_dump(tb, skb, cb) < 0) if (tb->tb_dump(tb, skb, cb) < 0)
goto out; goto out;
dumped = 1; dumped = 1;
...@@ -766,7 +766,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) ...@@ -766,7 +766,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb ) static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb )
{ {
struct fib_result res; struct fib_result res;
struct flowi fl = { .mark = frn->fl_mark, struct flowi fl = { .mark = frn->fl_mark,
.nl_u = { .ip4_u = { .daddr = frn->fl_addr, .nl_u = { .ip4_u = { .daddr = frn->fl_addr,
...@@ -791,11 +791,11 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb ) ...@@ -791,11 +791,11 @@ static void nl_fib_lookup(struct fib_result_nl *frn, struct fib_table *tb )
static void nl_fib_input(struct sock *sk, int len) static void nl_fib_input(struct sock *sk, int len)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct nlmsghdr *nlh = NULL; struct nlmsghdr *nlh = NULL;
struct fib_result_nl *frn; struct fib_result_nl *frn;
u32 pid; u32 pid;
struct fib_table *tb; struct fib_table *tb;
skb = skb_dequeue(&sk->sk_receive_queue); skb = skb_dequeue(&sk->sk_receive_queue);
nlh = (struct nlmsghdr *)skb->data; nlh = (struct nlmsghdr *)skb->data;
if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
...@@ -803,17 +803,17 @@ static void nl_fib_input(struct sock *sk, int len) ...@@ -803,17 +803,17 @@ static void nl_fib_input(struct sock *sk, int len)
kfree_skb(skb); kfree_skb(skb);
return; return;
} }
frn = (struct fib_result_nl *) NLMSG_DATA(nlh); frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
tb = fib_get_table(frn->tb_id_in); tb = fib_get_table(frn->tb_id_in);
nl_fib_lookup(frn, tb); nl_fib_lookup(frn, tb);
pid = nlh->nlmsg_pid; /*pid of sending process */ pid = nlh->nlmsg_pid; /*pid of sending process */
NETLINK_CB(skb).pid = 0; /* from kernel */ NETLINK_CB(skb).pid = 0; /* from kernel */
NETLINK_CB(skb).dst_group = 0; /* unicast */ NETLINK_CB(skb).dst_group = 0; /* unicast */
netlink_unicast(sk, skb, pid, MSG_DONTWAIT); netlink_unicast(sk, skb, pid, MSG_DONTWAIT);
} }
static void nl_fib_lookup_init(void) static void nl_fib_lookup_init(void)
{ {
......
...@@ -146,7 +146,7 @@ static void fn_rehash_zone(struct fn_zone *fz) ...@@ -146,7 +146,7 @@ static void fn_rehash_zone(struct fn_zone *fz)
struct hlist_head *ht, *old_ht; struct hlist_head *ht, *old_ht;
int old_divisor, new_divisor; int old_divisor, new_divisor;
u32 new_hashmask; u32 new_hashmask;
old_divisor = fz->fz_divisor; old_divisor = fz->fz_divisor;
switch (old_divisor) { switch (old_divisor) {
...@@ -911,7 +911,7 @@ static struct fib_alias *fib_get_next(struct seq_file *seq) ...@@ -911,7 +911,7 @@ static struct fib_alias *fib_get_next(struct seq_file *seq)
if (!iter->zone) if (!iter->zone)
goto out; goto out;
iter->bucket = 0; iter->bucket = 0;
iter->hash_head = iter->zone->fz_hash; iter->hash_head = iter->zone->fz_hash;
...@@ -932,7 +932,7 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) ...@@ -932,7 +932,7 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
{ {
struct fib_iter_state *iter = seq->private; struct fib_iter_state *iter = seq->private;
struct fib_alias *fa; struct fib_alias *fa;
if (iter->valid && pos >= iter->pos && iter->genid == fib_hash_genid) { if (iter->valid && pos >= iter->pos && iter->genid == fib_hash_genid) {
fa = iter->fa; fa = iter->fa;
pos -= iter->pos; pos -= iter->pos;
...@@ -981,7 +981,7 @@ static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi) ...@@ -981,7 +981,7 @@ static unsigned fib_flag_trans(int type, __be32 mask, struct fib_info *fi)
return flags; return flags;
} }
/* /*
* This outputs /proc/net/route. * This outputs /proc/net/route.
* *
* It always works in backward compatibility mode. * It always works in backward compatibility mode.
...@@ -1040,7 +1040,7 @@ static int fib_seq_open(struct inode *inode, struct file *file) ...@@ -1040,7 +1040,7 @@ static int fib_seq_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;
......
...@@ -85,12 +85,12 @@ for (nhsel=0; nhsel < 1; nhsel++) ...@@ -85,12 +85,12 @@ for (nhsel=0; nhsel < 1; nhsel++)
#define endfor_nexthops(fi) } #define endfor_nexthops(fi) }
static const struct static const struct
{ {
int error; int error;
u8 scope; u8 scope;
} fib_props[RTA_MAX + 1] = { } fib_props[RTA_MAX + 1] = {
{ {
.error = 0, .error = 0,
.scope = RT_SCOPE_NOWHERE, .scope = RT_SCOPE_NOWHERE,
}, /* RTN_UNSPEC */ }, /* RTN_UNSPEC */
...@@ -439,7 +439,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) ...@@ -439,7 +439,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
rtnh = cfg->fc_mp; rtnh = cfg->fc_mp;
remaining = cfg->fc_mp_len; remaining = cfg->fc_mp_len;
for_nexthops(fi) { for_nexthops(fi) {
int attrlen; int attrlen;
...@@ -508,9 +508,9 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi) ...@@ -508,9 +508,9 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
Normally it looks as following. Normally it looks as following.
{universe prefix} -> (gw, oif) [scope link] {universe prefix} -> (gw, oif) [scope link]
| |
|-> {link prefix} -> (gw, oif) [scope local] |-> {link prefix} -> (gw, oif) [scope local]
| |
|-> {local prefix} (terminal node) |-> {local prefix} (terminal node)
*/ */
...@@ -864,7 +864,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) ...@@ -864,7 +864,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
err = -EINVAL; err = -EINVAL;
failure: failure:
if (fi) { if (fi) {
fi->fib_dead = 1; fi->fib_dead = 1;
free_fib_info(fi); free_fib_info(fi);
} }
...@@ -1049,7 +1049,7 @@ int fib_sync_down(__be32 local, struct net_device *dev, int force) ...@@ -1049,7 +1049,7 @@ int fib_sync_down(__be32 local, struct net_device *dev, int force)
{ {
int ret = 0; int ret = 0;
int scope = RT_SCOPE_NOWHERE; int scope = RT_SCOPE_NOWHERE;
if (force) if (force)
scope = -1; scope = -1;
......
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
* Robert Olsson <robert.olsson@its.uu.se> Uppsala Universitet * Robert Olsson <robert.olsson@its.uu.se> Uppsala Universitet
* & Swedish University of Agricultural Sciences. * & Swedish University of Agricultural Sciences.
* *
* Jens Laas <jens.laas@data.slu.se> Swedish University of * Jens Laas <jens.laas@data.slu.se> Swedish University of
* Agricultural Sciences. * Agricultural Sciences.
* *
* Hans Liss <hans.liss@its.uu.se> Uppsala Universitet * Hans Liss <hans.liss@its.uu.se> Uppsala Universitet
* *
* This work is based on the LPC-trie which is originally descibed in: * This work is based on the LPC-trie which is originally descibed in:
* *
* An experimental study of compression methods for dynamic tries * An experimental study of compression methods for dynamic tries
* Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002. * Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
* http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/ * http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
...@@ -224,34 +224,34 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b) ...@@ -224,34 +224,34 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b)
} }
/* /*
To understand this stuff, an understanding of keys and all their bits is To understand this stuff, an understanding of keys and all their bits is
necessary. Every node in the trie has a key associated with it, but not necessary. Every node in the trie has a key associated with it, but not
all of the bits in that key are significant. all of the bits in that key are significant.
Consider a node 'n' and its parent 'tp'. Consider a node 'n' and its parent 'tp'.
If n is a leaf, every bit in its key is significant. Its presence is If n is a leaf, every bit in its key is significant. Its presence is
necessitated by path compression, since during a tree traversal (when necessitated by path compression, since during a tree traversal (when
searching for a leaf - unless we are doing an insertion) we will completely searching for a leaf - unless we are doing an insertion) we will completely
ignore all skipped bits we encounter. Thus we need to verify, at the end of ignore all skipped bits we encounter. Thus we need to verify, at the end of
a potentially successful search, that we have indeed been walking the a potentially successful search, that we have indeed been walking the
correct key path. correct key path.
Note that we can never "miss" the correct key in the tree if present by Note that we can never "miss" the correct key in the tree if present by
following the wrong path. Path compression ensures that segments of the key following the wrong path. Path compression ensures that segments of the key
that are the same for all keys with a given prefix are skipped, but the that are the same for all keys with a given prefix are skipped, but the
skipped part *is* identical for each node in the subtrie below the skipped skipped part *is* identical for each node in the subtrie below the skipped
bit! trie_insert() in this implementation takes care of that - note the bit! trie_insert() in this implementation takes care of that - note the
call to tkey_sub_equals() in trie_insert(). call to tkey_sub_equals() in trie_insert().
if n is an internal node - a 'tnode' here, the various parts of its key if n is an internal node - a 'tnode' here, the various parts of its key
have many different meanings. have many different meanings.
Example: Example:
_________________________________________________________________ _________________________________________________________________
| i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C | | i | i | i | i | i | i | i | N | N | N | S | S | S | S | S | C |
----------------------------------------------------------------- -----------------------------------------------------------------
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
_________________________________________________________________ _________________________________________________________________
| C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u | | C | C | C | u | u | u | u | u | u | u | u | u | u | u | u | u |
...@@ -263,23 +263,23 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b) ...@@ -263,23 +263,23 @@ static inline int tkey_mismatch(t_key a, int offset, t_key b)
n->pos = 15 n->pos = 15
n->bits = 4 n->bits = 4
First, let's just ignore the bits that come before the parent tp, that is First, let's just ignore the bits that come before the parent tp, that is
the bits from 0 to (tp->pos-1). They are *known* but at this point we do the bits from 0 to (tp->pos-1). They are *known* but at this point we do
not use them for anything. not use them for anything.
The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the The bits from (tp->pos) to (tp->pos + tp->bits - 1) - "N", above - are the
index into the parent's child array. That is, they will be used to find index into the parent's child array. That is, they will be used to find
'n' among tp's children. 'n' among tp's children.
The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits The bits from (tp->pos + tp->bits) to (n->pos - 1) - "S" - are skipped bits
for the node n. for the node n.
All the bits we have seen so far are significant to the node n. The rest All the bits we have seen so far are significant to the node n. The rest
of the bits are really not needed or indeed known in n->key. of the bits are really not needed or indeed known in n->key.
The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into The bits from (n->pos) to (n->pos + n->bits - 1) - "C" - are the index into
n's child array, and will of course be different for each child. n's child array, and will of course be different for each child.
The rest of the bits, from (n->pos + n->bits) onward, are completely unknown The rest of the bits, from (n->pos + n->bits) onward, are completely unknown
at this point. at this point.
...@@ -294,7 +294,7 @@ static inline void check_tnode(const struct tnode *tn) ...@@ -294,7 +294,7 @@ static inline void check_tnode(const struct tnode *tn)
static int halve_threshold = 25; static int halve_threshold = 25;
static int inflate_threshold = 50; static int inflate_threshold = 50;
static int halve_threshold_root = 15; static int halve_threshold_root = 15;
static int inflate_threshold_root = 25; static int inflate_threshold_root = 25;
static void __alias_free_mem(struct rcu_head *head) static void __alias_free_mem(struct rcu_head *head)
...@@ -355,7 +355,7 @@ static inline void tnode_free(struct tnode *tn) ...@@ -355,7 +355,7 @@ static inline void tnode_free(struct tnode *tn)
struct leaf *l = (struct leaf *) tn; struct leaf *l = (struct leaf *) tn;
call_rcu_bh(&l->rcu, __leaf_free_rcu); call_rcu_bh(&l->rcu, __leaf_free_rcu);
} }
else else
call_rcu(&tn->rcu, __tnode_free_rcu); call_rcu(&tn->rcu, __tnode_free_rcu);
} }
...@@ -461,7 +461,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) ...@@ -461,7 +461,7 @@ static struct node *resize(struct trie *t, struct tnode *tn)
int inflate_threshold_use; int inflate_threshold_use;
int halve_threshold_use; int halve_threshold_use;
if (!tn) if (!tn)
return NULL; return NULL;
pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n", pr_debug("In tnode_resize %p inflate_threshold=%d threshold=%d\n",
...@@ -556,7 +556,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) ...@@ -556,7 +556,7 @@ static struct node *resize(struct trie *t, struct tnode *tn)
if(!tn->parent) if(!tn->parent)
inflate_threshold_use = inflate_threshold_root; inflate_threshold_use = inflate_threshold_root;
else else
inflate_threshold_use = inflate_threshold; inflate_threshold_use = inflate_threshold;
err = 0; err = 0;
...@@ -587,7 +587,7 @@ static struct node *resize(struct trie *t, struct tnode *tn) ...@@ -587,7 +587,7 @@ static struct node *resize(struct trie *t, struct tnode *tn)
if(!tn->parent) if(!tn->parent)
halve_threshold_use = halve_threshold_root; halve_threshold_use = halve_threshold_root;
else else
halve_threshold_use = halve_threshold; halve_threshold_use = halve_threshold;
err = 0; err = 0;
...@@ -665,10 +665,10 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn) ...@@ -665,10 +665,10 @@ static struct tnode *inflate(struct trie *t, struct tnode *tn)
right = tnode_new(inode->key|m, inode->pos + 1, right = tnode_new(inode->key|m, inode->pos + 1,
inode->bits - 1); inode->bits - 1);
if (!right) { if (!right) {
tnode_free(left); tnode_free(left);
goto nomem; goto nomem;
} }
put_child(t, tn, 2*i, (struct node *) left); put_child(t, tn, 2*i, (struct node *) left);
put_child(t, tn, 2*i+1, (struct node *) right); put_child(t, tn, 2*i+1, (struct node *) right);
...@@ -890,23 +890,23 @@ static inline struct list_head * get_fa_head(struct leaf *l, int plen) ...@@ -890,23 +890,23 @@ static inline struct list_head * get_fa_head(struct leaf *l, int plen)
static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new) static void insert_leaf_info(struct hlist_head *head, struct leaf_info *new)
{ {
struct leaf_info *li = NULL, *last = NULL; struct leaf_info *li = NULL, *last = NULL;
struct hlist_node *node; struct hlist_node *node;
if (hlist_empty(head)) { if (hlist_empty(head)) {
hlist_add_head_rcu(&new->hlist, head); hlist_add_head_rcu(&new->hlist, head);
} else { } else {
hlist_for_each_entry(li, node, head, hlist) { hlist_for_each_entry(li, node, head, hlist) {
if (new->plen > li->plen) if (new->plen > li->plen)
break; break;
last = li; last = li;
} }
if (last) if (last)
hlist_add_after_rcu(&last->hlist, &new->hlist); hlist_add_after_rcu(&last->hlist, &new->hlist);
else else
hlist_add_before_rcu(&new->hlist, &li->hlist); hlist_add_before_rcu(&new->hlist, &li->hlist);
} }
} }
/* rcu_read_lock needs to be hold by caller from readside */ /* rcu_read_lock needs to be hold by caller from readside */
...@@ -1700,7 +1700,7 @@ static struct leaf *nextleaf(struct trie *t, struct leaf *thisleaf) ...@@ -1700,7 +1700,7 @@ static struct leaf *nextleaf(struct trie *t, struct leaf *thisleaf)
/* Decend if tnode */ /* Decend if tnode */
while (IS_TNODE(c)) { while (IS_TNODE(c)) {
p = (struct tnode *) c; p = (struct tnode *) c;
idx = 0; idx = 0;
/* Rightmost non-NULL branch */ /* Rightmost non-NULL branch */
if (p && IS_TNODE(p)) if (p && IS_TNODE(p))
...@@ -2303,9 +2303,9 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v) ...@@ -2303,9 +2303,9 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
seq_indent(seq, iter->depth-1); seq_indent(seq, iter->depth-1);
seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n",
NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, NIPQUAD(prf), tn->pos, tn->bits, tn->full_children,
tn->empty_children); tn->empty_children);
} else { } else {
struct leaf *l = (struct leaf *) n; struct leaf *l = (struct leaf *) n;
int i; int i;
......
...@@ -304,7 +304,7 @@ static inline int icmpv4_xrlim_allow(struct rtable *rt, int type, int code) ...@@ -304,7 +304,7 @@ static inline int icmpv4_xrlim_allow(struct rtable *rt, int type, int code)
/* No rate limit on loopback */ /* No rate limit on loopback */
if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) if (dst->dev && (dst->dev->flags&IFF_LOOPBACK))
goto out; goto out;
/* Limit if icmp type is enabled in ratemask. */ /* Limit if icmp type is enabled in ratemask. */
if ((1 << type) & sysctl_icmp_ratemask) if ((1 << type) & sysctl_icmp_ratemask)
...@@ -350,9 +350,9 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param, ...@@ -350,9 +350,9 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
struct sk_buff *skb; struct sk_buff *skb;
if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param, if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param,
icmp_param->data_len+icmp_param->head_len, icmp_param->data_len+icmp_param->head_len,
icmp_param->head_len, icmp_param->head_len,
ipc, rt, MSG_DONTWAIT) < 0) ipc, rt, MSG_DONTWAIT) < 0)
ip_flush_pending_frames(icmp_socket->sk); ip_flush_pending_frames(icmp_socket->sk);
else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
struct icmphdr *icmph = skb->h.icmph; struct icmphdr *icmph = skb->h.icmph;
...@@ -755,7 +755,7 @@ static void icmp_redirect(struct sk_buff *skb) ...@@ -755,7 +755,7 @@ static void icmp_redirect(struct sk_buff *skb)
skb->h.icmph->un.gateway, skb->h.icmph->un.gateway,
iph->saddr, skb->dev); iph->saddr, skb->dev);
break; break;
} }
out: out:
return; return;
out_err: out_err:
...@@ -959,7 +959,7 @@ int icmp_rcv(struct sk_buff *skb) ...@@ -959,7 +959,7 @@ int icmp_rcv(struct sk_buff *skb)
* Parse the ICMP message * Parse the ICMP message
*/ */
if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
/* /*
* RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be * RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be
* silently ignored (we let user decide with a sysctl). * silently ignored (we let user decide with a sysctl).
...@@ -976,7 +976,7 @@ int icmp_rcv(struct sk_buff *skb) ...@@ -976,7 +976,7 @@ int icmp_rcv(struct sk_buff *skb)
icmph->type != ICMP_ADDRESS && icmph->type != ICMP_ADDRESS &&
icmph->type != ICMP_ADDRESSREPLY) { icmph->type != ICMP_ADDRESSREPLY) {
goto error; goto error;
} }
} }
ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry); ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry);
...@@ -1085,7 +1085,7 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { ...@@ -1085,7 +1085,7 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
.input_entry = ICMP_MIB_DUMMY, .input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard, .handler = icmp_discard,
}, },
[ICMP_INFO_REPLY] = { [ICMP_INFO_REPLY] = {
.output_entry = ICMP_MIB_DUMMY, .output_entry = ICMP_MIB_DUMMY,
.input_entry = ICMP_MIB_DUMMY, .input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard, .handler = icmp_discard,
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* *
* Chih-Jen Chang : Tried to revise IGMP to Version 2 * Chih-Jen Chang : Tried to revise IGMP to Version 2
* Tsu-Sheng Tsao E-mail: chihjenc@scf.usc.edu and tsusheng@scf.usc.edu * Tsu-Sheng Tsao E-mail: chihjenc@scf.usc.edu and tsusheng@scf.usc.edu
* The enhancements are mainly based on Steve Deering's * The enhancements are mainly based on Steve Deering's
* ipmulti-3.5 source code. * ipmulti-3.5 source code.
* Chih-Jen Chang : Added the igmp_get_mrouter_info and * Chih-Jen Chang : Added the igmp_get_mrouter_info and
* Tsu-Sheng Tsao igmp_set_mrouter_info to keep track of * Tsu-Sheng Tsao igmp_set_mrouter_info to keep track of
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
* Alan Cox : Stop IGMP from 0.0.0.0 being accepted. * Alan Cox : Stop IGMP from 0.0.0.0 being accepted.
* Alan Cox : Use GFP_ATOMIC in the right places. * Alan Cox : Use GFP_ATOMIC in the right places.
* Christian Daudt : igmp timer wasn't set for local group * Christian Daudt : igmp timer wasn't set for local group
* memberships but was being deleted, * memberships but was being deleted,
* which caused a "del_timer() called * which caused a "del_timer() called
* from %p with timer not initialized\n" * from %p with timer not initialized\n"
* message (960131). * message (960131).
* Christian Daudt : removed del_timer from * Christian Daudt : removed del_timer from
* igmp_timer_expire function (960205). * igmp_timer_expire function (960205).
* Christian Daudt : igmp_heard_report now only calls * Christian Daudt : igmp_heard_report now only calls
* igmp_timer_expire if tm->running is * igmp_timer_expire if tm->running is
...@@ -718,7 +718,7 @@ static void igmp_ifc_event(struct in_device *in_dev) ...@@ -718,7 +718,7 @@ static void igmp_ifc_event(struct in_device *in_dev)
{ {
if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev))
return; return;
in_dev->mr_ifc_count = in_dev->mr_qrv ? in_dev->mr_qrv : in_dev->mr_ifc_count = in_dev->mr_qrv ? in_dev->mr_qrv :
IGMP_Unsolicited_Report_Count; IGMP_Unsolicited_Report_Count;
igmp_ifc_start_timer(in_dev, 1); igmp_ifc_start_timer(in_dev, 1);
} }
...@@ -838,7 +838,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -838,7 +838,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
if (len == 8) { if (len == 8) {
if (ih->code == 0) { if (ih->code == 0) {
/* Alas, old v1 router presents here. */ /* Alas, old v1 router presents here. */
max_delay = IGMP_Query_Response_Interval; max_delay = IGMP_Query_Response_Interval;
in_dev->mr_v1_seen = jiffies + in_dev->mr_v1_seen = jiffies +
IGMP_V1_Router_Present_Timeout; IGMP_V1_Router_Present_Timeout;
...@@ -860,10 +860,10 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -860,10 +860,10 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
} else { /* v3 */ } else { /* v3 */
if (!pskb_may_pull(skb, sizeof(struct igmpv3_query))) if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)))
return; return;
ih3 = (struct igmpv3_query *) skb->h.raw; ih3 = (struct igmpv3_query *) skb->h.raw;
if (ih3->nsrcs) { if (ih3->nsrcs) {
if (!pskb_may_pull(skb, sizeof(struct igmpv3_query) if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)
+ ntohs(ih3->nsrcs)*sizeof(__be32))) + ntohs(ih3->nsrcs)*sizeof(__be32)))
return; return;
ih3 = (struct igmpv3_query *) skb->h.raw; ih3 = (struct igmpv3_query *) skb->h.raw;
...@@ -909,7 +909,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, ...@@ -909,7 +909,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
else else
im->gsquery = mark; im->gsquery = mark;
changed = !im->gsquery || changed = !im->gsquery ||
igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs); igmp_marksources(im, ntohs(ih3->nsrcs), ih3->srcs);
spin_unlock_bh(&im->lock); spin_unlock_bh(&im->lock);
if (changed) if (changed)
igmp_mod_timer(im, max_delay); igmp_mod_timer(im, max_delay);
...@@ -1257,9 +1257,9 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) ...@@ -1257,9 +1257,9 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
{ {
struct ip_mc_list *i, **ip; struct ip_mc_list *i, **ip;
ASSERT_RTNL(); ASSERT_RTNL();
for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
if (i->multiaddr==addr) { if (i->multiaddr==addr) {
if (--i->users == 0) { if (--i->users == 0) {
...@@ -1436,7 +1436,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode, ...@@ -1436,7 +1436,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
#ifdef CONFIG_IP_MULTICAST #ifdef CONFIG_IP_MULTICAST
if (psf->sf_oldin && if (psf->sf_oldin &&
!IGMP_V1_SEEN(in_dev) && !IGMP_V2_SEEN(in_dev)) { !IGMP_V1_SEEN(in_dev) && !IGMP_V2_SEEN(in_dev)) {
psf->sf_crcount = in_dev->mr_qrv ? in_dev->mr_qrv : psf->sf_crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
IGMP_Unsolicited_Report_Count; IGMP_Unsolicited_Report_Count;
psf->sf_next = pmc->tomb; psf->sf_next = pmc->tomb;
pmc->tomb = psf; pmc->tomb = psf;
...@@ -1500,7 +1500,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode, ...@@ -1500,7 +1500,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
/* filter mode change */ /* filter mode change */
pmc->sfmode = MCAST_INCLUDE; pmc->sfmode = MCAST_INCLUDE;
#ifdef CONFIG_IP_MULTICAST #ifdef CONFIG_IP_MULTICAST
pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
IGMP_Unsolicited_Report_Count; IGMP_Unsolicited_Report_Count;
in_dev->mr_ifc_count = pmc->crcount; in_dev->mr_ifc_count = pmc->crcount;
for (psf=pmc->sources; psf; psf = psf->sf_next) for (psf=pmc->sources; psf; psf = psf->sf_next)
...@@ -1679,7 +1679,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, ...@@ -1679,7 +1679,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
#ifdef CONFIG_IP_MULTICAST #ifdef CONFIG_IP_MULTICAST
/* else no filters; keep old mode for reports */ /* else no filters; keep old mode for reports */
pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv : pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
IGMP_Unsolicited_Report_Count; IGMP_Unsolicited_Report_Count;
in_dev->mr_ifc_count = pmc->crcount; in_dev->mr_ifc_count = pmc->crcount;
for (psf=pmc->sources; psf; psf = psf->sf_next) for (psf=pmc->sources; psf; psf = psf->sf_next)
...@@ -1873,7 +1873,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct ...@@ -1873,7 +1873,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
} else if (pmc->sfmode != omode) { } else if (pmc->sfmode != omode) {
/* allow mode switches for empty-set filters */ /* allow mode switches for empty-set filters */
ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 0, NULL, 0); ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 0, NULL, 0);
ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, pmc->sfmode, 0, ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, pmc->sfmode, 0,
NULL, 0); NULL, 0);
pmc->sfmode = omode; pmc->sfmode = omode;
} }
...@@ -1899,7 +1899,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct ...@@ -1899,7 +1899,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
} }
/* update the interface filter */ /* update the interface filter */
ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1, ip_mc_del_src(in_dev, &mreqs->imr_multiaddr, omode, 1,
&mreqs->imr_sourceaddr, 1); &mreqs->imr_sourceaddr, 1);
for (j=i+1; j<psl->sl_count; j++) for (j=i+1; j<psl->sl_count; j++)
...@@ -1949,7 +1949,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct ...@@ -1949,7 +1949,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
psl->sl_count++; psl->sl_count++;
err = 0; err = 0;
/* update the interface list */ /* update the interface list */
ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 1, ip_mc_add_src(in_dev, &mreqs->imr_multiaddr, omode, 1,
&mreqs->imr_sourceaddr, 1); &mreqs->imr_sourceaddr, 1);
done: done:
rtnl_unlock(); rtnl_unlock();
...@@ -2264,7 +2264,7 @@ static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq) ...@@ -2264,7 +2264,7 @@ static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq)
struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq); struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
for (state->dev = dev_base, state->in_dev = NULL; for (state->dev = dev_base, state->in_dev = NULL;
state->dev; state->dev;
state->dev = state->dev->next) { state->dev = state->dev->next) {
struct in_device *in_dev; struct in_device *in_dev;
in_dev = in_dev_get(state->dev); in_dev = in_dev_get(state->dev);
...@@ -2346,7 +2346,7 @@ static void igmp_mc_seq_stop(struct seq_file *seq, void *v) ...@@ -2346,7 +2346,7 @@ static void igmp_mc_seq_stop(struct seq_file *seq, void *v)
static int igmp_mc_seq_show(struct seq_file *seq, void *v) static int igmp_mc_seq_show(struct seq_file *seq, void *v)
{ {
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
seq_puts(seq, seq_puts(seq,
"Idx\tDevice : Count Querier\tGroup Users Timer\tReporter\n"); "Idx\tDevice : Count Querier\tGroup Users Timer\tReporter\n");
else { else {
struct ip_mc_list *im = (struct ip_mc_list *)v; struct ip_mc_list *im = (struct ip_mc_list *)v;
...@@ -2426,7 +2426,7 @@ static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq) ...@@ -2426,7 +2426,7 @@ static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq)
struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
for (state->dev = dev_base, state->idev = NULL, state->im = NULL; for (state->dev = dev_base, state->idev = NULL, state->im = NULL;
state->dev; state->dev;
state->dev = state->dev->next) { state->dev = state->dev->next) {
struct in_device *idev; struct in_device *idev;
idev = in_dev_get(state->dev); idev = in_dev_get(state->dev);
...@@ -2531,7 +2531,7 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v) ...@@ -2531,7 +2531,7 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v)
struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq); struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, seq_printf(seq,
"%3s %6s " "%3s %6s "
"%10s %10s %6s %6s\n", "Idx", "%10s %10s %6s %6s\n", "Idx",
"Device", "MCA", "Device", "MCA",
...@@ -2539,8 +2539,8 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v) ...@@ -2539,8 +2539,8 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v)
} else { } else {
seq_printf(seq, seq_printf(seq,
"%3d %6.6s 0x%08x " "%3d %6.6s 0x%08x "
"0x%08x %6lu %6lu\n", "0x%08x %6lu %6lu\n",
state->dev->ifindex, state->dev->name, state->dev->ifindex, state->dev->name,
ntohl(state->im->multiaddr), ntohl(state->im->multiaddr),
ntohl(psf->sf_inaddr), ntohl(psf->sf_inaddr),
psf->sf_count[MCAST_INCLUDE], psf->sf_count[MCAST_INCLUDE],
......
...@@ -149,7 +149,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo, ...@@ -149,7 +149,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
if (!inet_csk(sk)->icsk_bind_hash) if (!inet_csk(sk)->icsk_bind_hash)
inet_bind_hash(sk, tb, snum); inet_bind_hash(sk, tb, snum);
BUG_TRAP(inet_csk(sk)->icsk_bind_hash == tb); BUG_TRAP(inet_csk(sk)->icsk_bind_hash == tb);
ret = 0; ret = 0;
fail_unlock: fail_unlock:
spin_unlock(&head->lock); spin_unlock(&head->lock);
...@@ -255,7 +255,7 @@ EXPORT_SYMBOL(inet_csk_accept); ...@@ -255,7 +255,7 @@ EXPORT_SYMBOL(inet_csk_accept);
/* /*
* Using different timers for retransmit, delayed acks and probes * Using different timers for retransmit, delayed acks and probes
* We may wish use just one timer maintaining a list of expire jiffies * We may wish use just one timer maintaining a list of expire jiffies
* to optimize. * to optimize.
*/ */
void inet_csk_init_xmit_timers(struct sock *sk, void inet_csk_init_xmit_timers(struct sock *sk,
...@@ -273,7 +273,7 @@ void inet_csk_init_xmit_timers(struct sock *sk, ...@@ -273,7 +273,7 @@ void inet_csk_init_xmit_timers(struct sock *sk,
icsk->icsk_delack_timer.function = delack_handler; icsk->icsk_delack_timer.function = delack_handler;
sk->sk_timer.function = keepalive_handler; sk->sk_timer.function = keepalive_handler;
icsk->icsk_retransmit_timer.data = icsk->icsk_retransmit_timer.data =
icsk->icsk_delack_timer.data = icsk->icsk_delack_timer.data =
sk->sk_timer.data = (unsigned long)sk; sk->sk_timer.data = (unsigned long)sk;
......
...@@ -381,7 +381,7 @@ static int inet_diag_bc_run(const void *bc, int len, ...@@ -381,7 +381,7 @@ static int inet_diag_bc_run(const void *bc, int len,
if (addr[0] == 0 && addr[1] == 0 && if (addr[0] == 0 && addr[1] == 0 &&
addr[2] == htonl(0xffff) && addr[2] == htonl(0xffff) &&
bitstring_match(addr + 3, cond->addr, bitstring_match(addr + 3, cond->addr,
cond->prefix_len)) cond->prefix_len))
break; break;
} }
yes = 0; yes = 0;
...@@ -518,7 +518,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, ...@@ -518,7 +518,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
} }
entry.sport = tw->tw_num; entry.sport = tw->tw_num;
entry.dport = ntohs(tw->tw_dport); entry.dport = ntohs(tw->tw_dport);
entry.userlocks = 0; entry.userlocks = 0;
if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry))
return 0; return 0;
......
...@@ -262,7 +262,7 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, ...@@ -262,7 +262,7 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
static inline u32 inet_sk_port_offset(const struct sock *sk) static inline u32 inet_sk_port_offset(const struct sock *sk)
{ {
const struct inet_sock *inet = inet_sk(sk); const struct inet_sock *inet = inet_sk(sk);
return secure_ipv4_port_ephemeral(inet->rcv_saddr, inet->daddr, return secure_ipv4_port_ephemeral(inet->rcv_saddr, inet->daddr,
inet->dport); inet->dport);
} }
...@@ -274,81 +274,81 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row, ...@@ -274,81 +274,81 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row,
{ {
struct inet_hashinfo *hinfo = death_row->hashinfo; struct inet_hashinfo *hinfo = death_row->hashinfo;
const unsigned short snum = inet_sk(sk)->num; const unsigned short snum = inet_sk(sk)->num;
struct inet_bind_hashbucket *head; struct inet_bind_hashbucket *head;
struct inet_bind_bucket *tb; struct inet_bind_bucket *tb;
int ret; int ret;
if (!snum) { if (!snum) {
int low = sysctl_local_port_range[0]; int low = sysctl_local_port_range[0];
int high = sysctl_local_port_range[1]; int high = sysctl_local_port_range[1];
int range = high - low; int range = high - low;
int i; int i;
int port; int port;
static u32 hint; static u32 hint;
u32 offset = hint + inet_sk_port_offset(sk); u32 offset = hint + inet_sk_port_offset(sk);
struct hlist_node *node; struct hlist_node *node;
struct inet_timewait_sock *tw = NULL; struct inet_timewait_sock *tw = NULL;
local_bh_disable(); local_bh_disable();
for (i = 1; i <= range; i++) { for (i = 1; i <= range; i++) {
port = low + (i + offset) % range; port = low + (i + offset) % range;
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
spin_lock(&head->lock); spin_lock(&head->lock);
/* Does not bother with rcv_saddr checks, /* Does not bother with rcv_saddr checks,
* because the established check is already * because the established check is already
* unique enough. * unique enough.
*/ */
inet_bind_bucket_for_each(tb, node, &head->chain) { inet_bind_bucket_for_each(tb, node, &head->chain) {
if (tb->port == port) { if (tb->port == port) {
BUG_TRAP(!hlist_empty(&tb->owners)); BUG_TRAP(!hlist_empty(&tb->owners));
if (tb->fastreuse >= 0) if (tb->fastreuse >= 0)
goto next_port; goto next_port;
if (!__inet_check_established(death_row, if (!__inet_check_established(death_row,
sk, port, sk, port,
&tw)) &tw))
goto ok; goto ok;
goto next_port; goto next_port;
} }
} }
tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port);
if (!tb) { if (!tb) {
spin_unlock(&head->lock); spin_unlock(&head->lock);
break; break;
} }
tb->fastreuse = -1; tb->fastreuse = -1;
goto ok; goto ok;
next_port: next_port:
spin_unlock(&head->lock); spin_unlock(&head->lock);
} }
local_bh_enable(); local_bh_enable();
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
ok: ok:
hint += i; hint += i;
/* Head lock still held and bh's disabled */ /* Head lock still held and bh's disabled */
inet_bind_hash(sk, tb, port); inet_bind_hash(sk, tb, port);
if (sk_unhashed(sk)) { if (sk_unhashed(sk)) {
inet_sk(sk)->sport = htons(port); inet_sk(sk)->sport = htons(port);
__inet_hash(hinfo, sk, 0); __inet_hash(hinfo, sk, 0);
} }
spin_unlock(&head->lock); spin_unlock(&head->lock);
if (tw) { if (tw) {
inet_twsk_deschedule(tw, death_row); inet_twsk_deschedule(tw, death_row);
inet_twsk_put(tw); inet_twsk_put(tw);
} }
ret = 0; ret = 0;
goto out; goto out;
} }
head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)];
tb = inet_csk(sk)->icsk_bind_hash; tb = inet_csk(sk)->icsk_bind_hash;
spin_lock_bh(&head->lock); spin_lock_bh(&head->lock);
if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) {
__inet_hash(hinfo, sk, 0); __inet_hash(hinfo, sk, 0);
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
* interface as the means of communication with the user level. * interface as the means of communication with the user level.
* *
* The IP forwarding functionality. * The IP forwarding functionality.
* *
* Version: $Id: ip_forward.c,v 1.48 2000/12/13 18:31:48 davem Exp $ * Version: $Id: ip_forward.c,v 1.48 2000/12/13 18:31:48 davem Exp $
* *
* Authors: see ip.c * Authors: see ip.c
* *
* Fixes: * Fixes:
* Many : Split from ip.c , see ip_input.c for * Many : Split from ip.c , see ip_input.c for
* history. * history.
* Dave Gregorich : NULL ip_rt_put fix for multicast * Dave Gregorich : NULL ip_rt_put fix for multicast
* routing. * routing.
* Jos Vos : Add call_out_firewall before sending, * Jos Vos : Add call_out_firewall before sending,
* use output device for accounting. * use output device for accounting.
...@@ -69,14 +69,14 @@ int ip_forward(struct sk_buff *skb) ...@@ -69,14 +69,14 @@ int ip_forward(struct sk_buff *skb)
goto drop; goto drop;
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
/* /*
* According to the RFC, we must first decrease the TTL field. If * According to the RFC, we must first decrease the TTL field. If
* that reaches zero, we must reply an ICMP control message telling * that reaches zero, we must reply an ICMP control message telling
* that the packet's lifetime expired. * that the packet's lifetime expired.
*/ */
if (skb->nh.iph->ttl <= 1) if (skb->nh.iph->ttl <= 1)
goto too_many_hops; goto too_many_hops;
if (!xfrm4_route_forward(skb)) if (!xfrm4_route_forward(skb))
goto drop; goto drop;
...@@ -107,16 +107,16 @@ int ip_forward(struct sk_buff *skb) ...@@ -107,16 +107,16 @@ int ip_forward(struct sk_buff *skb)
ip_forward_finish); ip_forward_finish);
sr_failed: sr_failed:
/* /*
* Strict routing permits no gatewaying * Strict routing permits no gatewaying
*/ */
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0);
goto drop; goto drop;
too_many_hops: too_many_hops:
/* Tell the sender its packet died... */ /* Tell the sender its packet died... */
IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0); icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
return NET_RX_DROP; return NET_RX_DROP;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface as the means of communication with the user level. * interface as the means of communication with the user level.
* *
* The IP fragmentation functionality. * The IP fragmentation functionality.
* *
* Version: $Id: ip_fragment.c,v 1.59 2002/01/12 07:54:56 davem Exp $ * Version: $Id: ip_fragment.c,v 1.59 2002/01/12 07:54:56 davem Exp $
* *
* Authors: Fred N. van Kempen <waltje@uWalt.NL.Mugnet.ORG> * Authors: Fred N. van Kempen <waltje@uWalt.NL.Mugnet.ORG>
...@@ -238,7 +238,7 @@ static void ipq_kill(struct ipq *ipq) ...@@ -238,7 +238,7 @@ static void ipq_kill(struct ipq *ipq)
} }
} }
/* Memory limiting on fragments. Evictor trashes the oldest /* Memory limiting on fragments. Evictor trashes the oldest
* fragment queue until we are back under the threshold. * fragment queue until we are back under the threshold.
*/ */
static void ip_evictor(void) static void ip_evictor(void)
...@@ -479,14 +479,14 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) ...@@ -479,14 +479,14 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
goto err; goto err;
} }
offset = ntohs(skb->nh.iph->frag_off); offset = ntohs(skb->nh.iph->frag_off);
flags = offset & ~IP_OFFSET; flags = offset & ~IP_OFFSET;
offset &= IP_OFFSET; offset &= IP_OFFSET;
offset <<= 3; /* offset is in 8-byte chunks */ offset <<= 3; /* offset is in 8-byte chunks */
ihl = skb->nh.iph->ihl * 4; ihl = skb->nh.iph->ihl * 4;
/* Determine the position of this fragment. */ /* Determine the position of this fragment. */
end = offset + skb->len - ihl; end = offset + skb->len - ihl;
/* Is this the final fragment? */ /* Is this the final fragment? */
if ((flags & IP_MF) == 0) { if ((flags & IP_MF) == 0) {
...@@ -589,8 +589,8 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb) ...@@ -589,8 +589,8 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
else else
qp->fragments = skb; qp->fragments = skb;
if (skb->dev) if (skb->dev)
qp->iif = skb->dev->ifindex; qp->iif = skb->dev->ifindex;
skb->dev = NULL; skb->dev = NULL;
skb_get_timestamp(skb, &qp->stamp); skb_get_timestamp(skb, &qp->stamp);
qp->meat += skb->len; qp->meat += skb->len;
...@@ -684,7 +684,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev) ...@@ -684,7 +684,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
return head; return head;
out_nomem: out_nomem:
LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing " LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing "
"queue %p\n", qp); "queue %p\n", qp);
goto out_fail; goto out_fail;
out_oversize: out_oversize:
...@@ -703,7 +703,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user) ...@@ -703,7 +703,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
struct iphdr *iph = skb->nh.iph; struct iphdr *iph = skb->nh.iph;
struct ipq *qp; struct ipq *qp;
struct net_device *dev; struct net_device *dev;
IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
/* Start by cleaning up the memory. */ /* Start by cleaning up the memory. */
......
/* /*
* Linux NET3: GRE over IP protocol decoder. * Linux NET3: GRE over IP protocol decoder.
* *
* Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru) * Authors: Alexey Kuznetsov (kuznet@ms2.inr.ac.ru)
* *
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
solution, but it supposes maintaing new variable in ALL solution, but it supposes maintaing new variable in ALL
skb, even if no tunneling is used. skb, even if no tunneling is used.
Current solution: t->recursion lock breaks dead loops. It looks Current solution: t->recursion lock breaks dead loops. It looks
like dev->tbusy flag, but I preferred new variable, because like dev->tbusy flag, but I preferred new variable, because
the semantics is different. One day, when hard_start_xmit the semantics is different. One day, when hard_start_xmit
will be multithreaded we will have to use skb->encapsulation. will be multithreaded we will have to use skb->encapsulation.
...@@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb) ...@@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb)
if (flags == 0 && if (flags == 0 &&
skb->protocol == htons(ETH_P_WCCP)) { skb->protocol == htons(ETH_P_WCCP)) {
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
if ((*(h + offset) & 0xF0) != 0x40) if ((*(h + offset) & 0xF0) != 0x40)
offset += 4; offset += 4;
} }
...@@ -816,7 +816,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -816,7 +816,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
if (!new_skb) { if (!new_skb) {
ip_rt_put(rt); ip_rt_put(rt);
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--; tunnel->recursion--;
return 0; return 0;
...@@ -1044,7 +1044,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1044,7 +1044,7 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
so that I had to set ARPHRD_IPGRE to a random value. so that I had to set ARPHRD_IPGRE to a random value.
I have an impression, that Cisco could make something similar, I have an impression, that Cisco could make something similar,
but this feature is apparently missing in IOS<=11.2(8). but this feature is apparently missing in IOS<=11.2(8).
I set up 10.66.66/24 and fec0:6666:6666::0/96 as virtual networks I set up 10.66.66/24 and fec0:6666:6666::0/96 as virtual networks
with broadcast 224.66.66.66. If you have access to mbone, play with me :-) with broadcast 224.66.66.66. If you have access to mbone, play with me :-)
...@@ -1076,9 +1076,9 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh ...@@ -1076,9 +1076,9 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
p[1] = htons(type); p[1] = htons(type);
/* /*
* Set the source hardware address. * Set the source hardware address.
*/ */
if (saddr) if (saddr)
memcpy(&iph->saddr, saddr, 4); memcpy(&iph->saddr, saddr, 4);
...@@ -1088,7 +1088,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh ...@@ -1088,7 +1088,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh
} }
if (iph->daddr && !MULTICAST(iph->daddr)) if (iph->daddr && !MULTICAST(iph->daddr))
return t->hlen; return t->hlen;
return -t->hlen; return -t->hlen;
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Stefan Becker, <stefanb@yello.ping.de> * Stefan Becker, <stefanb@yello.ping.de>
* Jorge Cwik, <jorge@laser.satlink.net> * Jorge Cwik, <jorge@laser.satlink.net>
* Arnt Gulbrandsen, <agulbra@nvg.unit.no> * Arnt Gulbrandsen, <agulbra@nvg.unit.no>
* *
* *
* Fixes: * Fixes:
* Alan Cox : Commented a couple of minor bits of surplus code * Alan Cox : Commented a couple of minor bits of surplus code
...@@ -98,13 +98,13 @@ ...@@ -98,13 +98,13 @@
* Jos Vos : Do accounting *before* call_in_firewall * Jos Vos : Do accounting *before* call_in_firewall
* Willy Konynenberg : Transparent proxying support * Willy Konynenberg : Transparent proxying support
* *
* *
* *
* To Fix: * To Fix:
* IP fragmentation wants rewriting cleanly. The RFC815 algorithm is much more efficient * IP fragmentation wants rewriting cleanly. The RFC815 algorithm is much more efficient
* and could be made very efficient with the addition of some virtual memory hacks to permit * and could be made very efficient with the addition of some virtual memory hacks to permit
* the allocation of a buffer that can then be 'grown' by twiddling page tables. * the allocation of a buffer that can then be 'grown' by twiddling page tables.
* Output fragmentation wants updating along with the buffer management to use a single * Output fragmentation wants updating along with the buffer management to use a single
* interleaved copy algorithm so that fragmenting has a one copy overhead. Actual packet * interleaved copy algorithm so that fragmenting has a one copy overhead. Actual packet
* output should probably do its own fragmentation at the UDP/RAW layer. TCP shouldn't cause * output should probably do its own fragmentation at the UDP/RAW layer. TCP shouldn't cause
* fragmentation anyway. * fragmentation anyway.
...@@ -154,7 +154,7 @@ DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly; ...@@ -154,7 +154,7 @@ DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics) __read_mostly;
/* /*
* Process Router Attention IP option * Process Router Attention IP option
*/ */
int ip_call_ra_chain(struct sk_buff *skb) int ip_call_ra_chain(struct sk_buff *skb)
{ {
struct ip_ra_chain *ra; struct ip_ra_chain *ra;
...@@ -202,8 +202,8 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb) ...@@ -202,8 +202,8 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
__skb_pull(skb, ihl); __skb_pull(skb, ihl);
/* Point into the IP datagram, just past the header. */ /* Point into the IP datagram, just past the header. */
skb->h.raw = skb->data; skb->h.raw = skb->data;
rcu_read_lock(); rcu_read_lock();
{ {
...@@ -259,7 +259,7 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb) ...@@ -259,7 +259,7 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
/* /*
* Deliver IP Packets to the higher protocol layers. * Deliver IP Packets to the higher protocol layers.
*/ */
int ip_local_deliver(struct sk_buff *skb) int ip_local_deliver(struct sk_buff *skb)
{ {
/* /*
...@@ -335,14 +335,14 @@ static inline int ip_rcv_finish(struct sk_buff *skb) ...@@ -335,14 +335,14 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
/* /*
* Initialise the virtual path cache for the packet. It describes * Initialise the virtual path cache for the packet. It describes
* how the packet travels inside Linux networking. * how the packet travels inside Linux networking.
*/ */
if (skb->dst == NULL) { if (skb->dst == NULL) {
int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
skb->dev); skb->dev);
if (unlikely(err)) { if (unlikely(err)) {
if (err == -EHOSTUNREACH) if (err == -EHOSTUNREACH)
IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS); IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
goto drop; goto drop;
} }
} }
...@@ -363,13 +363,13 @@ static inline int ip_rcv_finish(struct sk_buff *skb) ...@@ -363,13 +363,13 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
return dst_input(skb); return dst_input(skb);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
return NET_RX_DROP; return NET_RX_DROP;
} }
/* /*
* Main IP Receive routine. * Main IP Receive routine.
*/ */
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{ {
struct iphdr *iph; struct iphdr *iph;
...@@ -437,9 +437,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, ...@@ -437,9 +437,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
inhdr_error: inhdr_error:
IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
drop: drop:
kfree_skb(skb); kfree_skb(skb);
out: out:
return NET_RX_DROP; return NET_RX_DROP;
} }
EXPORT_SYMBOL(ip_statistics); EXPORT_SYMBOL(ip_statistics);
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Version: $Id: ip_options.c,v 1.21 2001/09/01 00:31:50 davem Exp $ * Version: $Id: ip_options.c,v 1.21 2001/09/01 00:31:50 davem Exp $
* *
* Authors: A.N.Kuznetsov * Authors: A.N.Kuznetsov
* *
*/ */
#include <linux/capability.h> #include <linux/capability.h>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <net/route.h> #include <net/route.h>
#include <net/cipso_ipv4.h> #include <net/cipso_ipv4.h>
/* /*
* Write options to IP header, record destination address to * Write options to IP header, record destination address to
* source route option, address of outgoing interface * source route option, address of outgoing interface
* (we should already know it, so that this function is allowed be * (we should already know it, so that this function is allowed be
...@@ -76,7 +76,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, ...@@ -76,7 +76,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt,
} }
} }
/* /*
* Provided (sopt, skb) points to received options, * Provided (sopt, skb) points to received options,
* build in dopt compiled option set appropriate for answering. * build in dopt compiled option set appropriate for answering.
* i.e. invert SRR option, copy anothers, * i.e. invert SRR option, copy anothers,
...@@ -85,7 +85,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt, ...@@ -85,7 +85,7 @@ void ip_options_build(struct sk_buff * skb, struct ip_options * opt,
* NOTE: dopt cannot point to skb. * NOTE: dopt cannot point to skb.
*/ */
int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
{ {
struct ip_options *sopt; struct ip_options *sopt;
unsigned char *sptr, *dptr; unsigned char *sptr, *dptr;
...@@ -215,7 +215,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) ...@@ -215,7 +215,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
* Simple and stupid 8), but the most efficient way. * Simple and stupid 8), but the most efficient way.
*/ */
void ip_options_fragment(struct sk_buff * skb) void ip_options_fragment(struct sk_buff * skb)
{ {
unsigned char * optptr = skb->nh.raw + sizeof(struct iphdr); unsigned char * optptr = skb->nh.raw + sizeof(struct iphdr);
struct ip_options * opt = &(IPCB(skb)->opt); struct ip_options * opt = &(IPCB(skb)->opt);
...@@ -370,7 +370,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) ...@@ -370,7 +370,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
switch (optptr[3]&0xF) { switch (optptr[3]&0xF) {
case IPOPT_TS_TSONLY: case IPOPT_TS_TSONLY:
opt->ts = optptr - iph; opt->ts = optptr - iph;
if (skb) if (skb)
timeptr = (__be32*)&optptr[optptr[2]-1]; timeptr = (__be32*)&optptr[optptr[2]-1];
opt->ts_needtime = 1; opt->ts_needtime = 1;
optptr[2] += 4; optptr[2] += 4;
...@@ -448,7 +448,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb) ...@@ -448,7 +448,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
goto error; goto error;
} }
opt->cipso = optptr - iph; opt->cipso = optptr - iph;
if (cipso_v4_validate(&optptr)) { if (cipso_v4_validate(&optptr)) {
pp_ptr = optptr; pp_ptr = optptr;
goto error; goto error;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Fixes: * Fixes:
* Alan Cox : Missing nonblock feature in ip_build_xmit. * Alan Cox : Missing nonblock feature in ip_build_xmit.
* Mike Kilburn : htons() missing in ip_build_xmit. * Mike Kilburn : htons() missing in ip_build_xmit.
* Bradford Johnson: Fix faulty handling of some frames when * Bradford Johnson: Fix faulty handling of some frames when
* no route is found. * no route is found.
* Alexander Demenshin: Missing sk/skb free in ip_queue_xmit * Alexander Demenshin: Missing sk/skb free in ip_queue_xmit
* (in case if packet not accepted by * (in case if packet not accepted by
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
* some redundant tests. * some redundant tests.
* Vitaly E. Lavrov : Transparent proxy revived after year coma. * Vitaly E. Lavrov : Transparent proxy revived after year coma.
* Andi Kleen : Replace ip_reply with ip_send_reply. * Andi Kleen : Replace ip_reply with ip_send_reply.
* Andi Kleen : Split fast and slow ip_build_xmit path * Andi Kleen : Split fast and slow ip_build_xmit path
* for decreased register pressure on x86 * for decreased register pressure on x86
* and more readibility. * and more readibility.
* Marc Boucher : When call_out_firewall returns FW_QUEUE, * Marc Boucher : When call_out_firewall returns FW_QUEUE,
* silently drop skb instead of failing with -EPERM. * silently drop skb instead of failing with -EPERM.
* Detlev Wengorz : Copy protocol for fragments. * Detlev Wengorz : Copy protocol for fragments.
...@@ -114,7 +114,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) ...@@ -114,7 +114,7 @@ static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst)
return ttl; return ttl;
} }
/* /*
* Add an ip header to a skbuff and send it out. * Add an ip header to a skbuff and send it out.
* *
*/ */
...@@ -243,7 +243,7 @@ int ip_mc_output(struct sk_buff *skb) ...@@ -243,7 +243,7 @@ int ip_mc_output(struct sk_buff *skb)
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
if (newskb) if (newskb)
NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL, NF_HOOK(PF_INET, NF_IP_POST_ROUTING, newskb, NULL,
newskb->dev, newskb->dev,
ip_dev_loopback_xmit); ip_dev_loopback_xmit);
} }
...@@ -277,7 +277,7 @@ int ip_output(struct sk_buff *skb) ...@@ -277,7 +277,7 @@ int ip_output(struct sk_buff *skb)
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev, return NF_HOOK_COND(PF_INET, NF_IP_POST_ROUTING, skb, NULL, dev,
ip_finish_output, ip_finish_output,
!(IPCB(skb)->flags & IPSKB_REROUTED)); !(IPCB(skb)->flags & IPSKB_REROUTED));
} }
...@@ -660,7 +660,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -660,7 +660,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
return err; return err;
fail: fail:
kfree_skb(skb); kfree_skb(skb);
IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
return err; return err;
} }
...@@ -755,7 +755,7 @@ static inline int ip_ufo_append_data(struct sock *sk, ...@@ -755,7 +755,7 @@ static inline int ip_ufo_append_data(struct sock *sk,
* from many pieces of data. Each pieces will be holded on the socket * from many pieces of data. Each pieces will be holded on the socket
* until ip_push_pending_frames() is called. Each piece can be a page * until ip_push_pending_frames() is called. Each piece can be a page
* or non-page data. * or non-page data.
* *
* Not only UDP, other transport protocols - e.g. raw sockets - can use * Not only UDP, other transport protocols - e.g. raw sockets - can use
* this interface potentially. * this interface potentially.
* *
...@@ -888,7 +888,7 @@ int ip_append_data(struct sock *sk, ...@@ -888,7 +888,7 @@ int ip_append_data(struct sock *sk,
datalen = maxfraglen - fragheaderlen; datalen = maxfraglen - fragheaderlen;
fraglen = datalen + fragheaderlen; fraglen = datalen + fragheaderlen;
if ((flags & MSG_MORE) && if ((flags & MSG_MORE) &&
!(rt->u.dst.dev->features&NETIF_F_SG)) !(rt->u.dst.dev->features&NETIF_F_SG))
alloclen = mtu; alloclen = mtu;
else else
...@@ -903,14 +903,14 @@ int ip_append_data(struct sock *sk, ...@@ -903,14 +903,14 @@ int ip_append_data(struct sock *sk,
alloclen += rt->u.dst.trailer_len; alloclen += rt->u.dst.trailer_len;
if (transhdrlen) { if (transhdrlen) {
skb = sock_alloc_send_skb(sk, skb = sock_alloc_send_skb(sk,
alloclen + hh_len + 15, alloclen + hh_len + 15,
(flags & MSG_DONTWAIT), &err); (flags & MSG_DONTWAIT), &err);
} else { } else {
skb = NULL; skb = NULL;
if (atomic_read(&sk->sk_wmem_alloc) <= if (atomic_read(&sk->sk_wmem_alloc) <=
2 * sk->sk_sndbuf) 2 * sk->sk_sndbuf)
skb = sock_wmalloc(sk, skb = sock_wmalloc(sk,
alloclen + hh_len + 15, 1, alloclen + hh_len + 15, 1,
sk->sk_allocation); sk->sk_allocation);
if (unlikely(skb == NULL)) if (unlikely(skb == NULL))
...@@ -971,7 +971,7 @@ int ip_append_data(struct sock *sk, ...@@ -971,7 +971,7 @@ int ip_append_data(struct sock *sk,
unsigned int off; unsigned int off;
off = skb->len; off = skb->len;
if (getfrag(from, skb_put(skb, copy), if (getfrag(from, skb_put(skb, copy),
offset, copy, off, skb) < 0) { offset, copy, off, skb) < 0) {
__skb_trim(skb, off); __skb_trim(skb, off);
err = -EFAULT; err = -EFAULT;
...@@ -993,7 +993,7 @@ int ip_append_data(struct sock *sk, ...@@ -993,7 +993,7 @@ int ip_append_data(struct sock *sk,
goto error; goto error;
} }
get_page(page); get_page(page);
skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0); skb_fill_page_desc(skb, i, page, sk->sk_sndmsg_off, 0);
frag = &skb_shinfo(skb)->frags[i]; frag = &skb_shinfo(skb)->frags[i];
} }
} else if (i < MAX_SKB_FRAGS) { } else if (i < MAX_SKB_FRAGS) {
...@@ -1033,7 +1033,7 @@ int ip_append_data(struct sock *sk, ...@@ -1033,7 +1033,7 @@ int ip_append_data(struct sock *sk,
error: error:
inet->cork.length -= length; inet->cork.length -= length;
IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS); IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
return err; return err;
} }
ssize_t ip_append_page(struct sock *sk, struct page *page, ssize_t ip_append_page(struct sock *sk, struct page *page,
...@@ -1257,7 +1257,7 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1257,7 +1257,7 @@ int ip_push_pending_frames(struct sock *sk)
skb->dst = dst_clone(&rt->u.dst); skb->dst = dst_clone(&rt->u.dst);
/* Netfilter gets whole the not fragmented skb. */ /* Netfilter gets whole the not fragmented skb. */
err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL,
skb->dst->dev, dst_output); skb->dst->dev, dst_output);
if (err) { if (err) {
if (err > 0) if (err > 0)
...@@ -1305,21 +1305,21 @@ void ip_flush_pending_frames(struct sock *sk) ...@@ -1305,21 +1305,21 @@ void ip_flush_pending_frames(struct sock *sk)
/* /*
* Fetch data from kernel space and fill in checksum if needed. * Fetch data from kernel space and fill in checksum if needed.
*/ */
static int ip_reply_glue_bits(void *dptr, char *to, int offset, static int ip_reply_glue_bits(void *dptr, char *to, int offset,
int len, int odd, struct sk_buff *skb) int len, int odd, struct sk_buff *skb)
{ {
__wsum csum; __wsum csum;
csum = csum_partial_copy_nocheck(dptr+offset, to, len, 0); csum = csum_partial_copy_nocheck(dptr+offset, to, len, 0);
skb->csum = csum_block_add(skb->csum, csum, odd); skb->csum = csum_block_add(skb->csum, csum, odd);
return 0; return 0;
} }
/* /*
* Generic function to send a packet as reply to another packet. * Generic function to send a packet as reply to another packet.
* Used to send TCP resets so far. ICMP should use this function too. * Used to send TCP resets so far. ICMP should use this function too.
* *
* Should run single threaded per socket because it uses the sock * Should run single threaded per socket because it uses the sock
* structure to pass arguments. * structure to pass arguments.
* *
* LATER: switch from ip_build_xmit to ip_append_* * LATER: switch from ip_build_xmit to ip_append_*
...@@ -1357,7 +1357,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar ...@@ -1357,7 +1357,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
/* Not quite clean, but right. */ /* Not quite clean, but right. */
.uli_u = { .ports = .uli_u = { .ports =
{ .sport = skb->h.th->dest, { .sport = skb->h.th->dest,
.dport = skb->h.th->source } }, .dport = skb->h.th->source } },
.proto = sk->sk_protocol }; .proto = sk->sk_protocol };
security_skb_classify_flow(skb, &fl); security_skb_classify_flow(skb, &fl);
if (ip_route_output_key(&rt, &fl)) if (ip_route_output_key(&rt, &fl))
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface as the means of communication with the user level. * interface as the means of communication with the user level.
* *
* The IP to API glue. * The IP to API glue.
* *
* Version: $Id: ip_sockglue.c,v 1.62 2002/02/01 22:01:04 davem Exp $ * Version: $Id: ip_sockglue.c,v 1.62 2002/02/01 22:01:04 davem Exp $
* *
* Authors: see ip.c * Authors: see ip.c
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Fixes: * Fixes:
* Many : Split from ip.c , see ip.c for history. * Many : Split from ip.c , see ip.c for history.
* Martin Mares : TOS setting fixed. * Martin Mares : TOS setting fixed.
* Alan Cox : Fixed a couple of oopses in Martin's * Alan Cox : Fixed a couple of oopses in Martin's
* TOS tweaks. * TOS tweaks.
* Mike McLagan : Routing by source * Mike McLagan : Routing by source
*/ */
...@@ -253,7 +253,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s ...@@ -253,7 +253,7 @@ int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct s
return 0; return 0;
} }
void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
__be16 port, u32 info, u8 *payload) __be16 port, u32 info, u8 *payload)
{ {
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
...@@ -266,10 +266,10 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, ...@@ -266,10 +266,10 @@ void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
if (!skb) if (!skb)
return; return;
serr = SKB_EXT_ERR(skb); serr = SKB_EXT_ERR(skb);
serr->ee.ee_errno = err; serr->ee.ee_errno = err;
serr->ee.ee_origin = SO_EE_ORIGIN_ICMP; serr->ee.ee_origin = SO_EE_ORIGIN_ICMP;
serr->ee.ee_type = skb->h.icmph->type; serr->ee.ee_type = skb->h.icmph->type;
serr->ee.ee_code = skb->h.icmph->code; serr->ee.ee_code = skb->h.icmph->code;
serr->ee.ee_pad = 0; serr->ee.ee_pad = 0;
serr->ee.ee_info = info; serr->ee.ee_info = info;
...@@ -301,10 +301,10 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf ...@@ -301,10 +301,10 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
skb->nh.iph = iph; skb->nh.iph = iph;
iph->daddr = daddr; iph->daddr = daddr;
serr = SKB_EXT_ERR(skb); serr = SKB_EXT_ERR(skb);
serr->ee.ee_errno = err; serr->ee.ee_errno = err;
serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL; serr->ee.ee_origin = SO_EE_ORIGIN_LOCAL;
serr->ee.ee_type = 0; serr->ee.ee_type = 0;
serr->ee.ee_code = 0; serr->ee.ee_code = 0;
serr->ee.ee_pad = 0; serr->ee.ee_pad = 0;
serr->ee.ee_info = info; serr->ee.ee_info = info;
...@@ -319,7 +319,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf ...@@ -319,7 +319,7 @@ void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 port, u32 inf
kfree_skb(skb); kfree_skb(skb);
} }
/* /*
* Handle MSG_ERRQUEUE * Handle MSG_ERRQUEUE
*/ */
int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) int ip_recv_error(struct sock *sk, struct msghdr *msg, int len)
...@@ -391,7 +391,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len) ...@@ -391,7 +391,7 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len)
} else } else
spin_unlock_bh(&sk->sk_error_queue.lock); spin_unlock_bh(&sk->sk_error_queue.lock);
out_free_skb: out_free_skb:
kfree_skb(skb); kfree_skb(skb);
out: out:
return err; return err;
...@@ -409,15 +409,15 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -409,15 +409,15 @@ static int do_ip_setsockopt(struct sock *sk, int level,
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
int val=0,err; int val=0,err;
if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) | if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) |
(1<<IP_RECVOPTS) | (1<<IP_RECVTOS) | (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) |
(1<<IP_RETOPTS) | (1<<IP_TOS) | (1<<IP_RETOPTS) | (1<<IP_TOS) |
(1<<IP_TTL) | (1<<IP_HDRINCL) | (1<<IP_TTL) | (1<<IP_HDRINCL) |
(1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) | (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) |
(1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
(1<<IP_PASSSEC))) || (1<<IP_PASSSEC))) ||
optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_TTL ||
optname == IP_MULTICAST_LOOP) { optname == IP_MULTICAST_LOOP) {
if (optlen >= sizeof(int)) { if (optlen >= sizeof(int)) {
if (get_user(val, (int __user *) optval)) if (get_user(val, (int __user *) optval))
return -EFAULT; return -EFAULT;
...@@ -511,7 +511,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -511,7 +511,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
val &= ~3; val &= ~3;
val |= inet->tos & 3; val |= inet->tos & 3;
} }
if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP && if (IPTOS_PREC(val) >= IPTOS_PREC_CRITIC_ECP &&
!capable(CAP_NET_ADMIN)) { !capable(CAP_NET_ADMIN)) {
err = -EPERM; err = -EPERM;
break; break;
...@@ -519,7 +519,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -519,7 +519,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
if (inet->tos != val) { if (inet->tos != val) {
inet->tos = val; inet->tos = val;
sk->sk_priority = rt_tos2priority(val); sk->sk_priority = rt_tos2priority(val);
sk_dst_reset(sk); sk_dst_reset(sk);
} }
break; break;
case IP_TTL: case IP_TTL:
...@@ -556,13 +556,13 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -556,13 +556,13 @@ static int do_ip_setsockopt(struct sock *sk, int level,
if (val < 0 || val > 255) if (val < 0 || val > 255)
goto e_inval; goto e_inval;
inet->mc_ttl = val; inet->mc_ttl = val;
break; break;
case IP_MULTICAST_LOOP: case IP_MULTICAST_LOOP:
if (optlen<1) if (optlen<1)
goto e_inval; goto e_inval;
inet->mc_loop = !!val; inet->mc_loop = !!val;
break; break;
case IP_MULTICAST_IF: case IP_MULTICAST_IF:
{ {
struct ip_mreqn mreq; struct ip_mreqn mreq;
struct net_device *dev = NULL; struct net_device *dev = NULL;
...@@ -616,7 +616,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -616,7 +616,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
} }
case IP_ADD_MEMBERSHIP: case IP_ADD_MEMBERSHIP:
case IP_DROP_MEMBERSHIP: case IP_DROP_MEMBERSHIP:
{ {
struct ip_mreqn mreq; struct ip_mreqn mreq;
...@@ -629,7 +629,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -629,7 +629,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
} else { } else {
memset(&mreq, 0, sizeof(mreq)); memset(&mreq, 0, sizeof(mreq));
if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq))) if (copy_from_user(&mreq,optval,sizeof(struct ip_mreq)))
break; break;
} }
if (optname == IP_ADD_MEMBERSHIP) if (optname == IP_ADD_MEMBERSHIP)
...@@ -714,7 +714,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -714,7 +714,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
break; break;
} }
case MCAST_JOIN_GROUP: case MCAST_JOIN_GROUP:
case MCAST_LEAVE_GROUP: case MCAST_LEAVE_GROUP:
{ {
struct group_req greq; struct group_req greq;
struct sockaddr_in *psin; struct sockaddr_in *psin;
...@@ -858,16 +858,16 @@ static int do_ip_setsockopt(struct sock *sk, int level, ...@@ -858,16 +858,16 @@ static int do_ip_setsockopt(struct sock *sk, int level,
kfree(gsf); kfree(gsf);
break; break;
} }
case IP_ROUTER_ALERT: case IP_ROUTER_ALERT:
err = ip_ra_control(sk, val ? 1 : 0, NULL); err = ip_ra_control(sk, val ? 1 : 0, NULL);
break; break;
case IP_FREEBIND: case IP_FREEBIND:
if (optlen<1) if (optlen<1)
goto e_inval; goto e_inval;
inet->freebind = !!val; inet->freebind = !!val;
break; break;
case IP_IPSEC_POLICY: case IP_IPSEC_POLICY:
case IP_XFRM_POLICY: case IP_XFRM_POLICY:
err = -EPERM; err = -EPERM;
...@@ -954,7 +954,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -954,7 +954,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
int val; int val;
int len; int len;
if(level!=SOL_IP) if(level!=SOL_IP)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -969,7 +969,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -969,7 +969,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
return -EFAULT; return -EFAULT;
if(len < 0) if(len < 0)
return -EINVAL; return -EINVAL;
lock_sock(sk); lock_sock(sk);
switch(optname) { switch(optname) {
...@@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -984,7 +984,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
inet->opt->optlen); inet->opt->optlen);
release_sock(sk); release_sock(sk);
if (opt->optlen == 0) if (opt->optlen == 0)
return put_user(0, optlen); return put_user(0, optlen);
ip_options_undo(opt); ip_options_undo(opt);
...@@ -1059,8 +1059,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1059,8 +1059,8 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
addr.s_addr = inet->mc_addr; addr.s_addr = inet->mc_addr;
release_sock(sk); release_sock(sk);
if(put_user(len, optlen)) if(put_user(len, optlen))
return -EFAULT; return -EFAULT;
if(copy_to_user(optval, &addr, len)) if(copy_to_user(optval, &addr, len))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1101,7 +1101,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1101,7 +1101,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
release_sock(sk); release_sock(sk);
return err; return err;
} }
case IP_PKTOPTIONS: case IP_PKTOPTIONS:
{ {
struct msghdr msg; struct msghdr msg;
...@@ -1129,15 +1129,15 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1129,15 +1129,15 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
len -= msg.msg_controllen; len -= msg.msg_controllen;
return put_user(len, optlen); return put_user(len, optlen);
} }
case IP_FREEBIND: case IP_FREEBIND:
val = inet->freebind; val = inet->freebind;
break; break;
default: default:
release_sock(sk); release_sock(sk);
return -ENOPROTOOPT; return -ENOPROTOOPT;
} }
release_sock(sk); release_sock(sk);
if (len < sizeof(int) && len > 0 && val>=0 && val<255) { if (len < sizeof(int) && len > 0 && val>=0 && val<255) {
unsigned char ucval = (unsigned char)val; unsigned char ucval = (unsigned char)val;
len = 1; len = 1;
...@@ -1168,7 +1168,7 @@ int ip_getsockopt(struct sock *sk, int level, ...@@ -1168,7 +1168,7 @@ int ip_getsockopt(struct sock *sk, int level,
&& (optname < MRT_BASE || optname > MRT_BASE+10) && (optname < MRT_BASE || optname > MRT_BASE+10)
#endif #endif
) { ) {
int len; int len;
if(get_user(len,optlen)) if(get_user(len,optlen))
return -EFAULT; return -EFAULT;
...@@ -1197,7 +1197,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, ...@@ -1197,7 +1197,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
&& (optname < MRT_BASE || optname > MRT_BASE+10) && (optname < MRT_BASE || optname > MRT_BASE+10)
#endif #endif
) { ) {
int len; int len;
if (get_user(len, optlen)) if (get_user(len, optlen))
return -EFAULT; return -EFAULT;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) * Software Foundation; either version 2 of the License, or (at your option)
* any later version. * any later version.
* *
* Todo: * Todo:
...@@ -48,7 +48,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -48,7 +48,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
u8 *start, *scratch; u8 *start, *scratch;
struct crypto_comp *tfm; struct crypto_comp *tfm;
int cpu; int cpu;
plen = skb->len; plen = skb->len;
dlen = IPCOMP_SCRATCH_SIZE; dlen = IPCOMP_SCRATCH_SIZE;
start = skb->data; start = skb->data;
...@@ -69,11 +69,11 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -69,11 +69,11 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb)
err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC); err = pskb_expand_head(skb, 0, dlen - plen, GFP_ATOMIC);
if (err) if (err)
goto out; goto out;
skb->truesize += dlen - plen; skb->truesize += dlen - plen;
__skb_put(skb, dlen - plen); __skb_put(skb, dlen - plen);
memcpy(skb->data, scratch, dlen); memcpy(skb->data, scratch, dlen);
out: out:
put_cpu(); put_cpu();
return err; return err;
} }
...@@ -85,11 +85,11 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -85,11 +85,11 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
struct ip_comp_hdr *ipch; struct ip_comp_hdr *ipch;
if (skb_linearize_cow(skb)) if (skb_linearize_cow(skb))
goto out; goto out;
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
/* Remove ipcomp header and decompress original payload */ /* Remove ipcomp header and decompress original payload */
iph = skb->nh.iph; iph = skb->nh.iph;
ipch = (void *)skb->data; ipch = (void *)skb->data;
iph->protocol = ipch->nexthdr; iph->protocol = ipch->nexthdr;
...@@ -97,7 +97,7 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -97,7 +97,7 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
__skb_pull(skb, sizeof(*ipch)); __skb_pull(skb, sizeof(*ipch));
err = ipcomp_decompress(x, skb); err = ipcomp_decompress(x, skb);
out: out:
return err; return err;
} }
...@@ -109,7 +109,7 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -109,7 +109,7 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
u8 *start, *scratch; u8 *start, *scratch;
struct crypto_comp *tfm; struct crypto_comp *tfm;
int cpu; int cpu;
ihlen = iph->ihl * 4; ihlen = iph->ihl * 4;
plen = skb->len - ihlen; plen = skb->len - ihlen;
dlen = IPCOMP_SCRATCH_SIZE; dlen = IPCOMP_SCRATCH_SIZE;
...@@ -127,14 +127,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) ...@@ -127,14 +127,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
err = -EMSGSIZE; err = -EMSGSIZE;
goto out; goto out;
} }
memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
put_cpu(); put_cpu();
pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr)); pskb_trim(skb, ihlen + dlen + sizeof(struct ip_comp_hdr));
return 0; return 0;
out: out:
put_cpu(); put_cpu();
return err; return err;
} }
...@@ -157,7 +157,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -157,7 +157,7 @@ static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
if (skb_linearize_cow(skb)) if (skb_linearize_cow(skb))
goto out_ok; goto out_ok;
err = ipcomp_compress(x, skb); err = ipcomp_compress(x, skb);
iph = skb->nh.iph; iph = skb->nh.iph;
...@@ -194,7 +194,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) ...@@ -194,7 +194,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
spi = htonl(ntohs(ipch->cpi)); spi = htonl(ntohs(ipch->cpi));
x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr,
spi, IPPROTO_COMP, AF_INET); spi, IPPROTO_COMP, AF_INET);
if (!x) if (!x)
return; return;
NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n", NETDEBUG(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%u.%u.%u.%u\n",
...@@ -202,12 +202,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) ...@@ -202,12 +202,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
xfrm_state_put(x); xfrm_state_put(x);
} }
/* We always hold one tunnel user reference to indicate a tunnel */ /* We always hold one tunnel user reference to indicate a tunnel */
static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x) static struct xfrm_state *ipcomp_tunnel_create(struct xfrm_state *x)
{ {
struct xfrm_state *t; struct xfrm_state *t;
u8 mode = XFRM_MODE_TUNNEL; u8 mode = XFRM_MODE_TUNNEL;
t = xfrm_state_alloc(); t = xfrm_state_alloc();
if (t == NULL) if (t == NULL)
goto out; goto out;
...@@ -247,7 +247,7 @@ static int ipcomp_tunnel_attach(struct xfrm_state *x) ...@@ -247,7 +247,7 @@ static int ipcomp_tunnel_attach(struct xfrm_state *x)
struct xfrm_state *t; struct xfrm_state *t;
t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr.a4, t = xfrm_state_lookup((xfrm_address_t *)&x->id.daddr.a4,
x->props.saddr.a4, IPPROTO_IPIP, AF_INET); x->props.saddr.a4, IPPROTO_IPIP, AF_INET);
if (!t) { if (!t) {
t = ipcomp_tunnel_create(x); t = ipcomp_tunnel_create(x);
if (!t) { if (!t) {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* BOOTP rewritten to construct and analyse packets itself instead * BOOTP rewritten to construct and analyse packets itself instead
* of misusing the IP layer. num_bugs_causing_wrong_arp_replies--; * of misusing the IP layer. num_bugs_causing_wrong_arp_replies--;
* -- MJ, December 1998 * -- MJ, December 1998
* *
* Fixed ip_auto_config_setup calling at startup in the new "Linker Magic" * Fixed ip_auto_config_setup calling at startup in the new "Linker Magic"
* initialization scheme. * initialization scheme.
* - Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 08/11/1999 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>, 08/11/1999
...@@ -98,8 +98,8 @@ ...@@ -98,8 +98,8 @@
#define CONF_TIMEOUT_RANDOM (HZ) /* Maximum amount of randomization */ #define CONF_TIMEOUT_RANDOM (HZ) /* Maximum amount of randomization */
#define CONF_TIMEOUT_MULT *7/4 /* Rate of timeout growth */ #define CONF_TIMEOUT_MULT *7/4 /* Rate of timeout growth */
#define CONF_TIMEOUT_MAX (HZ*30) /* Maximum allowed timeout */ #define CONF_TIMEOUT_MAX (HZ*30) /* Maximum allowed timeout */
#define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers #define CONF_NAMESERVERS_MAX 3 /* Maximum number of nameservers
- '3' from resolv.h */ - '3' from resolv.h */
#define NONE __constant_htonl(INADDR_NONE) #define NONE __constant_htonl(INADDR_NONE)
...@@ -365,7 +365,7 @@ static int __init ic_defaults(void) ...@@ -365,7 +365,7 @@ static int __init ic_defaults(void)
* At this point we have no userspace running so need not * At this point we have no userspace running so need not
* claim locks on system_utsname * claim locks on system_utsname
*/ */
if (!ic_host_name_set) if (!ic_host_name_set)
sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); sprintf(init_utsname()->nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr));
...@@ -650,9 +650,9 @@ static void __init ic_bootp_init_ext(u8 *e) ...@@ -650,9 +650,9 @@ static void __init ic_bootp_init_ext(u8 *e)
*e++ = 40; *e++ = 40;
e += 40; e += 40;
*e++ = 57; /* set extension buffer size for reply */ *e++ = 57; /* set extension buffer size for reply */
*e++ = 2; *e++ = 2;
*e++ = 1; /* 128+236+8+20+14, see dhcpd sources */ *e++ = 1; /* 128+236+8+20+14, see dhcpd sources */
*e++ = 150; *e++ = 150;
*e++ = 255; /* End of the list */ *e++ = 255; /* End of the list */
...@@ -913,7 +913,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ...@@ -913,7 +913,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
/* Parse extensions */ /* Parse extensions */
if (ext_len >= 4 && if (ext_len >= 4 &&
!memcmp(b->exten, ic_bootp_cookie, 4)) { /* Check magic cookie */ !memcmp(b->exten, ic_bootp_cookie, 4)) { /* Check magic cookie */
u8 *end = (u8 *) b + ntohs(b->iph.tot_len); u8 *end = (u8 *) b + ntohs(b->iph.tot_len);
u8 *ext; u8 *ext;
#ifdef IPCONFIG_DHCP #ifdef IPCONFIG_DHCP
...@@ -1020,7 +1020,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ...@@ -1020,7 +1020,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
#endif #endif
...@@ -1080,7 +1080,7 @@ static int __init ic_dynamic(void) ...@@ -1080,7 +1080,7 @@ static int __init ic_dynamic(void)
* seems to be a terrible waste of CPU time, but actually there is * seems to be a terrible waste of CPU time, but actually there is
* only one process running at all, so we don't need to use any * only one process running at all, so we don't need to use any
* scheduler functions. * scheduler functions.
* [Actually we could now, but the nothing else running note still * [Actually we could now, but the nothing else running note still
* applies.. - AC] * applies.. - AC]
*/ */
printk(KERN_NOTICE "Sending %s%s%s requests .", printk(KERN_NOTICE "Sending %s%s%s requests .",
...@@ -1156,7 +1156,7 @@ static int __init ic_dynamic(void) ...@@ -1156,7 +1156,7 @@ static int __init ic_dynamic(void)
} }
printk("IP-Config: Got %s answer from %u.%u.%u.%u, ", printk("IP-Config: Got %s answer from %u.%u.%u.%u, ",
((ic_got_reply & IC_RARP) ? "RARP" ((ic_got_reply & IC_RARP) ? "RARP"
: (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"),
NIPQUAD(ic_servaddr)); NIPQUAD(ic_servaddr));
printk("my address is %u.%u.%u.%u\n", NIPQUAD(ic_myaddr)); printk("my address is %u.%u.%u.%u\n", NIPQUAD(ic_myaddr));
...@@ -1286,7 +1286,7 @@ static int __init ip_auto_config(void) ...@@ -1286,7 +1286,7 @@ static int __init ip_auto_config(void)
#endif #endif
ic_first_dev->next) { ic_first_dev->next) {
#ifdef IPCONFIG_DYNAMIC #ifdef IPCONFIG_DYNAMIC
int retries = CONF_OPEN_RETRIES; int retries = CONF_OPEN_RETRIES;
if (ic_dynamic() < 0) { if (ic_dynamic() < 0) {
...@@ -1308,14 +1308,14 @@ static int __init ip_auto_config(void) ...@@ -1308,14 +1308,14 @@ static int __init ip_auto_config(void)
*/ */
#ifdef CONFIG_ROOT_NFS #ifdef CONFIG_ROOT_NFS
if (ROOT_DEV == Root_NFS) { if (ROOT_DEV == Root_NFS) {
printk(KERN_ERR printk(KERN_ERR
"IP-Config: Retrying forever (NFS root)...\n"); "IP-Config: Retrying forever (NFS root)...\n");
goto try_try_again; goto try_try_again;
} }
#endif #endif
if (--retries) { if (--retries) {
printk(KERN_ERR printk(KERN_ERR
"IP-Config: Reopening network devices...\n"); "IP-Config: Reopening network devices...\n");
goto try_try_again; goto try_try_again;
} }
...@@ -1443,8 +1443,8 @@ static int __init ip_auto_config_setup(char *addrs) ...@@ -1443,8 +1443,8 @@ static int __init ip_auto_config_setup(char *addrs)
ic_set_manually = 1; ic_set_manually = 1;
ic_enable = (*addrs && ic_enable = (*addrs &&
(strcmp(addrs, "off") != 0) && (strcmp(addrs, "off") != 0) &&
(strcmp(addrs, "none") != 0)); (strcmp(addrs, "none") != 0));
if (!ic_enable) if (!ic_enable)
return 1; return 1;
......
/* /*
* Linux NET3: IP/IP protocol decoder. * Linux NET3: IP/IP protocol decoder.
* *
* Version: $Id: ipip.c,v 1.50 2001/10/02 02:22:36 davem Exp $ * Version: $Id: ipip.c,v 1.50 2001/10/02 02:22:36 davem Exp $
* *
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
Thanks for the great code! Thanks for the great code!
-Sam Lantinga (slouken@cs.ucdavis.edu) 02/01/95 -Sam Lantinga (slouken@cs.ucdavis.edu) 02/01/95
Minor tweaks: Minor tweaks:
Cleaned up the code a little and added some pre-1.3.0 tweaks. Cleaned up the code a little and added some pre-1.3.0 tweaks.
dev->hard_header/hard_header_len changed to use no headers. dev->hard_header/hard_header_len changed to use no headers.
Comments/bracketing tweaked. Comments/bracketing tweaked.
Made the tunnels use dev->name not tunnel: when error reporting. Made the tunnels use dev->name not tunnel: when error reporting.
Added tx_dropped stat Added tx_dropped stat
-Alan Cox (Alan.Cox@linux.org) 21 March 95 -Alan Cox (Alan.Cox@linux.org) 21 March 95
Reworked: Reworked:
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
Note: There is currently no firewall or ICMP handling done. Note: There is currently no firewall or ICMP handling done.
-Sam Lantinga (slouken@cs.ucdavis.edu) 02/13/96 -Sam Lantinga (slouken@cs.ucdavis.edu) 02/13/96
*/ */
/* Things I wish I had known when writing the tunnel driver: /* Things I wish I had known when writing the tunnel driver:
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
"allocated" with skb_put(). You can then write up to skb->len "allocated" with skb_put(). You can then write up to skb->len
bytes to that buffer. If you need more, you can call skb_put() bytes to that buffer. If you need more, you can call skb_put()
again with the additional amount of space you need. You can again with the additional amount of space you need. You can
find out how much more space you can allocate by calling find out how much more space you can allocate by calling
"skb_tailroom(skb)". "skb_tailroom(skb)".
Now, to add header space, call "skb_push(skb, header_len)". Now, to add header space, call "skb_push(skb, header_len)".
This creates space at the beginning of the buffer and returns This creates space at the beginning of the buffer and returns
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
For comments look at net/ipv4/ip_gre.c --ANK For comments look at net/ipv4/ip_gre.c --ANK
*/ */
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -607,7 +607,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -607,7 +607,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
if (!new_skb) { if (!new_skb) {
ip_rt_put(rt); ip_rt_put(rt);
stats->tx_dropped++; stats->tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
tunnel->recursion--; tunnel->recursion--;
return 0; return 0;
......
...@@ -241,7 +241,7 @@ static struct net_device *ipmr_reg_vif(void) ...@@ -241,7 +241,7 @@ static struct net_device *ipmr_reg_vif(void)
/* /*
* Delete a VIF entry * Delete a VIF entry
*/ */
static int vif_delete(int vifi) static int vif_delete(int vifi)
{ {
struct vif_device *v; struct vif_device *v;
...@@ -409,7 +409,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) ...@@ -409,7 +409,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
return -ENOBUFS; return -ENOBUFS;
break; break;
#endif #endif
case VIFF_TUNNEL: case VIFF_TUNNEL:
dev = ipmr_new_tunnel(vifc); dev = ipmr_new_tunnel(vifc);
if (!dev) if (!dev)
return -ENOBUFS; return -ENOBUFS;
...@@ -501,7 +501,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void) ...@@ -501,7 +501,7 @@ static struct mfc_cache *ipmr_cache_alloc_unres(void)
/* /*
* A cache entry has gone into a resolved state from queued * A cache entry has gone into a resolved state from queued
*/ */
static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -538,7 +538,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c) ...@@ -538,7 +538,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
* *
* Called under mrt_lock. * Called under mrt_lock.
*/ */
static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
{ {
struct sk_buff *skb; struct sk_buff *skb;
...@@ -569,13 +569,13 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) ...@@ -569,13 +569,13 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
memcpy(msg, pkt->nh.raw, sizeof(struct iphdr)); memcpy(msg, pkt->nh.raw, sizeof(struct iphdr));
msg->im_msgtype = IGMPMSG_WHOLEPKT; msg->im_msgtype = IGMPMSG_WHOLEPKT;
msg->im_mbz = 0; msg->im_mbz = 0;
msg->im_vif = reg_vif_num; msg->im_vif = reg_vif_num;
skb->nh.iph->ihl = sizeof(struct iphdr) >> 2; skb->nh.iph->ihl = sizeof(struct iphdr) >> 2;
skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr)); skb->nh.iph->tot_len = htons(ntohs(pkt->nh.iph->tot_len) + sizeof(struct iphdr));
} else } else
#endif #endif
{ {
/* /*
* Copy the IP header * Copy the IP header
*/ */
...@@ -597,7 +597,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) ...@@ -597,7 +597,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
igmp->code = 0; igmp->code = 0;
skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */ skb->nh.iph->tot_len=htons(skb->len); /* Fix the length */
skb->h.raw = skb->nh.raw; skb->h.raw = skb->nh.raw;
} }
if (mroute_socket == NULL) { if (mroute_socket == NULL) {
kfree_skb(skb); kfree_skb(skb);
...@@ -619,7 +619,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert) ...@@ -619,7 +619,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
/* /*
* Queue a packet for resolution. It gets locked cache entry! * Queue a packet for resolution. It gets locked cache entry!
*/ */
static int static int
ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
{ {
...@@ -657,7 +657,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb) ...@@ -657,7 +657,7 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
* Reflect first query at mrouted. * Reflect first query at mrouted.
*/ */
if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) { if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) {
/* If the report failed throw the cache entry /* If the report failed throw the cache entry
out - Brad Parker out - Brad Parker
*/ */
spin_unlock_bh(&mfc_unres_lock); spin_unlock_bh(&mfc_unres_lock);
...@@ -783,11 +783,11 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock) ...@@ -783,11 +783,11 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
/* /*
* Close the multicast socket, and clear the vif tables etc * Close the multicast socket, and clear the vif tables etc
*/ */
static void mroute_clean_tables(struct sock *sk) static void mroute_clean_tables(struct sock *sk)
{ {
int i; int i;
/* /*
* Shut down all active vif entries * Shut down all active vif entries
*/ */
...@@ -854,13 +854,13 @@ static void mrtsock_destruct(struct sock *sk) ...@@ -854,13 +854,13 @@ static void mrtsock_destruct(struct sock *sk)
* that's how BSD mrouted happens to think. Maybe one day with a proper * that's how BSD mrouted happens to think. Maybe one day with a proper
* MOSPF/PIM router set up we can clean this up. * MOSPF/PIM router set up we can clean this up.
*/ */
int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen) int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen)
{ {
int ret; int ret;
struct vifctl vif; struct vifctl vif;
struct mfcctl mfc; struct mfcctl mfc;
if(optname!=MRT_INIT) if(optname!=MRT_INIT)
{ {
if(sk!=mroute_socket && !capable(CAP_NET_ADMIN)) if(sk!=mroute_socket && !capable(CAP_NET_ADMIN))
...@@ -901,7 +901,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt ...@@ -901,7 +901,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
if(optlen!=sizeof(vif)) if(optlen!=sizeof(vif))
return -EINVAL; return -EINVAL;
if (copy_from_user(&vif,optval,sizeof(vif))) if (copy_from_user(&vif,optval,sizeof(vif)))
return -EFAULT; return -EFAULT;
if(vif.vifc_vifi >= MAXVIFS) if(vif.vifc_vifi >= MAXVIFS)
return -ENFILE; return -ENFILE;
rtnl_lock(); rtnl_lock();
...@@ -980,13 +980,13 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt ...@@ -980,13 +980,13 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
/* /*
* Getsock opt support for the multicast routing system. * Getsock opt support for the multicast routing system.
*/ */
int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen) int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen)
{ {
int olr; int olr;
int val; int val;
if(optname!=MRT_VERSION && if(optname!=MRT_VERSION &&
#ifdef CONFIG_IP_PIMSM #ifdef CONFIG_IP_PIMSM
optname!=MRT_PIM && optname!=MRT_PIM &&
#endif #endif
...@@ -999,7 +999,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u ...@@ -999,7 +999,7 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
olr = min_t(unsigned int, olr, sizeof(int)); olr = min_t(unsigned int, olr, sizeof(int));
if (olr < 0) if (olr < 0)
return -EINVAL; return -EINVAL;
if(put_user(olr,optlen)) if(put_user(olr,optlen))
return -EFAULT; return -EFAULT;
if(optname==MRT_VERSION) if(optname==MRT_VERSION)
...@@ -1018,19 +1018,19 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u ...@@ -1018,19 +1018,19 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __u
/* /*
* The IP multicast ioctl support routines. * The IP multicast ioctl support routines.
*/ */
int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
{ {
struct sioc_sg_req sr; struct sioc_sg_req sr;
struct sioc_vif_req vr; struct sioc_vif_req vr;
struct vif_device *vif; struct vif_device *vif;
struct mfc_cache *c; struct mfc_cache *c;
switch(cmd) switch(cmd)
{ {
case SIOCGETVIFCNT: case SIOCGETVIFCNT:
if (copy_from_user(&vr,arg,sizeof(vr))) if (copy_from_user(&vr,arg,sizeof(vr)))
return -EFAULT; return -EFAULT;
if(vr.vifi>=maxvif) if(vr.vifi>=maxvif)
return -EINVAL; return -EINVAL;
read_lock(&mrt_lock); read_lock(&mrt_lock);
...@@ -1096,7 +1096,7 @@ static struct notifier_block ip_mr_notifier={ ...@@ -1096,7 +1096,7 @@ static struct notifier_block ip_mr_notifier={
* This avoids tunnel drivers and other mess and gives us the speed so * This avoids tunnel drivers and other mess and gives us the speed so
* important for multicast video. * important for multicast video.
*/ */
static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr) static void ip_encap(struct sk_buff *skb, __be32 saddr, __be32 daddr)
{ {
struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr)); struct iphdr *iph = (struct iphdr *)skb_push(skb,sizeof(struct iphdr));
...@@ -1194,7 +1194,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1194,7 +1194,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len; encap += LL_RESERVED_SPACE(dev) + rt->u.dst.header_len;
if (skb_cow(skb, encap)) { if (skb_cow(skb, encap)) {
ip_rt_put(rt); ip_rt_put(rt);
goto out_free; goto out_free;
} }
...@@ -1228,7 +1228,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi) ...@@ -1228,7 +1228,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
* not mrouter) cannot join to more than one interface - it will * not mrouter) cannot join to more than one interface - it will
* result in receiving multiple packets. * result in receiving multiple packets.
*/ */
NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev, NF_HOOK(PF_INET, NF_IP_FORWARD, skb, skb->dev, dev,
ipmr_forward_finish); ipmr_forward_finish);
return; return;
...@@ -1289,7 +1289,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local ...@@ -1289,7 +1289,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
large chunk of pimd to kernel. Ough... --ANK large chunk of pimd to kernel. Ough... --ANK
*/ */
(mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) && (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) &&
time_after(jiffies, time_after(jiffies,
cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) { cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) {
cache->mfc_un.res.last_assert = jiffies; cache->mfc_un.res.last_assert = jiffies;
ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF); ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF);
...@@ -1426,14 +1426,14 @@ int pim_rcv_v1(struct sk_buff * skb) ...@@ -1426,14 +1426,14 @@ int pim_rcv_v1(struct sk_buff * skb)
struct iphdr *encap; struct iphdr *encap;
struct net_device *reg_dev = NULL; struct net_device *reg_dev = NULL;
if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
goto drop; goto drop;
pim = (struct igmphdr*)skb->h.raw; pim = (struct igmphdr*)skb->h.raw;
if (!mroute_do_pim || if (!mroute_do_pim ||
skb->len < sizeof(*pim) + sizeof(*encap) || skb->len < sizeof(*pim) + sizeof(*encap) ||
pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
goto drop; goto drop;
encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr));
...@@ -1445,7 +1445,7 @@ int pim_rcv_v1(struct sk_buff * skb) ...@@ -1445,7 +1445,7 @@ int pim_rcv_v1(struct sk_buff * skb)
*/ */
if (!MULTICAST(encap->daddr) || if (!MULTICAST(encap->daddr) ||
encap->tot_len == 0 || encap->tot_len == 0 ||
ntohs(encap->tot_len) + sizeof(*pim) > skb->len) ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
goto drop; goto drop;
read_lock(&mrt_lock); read_lock(&mrt_lock);
...@@ -1455,7 +1455,7 @@ int pim_rcv_v1(struct sk_buff * skb) ...@@ -1455,7 +1455,7 @@ int pim_rcv_v1(struct sk_buff * skb)
dev_hold(reg_dev); dev_hold(reg_dev);
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
if (reg_dev == NULL) if (reg_dev == NULL)
goto drop; goto drop;
skb->mac.raw = skb->nh.raw; skb->mac.raw = skb->nh.raw;
...@@ -1486,13 +1486,13 @@ static int pim_rcv(struct sk_buff * skb) ...@@ -1486,13 +1486,13 @@ static int pim_rcv(struct sk_buff * skb)
struct iphdr *encap; struct iphdr *encap;
struct net_device *reg_dev = NULL; struct net_device *reg_dev = NULL;
if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
goto drop; goto drop;
pim = (struct pimreghdr*)skb->h.raw; pim = (struct pimreghdr*)skb->h.raw;
if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
(pim->flags&PIM_NULL_REGISTER) || (pim->flags&PIM_NULL_REGISTER) ||
(ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
csum_fold(skb_checksum(skb, 0, skb->len, 0)))) csum_fold(skb_checksum(skb, 0, skb->len, 0))))
goto drop; goto drop;
...@@ -1500,7 +1500,7 @@ static int pim_rcv(struct sk_buff * skb) ...@@ -1500,7 +1500,7 @@ static int pim_rcv(struct sk_buff * skb)
encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr));
if (!MULTICAST(encap->daddr) || if (!MULTICAST(encap->daddr) ||
encap->tot_len == 0 || encap->tot_len == 0 ||
ntohs(encap->tot_len) + sizeof(*pim) > skb->len) ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
goto drop; goto drop;
read_lock(&mrt_lock); read_lock(&mrt_lock);
...@@ -1510,7 +1510,7 @@ static int pim_rcv(struct sk_buff * skb) ...@@ -1510,7 +1510,7 @@ static int pim_rcv(struct sk_buff * skb)
dev_hold(reg_dev); dev_hold(reg_dev);
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
if (reg_dev == NULL) if (reg_dev == NULL)
goto drop; goto drop;
skb->mac.raw = skb->nh.raw; skb->mac.raw = skb->nh.raw;
...@@ -1616,7 +1616,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait) ...@@ -1616,7 +1616,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
return err; return err;
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
/* /*
* The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif * The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif
*/ */
...@@ -1630,7 +1630,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter, ...@@ -1630,7 +1630,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) { for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) {
if(!VIF_EXISTS(iter->ct)) if(!VIF_EXISTS(iter->ct))
continue; continue;
if (pos-- == 0) if (pos-- == 0)
return &vif_table[iter->ct]; return &vif_table[iter->ct];
} }
return NULL; return NULL;
...@@ -1639,7 +1639,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter, ...@@ -1639,7 +1639,7 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos) static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos)
{ {
read_lock(&mrt_lock); read_lock(&mrt_lock);
return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1) return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1)
: SEQ_START_TOKEN; : SEQ_START_TOKEN;
} }
...@@ -1650,7 +1650,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1650,7 +1650,7 @@ static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
return ipmr_vif_seq_idx(iter, 0); return ipmr_vif_seq_idx(iter, 0);
while (++iter->ct < maxvif) { while (++iter->ct < maxvif) {
if(!VIF_EXISTS(iter->ct)) if(!VIF_EXISTS(iter->ct))
continue; continue;
...@@ -1667,7 +1667,7 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v) ...@@ -1667,7 +1667,7 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v)
static int ipmr_vif_seq_show(struct seq_file *seq, void *v) static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
{ {
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_puts(seq, seq_puts(seq,
"Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n"); "Interface BytesIn PktsIn BytesOut PktsOut Flags Local Remote\n");
} else { } else {
const struct vif_device *vif = v; const struct vif_device *vif = v;
...@@ -1676,7 +1676,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v) ...@@ -1676,7 +1676,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, seq_printf(seq,
"%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n", "%2Zd %-10s %8ld %7ld %8ld %7ld %05X %08X %08X\n",
vif - vif_table, vif - vif_table,
name, vif->bytes_in, vif->pkt_in, name, vif->bytes_in, vif->pkt_in,
vif->bytes_out, vif->pkt_out, vif->bytes_out, vif->pkt_out,
vif->flags, vif->local, vif->remote); vif->flags, vif->local, vif->remote);
} }
...@@ -1695,7 +1695,7 @@ static int ipmr_vif_open(struct inode *inode, struct file *file) ...@@ -1695,7 +1695,7 @@ static int ipmr_vif_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;
...@@ -1734,15 +1734,15 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos) ...@@ -1734,15 +1734,15 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
it->cache = mfc_cache_array; it->cache = mfc_cache_array;
read_lock(&mrt_lock); read_lock(&mrt_lock);
for (it->ct = 0; it->ct < MFC_LINES; it->ct++) 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) if (pos-- == 0)
return mfc; return mfc;
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
it->cache = &mfc_unres_queue; it->cache = &mfc_unres_queue;
spin_lock_bh(&mfc_unres_lock); 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) if (pos-- == 0)
return mfc; return mfc;
spin_unlock_bh(&mfc_unres_lock); spin_unlock_bh(&mfc_unres_lock);
...@@ -1757,7 +1757,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos) ...@@ -1757,7 +1757,7 @@ static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
struct ipmr_mfc_iter *it = seq->private; struct ipmr_mfc_iter *it = seq->private;
it->cache = NULL; it->cache = NULL;
it->ct = 0; it->ct = 0;
return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1) return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
: SEQ_START_TOKEN; : SEQ_START_TOKEN;
} }
...@@ -1773,8 +1773,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1773,8 +1773,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
if (mfc->next) if (mfc->next)
return mfc->next; return mfc->next;
if (it->cache == &mfc_unres_queue) if (it->cache == &mfc_unres_queue)
goto end_of_list; goto end_of_list;
BUG_ON(it->cache != mfc_cache_array); BUG_ON(it->cache != mfc_cache_array);
...@@ -1789,10 +1789,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -1789,10 +1789,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
it->cache = &mfc_unres_queue; it->cache = &mfc_unres_queue;
it->ct = 0; it->ct = 0;
spin_lock_bh(&mfc_unres_lock); spin_lock_bh(&mfc_unres_lock);
mfc = mfc_unres_queue; mfc = mfc_unres_queue;
if (mfc) if (mfc)
return mfc; return mfc;
end_of_list: end_of_list:
...@@ -1817,12 +1817,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) ...@@ -1817,12 +1817,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
int n; int n;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_puts(seq, seq_puts(seq,
"Group Origin Iif Pkts Bytes Wrong Oifs\n"); "Group Origin Iif Pkts Bytes Wrong Oifs\n");
} else { } else {
const struct mfc_cache *mfc = v; const struct mfc_cache *mfc = v;
const struct ipmr_mfc_iter *it = seq->private; const struct ipmr_mfc_iter *it = seq->private;
seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld", seq_printf(seq, "%08lX %08lX %-3d %8ld %8ld %8ld",
(unsigned long) mfc->mfc_mcastgrp, (unsigned long) mfc->mfc_mcastgrp,
(unsigned long) mfc->mfc_origin, (unsigned long) mfc->mfc_origin,
...@@ -1832,12 +1832,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) ...@@ -1832,12 +1832,12 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
mfc->mfc_un.res.wrong_if); mfc->mfc_un.res.wrong_if);
if (it->cache != &mfc_unres_queue) { if (it->cache != &mfc_unres_queue) {
for(n = mfc->mfc_un.res.minvif; for(n = mfc->mfc_un.res.minvif;
n < mfc->mfc_un.res.maxvif; n++ ) { n < mfc->mfc_un.res.maxvif; n++ ) {
if(VIF_EXISTS(n) if(VIF_EXISTS(n)
&& mfc->mfc_un.res.ttls[n] < 255) && mfc->mfc_un.res.ttls[n] < 255)
seq_printf(seq, seq_printf(seq,
" %2d:%-3d", " %2d:%-3d",
n, mfc->mfc_un.res.ttls[n]); n, mfc->mfc_un.res.ttls[n]);
} }
} }
...@@ -1858,7 +1858,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file) ...@@ -1858,7 +1858,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;
...@@ -1883,7 +1883,7 @@ static struct file_operations ipmr_mfc_fops = { ...@@ -1883,7 +1883,7 @@ static struct file_operations ipmr_mfc_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release_private, .release = seq_release_private,
}; };
#endif #endif
#ifdef CONFIG_IP_PIMSM_V2 #ifdef CONFIG_IP_PIMSM_V2
static struct net_protocol pim_protocol = { static struct net_protocol pim_protocol = {
...@@ -1895,7 +1895,7 @@ static struct net_protocol pim_protocol = { ...@@ -1895,7 +1895,7 @@ static struct net_protocol pim_protocol = {
/* /*
* Setup for IP multicast routing * Setup for IP multicast routing
*/ */
void __init ip_mr_init(void) void __init ip_mr_init(void)
{ {
mrt_cachep = kmem_cache_create("ip_mrt_cache", mrt_cachep = kmem_cache_create("ip_mrt_cache",
...@@ -1905,8 +1905,8 @@ void __init ip_mr_init(void) ...@@ -1905,8 +1905,8 @@ void __init ip_mr_init(void)
init_timer(&ipmr_expire_timer); init_timer(&ipmr_expire_timer);
ipmr_expire_timer.function=ipmr_expire_process; ipmr_expire_timer.function=ipmr_expire_process;
register_netdevice_notifier(&ip_mr_notifier); register_netdevice_notifier(&ip_mr_notifier);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops); proc_net_fops_create("ip_mr_vif", 0, &ipmr_vif_fops);
proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops); proc_net_fops_create("ip_mr_cache", 0, &ipmr_mfc_fops);
#endif #endif
} }
...@@ -494,8 +494,8 @@ int ip_vs_check_template(struct ip_vs_conn *ct) ...@@ -494,8 +494,8 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
* Checking the dest server status. * Checking the dest server status.
*/ */
if ((dest == NULL) || if ((dest == NULL) ||
!(dest->flags & IP_VS_DEST_F_AVAILABLE) || !(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
(sysctl_ip_vs_expire_quiescent_template && (sysctl_ip_vs_expire_quiescent_template &&
(atomic_read(&dest->weight) == 0))) { (atomic_read(&dest->weight) == 0))) {
IP_VS_DBG(9, "check_template: dest not available for " IP_VS_DBG(9, "check_template: dest not available for "
"protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " "protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d "
...@@ -667,7 +667,7 @@ static void *ip_vs_conn_array(struct seq_file *seq, loff_t pos) ...@@ -667,7 +667,7 @@ static void *ip_vs_conn_array(struct seq_file *seq, loff_t pos)
{ {
int idx; int idx;
struct ip_vs_conn *cp; struct ip_vs_conn *cp;
for(idx = 0; idx < IP_VS_CONN_TAB_SIZE; idx++) { for(idx = 0; idx < IP_VS_CONN_TAB_SIZE; idx++) {
ct_read_lock_bh(idx); ct_read_lock_bh(idx);
list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) {
...@@ -695,7 +695,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -695,7 +695,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos)
int idx; int idx;
++*pos; ++*pos;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
return ip_vs_conn_array(seq, 0); return ip_vs_conn_array(seq, 0);
/* more on same hash chain? */ /* more on same hash chain? */
...@@ -710,7 +710,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -710,7 +710,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos)
list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) { list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) {
seq->private = &ip_vs_conn_tab[idx]; seq->private = &ip_vs_conn_tab[idx];
return cp; return cp;
} }
ct_read_unlock_bh(idx); ct_read_unlock_bh(idx);
} }
seq->private = NULL; seq->private = NULL;
......
...@@ -813,14 +813,14 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, ...@@ -813,14 +813,14 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
skb->nh.iph->saddr = cp->vaddr; skb->nh.iph->saddr = cp->vaddr;
ip_send_check(skb->nh.iph); ip_send_check(skb->nh.iph);
/* For policy routing, packets originating from this /* For policy routing, packets originating from this
* machine itself may be routed differently to packets * machine itself may be routed differently to packets
* passing through. We want this packet to be routed as * passing through. We want this packet to be routed as
* if it came from this machine itself. So re-compute * if it came from this machine itself. So re-compute
* the routing information. * the routing information.
*/ */
if (ip_route_me_harder(pskb, RTN_LOCAL) != 0) if (ip_route_me_harder(pskb, RTN_LOCAL) != 0)
goto drop; goto drop;
skb = *pskb; skb = *pskb;
IP_VS_DBG_PKT(10, pp, skb, 0, "After SNAT"); IP_VS_DBG_PKT(10, pp, skb, 0, "After SNAT");
...@@ -847,7 +847,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb, ...@@ -847,7 +847,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
* forward to the right destination host if relevant. * forward to the right destination host if relevant.
* Currently handles error types - unreachable, quench, ttl exceeded. * Currently handles error types - unreachable, quench, ttl exceeded.
*/ */
static int static int
ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
{ {
struct sk_buff *skb = *pskb; struct sk_buff *skb = *pskb;
...@@ -863,7 +863,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum) ...@@ -863,7 +863,7 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)
/* reassemble IP fragments */ /* reassemble IP fragments */
if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) { if (skb->nh.iph->frag_off & __constant_htons(IP_MF|IP_OFFSET)) {
skb = ip_vs_gather_frags(skb, skb = ip_vs_gather_frags(skb,
hooknum == NF_IP_LOCAL_IN ? hooknum == NF_IP_LOCAL_IN ?
IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD); IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD);
if (!skb) if (!skb)
return NF_STOLEN; return NF_STOLEN;
......
...@@ -370,7 +370,7 @@ static int __init ip_vs_ftp_init(void) ...@@ -370,7 +370,7 @@ static int __init ip_vs_ftp_init(void)
if (ret) if (ret)
break; break;
IP_VS_INFO("%s: loaded support on port[%d] = %d\n", IP_VS_INFO("%s: loaded support on port[%d] = %d\n",
app->name, i, ports[i]); app->name, i, ports[i]);
} }
if (ret) if (ret)
......
...@@ -118,7 +118,7 @@ static ctl_table vs_vars_table[] = { ...@@ -118,7 +118,7 @@ static ctl_table vs_vars_table[] = {
.procname = "lblc_expiration", .procname = "lblc_expiration",
.data = &sysctl_ip_vs_lblc_expiration, .data = &sysctl_ip_vs_lblc_expiration,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
...@@ -128,7 +128,7 @@ static ctl_table vs_table[] = { ...@@ -128,7 +128,7 @@ static ctl_table vs_table[] = {
{ {
.ctl_name = NET_IPV4_VS, .ctl_name = NET_IPV4_VS,
.procname = "vs", .procname = "vs",
.mode = 0555, .mode = 0555,
.child = vs_vars_table .child = vs_vars_table
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
...@@ -137,7 +137,7 @@ static ctl_table vs_table[] = { ...@@ -137,7 +137,7 @@ static ctl_table vs_table[] = {
static ctl_table ipvs_ipv4_table[] = { static ctl_table ipvs_ipv4_table[] = {
{ {
.ctl_name = NET_IPV4, .ctl_name = NET_IPV4,
.procname = "ipv4", .procname = "ipv4",
.mode = 0555, .mode = 0555,
.child = vs_table .child = vs_table
}, },
...@@ -147,8 +147,8 @@ static ctl_table ipvs_ipv4_table[] = { ...@@ -147,8 +147,8 @@ static ctl_table ipvs_ipv4_table[] = {
static ctl_table lblc_root_table[] = { static ctl_table lblc_root_table[] = {
{ {
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = ipvs_ipv4_table .child = ipvs_ipv4_table
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
...@@ -288,7 +288,7 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_lblc_table *tbl) ...@@ -288,7 +288,7 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_lblc_table *tbl)
write_lock(&tbl->lock); write_lock(&tbl->lock);
list_for_each_entry_safe(en, nxt, &tbl->bucket[j], list) { list_for_each_entry_safe(en, nxt, &tbl->bucket[j], list) {
if (time_before(now, if (time_before(now,
en->lastuse + sysctl_ip_vs_lblc_expiration)) en->lastuse + sysctl_ip_vs_lblc_expiration))
continue; continue;
......
...@@ -307,7 +307,7 @@ static ctl_table vs_vars_table[] = { ...@@ -307,7 +307,7 @@ static ctl_table vs_vars_table[] = {
.procname = "lblcr_expiration", .procname = "lblcr_expiration",
.data = &sysctl_ip_vs_lblcr_expiration, .data = &sysctl_ip_vs_lblcr_expiration,
.maxlen = sizeof(int), .maxlen = sizeof(int),
.mode = 0644, .mode = 0644,
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
...@@ -326,7 +326,7 @@ static ctl_table vs_table[] = { ...@@ -326,7 +326,7 @@ static ctl_table vs_table[] = {
static ctl_table ipvs_ipv4_table[] = { static ctl_table ipvs_ipv4_table[] = {
{ {
.ctl_name = NET_IPV4, .ctl_name = NET_IPV4,
.procname = "ipv4", .procname = "ipv4",
.mode = 0555, .mode = 0555,
.child = vs_table .child = vs_table
}, },
...@@ -336,8 +336,8 @@ static ctl_table ipvs_ipv4_table[] = { ...@@ -336,8 +336,8 @@ static ctl_table ipvs_ipv4_table[] = {
static ctl_table lblcr_root_table[] = { static ctl_table lblcr_root_table[] = {
{ {
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = ipvs_ipv4_table .child = ipvs_ipv4_table
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
......
...@@ -68,7 +68,7 @@ ip_vs_rr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) ...@@ -68,7 +68,7 @@ ip_vs_rr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
q = q->next; q = q->next;
continue; continue;
} }
dest = list_entry(q, struct ip_vs_dest, n_list); dest = list_entry(q, struct ip_vs_dest, n_list);
if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) && if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) &&
atomic_read(&dest->weight) > 0) atomic_read(&dest->weight) > 0)
......
...@@ -134,7 +134,7 @@ static void drr_select_route(const struct flowi *flp, ...@@ -134,7 +134,7 @@ static void drr_select_route(const struct flowi *flp,
struct rtable *first, struct rtable **rp) struct rtable *first, struct rtable **rp)
{ {
struct rtable *nh, *result, *cur_min; struct rtable *nh, *result, *cur_min;
int min_usecount = -1; int min_usecount = -1;
int devidx = -1; int devidx = -1;
int cur_min_devidx = -1; int cur_min_devidx = -1;
...@@ -161,7 +161,7 @@ static void drr_select_route(const struct flowi *flp, ...@@ -161,7 +161,7 @@ static void drr_select_route(const struct flowi *flp,
*/ */
devidx = __multipath_finddev(nh_ifidx); devidx = __multipath_finddev(nh_ifidx);
if (devidx == -1) { if (devidx == -1) {
/* add the interface to the array /* add the interface to the array
* SMP safe * SMP safe
*/ */
spin_lock_bh(&state_lock); spin_lock_bh(&state_lock);
......
...@@ -58,7 +58,7 @@ static void rr_select_route(const struct flowi *flp, ...@@ -58,7 +58,7 @@ static void rr_select_route(const struct flowi *flp,
*/ */
result = NULL; result = NULL;
for (nh = rcu_dereference(first); nh; for (nh = rcu_dereference(first); nh;
nh = rcu_dereference(nh->u.rt_next)) { nh = rcu_dereference(nh->u.rt_next)) {
if ((nh->u.dst.flags & DST_BALANCED) != 0 && if ((nh->u.dst.flags & DST_BALANCED) != 0 &&
multipath_comparekeys(&nh->fl, flp)) { multipath_comparekeys(&nh->fl, flp)) {
nh->u.dst.lastuse = jiffies; nh->u.dst.lastuse = jiffies;
......
...@@ -142,7 +142,7 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl, ...@@ -142,7 +142,7 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl,
return weight; return weight;
} }
static void wrandom_init_state(void) static void wrandom_init_state(void)
{ {
int i; int i;
...@@ -287,7 +287,7 @@ static void __multipath_free(struct rcu_head *head) ...@@ -287,7 +287,7 @@ static void __multipath_free(struct rcu_head *head)
static void __multipath_free_dst(struct rcu_head *head) static void __multipath_free_dst(struct rcu_head *head)
{ {
struct multipath_dest *dst = container_of(head, struct multipath_dest *dst = container_of(head,
struct multipath_dest, struct multipath_dest,
rcu); rcu);
kfree(dst); kfree(dst);
......
...@@ -53,7 +53,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type) ...@@ -53,7 +53,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type)
dst_release(&rt->u.dst); dst_release(&rt->u.dst);
dst_release(odst); dst_release(odst);
} }
if ((*pskb)->dst->error) if ((*pskb)->dst->error)
return -1; return -1;
...@@ -70,7 +70,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type) ...@@ -70,7 +70,7 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type)
struct sk_buff *nskb; struct sk_buff *nskb;
nskb = skb_realloc_headroom(*pskb, hh_len); nskb = skb_realloc_headroom(*pskb, hh_len);
if (!nskb) if (!nskb)
return -1; return -1;
if ((*pskb)->sk) if ((*pskb)->sk)
skb_set_owner_w(nskb, (*pskb)->sk); skb_set_owner_w(nskb, (*pskb)->sk);
...@@ -177,7 +177,7 @@ __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, ...@@ -177,7 +177,7 @@ __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
break; break;
if ((protocol == 0 && !csum_fold(skb->csum)) || if ((protocol == 0 && !csum_fold(skb->csum)) ||
!csum_tcpudp_magic(iph->saddr, iph->daddr, !csum_tcpudp_magic(iph->saddr, iph->daddr,
skb->len - dataoff, protocol, skb->len - dataoff, protocol,
skb->csum)) { skb->csum)) {
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
break; break;
......
...@@ -544,7 +544,7 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, ...@@ -544,7 +544,7 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,
} }
/* FIXME: underflows must be unconditional, standard verdicts /* FIXME: underflows must be unconditional, standard verdicts
< 0 (not ARPT_RETURN). --RR */ < 0 (not ARPT_RETURN). --RR */
/* Clear counters and comefrom */ /* Clear counters and comefrom */
e->counters = ((struct xt_counters) { 0, 0 }); e->counters = ((struct xt_counters) { 0, 0 });
...@@ -869,8 +869,8 @@ static int do_replace(void __user *user, unsigned int len) ...@@ -869,8 +869,8 @@ static int do_replace(void __user *user, unsigned int len)
/* Update module usage count based on number of rules */ /* Update module usage count based on number of rules */
duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n", duprintf("do_replace: oldnum=%u, initnum=%u, newnum=%u\n",
oldinfo->number, oldinfo->initial_entries, newinfo->number); oldinfo->number, oldinfo->initial_entries, newinfo->number);
if ((oldinfo->number > oldinfo->initial_entries) || if ((oldinfo->number > oldinfo->initial_entries) ||
(newinfo->number <= oldinfo->initial_entries)) (newinfo->number <= oldinfo->initial_entries))
module_put(t->me); module_put(t->me);
if ((oldinfo->number > oldinfo->initial_entries) && if ((oldinfo->number > oldinfo->initial_entries) &&
(newinfo->number <= oldinfo->initial_entries)) (newinfo->number <= oldinfo->initial_entries))
......
...@@ -67,7 +67,7 @@ target(struct sk_buff **pskb, ...@@ -67,7 +67,7 @@ target(struct sk_buff **pskb,
static int static int
checkentry(const char *tablename, const void *e, const struct xt_target *target, checkentry(const char *tablename, const void *e, const struct xt_target *target,
void *targinfo, unsigned int hook_mask) void *targinfo, unsigned int hook_mask)
{ {
const struct arpt_mangle *mangle = targinfo; const struct arpt_mangle *mangle = targinfo;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* Module load syntax: * Module load syntax:
* insmod ip_conntrack_amanda.o [master_timeout=n] * insmod ip_conntrack_amanda.o [master_timeout=n]
* *
* Where master_timeout is the timeout (in seconds) of the master * Where master_timeout is the timeout (in seconds) of the master
* connection (port 10080). This defaults to 5 minutes but if * connection (port 10080). This defaults to 5 minutes but if
* your clients take longer than 5 minutes to do their work * your clients take longer than 5 minutes to do their work
...@@ -84,7 +84,7 @@ static struct { ...@@ -84,7 +84,7 @@ static struct {
}; };
static int help(struct sk_buff **pskb, static int help(struct sk_buff **pskb,
struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) struct ip_conntrack *ct, enum ip_conntrack_info ctinfo)
{ {
struct ts_state ts; struct ts_state ts;
struct ip_conntrack_expect *exp; struct ip_conntrack_expect *exp;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
but required by, the NAT layer; it can also be used by an iptables but required by, the NAT layer; it can also be used by an iptables
extension. */ extension. */
/* (C) 1999-2001 Paul `Rusty' Russell /* (C) 1999-2001 Paul `Rusty' Russell
* (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -99,7 +99,7 @@ __ip_ct_deliver_cached_events(struct ip_conntrack_ecache *ecache) ...@@ -99,7 +99,7 @@ __ip_ct_deliver_cached_events(struct ip_conntrack_ecache *ecache)
void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) void ip_ct_deliver_cached_events(const struct ip_conntrack *ct)
{ {
struct ip_conntrack_ecache *ecache; struct ip_conntrack_ecache *ecache;
local_bh_disable(); local_bh_disable();
ecache = &__get_cpu_var(ip_conntrack_ecache); ecache = &__get_cpu_var(ip_conntrack_ecache);
if (ecache->ct == ct) if (ecache->ct == ct)
...@@ -147,9 +147,9 @@ static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple, ...@@ -147,9 +147,9 @@ static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple *tuple,
unsigned int size, unsigned int rnd) unsigned int size, unsigned int rnd)
{ {
return (jhash_3words((__force u32)tuple->src.ip, return (jhash_3words((__force u32)tuple->src.ip,
((__force u32)tuple->dst.ip ^ tuple->dst.protonum), ((__force u32)tuple->dst.ip ^ tuple->dst.protonum),
(tuple->src.u.all | (tuple->dst.u.all << 16)), (tuple->src.u.all | (tuple->dst.u.all << 16)),
rnd) % size); rnd) % size);
} }
static u_int32_t static u_int32_t
...@@ -219,7 +219,7 @@ struct ip_conntrack_expect * ...@@ -219,7 +219,7 @@ struct ip_conntrack_expect *
__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple) __ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple)
{ {
struct ip_conntrack_expect *i; struct ip_conntrack_expect *i;
list_for_each_entry(i, &ip_conntrack_expect_list, list) { list_for_each_entry(i, &ip_conntrack_expect_list, list) {
if (ip_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask)) if (ip_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask))
return i; return i;
...@@ -232,7 +232,7 @@ struct ip_conntrack_expect * ...@@ -232,7 +232,7 @@ struct ip_conntrack_expect *
ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple) ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple)
{ {
struct ip_conntrack_expect *i; struct ip_conntrack_expect *i;
read_lock_bh(&ip_conntrack_lock); read_lock_bh(&ip_conntrack_lock);
i = __ip_conntrack_expect_find(tuple); i = __ip_conntrack_expect_find(tuple);
if (i) if (i)
...@@ -398,7 +398,7 @@ ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple, ...@@ -398,7 +398,7 @@ ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
static void __ip_conntrack_hash_insert(struct ip_conntrack *ct, static void __ip_conntrack_hash_insert(struct ip_conntrack *ct,
unsigned int hash, unsigned int hash,
unsigned int repl_hash) unsigned int repl_hash)
{ {
ct->id = ++ip_conntrack_next_id; ct->id = ++ip_conntrack_next_id;
list_add(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list, list_add(&ct->tuplehash[IP_CT_DIR_ORIGINAL].list,
...@@ -446,15 +446,15 @@ __ip_conntrack_confirm(struct sk_buff **pskb) ...@@ -446,15 +446,15 @@ __ip_conntrack_confirm(struct sk_buff **pskb)
/* IP_NF_ASSERT(atomic_read(&ct->ct_general.use) == 1); */ /* IP_NF_ASSERT(atomic_read(&ct->ct_general.use) == 1); */
/* No external references means noone else could have /* No external references means noone else could have
confirmed us. */ confirmed us. */
IP_NF_ASSERT(!is_confirmed(ct)); IP_NF_ASSERT(!is_confirmed(ct));
DEBUGP("Confirming conntrack %p\n", ct); DEBUGP("Confirming conntrack %p\n", ct);
write_lock_bh(&ip_conntrack_lock); write_lock_bh(&ip_conntrack_lock);
/* See if there's one in the list already, including reverse: /* See if there's one in the list already, including reverse:
NAT could have grabbed it without realizing, since we're NAT could have grabbed it without realizing, since we're
not in the hash. If there is, we lost race. */ not in the hash. If there is, we lost race. */
list_for_each_entry(h, &ip_conntrack_hash[hash], list) list_for_each_entry(h, &ip_conntrack_hash[hash], list)
if (ip_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, if (ip_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
&h->tuple)) &h->tuple))
...@@ -602,7 +602,7 @@ ip_conntrack_proto_find_get(u_int8_t protocol) ...@@ -602,7 +602,7 @@ ip_conntrack_proto_find_get(u_int8_t protocol)
p = &ip_conntrack_generic_protocol; p = &ip_conntrack_generic_protocol;
} }
preempt_enable(); preempt_enable();
return p; return p;
} }
...@@ -746,7 +746,7 @@ resolve_normal_ct(struct sk_buff *skb, ...@@ -746,7 +746,7 @@ resolve_normal_ct(struct sk_buff *skb,
IP_NF_ASSERT((skb->nh.iph->frag_off & htons(IP_OFFSET)) == 0); IP_NF_ASSERT((skb->nh.iph->frag_off & htons(IP_OFFSET)) == 0);
if (!ip_ct_get_tuple(skb->nh.iph, skb, skb->nh.iph->ihl*4, if (!ip_ct_get_tuple(skb->nh.iph, skb, skb->nh.iph->ihl*4,
&tuple,proto)) &tuple,proto))
return NULL; return NULL;
...@@ -771,7 +771,7 @@ resolve_normal_ct(struct sk_buff *skb, ...@@ -771,7 +771,7 @@ resolve_normal_ct(struct sk_buff *skb,
if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
DEBUGP("ip_conntrack_in: normal packet for %p\n", DEBUGP("ip_conntrack_in: normal packet for %p\n",
ct); ct);
*ctinfo = IP_CT_ESTABLISHED; *ctinfo = IP_CT_ESTABLISHED;
} else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) { } else if (test_bit(IPS_EXPECTED_BIT, &ct->status)) {
DEBUGP("ip_conntrack_in: related packet for %p\n", DEBUGP("ip_conntrack_in: related packet for %p\n",
ct); ct);
...@@ -822,7 +822,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, ...@@ -822,7 +822,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum,
if ((*pskb)->pkt_type == PACKET_BROADCAST) { if ((*pskb)->pkt_type == PACKET_BROADCAST) {
printk("Broadcast packet!\n"); printk("Broadcast packet!\n");
return NF_ACCEPT; return NF_ACCEPT;
} else if (((*pskb)->nh.iph->daddr & htonl(0x000000FF)) } else if (((*pskb)->nh.iph->daddr & htonl(0x000000FF))
== htonl(0x000000FF)) { == htonl(0x000000FF)) {
printk("Should bcast: %u.%u.%u.%u->%u.%u.%u.%u (sk=%p, ptype=%u)\n", printk("Should bcast: %u.%u.%u.%u->%u.%u.%u.%u (sk=%p, ptype=%u)\n",
NIPQUAD((*pskb)->nh.iph->saddr), NIPQUAD((*pskb)->nh.iph->saddr),
...@@ -836,7 +836,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, ...@@ -836,7 +836,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum,
/* It may be an special packet, error, unclean... /* It may be an special packet, error, unclean...
* inverse of the return code tells to the netfilter * inverse of the return code tells to the netfilter
* core what to do with the packet. */ * core what to do with the packet. */
if (proto->error != NULL if (proto->error != NULL
&& (ret = proto->error(*pskb, &ctinfo, hooknum)) <= 0) { && (ret = proto->error(*pskb, &ctinfo, hooknum)) <= 0) {
CONNTRACK_STAT_INC(error); CONNTRACK_STAT_INC(error);
CONNTRACK_STAT_INC(invalid); CONNTRACK_STAT_INC(invalid);
...@@ -876,7 +876,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum, ...@@ -876,7 +876,7 @@ unsigned int ip_conntrack_in(unsigned int hooknum,
int invert_tuplepr(struct ip_conntrack_tuple *inverse, int invert_tuplepr(struct ip_conntrack_tuple *inverse,
const struct ip_conntrack_tuple *orig) const struct ip_conntrack_tuple *orig)
{ {
return ip_ct_invert_tuple(inverse, orig, return ip_ct_invert_tuple(inverse, orig,
__ip_conntrack_proto_find(orig->dst.protonum)); __ip_conntrack_proto_find(orig->dst.protonum));
} }
...@@ -885,7 +885,7 @@ static inline int expect_clash(const struct ip_conntrack_expect *a, ...@@ -885,7 +885,7 @@ static inline int expect_clash(const struct ip_conntrack_expect *a,
const struct ip_conntrack_expect *b) const struct ip_conntrack_expect *b)
{ {
/* Part covered by intersection of masks must be unequal, /* Part covered by intersection of masks must be unequal,
otherwise they clash */ otherwise they clash */
struct ip_conntrack_tuple intersect_mask struct ip_conntrack_tuple intersect_mask
= { { a->mask.src.ip & b->mask.src.ip, = { { a->mask.src.ip & b->mask.src.ip,
{ a->mask.src.u.all & b->mask.src.u.all } }, { a->mask.src.u.all & b->mask.src.u.all } },
...@@ -923,7 +923,7 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp) ...@@ -923,7 +923,7 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp)
} }
/* We don't increase the master conntrack refcount for non-fulfilled /* We don't increase the master conntrack refcount for non-fulfilled
* conntracks. During the conntrack destruction, the expectations are * conntracks. During the conntrack destruction, the expectations are
* always killed before the conntrack itself */ * always killed before the conntrack itself */
struct ip_conntrack_expect *ip_conntrack_expect_alloc(struct ip_conntrack *me) struct ip_conntrack_expect *ip_conntrack_expect_alloc(struct ip_conntrack *me)
{ {
...@@ -1012,7 +1012,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect) ...@@ -1012,7 +1012,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
} }
/* Will be over limit? */ /* Will be over limit? */
if (expect->master->helper->max_expected && if (expect->master->helper->max_expected &&
expect->master->expecting >= expect->master->helper->max_expected) expect->master->expecting >= expect->master->helper->max_expected)
evict_oldest_expect(expect->master); evict_oldest_expect(expect->master);
...@@ -1021,7 +1021,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect) ...@@ -1021,7 +1021,7 @@ int ip_conntrack_expect_related(struct ip_conntrack_expect *expect)
ret = 0; ret = 0;
out: out:
write_unlock_bh(&ip_conntrack_lock); write_unlock_bh(&ip_conntrack_lock);
return ret; return ret;
} }
/* Alter reply tuple (maybe alter helper). This is for NAT, and is /* Alter reply tuple (maybe alter helper). This is for NAT, and is
...@@ -1069,7 +1069,7 @@ static inline void unhelp(struct ip_conntrack_tuple_hash *i, ...@@ -1069,7 +1069,7 @@ static inline void unhelp(struct ip_conntrack_tuple_hash *i,
const struct ip_conntrack_helper *me) const struct ip_conntrack_helper *me)
{ {
if (tuplehash_to_ctrack(i)->helper == me) { if (tuplehash_to_ctrack(i)->helper == me) {
ip_conntrack_event(IPCT_HELPER, tuplehash_to_ctrack(i)); ip_conntrack_event(IPCT_HELPER, tuplehash_to_ctrack(i));
tuplehash_to_ctrack(i)->helper = NULL; tuplehash_to_ctrack(i)->helper = NULL;
} }
} }
...@@ -1105,8 +1105,8 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me) ...@@ -1105,8 +1105,8 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
} }
/* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */ /* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */
void __ip_ct_refresh_acct(struct ip_conntrack *ct, void __ip_ct_refresh_acct(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo, enum ip_conntrack_info ctinfo,
const struct sk_buff *skb, const struct sk_buff *skb,
unsigned long extra_jiffies, unsigned long extra_jiffies,
int do_acct) int do_acct)
...@@ -1140,7 +1140,7 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct, ...@@ -1140,7 +1140,7 @@ void __ip_ct_refresh_acct(struct ip_conntrack *ct,
#ifdef CONFIG_IP_NF_CT_ACCT #ifdef CONFIG_IP_NF_CT_ACCT
if (do_acct) { if (do_acct) {
ct->counters[CTINFO2DIR(ctinfo)].packets++; ct->counters[CTINFO2DIR(ctinfo)].packets++;
ct->counters[CTINFO2DIR(ctinfo)].bytes += ct->counters[CTINFO2DIR(ctinfo)].bytes +=
ntohs(skb->nh.iph->tot_len); ntohs(skb->nh.iph->tot_len);
if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000) if ((ct->counters[CTINFO2DIR(ctinfo)].packets & 0x80000000)
|| (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000)) || (ct->counters[CTINFO2DIR(ctinfo)].bytes & 0x80000000))
...@@ -1194,7 +1194,7 @@ ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user) ...@@ -1194,7 +1194,7 @@ ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user)
{ {
skb_orphan(skb); skb_orphan(skb);
local_bh_disable(); local_bh_disable();
skb = ip_defrag(skb, user); skb = ip_defrag(skb, user);
local_bh_enable(); local_bh_enable();
...@@ -1211,7 +1211,7 @@ static void ip_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb) ...@@ -1211,7 +1211,7 @@ static void ip_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb)
/* This ICMP is in reverse direction to the packet which caused it */ /* This ICMP is in reverse direction to the packet which caused it */
ct = ip_conntrack_get(skb, &ctinfo); ct = ip_conntrack_get(skb, &ctinfo);
if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL)
ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY; ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY;
else else
...@@ -1279,7 +1279,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) ...@@ -1279,7 +1279,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
struct inet_sock *inet = inet_sk(sk); struct inet_sock *inet = inet_sk(sk);
struct ip_conntrack_tuple_hash *h; struct ip_conntrack_tuple_hash *h;
struct ip_conntrack_tuple tuple; struct ip_conntrack_tuple tuple;
IP_CT_TUPLE_U_BLANK(&tuple); IP_CT_TUPLE_U_BLANK(&tuple);
tuple.src.ip = inet->rcv_saddr; tuple.src.ip = inet->rcv_saddr;
tuple.src.u.tcp.port = inet->sport; tuple.src.u.tcp.port = inet->sport;
...@@ -1347,7 +1347,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size) ...@@ -1347,7 +1347,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size)
if (vmalloced) if (vmalloced)
vfree(hash); vfree(hash);
else else
free_pages((unsigned long)hash, free_pages((unsigned long)hash,
get_order(sizeof(struct list_head) * size)); get_order(sizeof(struct list_head) * size));
} }
...@@ -1358,8 +1358,8 @@ void ip_conntrack_cleanup(void) ...@@ -1358,8 +1358,8 @@ void ip_conntrack_cleanup(void)
ip_ct_attach = NULL; ip_ct_attach = NULL;
/* This makes sure all current packets have passed through /* This makes sure all current packets have passed through
netfilter framework. Roll on, two-stage module netfilter framework. Roll on, two-stage module
delete... */ delete... */
synchronize_net(); synchronize_net();
ip_ct_event_cache_flush(); ip_ct_event_cache_flush();
...@@ -1385,11 +1385,11 @@ static struct list_head *alloc_hashtable(int size, int *vmalloced) ...@@ -1385,11 +1385,11 @@ static struct list_head *alloc_hashtable(int size, int *vmalloced)
struct list_head *hash; struct list_head *hash;
unsigned int i; unsigned int i;
*vmalloced = 0; *vmalloced = 0;
hash = (void*)__get_free_pages(GFP_KERNEL, hash = (void*)__get_free_pages(GFP_KERNEL,
get_order(sizeof(struct list_head) get_order(sizeof(struct list_head)
* size)); * size));
if (!hash) { if (!hash) {
*vmalloced = 1; *vmalloced = 1;
printk(KERN_WARNING"ip_conntrack: falling back to vmalloc.\n"); printk(KERN_WARNING"ip_conntrack: falling back to vmalloc.\n");
hash = vmalloc(sizeof(struct list_head) * size); hash = vmalloc(sizeof(struct list_head) * size);
...@@ -1422,7 +1422,7 @@ static int set_hashsize(const char *val, struct kernel_param *kp) ...@@ -1422,7 +1422,7 @@ static int set_hashsize(const char *val, struct kernel_param *kp)
if (!hash) if (!hash)
return -ENOMEM; return -ENOMEM;
/* We have to rehash for the new table anyway, so we also can /* We have to rehash for the new table anyway, so we also can
* use a new random seed */ * use a new random seed */
get_random_bytes(&rnd, 4); get_random_bytes(&rnd, 4);
...@@ -1460,7 +1460,7 @@ int __init ip_conntrack_init(void) ...@@ -1460,7 +1460,7 @@ int __init ip_conntrack_init(void)
/* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB /* Idea from tcp.c: use 1/16384 of memory. On i386: 32MB
* machine has 256 buckets. >= 1GB machines have 8192 buckets. */ * machine has 256 buckets. >= 1GB machines have 8192 buckets. */
if (!ip_conntrack_htable_size) { if (!ip_conntrack_htable_size) {
ip_conntrack_htable_size ip_conntrack_htable_size
= (((num_physpages << PAGE_SHIFT) / 16384) = (((num_physpages << PAGE_SHIFT) / 16384)
/ sizeof(struct list_head)); / sizeof(struct list_head));
...@@ -1490,8 +1490,8 @@ int __init ip_conntrack_init(void) ...@@ -1490,8 +1490,8 @@ int __init ip_conntrack_init(void)
} }
ip_conntrack_cachep = kmem_cache_create("ip_conntrack", ip_conntrack_cachep = kmem_cache_create("ip_conntrack",
sizeof(struct ip_conntrack), 0, sizeof(struct ip_conntrack), 0,
0, NULL, NULL); 0, NULL, NULL);
if (!ip_conntrack_cachep) { if (!ip_conntrack_cachep) {
printk(KERN_ERR "Unable to create ip_conntrack slab cache\n"); printk(KERN_ERR "Unable to create ip_conntrack slab cache\n");
goto err_free_hash; goto err_free_hash;
......
/* FTP extension for IP connection tracking. */ /* FTP extension for IP connection tracking. */
/* (C) 1999-2001 Paul `Rusty' Russell /* (C) 1999-2001 Paul `Rusty' Russell
* (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -169,7 +169,7 @@ static int try_eprt(const char *data, size_t dlen, u_int32_t array[6], ...@@ -169,7 +169,7 @@ static int try_eprt(const char *data, size_t dlen, u_int32_t array[6],
int length; int length;
/* First character is delimiter, then "1" for IPv4, then /* First character is delimiter, then "1" for IPv4, then
delimiter again. */ delimiter again. */
if (dlen <= 3) return 0; if (dlen <= 3) return 0;
delim = data[0]; delim = data[0];
if (isdigit(delim) || delim < 33 || delim > 126 if (isdigit(delim) || delim < 33 || delim > 126
...@@ -344,14 +344,14 @@ static int help(struct sk_buff **pskb, ...@@ -344,14 +344,14 @@ static int help(struct sk_buff **pskb,
if (!find_nl_seq(ntohl(th->seq), ct_ftp_info, dir)) { if (!find_nl_seq(ntohl(th->seq), ct_ftp_info, dir)) {
/* Now if this ends in \n, update ftp info. */ /* Now if this ends in \n, update ftp info. */
DEBUGP("ip_conntrack_ftp_help: wrong seq pos %s(%u) or %s(%u)\n", DEBUGP("ip_conntrack_ftp_help: wrong seq pos %s(%u) or %s(%u)\n",
ct_ftp_info->seq_aft_nl[0][dir] ct_ftp_info->seq_aft_nl[0][dir]
old_seq_aft_nl_set ? "":"(UNSET) ", old_seq_aft_nl); old_seq_aft_nl_set ? "":"(UNSET) ", old_seq_aft_nl);
ret = NF_ACCEPT; ret = NF_ACCEPT;
goto out_update_nl; goto out_update_nl;
} }
/* Initialize IP array to expected address (it's not mentioned /* Initialize IP array to expected address (it's not mentioned
in EPSV responses) */ in EPSV responses) */
array[0] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 24) & 0xFF; array[0] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 24) & 0xFF;
array[1] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 16) & 0xFF; array[1] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 16) & 0xFF;
array[2] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 8) & 0xFF; array[2] = (ntohl(ct->tuplehash[dir].tuple.src.ip) >> 8) & 0xFF;
...@@ -386,7 +386,7 @@ static int help(struct sk_buff **pskb, ...@@ -386,7 +386,7 @@ static int help(struct sk_buff **pskb,
DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n", DEBUGP("conntrack_ftp: match `%s' (%u bytes at %u)\n",
fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff); fb_ptr + matchoff, matchlen, ntohl(th->seq) + matchoff);
/* Allocate expectation which will be inserted */ /* Allocate expectation which will be inserted */
exp = ip_conntrack_expect_alloc(ct); exp = ip_conntrack_expect_alloc(ct);
if (exp == NULL) { if (exp == NULL) {
...@@ -504,7 +504,7 @@ static int __init ip_conntrack_ftp_init(void) ...@@ -504,7 +504,7 @@ static int __init ip_conntrack_ftp_init(void)
sprintf(tmpname, "ftp-%d", ports[i]); sprintf(tmpname, "ftp-%d", ports[i]);
ftp[i].name = tmpname; ftp[i].name = tmpname;
DEBUGP("ip_ct_ftp: registering helper for port %d\n", DEBUGP("ip_ct_ftp: registering helper for port %d\n",
ports[i]); ports[i]);
ret = ip_conntrack_helper_register(&ftp[i]); ret = ip_conntrack_helper_register(&ftp[i]);
......
...@@ -42,7 +42,7 @@ MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper"); ...@@ -42,7 +42,7 @@ MODULE_PARM_DESC(gkrouted_only, "only accept calls from gatekeeper");
static int callforward_filter = 1; static int callforward_filter = 1;
module_param(callforward_filter, bool, 0600); module_param(callforward_filter, bool, 0600);
MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations " MODULE_PARM_DESC(callforward_filter, "only create call forwarding expectations "
"if both endpoints are on different sides " "if both endpoints are on different sides "
"(determined by routing information)"); "(determined by routing information)");
/* Hooks for NAT */ /* Hooks for NAT */
......
...@@ -560,7 +560,7 @@ conntrack_pptp_help(struct sk_buff **pskb, ...@@ -560,7 +560,7 @@ conntrack_pptp_help(struct sk_buff **pskb,
tcph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_tcph), &_tcph); tcph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_tcph), &_tcph);
BUG_ON(!tcph); BUG_ON(!tcph);
nexthdr_off += tcph->doff * 4; nexthdr_off += tcph->doff * 4;
datalen = tcplen - tcph->doff * 4; datalen = tcplen - tcph->doff * 4;
pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph); pptph = skb_header_pointer(*pskb, nexthdr_off, sizeof(_pptph), &_pptph);
if (!pptph) { if (!pptph) {
...@@ -624,7 +624,7 @@ static struct ip_conntrack_helper pptp = { ...@@ -624,7 +624,7 @@ static struct ip_conntrack_helper pptp = {
.max_expected = 2, .max_expected = 2,
.timeout = 5 * 60, .timeout = 5 * 60,
.tuple = { .src = { .ip = 0, .tuple = { .src = { .ip = 0,
.u = { .tcp = { .port = .u = { .tcp = { .port =
__constant_htons(PPTP_CONTROL_PORT) } } __constant_htons(PPTP_CONTROL_PORT) } }
}, },
.dst = { .ip = 0, .dst = { .ip = 0,
...@@ -638,7 +638,7 @@ static struct ip_conntrack_helper pptp = { ...@@ -638,7 +638,7 @@ static struct ip_conntrack_helper pptp = {
.dst = { .ip = 0, .dst = { .ip = 0,
.u = { .all = 0 }, .u = { .all = 0 },
.protonum = 0xff .protonum = 0xff
} }
}, },
.help = conntrack_pptp_help, .help = conntrack_pptp_help,
.destroy = pptp_destroy_siblings, .destroy = pptp_destroy_siblings,
......
/* IRC extension for IP connection tracking, Version 1.21 /* IRC extension for IP connection tracking, Version 1.21
* (C) 2000-2002 by Harald Welte <laforge@gnumonks.org> * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org>
* based on RR's ip_conntrack_ftp.c * based on RR's ip_conntrack_ftp.c
* *
* ip_conntrack_irc.c,v 1.21 2002/02/05 14:49:26 laforge Exp * ip_conntrack_irc.c,v 1.21 2002/02/05 14:49:26 laforge Exp
* *
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
* Module load syntax: * Module load syntax:
* insmod ip_conntrack_irc.o ports=port1,port2,...port<MAX_PORTS> * insmod ip_conntrack_irc.o ports=port1,port2,...port<MAX_PORTS>
* max_dcc_channels=n dcc_timeout=secs * max_dcc_channels=n dcc_timeout=secs
* *
* please give the ports of all IRC servers You wish to connect to. * please give the ports of all IRC servers You wish to connect to.
* If You don't specify ports, the default will be port 6667. * If You don't specify ports, the default will be port 6667.
* With max_dcc_channels you can define the maximum number of not * With max_dcc_channels you can define the maximum number of not
* yet answered DCC channels per IRC session (default 8). * yet answered DCC channels per IRC session (default 8).
* With dcc_timeout you can specify how long the system waits for * With dcc_timeout you can specify how long the system waits for
* an expected DCC channel (default 300 seconds). * an expected DCC channel (default 300 seconds).
* *
*/ */
...@@ -63,7 +63,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " ...@@ -63,7 +63,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT "
#if 0 #if 0
#define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s:" format, \ #define DEBUGP(format, args...) printk(KERN_DEBUG "%s:%s:" format, \
__FILE__, __FUNCTION__ , ## args) __FILE__, __FUNCTION__ , ## args)
#else #else
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
...@@ -71,7 +71,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT " ...@@ -71,7 +71,7 @@ static const char *dccprotos[] = { "SEND ", "CHAT ", "MOVE ", "TSEND ", "SCHAT "
static int parse_dcc(char *data, char *data_end, u_int32_t *ip, static int parse_dcc(char *data, char *data_end, u_int32_t *ip,
u_int16_t *port, char **ad_beg_p, char **ad_end_p) u_int16_t *port, char **ad_beg_p, char **ad_end_p)
/* tries to get the ip_addr and port out of a dcc command /* tries to get the ip_addr and port out of a dcc command
return value: -1 on failure, 0 on success return value: -1 on failure, 0 on success
data pointer to first byte of DCC command data data pointer to first byte of DCC command data
data_end pointer to last byte of dcc command data data_end pointer to last byte of dcc command data
ip returns parsed ip of dcc command ip returns parsed ip of dcc command
...@@ -90,7 +90,7 @@ static int parse_dcc(char *data, char *data_end, u_int32_t *ip, ...@@ -90,7 +90,7 @@ static int parse_dcc(char *data, char *data_end, u_int32_t *ip,
/* skip blanks between ip and port */ /* skip blanks between ip and port */
while (*data == ' ') { while (*data == ' ') {
if (data >= data_end) if (data >= data_end)
return -1; return -1;
data++; data++;
} }
...@@ -171,7 +171,7 @@ static int help(struct sk_buff **pskb, ...@@ -171,7 +171,7 @@ static int help(struct sk_buff **pskb,
DEBUGP("DCC %s detected\n", dccprotos[i]); DEBUGP("DCC %s detected\n", dccprotos[i]);
data += strlen(dccprotos[i]); data += strlen(dccprotos[i]);
/* we have at least /* we have at least
* (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid
* data left (== 14/13 bytes) */ * data left (== 14/13 bytes) */
if (parse_dcc((char *)data, data_limit, &dcc_ip, if (parse_dcc((char *)data, data_limit, &dcc_ip,
...@@ -260,7 +260,7 @@ static int __init ip_conntrack_irc_init(void) ...@@ -260,7 +260,7 @@ static int __init ip_conntrack_irc_init(void)
irc_buffer = kmalloc(65536, GFP_KERNEL); irc_buffer = kmalloc(65536, GFP_KERNEL);
if (!irc_buffer) if (!irc_buffer)
return -ENOMEM; return -ENOMEM;
/* If no port given, default to standard irc port */ /* If no port given, default to standard irc port */
if (ports_c == 0) if (ports_c == 0)
ports[ports_c++] = IRC_PORT; ports[ports_c++] = IRC_PORT;
...@@ -297,7 +297,7 @@ static int __init ip_conntrack_irc_init(void) ...@@ -297,7 +297,7 @@ static int __init ip_conntrack_irc_init(void)
return 0; return 0;
} }
/* This function is intentionally _NOT_ defined as __exit, because /* This function is intentionally _NOT_ defined as __exit, because
* it is needed by the init function */ * it is needed by the init function */
static void ip_conntrack_irc_fini(void) static void ip_conntrack_irc_fini(void)
{ {
......
...@@ -42,7 +42,7 @@ module_param(timeout, uint, 0400); ...@@ -42,7 +42,7 @@ module_param(timeout, uint, 0400);
MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds"); MODULE_PARM_DESC(timeout, "timeout for master connection/replies in seconds");
static int help(struct sk_buff **pskb, static int help(struct sk_buff **pskb,
struct ip_conntrack *ct, enum ip_conntrack_info ctinfo) struct ip_conntrack *ct, enum ip_conntrack_info ctinfo)
{ {
struct ip_conntrack_expect *exp; struct ip_conntrack_expect *exp;
struct iphdr *iph = (*pskb)->nh.iph; struct iphdr *iph = (*pskb)->nh.iph;
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
* (C) 2003 by Patrick Mchardy <kaber@trash.net> * (C) 2003 by Patrick Mchardy <kaber@trash.net>
* (C) 2005-2006 by Pablo Neira Ayuso <pablo@eurodev.net> * (C) 2005-2006 by Pablo Neira Ayuso <pablo@eurodev.net>
* *
* I've reworked this stuff to use attributes instead of conntrack * I've reworked this stuff to use attributes instead of conntrack
* structures. 5.44 am. I need more tea. --pablo 05/07/11. * structures. 5.44 am. I need more tea. --pablo 05/07/11.
* *
* Initial connection tracking via netlink development funded and * Initial connection tracking via netlink development funded and
* generally made possible by Network Robots, Inc. (www.networkrobots.com) * generally made possible by Network Robots, Inc. (www.networkrobots.com)
* *
* Further development of this code funded by Astaro AG (http://www.astaro.com) * Further development of this code funded by Astaro AG (http://www.astaro.com)
...@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL"); ...@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL");
static char __initdata version[] = "0.90"; static char __initdata version[] = "0.90";
static inline int static inline int
ctnetlink_dump_tuples_proto(struct sk_buff *skb, ctnetlink_dump_tuples_proto(struct sk_buff *skb,
const struct ip_conntrack_tuple *tuple, const struct ip_conntrack_tuple *tuple,
struct ip_conntrack_protocol *proto) struct ip_conntrack_protocol *proto)
{ {
...@@ -56,7 +56,7 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb, ...@@ -56,7 +56,7 @@ ctnetlink_dump_tuples_proto(struct sk_buff *skb,
if (likely(proto->tuple_to_nfattr)) if (likely(proto->tuple_to_nfattr))
ret = proto->tuple_to_nfattr(skb, tuple); ret = proto->tuple_to_nfattr(skb, tuple);
NFA_NEST_END(skb, nest_parms); NFA_NEST_END(skb, nest_parms);
return ret; return ret;
...@@ -70,7 +70,7 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb, ...@@ -70,7 +70,7 @@ ctnetlink_dump_tuples_ip(struct sk_buff *skb,
const struct ip_conntrack_tuple *tuple) const struct ip_conntrack_tuple *tuple)
{ {
struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP); struct nfattr *nest_parms = NFA_NEST(skb, CTA_TUPLE_IP);
NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip); NFA_PUT(skb, CTA_IP_V4_SRC, sizeof(__be32), &tuple->src.ip);
NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip); NFA_PUT(skb, CTA_IP_V4_DST, sizeof(__be32), &tuple->dst.ip);
...@@ -121,7 +121,7 @@ ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct) ...@@ -121,7 +121,7 @@ ctnetlink_dump_timeout(struct sk_buff *skb, const struct ip_conntrack *ct)
timeout = 0; timeout = 0;
else else
timeout = htonl(timeout_l / HZ); timeout = htonl(timeout_l / HZ);
NFA_PUT(skb, CTA_TIMEOUT, sizeof(timeout), &timeout); NFA_PUT(skb, CTA_TIMEOUT, sizeof(timeout), &timeout);
return 0; return 0;
...@@ -141,7 +141,7 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct ip_conntrack *ct) ...@@ -141,7 +141,7 @@ ctnetlink_dump_protoinfo(struct sk_buff *skb, const struct ip_conntrack *ct)
ip_conntrack_proto_put(proto); ip_conntrack_proto_put(proto);
return 0; return 0;
} }
nest_proto = NFA_NEST(skb, CTA_PROTOINFO); nest_proto = NFA_NEST(skb, CTA_PROTOINFO);
ret = proto->to_nfattr(skb, nest_proto, ct); ret = proto->to_nfattr(skb, nest_proto, ct);
...@@ -164,7 +164,7 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct ip_conntrack *ct) ...@@ -164,7 +164,7 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct ip_conntrack *ct)
if (!ct->helper) if (!ct->helper)
return 0; return 0;
nest_helper = NFA_NEST(skb, CTA_HELP); nest_helper = NFA_NEST(skb, CTA_HELP);
NFA_PUT(skb, CTA_HELP_NAME, strlen(ct->helper->name), ct->helper->name); NFA_PUT(skb, CTA_HELP_NAME, strlen(ct->helper->name), ct->helper->name);
...@@ -236,7 +236,7 @@ static inline int ...@@ -236,7 +236,7 @@ static inline int
ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct)
{ {
__be32 use = htonl(atomic_read(&ct->ct_general.use)); __be32 use = htonl(atomic_read(&ct->ct_general.use));
NFA_PUT(skb, CTA_USE, sizeof(__be32), &use); NFA_PUT(skb, CTA_USE, sizeof(__be32), &use);
return 0; return 0;
...@@ -248,7 +248,7 @@ ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct) ...@@ -248,7 +248,7 @@ ctnetlink_dump_use(struct sk_buff *skb, const struct ip_conntrack *ct)
static int static int
ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
int event, int nowait, int event, int nowait,
const struct ip_conntrack *ct) const struct ip_conntrack *ct)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
...@@ -271,7 +271,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -271,7 +271,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0) if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0)
goto nfattr_failure; goto nfattr_failure;
NFA_NEST_END(skb, nest_parms); NFA_NEST_END(skb, nest_parms);
nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY); nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY);
if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0) if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0)
goto nfattr_failure; goto nfattr_failure;
...@@ -299,7 +299,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq, ...@@ -299,7 +299,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
static int ctnetlink_conntrack_event(struct notifier_block *this, static int ctnetlink_conntrack_event(struct notifier_block *this,
unsigned long events, void *ptr) unsigned long events, void *ptr)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
struct nfgenmsg *nfmsg; struct nfgenmsg *nfmsg;
...@@ -324,7 +324,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, ...@@ -324,7 +324,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
} else if (events & (IPCT_STATUS | IPCT_PROTOINFO)) { } else if (events & (IPCT_STATUS | IPCT_PROTOINFO)) {
type = IPCTNL_MSG_CT_NEW; type = IPCTNL_MSG_CT_NEW;
group = NFNLGRP_CONNTRACK_UPDATE; group = NFNLGRP_CONNTRACK_UPDATE;
} else } else
return NOTIFY_DONE; return NOTIFY_DONE;
if (!nfnetlink_has_listeners(group)) if (!nfnetlink_has_listeners(group))
...@@ -349,7 +349,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, ...@@ -349,7 +349,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0) if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_ORIGINAL)) < 0)
goto nfattr_failure; goto nfattr_failure;
NFA_NEST_END(skb, nest_parms); NFA_NEST_END(skb, nest_parms);
nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY); nest_parms = NFA_NEST(skb, CTA_TUPLE_REPLY);
if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0) if (ctnetlink_dump_tuples(skb, tuple(ct, IP_CT_DIR_REPLY)) < 0)
goto nfattr_failure; goto nfattr_failure;
...@@ -368,16 +368,16 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, ...@@ -368,16 +368,16 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
if (events & IPCT_PROTOINFO if (events & IPCT_PROTOINFO
&& ctnetlink_dump_protoinfo(skb, ct) < 0) && ctnetlink_dump_protoinfo(skb, ct) < 0)
goto nfattr_failure; goto nfattr_failure;
if ((events & IPCT_HELPER || ct->helper) if ((events & IPCT_HELPER || ct->helper)
&& ctnetlink_dump_helpinfo(skb, ct) < 0) && ctnetlink_dump_helpinfo(skb, ct) < 0)
goto nfattr_failure; goto nfattr_failure;
#ifdef CONFIG_IP_NF_CONNTRACK_MARK #ifdef CONFIG_IP_NF_CONNTRACK_MARK
if ((events & IPCT_MARK || ct->mark) if ((events & IPCT_MARK || ct->mark)
&& ctnetlink_dump_mark(skb, ct) < 0) && ctnetlink_dump_mark(skb, ct) < 0)
goto nfattr_failure; goto nfattr_failure;
#endif #endif
if (events & IPCT_COUNTER_FILLING && if (events & IPCT_COUNTER_FILLING &&
...@@ -426,7 +426,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -426,7 +426,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
cb->args[1] = 0; cb->args[1] = 0;
} }
if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq, cb->nlh->nlmsg_seq,
IPCTNL_MSG_CT_NEW, IPCTNL_MSG_CT_NEW,
1, ct) < 0) { 1, ct) < 0) {
nf_conntrack_get(&ct->ct_general); nf_conntrack_get(&ct->ct_general);
...@@ -488,7 +488,7 @@ static const size_t cta_min_proto[CTA_PROTO_MAX] = { ...@@ -488,7 +488,7 @@ static const size_t cta_min_proto[CTA_PROTO_MAX] = {
}; };
static inline int static inline int
ctnetlink_parse_tuple_proto(struct nfattr *attr, ctnetlink_parse_tuple_proto(struct nfattr *attr,
struct ip_conntrack_tuple *tuple) struct ip_conntrack_tuple *tuple)
{ {
struct nfattr *tb[CTA_PROTO_MAX]; struct nfattr *tb[CTA_PROTO_MAX];
...@@ -508,9 +508,9 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr, ...@@ -508,9 +508,9 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr,
if (likely(proto->nfattr_to_tuple)) if (likely(proto->nfattr_to_tuple))
ret = proto->nfattr_to_tuple(tb, tuple); ret = proto->nfattr_to_tuple(tb, tuple);
ip_conntrack_proto_put(proto); ip_conntrack_proto_put(proto);
return ret; return ret;
} }
...@@ -595,7 +595,7 @@ ctnetlink_parse_nat(struct nfattr *nat, ...@@ -595,7 +595,7 @@ ctnetlink_parse_nat(struct nfattr *nat,
int err; int err;
memset(range, 0, sizeof(*range)); memset(range, 0, sizeof(*range));
nfattr_parse_nested(tb, CTA_NAT_MAX, nat); nfattr_parse_nested(tb, CTA_NAT_MAX, nat);
if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat)) if (nfattr_bad_size(tb, CTA_NAT_MAX, cta_min_nat))
...@@ -647,7 +647,7 @@ static const size_t cta_min[CTA_MAX] = { ...@@ -647,7 +647,7 @@ static const size_t cta_min[CTA_MAX] = {
}; };
static int static int
ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) struct nlmsghdr *nlh, struct nfattr *cda[], int *errp)
{ {
struct ip_conntrack_tuple_hash *h; struct ip_conntrack_tuple_hash *h;
...@@ -676,14 +676,14 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -676,14 +676,14 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
return -ENOENT; return -ENOENT;
ct = tuplehash_to_ctrack(h); ct = tuplehash_to_ctrack(h);
if (cda[CTA_ID-1]) { if (cda[CTA_ID-1]) {
u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1])); u_int32_t id = ntohl(*(__be32 *)NFA_DATA(cda[CTA_ID-1]));
if (ct->id != id) { if (ct->id != id) {
ip_conntrack_put(ct); ip_conntrack_put(ct);
return -ENOENT; return -ENOENT;
} }
} }
if (del_timer(&ct->timeout)) if (del_timer(&ct->timeout))
ct->timeout.function((unsigned long)ct); ct->timeout.function((unsigned long)ct);
...@@ -693,7 +693,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -693,7 +693,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb,
} }
static int static int
ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) struct nlmsghdr *nlh, struct nfattr *cda[], int *errp)
{ {
struct ip_conntrack_tuple_hash *h; struct ip_conntrack_tuple_hash *h;
...@@ -714,8 +714,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -714,8 +714,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
return -ENOTSUPP; return -ENOTSUPP;
#endif #endif
if ((*errp = netlink_dump_start(ctnl, skb, nlh, if ((*errp = netlink_dump_start(ctnl, skb, nlh,
ctnetlink_dump_table, ctnetlink_dump_table,
ctnetlink_done)) != 0) ctnetlink_done)) != 0)
return -EINVAL; return -EINVAL;
rlen = NLMSG_ALIGN(nlh->nlmsg_len); rlen = NLMSG_ALIGN(nlh->nlmsg_len);
...@@ -751,7 +751,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -751,7 +751,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
return -ENOMEM; return -ENOMEM;
} }
err = ctnetlink_fill_info(skb2, NETLINK_CB(skb).pid, nlh->nlmsg_seq, err = ctnetlink_fill_info(skb2, NETLINK_CB(skb).pid, nlh->nlmsg_seq,
IPCTNL_MSG_CT_NEW, 1, ct); IPCTNL_MSG_CT_NEW, 1, ct);
ip_conntrack_put(ct); ip_conntrack_put(ct);
if (err <= 0) if (err <= 0)
...@@ -779,12 +779,12 @@ ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[]) ...@@ -779,12 +779,12 @@ ctnetlink_change_status(struct ip_conntrack *ct, struct nfattr *cda[])
if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING)) if (d & (IPS_EXPECTED|IPS_CONFIRMED|IPS_DYING))
/* unchangeable */ /* unchangeable */
return -EINVAL; return -EINVAL;
if (d & IPS_SEEN_REPLY && !(status & IPS_SEEN_REPLY)) if (d & IPS_SEEN_REPLY && !(status & IPS_SEEN_REPLY))
/* SEEN_REPLY bit can only be set */ /* SEEN_REPLY bit can only be set */
return -EINVAL; return -EINVAL;
if (d & IPS_ASSURED && !(status & IPS_ASSURED)) if (d & IPS_ASSURED && !(status & IPS_ASSURED))
/* ASSURED bit can only be set */ /* ASSURED bit can only be set */
return -EINVAL; return -EINVAL;
...@@ -857,7 +857,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[]) ...@@ -857,7 +857,7 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[])
memset(&ct->help, 0, sizeof(ct->help)); memset(&ct->help, 0, sizeof(ct->help));
} }
} }
ct->helper = helper; ct->helper = helper;
return 0; return 0;
...@@ -867,7 +867,7 @@ static inline int ...@@ -867,7 +867,7 @@ static inline int
ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[]) ctnetlink_change_timeout(struct ip_conntrack *ct, struct nfattr *cda[])
{ {
u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1])); u_int32_t timeout = ntohl(*(__be32 *)NFA_DATA(cda[CTA_TIMEOUT-1]));
if (!del_timer(&ct->timeout)) if (!del_timer(&ct->timeout))
return -ETIME; return -ETIME;
...@@ -891,7 +891,7 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[]) ...@@ -891,7 +891,7 @@ ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
if (proto->from_nfattr) if (proto->from_nfattr)
err = proto->from_nfattr(tb, ct); err = proto->from_nfattr(tb, ct);
ip_conntrack_proto_put(proto); ip_conntrack_proto_put(proto);
return err; return err;
} }
...@@ -934,7 +934,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) ...@@ -934,7 +934,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[])
} }
static int static int
ctnetlink_create_conntrack(struct nfattr *cda[], ctnetlink_create_conntrack(struct nfattr *cda[],
struct ip_conntrack_tuple *otuple, struct ip_conntrack_tuple *otuple,
struct ip_conntrack_tuple *rtuple) struct ip_conntrack_tuple *rtuple)
{ {
...@@ -943,7 +943,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], ...@@ -943,7 +943,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
ct = ip_conntrack_alloc(otuple, rtuple); ct = ip_conntrack_alloc(otuple, rtuple);
if (ct == NULL || IS_ERR(ct)) if (ct == NULL || IS_ERR(ct))
return -ENOMEM; return -ENOMEM;
if (!cda[CTA_TIMEOUT-1]) if (!cda[CTA_TIMEOUT-1])
goto err; goto err;
...@@ -979,13 +979,13 @@ ctnetlink_create_conntrack(struct nfattr *cda[], ...@@ -979,13 +979,13 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
return 0; return 0;
err: err:
ip_conntrack_free(ct); ip_conntrack_free(ct);
return err; return err;
} }
static int static int
ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) struct nlmsghdr *nlh, struct nfattr *cda[], int *errp)
{ {
struct ip_conntrack_tuple otuple, rtuple; struct ip_conntrack_tuple otuple, rtuple;
...@@ -1039,9 +1039,9 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, ...@@ -1039,9 +1039,9 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
return err; return err;
} }
/*********************************************************************** /***********************************************************************
* EXPECT * EXPECT
***********************************************************************/ ***********************************************************************/
static inline int static inline int
ctnetlink_exp_dump_tuple(struct sk_buff *skb, ctnetlink_exp_dump_tuple(struct sk_buff *skb,
...@@ -1049,7 +1049,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb, ...@@ -1049,7 +1049,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb,
enum ctattr_expect type) enum ctattr_expect type)
{ {
struct nfattr *nest_parms = NFA_NEST(skb, type); struct nfattr *nest_parms = NFA_NEST(skb, type);
if (ctnetlink_dump_tuples(skb, tuple) < 0) if (ctnetlink_dump_tuples(skb, tuple) < 0)
goto nfattr_failure; goto nfattr_failure;
...@@ -1059,7 +1059,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb, ...@@ -1059,7 +1059,7 @@ ctnetlink_exp_dump_tuple(struct sk_buff *skb,
nfattr_failure: nfattr_failure:
return -1; return -1;
} }
static inline int static inline int
ctnetlink_exp_dump_mask(struct sk_buff *skb, ctnetlink_exp_dump_mask(struct sk_buff *skb,
...@@ -1090,7 +1090,7 @@ ctnetlink_exp_dump_mask(struct sk_buff *skb, ...@@ -1090,7 +1090,7 @@ ctnetlink_exp_dump_mask(struct sk_buff *skb,
static inline int static inline int
ctnetlink_exp_dump_expect(struct sk_buff *skb, ctnetlink_exp_dump_expect(struct sk_buff *skb,
const struct ip_conntrack_expect *exp) const struct ip_conntrack_expect *exp)
{ {
struct ip_conntrack *master = exp->master; struct ip_conntrack *master = exp->master;
__be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ); __be32 timeout = htonl((exp->timeout.expires - jiffies) / HZ);
...@@ -1104,20 +1104,20 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb, ...@@ -1104,20 +1104,20 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb,
&master->tuplehash[IP_CT_DIR_ORIGINAL].tuple, &master->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
CTA_EXPECT_MASTER) < 0) CTA_EXPECT_MASTER) < 0)
goto nfattr_failure; goto nfattr_failure;
NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout); NFA_PUT(skb, CTA_EXPECT_TIMEOUT, sizeof(__be32), &timeout);
NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id); NFA_PUT(skb, CTA_EXPECT_ID, sizeof(__be32), &id);
return 0; return 0;
nfattr_failure: nfattr_failure:
return -1; return -1;
} }
static int static int
ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq, ctnetlink_exp_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
int event, int event,
int nowait, int nowait,
const struct ip_conntrack_expect *exp) const struct ip_conntrack_expect *exp)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
...@@ -1216,7 +1216,7 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1216,7 +1216,7 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
goto out; goto out;
*id = exp->id; *id = exp->id;
} }
out: out:
read_unlock_bh(&ip_conntrack_lock); read_unlock_bh(&ip_conntrack_lock);
return skb->len; return skb->len;
...@@ -1228,7 +1228,7 @@ static const size_t cta_min_exp[CTA_EXPECT_MAX] = { ...@@ -1228,7 +1228,7 @@ static const size_t cta_min_exp[CTA_EXPECT_MAX] = {
}; };
static int static int
ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) struct nlmsghdr *nlh, struct nfattr *cda[], int *errp)
{ {
struct ip_conntrack_tuple tuple; struct ip_conntrack_tuple tuple;
...@@ -1247,7 +1247,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, ...@@ -1247,7 +1247,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
if ((*errp = netlink_dump_start(ctnl, skb, nlh, if ((*errp = netlink_dump_start(ctnl, skb, nlh,
ctnetlink_exp_dump_table, ctnetlink_exp_dump_table,
ctnetlink_done)) != 0) ctnetlink_done)) != 0)
return -EINVAL; return -EINVAL;
rlen = NLMSG_ALIGN(nlh->nlmsg_len); rlen = NLMSG_ALIGN(nlh->nlmsg_len);
...@@ -1275,14 +1275,14 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, ...@@ -1275,14 +1275,14 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
ip_conntrack_expect_put(exp); ip_conntrack_expect_put(exp);
return -ENOENT; return -ENOENT;
} }
} }
err = -ENOMEM; err = -ENOMEM;
skb2 = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); skb2 = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (!skb2) if (!skb2)
goto out; goto out;
err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid, err = ctnetlink_exp_fill_info(skb2, NETLINK_CB(skb).pid,
nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW, nlh->nlmsg_seq, IPCTNL_MSG_EXP_NEW,
1, exp); 1, exp);
if (err <= 0) if (err <= 0)
...@@ -1300,7 +1300,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, ...@@ -1300,7 +1300,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
} }
static int static int
ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp) struct nlmsghdr *nlh, struct nfattr *cda[], int *errp)
{ {
struct ip_conntrack_expect *exp, *tmp; struct ip_conntrack_expect *exp, *tmp;
...@@ -1333,7 +1333,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, ...@@ -1333,7 +1333,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
/* after list removal, usage count == 1 */ /* after list removal, usage count == 1 */
ip_conntrack_unexpect_related(exp); ip_conntrack_unexpect_related(exp);
/* have to put what we 'get' above. /* have to put what we 'get' above.
* after this line usage count == 0 */ * after this line usage count == 0 */
ip_conntrack_expect_put(exp); ip_conntrack_expect_put(exp);
} else if (cda[CTA_EXPECT_HELP_NAME-1]) { } else if (cda[CTA_EXPECT_HELP_NAME-1]) {
...@@ -1348,7 +1348,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb, ...@@ -1348,7 +1348,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
} }
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list,
list) { list) {
if (exp->master->helper == h if (exp->master->helper == h
&& del_timer(&exp->timeout)) { && del_timer(&exp->timeout)) {
ip_ct_unlink_expect(exp); ip_ct_unlink_expect(exp);
ip_conntrack_expect_put(exp); ip_conntrack_expect_put(exp);
...@@ -1413,7 +1413,7 @@ ctnetlink_create_expect(struct nfattr *cda[]) ...@@ -1413,7 +1413,7 @@ ctnetlink_create_expect(struct nfattr *cda[])
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
} }
exp->expectfn = NULL; exp->expectfn = NULL;
exp->flags = 0; exp->flags = 0;
exp->master = ct; exp->master = ct;
...@@ -1423,7 +1423,7 @@ ctnetlink_create_expect(struct nfattr *cda[]) ...@@ -1423,7 +1423,7 @@ ctnetlink_create_expect(struct nfattr *cda[])
err = ip_conntrack_expect_related(exp); err = ip_conntrack_expect_related(exp);
ip_conntrack_expect_put(exp); ip_conntrack_expect_put(exp);
out: out:
ip_conntrack_put(tuplehash_to_ctrack(h)); ip_conntrack_put(tuplehash_to_ctrack(h));
return err; return err;
} }
......
...@@ -94,9 +94,9 @@ static int icmp_packet(struct ip_conntrack *ct, ...@@ -94,9 +94,9 @@ static int icmp_packet(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo) enum ip_conntrack_info ctinfo)
{ {
/* Try to delete connection immediately after all replies: /* Try to delete connection immediately after all replies:
won't actually vanish as we still have skb, and del_timer won't actually vanish as we still have skb, and del_timer
means this will only run once even if count hits zero twice means this will only run once even if count hits zero twice
(theoretically possible with SMP) */ (theoretically possible with SMP) */
if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) { if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
if (atomic_dec_and_test(&ct->proto.icmp.count) if (atomic_dec_and_test(&ct->proto.icmp.count)
&& del_timer(&ct->timeout)) && del_timer(&ct->timeout))
...@@ -114,11 +114,11 @@ static int icmp_packet(struct ip_conntrack *ct, ...@@ -114,11 +114,11 @@ static int icmp_packet(struct ip_conntrack *ct,
static int icmp_new(struct ip_conntrack *conntrack, static int icmp_new(struct ip_conntrack *conntrack,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
static const u_int8_t valid_new[] = { static const u_int8_t valid_new[] = {
[ICMP_ECHO] = 1, [ICMP_ECHO] = 1,
[ICMP_TIMESTAMP] = 1, [ICMP_TIMESTAMP] = 1,
[ICMP_INFO_REQUEST] = 1, [ICMP_INFO_REQUEST] = 1,
[ICMP_ADDRESS] = 1 [ICMP_ADDRESS] = 1
}; };
if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new)
...@@ -282,7 +282,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[], ...@@ -282,7 +282,7 @@ static int icmp_nfattr_to_tuple(struct nfattr *tb[],
|| !tb[CTA_PROTO_ICMP_ID-1]) || !tb[CTA_PROTO_ICMP_ID-1])
return -EINVAL; return -EINVAL;
tuple->dst.u.icmp.type = tuple->dst.u.icmp.type =
*(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_TYPE-1]); *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_TYPE-1]);
tuple->dst.u.icmp.code = tuple->dst.u.icmp.code =
*(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]); *(u_int8_t *)NFA_DATA(tb[CTA_PROTO_ICMP_CODE-1]);
......
/* /*
* Connection tracking protocol helper module for SCTP. * Connection tracking protocol helper module for SCTP.
* *
* SCTP is defined in RFC 2960. References to various sections in this code * SCTP is defined in RFC 2960. References to various sections in this code
* are to this RFC. * are to this RFC.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
static DEFINE_RWLOCK(sctp_lock); static DEFINE_RWLOCK(sctp_lock);
/* FIXME: Examine ipfilter's timeouts and conntrack transitions more /* FIXME: Examine ipfilter's timeouts and conntrack transitions more
closely. They're more complex. --RR closely. They're more complex. --RR
And so for me for SCTP :D -Kiran */ And so for me for SCTP :D -Kiran */
...@@ -87,32 +87,32 @@ static const unsigned int * sctp_timeouts[] ...@@ -87,32 +87,32 @@ static const unsigned int * sctp_timeouts[]
#define sSA SCTP_CONNTRACK_SHUTDOWN_ACK_SENT #define sSA SCTP_CONNTRACK_SHUTDOWN_ACK_SENT
#define sIV SCTP_CONNTRACK_MAX #define sIV SCTP_CONNTRACK_MAX
/* /*
These are the descriptions of the states: These are the descriptions of the states:
NOTE: These state names are tantalizingly similar to the states of an NOTE: These state names are tantalizingly similar to the states of an
SCTP endpoint. But the interpretation of the states is a little different, SCTP endpoint. But the interpretation of the states is a little different,
considering that these are the states of the connection and not of an end considering that these are the states of the connection and not of an end
point. Please note the subtleties. -Kiran point. Please note the subtleties. -Kiran
NONE - Nothing so far. NONE - Nothing so far.
COOKIE WAIT - We have seen an INIT chunk in the original direction, or also COOKIE WAIT - We have seen an INIT chunk in the original direction, or also
an INIT_ACK chunk in the reply direction. an INIT_ACK chunk in the reply direction.
COOKIE ECHOED - We have seen a COOKIE_ECHO chunk in the original direction. COOKIE ECHOED - We have seen a COOKIE_ECHO chunk in the original direction.
ESTABLISHED - We have seen a COOKIE_ACK in the reply direction. ESTABLISHED - We have seen a COOKIE_ACK in the reply direction.
SHUTDOWN_SENT - We have seen a SHUTDOWN chunk in the original direction. SHUTDOWN_SENT - We have seen a SHUTDOWN chunk in the original direction.
SHUTDOWN_RECD - We have seen a SHUTDOWN chunk in the reply directoin. SHUTDOWN_RECD - We have seen a SHUTDOWN chunk in the reply directoin.
SHUTDOWN_ACK_SENT - We have seen a SHUTDOWN_ACK chunk in the direction opposite SHUTDOWN_ACK_SENT - We have seen a SHUTDOWN_ACK chunk in the direction opposite
to that of the SHUTDOWN chunk. to that of the SHUTDOWN chunk.
CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of CLOSED - We have seen a SHUTDOWN_COMPLETE chunk in the direction of
the SHUTDOWN chunk. Connection is closed. the SHUTDOWN chunk. Connection is closed.
*/ */
/* TODO /* TODO
- I have assumed that the first INIT is in the original direction. - I have assumed that the first INIT is in the original direction.
This messes things when an INIT comes in the reply direction in CLOSED This messes things when an INIT comes in the reply direction in CLOSED
state. state.
- Check the error type in the reply dir before transitioning from - Check the error type in the reply dir before transitioning from
cookie echoed to closed. cookie echoed to closed.
- Sec 5.2.4 of RFC 2960 - Sec 5.2.4 of RFC 2960
- Multi Homing support. - Multi Homing support.
...@@ -229,7 +229,7 @@ static int do_basic_checks(struct ip_conntrack *conntrack, ...@@ -229,7 +229,7 @@ static int do_basic_checks(struct ip_conntrack *conntrack,
for_each_sctp_chunk (skb, sch, _sch, offset, count) { for_each_sctp_chunk (skb, sch, _sch, offset, count) {
DEBUGP("Chunk Num: %d Type: %d\n", count, sch->type); DEBUGP("Chunk Num: %d Type: %d\n", count, sch->type);
if (sch->type == SCTP_CID_INIT if (sch->type == SCTP_CID_INIT
|| sch->type == SCTP_CID_INIT_ACK || sch->type == SCTP_CID_INIT_ACK
|| sch->type == SCTP_CID_SHUTDOWN_COMPLETE) { || sch->type == SCTP_CID_SHUTDOWN_COMPLETE) {
flag = 1; flag = 1;
...@@ -269,42 +269,42 @@ static int new_state(enum ip_conntrack_dir dir, ...@@ -269,42 +269,42 @@ static int new_state(enum ip_conntrack_dir dir,
DEBUGP("Chunk type: %d\n", chunk_type); DEBUGP("Chunk type: %d\n", chunk_type);
switch (chunk_type) { switch (chunk_type) {
case SCTP_CID_INIT: case SCTP_CID_INIT:
DEBUGP("SCTP_CID_INIT\n"); DEBUGP("SCTP_CID_INIT\n");
i = 0; break; i = 0; break;
case SCTP_CID_INIT_ACK: case SCTP_CID_INIT_ACK:
DEBUGP("SCTP_CID_INIT_ACK\n"); DEBUGP("SCTP_CID_INIT_ACK\n");
i = 1; break; i = 1; break;
case SCTP_CID_ABORT: case SCTP_CID_ABORT:
DEBUGP("SCTP_CID_ABORT\n"); DEBUGP("SCTP_CID_ABORT\n");
i = 2; break; i = 2; break;
case SCTP_CID_SHUTDOWN: case SCTP_CID_SHUTDOWN:
DEBUGP("SCTP_CID_SHUTDOWN\n"); DEBUGP("SCTP_CID_SHUTDOWN\n");
i = 3; break; i = 3; break;
case SCTP_CID_SHUTDOWN_ACK: case SCTP_CID_SHUTDOWN_ACK:
DEBUGP("SCTP_CID_SHUTDOWN_ACK\n"); DEBUGP("SCTP_CID_SHUTDOWN_ACK\n");
i = 4; break; i = 4; break;
case SCTP_CID_ERROR: case SCTP_CID_ERROR:
DEBUGP("SCTP_CID_ERROR\n"); DEBUGP("SCTP_CID_ERROR\n");
i = 5; break; i = 5; break;
case SCTP_CID_COOKIE_ECHO: case SCTP_CID_COOKIE_ECHO:
DEBUGP("SCTP_CID_COOKIE_ECHO\n"); DEBUGP("SCTP_CID_COOKIE_ECHO\n");
i = 6; break; i = 6; break;
case SCTP_CID_COOKIE_ACK: case SCTP_CID_COOKIE_ACK:
DEBUGP("SCTP_CID_COOKIE_ACK\n"); DEBUGP("SCTP_CID_COOKIE_ACK\n");
i = 7; break; i = 7; break;
case SCTP_CID_SHUTDOWN_COMPLETE: case SCTP_CID_SHUTDOWN_COMPLETE:
DEBUGP("SCTP_CID_SHUTDOWN_COMPLETE\n"); DEBUGP("SCTP_CID_SHUTDOWN_COMPLETE\n");
i = 8; break; i = 8; break;
default: default:
/* Other chunks like DATA, SACK, HEARTBEAT and /* Other chunks like DATA, SACK, HEARTBEAT and
its ACK do not cause a change in state */ its ACK do not cause a change in state */
DEBUGP("Unknown chunk type, Will stay in %s\n", DEBUGP("Unknown chunk type, Will stay in %s\n",
sctp_conntrack_names[cur_state]); sctp_conntrack_names[cur_state]);
return cur_state; return cur_state;
} }
DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n", DEBUGP("dir: %d cur_state: %s chunk_type: %d new_state: %s\n",
dir, sctp_conntrack_names[cur_state], chunk_type, dir, sctp_conntrack_names[cur_state], chunk_type,
sctp_conntrack_names[sctp_conntracks[dir][i][cur_state]]); sctp_conntrack_names[sctp_conntracks[dir][i][cur_state]]);
...@@ -367,7 +367,7 @@ static int sctp_packet(struct ip_conntrack *conntrack, ...@@ -367,7 +367,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
/* Sec 8.5.1 (C) */ /* Sec 8.5.1 (C) */
if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)]) if (!(sh->vtag == conntrack->proto.sctp.vtag[CTINFO2DIR(ctinfo)])
&& !(sh->vtag == conntrack->proto.sctp.vtag && !(sh->vtag == conntrack->proto.sctp.vtag
[1 - CTINFO2DIR(ctinfo)] [1 - CTINFO2DIR(ctinfo)]
&& (sch->flags & 1))) { && (sch->flags & 1))) {
write_unlock_bh(&sctp_lock); write_unlock_bh(&sctp_lock);
return -1; return -1;
...@@ -392,17 +392,17 @@ static int sctp_packet(struct ip_conntrack *conntrack, ...@@ -392,17 +392,17 @@ static int sctp_packet(struct ip_conntrack *conntrack,
} }
/* If it is an INIT or an INIT ACK note down the vtag */ /* If it is an INIT or an INIT ACK note down the vtag */
if (sch->type == SCTP_CID_INIT if (sch->type == SCTP_CID_INIT
|| sch->type == SCTP_CID_INIT_ACK) { || sch->type == SCTP_CID_INIT_ACK) {
sctp_inithdr_t _inithdr, *ih; sctp_inithdr_t _inithdr, *ih;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) { if (ih == NULL) {
write_unlock_bh(&sctp_lock); write_unlock_bh(&sctp_lock);
return -1; return -1;
} }
DEBUGP("Setting vtag %x for dir %d\n", DEBUGP("Setting vtag %x for dir %d\n",
ih->init_tag, !CTINFO2DIR(ctinfo)); ih->init_tag, !CTINFO2DIR(ctinfo));
conntrack->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag; conntrack->proto.sctp.vtag[!CTINFO2DIR(ctinfo)] = ih->init_tag;
} }
...@@ -427,7 +427,7 @@ static int sctp_packet(struct ip_conntrack *conntrack, ...@@ -427,7 +427,7 @@ static int sctp_packet(struct ip_conntrack *conntrack,
} }
/* Called when a new connection for this protocol found. */ /* Called when a new connection for this protocol found. */
static int sctp_new(struct ip_conntrack *conntrack, static int sctp_new(struct ip_conntrack *conntrack,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
enum sctp_conntrack newconntrack; enum sctp_conntrack newconntrack;
...@@ -457,7 +457,7 @@ static int sctp_new(struct ip_conntrack *conntrack, ...@@ -457,7 +457,7 @@ static int sctp_new(struct ip_conntrack *conntrack,
newconntrack = SCTP_CONNTRACK_MAX; newconntrack = SCTP_CONNTRACK_MAX;
for_each_sctp_chunk (skb, sch, _sch, offset, count) { for_each_sctp_chunk (skb, sch, _sch, offset, count) {
/* Don't need lock here: this conntrack not in circulation yet */ /* Don't need lock here: this conntrack not in circulation yet */
newconntrack = new_state (IP_CT_DIR_ORIGINAL, newconntrack = new_state (IP_CT_DIR_ORIGINAL,
SCTP_CONNTRACK_NONE, sch->type); SCTP_CONNTRACK_NONE, sch->type);
/* Invalid: delete conntrack */ /* Invalid: delete conntrack */
...@@ -472,14 +472,14 @@ static int sctp_new(struct ip_conntrack *conntrack, ...@@ -472,14 +472,14 @@ static int sctp_new(struct ip_conntrack *conntrack,
sctp_inithdr_t _inithdr, *ih; sctp_inithdr_t _inithdr, *ih;
ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t),
sizeof(_inithdr), &_inithdr); sizeof(_inithdr), &_inithdr);
if (ih == NULL) if (ih == NULL)
return 0; return 0;
DEBUGP("Setting vtag %x for new conn\n", DEBUGP("Setting vtag %x for new conn\n",
ih->init_tag); ih->init_tag);
conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] =
ih->init_tag; ih->init_tag;
} else { } else {
/* Sec 8.5.1 (A) */ /* Sec 8.5.1 (A) */
...@@ -489,7 +489,7 @@ static int sctp_new(struct ip_conntrack *conntrack, ...@@ -489,7 +489,7 @@ static int sctp_new(struct ip_conntrack *conntrack,
/* If it is a shutdown ack OOTB packet, we expect a return /* If it is a shutdown ack OOTB packet, we expect a return
shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */ shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */
else { else {
DEBUGP("Setting vtag %x for new conn OOTB\n", DEBUGP("Setting vtag %x for new conn OOTB\n",
sh->vtag); sh->vtag);
conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag; conntrack->proto.sctp.vtag[IP_CT_DIR_REPLY] = sh->vtag;
} }
...@@ -500,16 +500,16 @@ static int sctp_new(struct ip_conntrack *conntrack, ...@@ -500,16 +500,16 @@ static int sctp_new(struct ip_conntrack *conntrack,
return 1; return 1;
} }
static struct ip_conntrack_protocol ip_conntrack_protocol_sctp = { static struct ip_conntrack_protocol ip_conntrack_protocol_sctp = {
.proto = IPPROTO_SCTP, .proto = IPPROTO_SCTP,
.name = "sctp", .name = "sctp",
.pkt_to_tuple = sctp_pkt_to_tuple, .pkt_to_tuple = sctp_pkt_to_tuple,
.invert_tuple = sctp_invert_tuple, .invert_tuple = sctp_invert_tuple,
.print_tuple = sctp_print_tuple, .print_tuple = sctp_print_tuple,
.print_conntrack = sctp_print_conntrack, .print_conntrack = sctp_print_conntrack,
.packet = sctp_packet, .packet = sctp_packet,
.new = sctp_new, .new = sctp_new,
.destroy = NULL, .destroy = NULL,
.me = THIS_MODULE, .me = THIS_MODULE,
#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \ #if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE) defined(CONFIG_IP_NF_CONNTRACK_NETLINK_MODULE)
...@@ -603,7 +603,7 @@ static ctl_table ip_ct_net_table[] = { ...@@ -603,7 +603,7 @@ static ctl_table ip_ct_net_table[] = {
{ {
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = ip_ct_ipv4_table, .child = ip_ct_ipv4_table,
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
...@@ -638,7 +638,7 @@ static int __init ip_conntrack_proto_sctp_init(void) ...@@ -638,7 +638,7 @@ static int __init ip_conntrack_proto_sctp_init(void)
ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp);
#endif #endif
out: out:
DEBUGP("SCTP conntrack module loading %s\n", DEBUGP("SCTP conntrack module loading %s\n",
ret ? "failed": "succeeded"); ret ? "failed": "succeeded");
return ret; return ret;
} }
...@@ -647,7 +647,7 @@ static void __exit ip_conntrack_proto_sctp_fini(void) ...@@ -647,7 +647,7 @@ static void __exit ip_conntrack_proto_sctp_fini(void)
{ {
ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp); ip_conntrack_protocol_unregister(&ip_conntrack_protocol_sctp);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
unregister_sysctl_table(ip_ct_sysctl_header); unregister_sysctl_table(ip_ct_sysctl_header);
#endif #endif
DEBUGP("SCTP conntrack module unloaded\n"); DEBUGP("SCTP conntrack module unloaded\n");
} }
......
...@@ -70,7 +70,7 @@ static int udp_packet(struct ip_conntrack *conntrack, ...@@ -70,7 +70,7 @@ static int udp_packet(struct ip_conntrack *conntrack,
/* If we've seen traffic both ways, this is some kind of UDP /* If we've seen traffic both ways, this is some kind of UDP
stream. Extend timeout. */ stream. Extend timeout. */
if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) {
ip_ct_refresh_acct(conntrack, ctinfo, skb, ip_ct_refresh_acct(conntrack, ctinfo, skb,
ip_ct_udp_timeout_stream); ip_ct_udp_timeout_stream);
/* Also, more likely to be important, and not a probe */ /* Also, more likely to be important, and not a probe */
if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status)) if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status))
...@@ -102,7 +102,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, ...@@ -102,7 +102,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
"ip_ct_udp: short packet "); "ip_ct_udp: short packet ");
return -NF_ACCEPT; return -NF_ACCEPT;
} }
/* Truncated/malformed packets */ /* Truncated/malformed packets */
if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) { if (ntohs(hdr->len) > udplen || ntohs(hdr->len) < sizeof(*hdr)) {
if (LOG_INVALID(IPPROTO_UDP)) if (LOG_INVALID(IPPROTO_UDP))
...@@ -110,7 +110,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, ...@@ -110,7 +110,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
"ip_ct_udp: truncated/malformed packet "); "ip_ct_udp: truncated/malformed packet ");
return -NF_ACCEPT; return -NF_ACCEPT;
} }
/* Packet with no checksum */ /* Packet with no checksum */
if (!hdr->check) if (!hdr->check)
return NF_ACCEPT; return NF_ACCEPT;
...@@ -126,7 +126,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo, ...@@ -126,7 +126,7 @@ static int udp_error(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
"ip_ct_udp: bad UDP checksum "); "ip_ct_udp: bad UDP checksum ");
return -NF_ACCEPT; return -NF_ACCEPT;
} }
return NF_ACCEPT; return NF_ACCEPT;
} }
......
...@@ -321,7 +321,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen, ...@@ -321,7 +321,7 @@ int ct_sip_get_info(const char *dptr, size_t dlen,
continue; continue;
} }
aux = ct_sip_search(hnfo->ln_str, dptr, hnfo->ln_strlen, aux = ct_sip_search(hnfo->ln_str, dptr, hnfo->ln_strlen,
ct_sip_lnlen(dptr, limit), ct_sip_lnlen(dptr, limit),
hnfo->case_sensitive); hnfo->case_sensitive);
if (!aux) { if (!aux) {
DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str, DEBUGP("'%s' not found in '%s'.\n", hnfo->ln_str,
...@@ -406,7 +406,7 @@ static int sip_help(struct sk_buff **pskb, ...@@ -406,7 +406,7 @@ static int sip_help(struct sk_buff **pskb,
if (dataoff >= (*pskb)->len) { if (dataoff >= (*pskb)->len) {
DEBUGP("skb->len = %u\n", (*pskb)->len); DEBUGP("skb->len = %u\n", (*pskb)->len);
return NF_ACCEPT; return NF_ACCEPT;
} }
ip_ct_refresh(ct, *pskb, sip_timeout * HZ); ip_ct_refresh(ct, *pskb, sip_timeout * HZ);
...@@ -439,16 +439,16 @@ static int sip_help(struct sk_buff **pskb, ...@@ -439,16 +439,16 @@ static int sip_help(struct sk_buff **pskb,
} }
/* Get ip and port address from SDP packet. */ /* Get ip and port address from SDP packet. */
if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen, if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
POS_CONNECTION) > 0) { POS_CONNECTION) > 0) {
/* We'll drop only if there are parse problems. */ /* We'll drop only if there are parse problems. */
if (parse_ipaddr(dptr + matchoff, NULL, &ipaddr, if (parse_ipaddr(dptr + matchoff, NULL, &ipaddr,
dptr + datalen) < 0) { dptr + datalen) < 0) {
ret = NF_DROP; ret = NF_DROP;
goto out; goto out;
} }
if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen, if (ct_sip_get_info(dptr, datalen, &matchoff, &matchlen,
POS_MEDIA) > 0) { POS_MEDIA) > 0) {
port = simple_strtoul(dptr + matchoff, NULL, 10); port = simple_strtoul(dptr + matchoff, NULL, 10);
if (port < 1024) { if (port < 1024) {
......
...@@ -46,7 +46,7 @@ DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat); ...@@ -46,7 +46,7 @@ DECLARE_PER_CPU(struct ip_conntrack_stat, ip_conntrack_stat);
static int kill_proto(struct ip_conntrack *i, void *data) static int kill_proto(struct ip_conntrack *i, void *data)
{ {
return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == return (i->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum ==
*((u_int8_t *) data)); *((u_int8_t *) data));
} }
...@@ -124,12 +124,12 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) ...@@ -124,12 +124,12 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
(*pos)++; (*pos)++;
return ct_get_next(s, v); return ct_get_next(s, v);
} }
static void ct_seq_stop(struct seq_file *s, void *v) static void ct_seq_stop(struct seq_file *s, void *v)
{ {
read_unlock_bh(&ip_conntrack_lock); read_unlock_bh(&ip_conntrack_lock);
} }
static int ct_seq_show(struct seq_file *s, void *v) static int ct_seq_show(struct seq_file *s, void *v)
{ {
const struct ip_conntrack_tuple_hash *hash = v; const struct ip_conntrack_tuple_hash *hash = v;
...@@ -155,12 +155,12 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -155,12 +155,12 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (proto->print_conntrack(s, conntrack)) if (proto->print_conntrack(s, conntrack))
return -ENOSPC; return -ENOSPC;
if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple, if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
proto)) proto))
return -ENOSPC; return -ENOSPC;
if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL])) if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL]))
return -ENOSPC; return -ENOSPC;
if (!(test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status))) if (!(test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)))
...@@ -171,7 +171,7 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -171,7 +171,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
proto)) proto))
return -ENOSPC; return -ENOSPC;
if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY])) if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY]))
return -ENOSPC; return -ENOSPC;
if (test_bit(IPS_ASSURED_BIT, &conntrack->status)) if (test_bit(IPS_ASSURED_BIT, &conntrack->status))
...@@ -200,7 +200,7 @@ static struct seq_operations ct_seq_ops = { ...@@ -200,7 +200,7 @@ static struct seq_operations ct_seq_ops = {
.stop = ct_seq_stop, .stop = ct_seq_stop,
.show = ct_seq_show .show = ct_seq_show
}; };
static int ct_open(struct inode *inode, struct file *file) static int ct_open(struct inode *inode, struct file *file)
{ {
struct seq_file *seq; struct seq_file *seq;
...@@ -229,7 +229,7 @@ static struct file_operations ct_file_ops = { ...@@ -229,7 +229,7 @@ static struct file_operations ct_file_ops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = seq_release_private, .release = seq_release_private,
}; };
/* expects */ /* expects */
static void *exp_seq_start(struct seq_file *s, loff_t *pos) static void *exp_seq_start(struct seq_file *s, loff_t *pos)
{ {
...@@ -253,7 +253,7 @@ static void *exp_seq_start(struct seq_file *s, loff_t *pos) ...@@ -253,7 +253,7 @@ static void *exp_seq_start(struct seq_file *s, loff_t *pos)
static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos) static void *exp_seq_next(struct seq_file *s, void *v, loff_t *pos)
{ {
struct list_head *e = v; struct list_head *e = v;
++*pos; ++*pos;
e = e->next; e = e->next;
...@@ -297,7 +297,7 @@ static int exp_open(struct inode *inode, struct file *file) ...@@ -297,7 +297,7 @@ static int exp_open(struct inode *inode, struct file *file)
{ {
return seq_open(file, &exp_seq_ops); return seq_open(file, &exp_seq_ops);
} }
static struct file_operations exp_file_ops = { static struct file_operations exp_file_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = exp_open, .open = exp_open,
...@@ -426,14 +426,14 @@ static unsigned int ip_conntrack_help(unsigned int hooknum, ...@@ -426,14 +426,14 @@ static unsigned int ip_conntrack_help(unsigned int hooknum,
} }
static unsigned int ip_conntrack_defrag(unsigned int hooknum, static unsigned int ip_conntrack_defrag(unsigned int hooknum,
struct sk_buff **pskb, struct sk_buff **pskb,
const struct net_device *in, const struct net_device *in,
const struct net_device *out, const struct net_device *out,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
#if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE) #if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE)
/* Previously seen (loopback)? Ignore. Do this before /* Previously seen (loopback)? Ignore. Do this before
fragment check. */ fragment check. */
if ((*pskb)->nfct) if ((*pskb)->nfct)
return NF_ACCEPT; return NF_ACCEPT;
#endif #endif
...@@ -441,7 +441,7 @@ static unsigned int ip_conntrack_defrag(unsigned int hooknum, ...@@ -441,7 +441,7 @@ static unsigned int ip_conntrack_defrag(unsigned int hooknum,
/* Gather fragments. */ /* Gather fragments. */
if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
*pskb = ip_ct_gather_frags(*pskb, *pskb = ip_ct_gather_frags(*pskb,
hooknum == NF_IP_PRE_ROUTING ? hooknum == NF_IP_PRE_ROUTING ?
IP_DEFRAG_CONNTRACK_IN : IP_DEFRAG_CONNTRACK_IN :
IP_DEFRAG_CONNTRACK_OUT); IP_DEFRAG_CONNTRACK_OUT);
if (!*pskb) if (!*pskb)
...@@ -776,7 +776,7 @@ static ctl_table ip_ct_net_table[] = { ...@@ -776,7 +776,7 @@ static ctl_table ip_ct_net_table[] = {
{ {
.ctl_name = CTL_NET, .ctl_name = CTL_NET,
.procname = "net", .procname = "net",
.mode = 0555, .mode = 0555,
.child = ip_ct_ipv4_table, .child = ip_ct_ipv4_table,
}, },
{ .ctl_name = 0 } { .ctl_name = 0 }
......
...@@ -33,7 +33,7 @@ MODULE_PARM_DESC(ports, "port numbers of tftp servers"); ...@@ -33,7 +33,7 @@ MODULE_PARM_DESC(ports, "port numbers of tftp servers");
#if 0 #if 0
#define DEBUGP(format, args...) printk("%s:%s:" format, \ #define DEBUGP(format, args...) printk("%s:%s:" format, \
__FILE__, __FUNCTION__ , ## args) __FILE__, __FUNCTION__ , ## args)
#else #else
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
...@@ -113,7 +113,7 @@ static void ip_conntrack_tftp_fini(void) ...@@ -113,7 +113,7 @@ static void ip_conntrack_tftp_fini(void)
DEBUGP("unregistering helper for port %d\n", DEBUGP("unregistering helper for port %d\n",
ports[i]); ports[i]);
ip_conntrack_helper_unregister(&tftp[i]); ip_conntrack_helper_unregister(&tftp[i]);
} }
} }
static int __init ip_conntrack_tftp_init(void) static int __init ip_conntrack_tftp_init(void)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -88,8 +88,8 @@ static unsigned int help(struct sk_buff **pskb, ...@@ -88,8 +88,8 @@ static unsigned int help(struct sk_buff **pskb,
DEBUGP("ip_nat_irc: Inserting '%s' == %u.%u.%u.%u, port %u\n", DEBUGP("ip_nat_irc: Inserting '%s' == %u.%u.%u.%u, port %u\n",
buffer, NIPQUAD(exp->tuple.src.ip), port); buffer, NIPQUAD(exp->tuple.src.ip), port);
ret = ip_nat_mangle_tcp_packet(pskb, exp->master, ctinfo, ret = ip_nat_mangle_tcp_packet(pskb, exp->master, ctinfo,
matchoff, matchlen, buffer, matchoff, matchlen, buffer,
strlen(buffer)); strlen(buffer));
if (ret != NF_ACCEPT) if (ret != NF_ACCEPT)
ip_conntrack_unexpect_related(exp); ip_conntrack_unexpect_related(exp);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册