Commit 343d8c60 authored by Miaohe Lin's avatar Miaohe Lin Committed by David S. Miller

net: clean up codestyle for net/ipv4

This is a pure codestyle cleanup patch. Also add a blank line after
declarations as warned by checkpatch.pl.
Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdf1923b
...@@ -47,32 +47,32 @@ void ip_options_build(struct sk_buff *skb, struct ip_options *opt, ...@@ -47,32 +47,32 @@ void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
unsigned char *iph = skb_network_header(skb); unsigned char *iph = skb_network_header(skb);
memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options)); memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options));
memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen); memcpy(iph + sizeof(struct iphdr), opt->__data, opt->optlen);
opt = &(IPCB(skb)->opt); opt = &(IPCB(skb)->opt);
if (opt->srr) if (opt->srr)
memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4); memcpy(iph + opt->srr + iph[opt->srr + 1] - 4, &daddr, 4);
if (!is_frag) { if (!is_frag) {
if (opt->rr_needaddr) if (opt->rr_needaddr)
ip_rt_get_source(iph+opt->rr+iph[opt->rr+2]-5, skb, rt); ip_rt_get_source(iph + opt->rr + iph[opt->rr + 2] - 5, skb, rt);
if (opt->ts_needaddr) if (opt->ts_needaddr)
ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt); ip_rt_get_source(iph + opt->ts + iph[opt->ts + 2] - 9, skb, rt);
if (opt->ts_needtime) { if (opt->ts_needtime) {
__be32 midtime; __be32 midtime;
midtime = inet_current_timestamp(); midtime = inet_current_timestamp();
memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4); memcpy(iph + opt->ts + iph[opt->ts + 2] - 5, &midtime, 4);
} }
return; return;
} }
if (opt->rr) { if (opt->rr) {
memset(iph+opt->rr, IPOPT_NOP, iph[opt->rr+1]); memset(iph + opt->rr, IPOPT_NOP, iph[opt->rr + 1]);
opt->rr = 0; opt->rr = 0;
opt->rr_needaddr = 0; opt->rr_needaddr = 0;
} }
if (opt->ts) { if (opt->ts) {
memset(iph+opt->ts, IPOPT_NOP, iph[opt->ts+1]); memset(iph + opt->ts, IPOPT_NOP, iph[opt->ts + 1]);
opt->ts = 0; opt->ts = 0;
opt->ts_needaddr = opt->ts_needtime = 0; opt->ts_needaddr = opt->ts_needtime = 0;
} }
...@@ -495,26 +495,29 @@ EXPORT_SYMBOL(ip_options_compile); ...@@ -495,26 +495,29 @@ EXPORT_SYMBOL(ip_options_compile);
void ip_options_undo(struct ip_options *opt) void ip_options_undo(struct ip_options *opt)
{ {
if (opt->srr) { if (opt->srr) {
unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr); unsigned char *optptr = opt->__data + opt->srr - sizeof(struct iphdr);
memmove(optptr+7, optptr+3, optptr[1]-7);
memcpy(optptr+3, &opt->faddr, 4); memmove(optptr + 7, optptr + 3, optptr[1] - 7);
memcpy(optptr + 3, &opt->faddr, 4);
} }
if (opt->rr_needaddr) { if (opt->rr_needaddr) {
unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr); unsigned char *optptr = opt->__data + opt->rr - sizeof(struct iphdr);
optptr[2] -= 4; optptr[2] -= 4;
memset(&optptr[optptr[2]-1], 0, 4); memset(&optptr[optptr[2] - 1], 0, 4);
} }
if (opt->ts) { if (opt->ts) {
unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr); unsigned char *optptr = opt->__data + opt->ts - sizeof(struct iphdr);
if (opt->ts_needtime) { if (opt->ts_needtime) {
optptr[2] -= 4; optptr[2] -= 4;
memset(&optptr[optptr[2]-1], 0, 4); memset(&optptr[optptr[2] - 1], 0, 4);
if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC) if ((optptr[3] & 0xF) == IPOPT_TS_PRESPEC)
optptr[2] -= 4; optptr[2] -= 4;
} }
if (opt->ts_needaddr) { if (opt->ts_needaddr) {
optptr[2] -= 4; optptr[2] -= 4;
memset(&optptr[optptr[2]-1], 0, 4); memset(&optptr[optptr[2] - 1], 0, 4);
} }
} }
} }
......
...@@ -1351,7 +1351,7 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, ...@@ -1351,7 +1351,7 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
if (cork->flags & IPCORK_OPT) if (cork->flags & IPCORK_OPT)
opt = cork->opt; opt = cork->opt;
if (!(rt->dst.dev->features&NETIF_F_SG)) if (!(rt->dst.dev->features & NETIF_F_SG))
return -EOPNOTSUPP; return -EOPNOTSUPP;
hh_len = LL_RESERVED_SPACE(rt->dst.dev); hh_len = LL_RESERVED_SPACE(rt->dst.dev);
......
...@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(ipv4_update_pmtu); ...@@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(ipv4_update_pmtu);
static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
{ {
const struct iphdr *iph = (const struct iphdr *) skb->data; const struct iphdr *iph = (const struct iphdr *)skb->data;
struct flowi4 fl4; struct flowi4 fl4;
struct rtable *rt; struct rtable *rt;
...@@ -1127,7 +1127,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) ...@@ -1127,7 +1127,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
new = true; new = true;
} }
__ip_rt_update_pmtu((struct rtable *) xfrm_dst_path(&rt->dst), &fl4, mtu); __ip_rt_update_pmtu((struct rtable *)xfrm_dst_path(&rt->dst), &fl4, mtu);
if (!dst_check(&rt->dst, 0)) { if (!dst_check(&rt->dst, 0)) {
if (new) if (new)
...@@ -1168,7 +1168,7 @@ EXPORT_SYMBOL_GPL(ipv4_redirect); ...@@ -1168,7 +1168,7 @@ EXPORT_SYMBOL_GPL(ipv4_redirect);
void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk) void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk)
{ {
const struct iphdr *iph = (const struct iphdr *) skb->data; const struct iphdr *iph = (const struct iphdr *)skb->data;
struct flowi4 fl4; struct flowi4 fl4;
struct rtable *rt; struct rtable *rt;
struct net *net = sock_net(sk); struct net *net = sock_net(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment