提交 852ad5e6 编写于 作者: D David S. Miller

Merge branch 'bridge_cleanups'

Tan Xiaojun says:

====================
bridge: cleanup and fix checkpatch errors

Clean up and fix some checkpatch errors in bridge driver.
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Acked-by: NStephen Hemminger <stephen@networkplumber.org>
...@@ -570,8 +570,7 @@ static void fdb_notify(struct net_bridge *br, ...@@ -570,8 +570,7 @@ static void fdb_notify(struct net_bridge *br,
rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
return; return;
errout: errout:
if (err < 0) rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
} }
/* Dump information about entries, in response to GETNEIGH */ /* Dump information about entries, in response to GETNEIGH */
......
...@@ -30,9 +30,9 @@ static int deliver_clone(const struct net_bridge_port *prev, ...@@ -30,9 +30,9 @@ static int deliver_clone(const struct net_bridge_port *prev,
static inline int should_deliver(const struct net_bridge_port *p, static inline int should_deliver(const struct net_bridge_port *p,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
return (((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) && return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
br_allowed_egress(p->br, nbp_get_vlan_info(p), skb) && br_allowed_egress(p->br, nbp_get_vlan_info(p), skb) &&
p->state == BR_STATE_FORWARDING); p->state == BR_STATE_FORWARDING;
} }
static inline unsigned int packet_length(const struct sk_buff *skb) static inline unsigned int packet_length(const struct sk_buff *skb)
......
...@@ -381,7 +381,7 @@ int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -381,7 +381,7 @@ int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct net_bridge *br = netdev_priv(dev); struct net_bridge *br = netdev_priv(dev);
switch(cmd) { switch (cmd) {
case SIOCDEVPRIVATE: case SIOCDEVPRIVATE:
return old_dev_ioctl(dev, rq, cmd); return old_dev_ioctl(dev, rq, cmd);
......
...@@ -1001,7 +1001,7 @@ static struct nf_hook_ops br_nf_ops[] __read_mostly = { ...@@ -1001,7 +1001,7 @@ static struct nf_hook_ops br_nf_ops[] __read_mostly = {
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
static static
int brnf_sysctl_call_tables(struct ctl_table *ctl, int write, int brnf_sysctl_call_tables(struct ctl_table *ctl, int write,
void __user * buffer, size_t * lenp, loff_t * ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
int ret; int ret;
......
...@@ -195,8 +195,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port) ...@@ -195,8 +195,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
return; return;
errout: errout:
if (err < 0) rtnl_set_sk_err(net, RTNLGRP_LINK, err);
rtnl_set_sk_err(net, RTNLGRP_LINK, err);
} }
......
...@@ -721,7 +721,7 @@ void br_netfilter_fini(void); ...@@ -721,7 +721,7 @@ void br_netfilter_fini(void);
void br_netfilter_rtable_init(struct net_bridge *); void br_netfilter_rtable_init(struct net_bridge *);
#else #else
#define br_netfilter_init() (0) #define br_netfilter_init() (0)
#define br_netfilter_fini() do { } while(0) #define br_netfilter_fini() do { } while (0)
#define br_netfilter_rtable_init(x) #define br_netfilter_rtable_init(x)
#endif #endif
......
...@@ -110,7 +110,7 @@ static void br_tcn_timer_expired(unsigned long arg) ...@@ -110,7 +110,7 @@ static void br_tcn_timer_expired(unsigned long arg)
if (!br_is_root_bridge(br) && (br->dev->flags & IFF_UP)) { if (!br_is_root_bridge(br) && (br->dev->flags & IFF_UP)) {
br_transmit_tcn(br); br_transmit_tcn(br);
mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time); mod_timer(&br->tcn_timer, jiffies + br->bridge_hello_time);
} }
spin_unlock(&br->lock); spin_unlock(&br->lock);
} }
......
...@@ -26,7 +26,7 @@ struct brport_attribute { ...@@ -26,7 +26,7 @@ struct brport_attribute {
int (*store)(struct net_bridge_port *, unsigned long); int (*store)(struct net_bridge_port *, unsigned long);
}; };
#define BRPORT_ATTR(_name,_mode,_show,_store) \ #define BRPORT_ATTR(_name, _mode, _show, _store) \
const struct brport_attribute brport_attr_##_name = { \ const struct brport_attribute brport_attr_##_name = { \
.attr = {.name = __stringify(_name), \ .attr = {.name = __stringify(_name), \
.mode = _mode }, \ .mode = _mode }, \
...@@ -209,21 +209,21 @@ static const struct brport_attribute *brport_attrs[] = { ...@@ -209,21 +209,21 @@ static const struct brport_attribute *brport_attrs[] = {
#define to_brport_attr(_at) container_of(_at, struct brport_attribute, attr) #define to_brport_attr(_at) container_of(_at, struct brport_attribute, attr)
#define to_brport(obj) container_of(obj, struct net_bridge_port, kobj) #define to_brport(obj) container_of(obj, struct net_bridge_port, kobj)
static ssize_t brport_show(struct kobject * kobj, static ssize_t brport_show(struct kobject *kobj,
struct attribute * attr, char * buf) struct attribute *attr, char *buf)
{ {
struct brport_attribute * brport_attr = to_brport_attr(attr); struct brport_attribute *brport_attr = to_brport_attr(attr);
struct net_bridge_port * p = to_brport(kobj); struct net_bridge_port *p = to_brport(kobj);
return brport_attr->show(p, buf); return brport_attr->show(p, buf);
} }
static ssize_t brport_store(struct kobject * kobj, static ssize_t brport_store(struct kobject *kobj,
struct attribute * attr, struct attribute *attr,
const char * buf, size_t count) const char *buf, size_t count)
{ {
struct brport_attribute * brport_attr = to_brport_attr(attr); struct brport_attribute *brport_attr = to_brport_attr(attr);
struct net_bridge_port * p = to_brport(kobj); struct net_bridge_port *p = to_brport(kobj);
ssize_t ret = -EINVAL; ssize_t ret = -EINVAL;
char *endp; char *endp;
unsigned long val; unsigned long val;
......
...@@ -96,7 +96,7 @@ ebt_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum, ...@@ -96,7 +96,7 @@ ebt_log_packet(struct net *net, u_int8_t pf, unsigned int hooknum,
bitmask = NF_LOG_MASK; bitmask = NF_LOG_MASK;
if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto == if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto ==
htons(ETH_P_IP)){ htons(ETH_P_IP)) {
const struct iphdr *ih; const struct iphdr *ih;
struct iphdr _iph; struct iphdr _iph;
......
...@@ -35,7 +35,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par) ...@@ -35,7 +35,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
return EBT_DROP; return EBT_DROP;
if (ap->ar_hln != ETH_ALEN) if (ap->ar_hln != ETH_ALEN)
goto out; goto out;
if (skb_store_bits(skb, sizeof(_ah), info->mac,ETH_ALEN)) if (skb_store_bits(skb, sizeof(_ah), info->mac, ETH_ALEN))
return EBT_DROP; return EBT_DROP;
} }
out: out:
......
...@@ -23,8 +23,7 @@ static struct ebt_entries initial_chain = { ...@@ -23,8 +23,7 @@ static struct ebt_entries initial_chain = {
.policy = EBT_ACCEPT, .policy = EBT_ACCEPT,
}; };
static struct ebt_replace_kernel initial_table = static struct ebt_replace_kernel initial_table = {
{
.name = "broute", .name = "broute",
.valid_hooks = 1 << NF_BR_BROUTING, .valid_hooks = 1 << NF_BR_BROUTING,
.entries_size = sizeof(struct ebt_entries), .entries_size = sizeof(struct ebt_entries),
...@@ -41,8 +40,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) ...@@ -41,8 +40,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
return 0; return 0;
} }
static const struct ebt_table broute_table = static const struct ebt_table broute_table = {
{
.name = "broute", .name = "broute",
.table = &initial_table, .table = &initial_table,
.valid_hooks = 1 << NF_BR_BROUTING, .valid_hooks = 1 << NF_BR_BROUTING,
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
#define FILTER_VALID_HOOKS ((1 << NF_BR_LOCAL_IN) | (1 << NF_BR_FORWARD) | \ #define FILTER_VALID_HOOKS ((1 << NF_BR_LOCAL_IN) | (1 << NF_BR_FORWARD) | \
(1 << NF_BR_LOCAL_OUT)) (1 << NF_BR_LOCAL_OUT))
static struct ebt_entries initial_chains[] = static struct ebt_entries initial_chains[] = {
{
{ {
.name = "INPUT", .name = "INPUT",
.policy = EBT_ACCEPT, .policy = EBT_ACCEPT,
...@@ -30,8 +29,7 @@ static struct ebt_entries initial_chains[] = ...@@ -30,8 +29,7 @@ static struct ebt_entries initial_chains[] =
}, },
}; };
static struct ebt_replace_kernel initial_table = static struct ebt_replace_kernel initial_table = {
{
.name = "filter", .name = "filter",
.valid_hooks = FILTER_VALID_HOOKS, .valid_hooks = FILTER_VALID_HOOKS,
.entries_size = 3 * sizeof(struct ebt_entries), .entries_size = 3 * sizeof(struct ebt_entries),
...@@ -50,8 +48,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) ...@@ -50,8 +48,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
return 0; return 0;
} }
static const struct ebt_table frame_filter = static const struct ebt_table frame_filter = {
{
.name = "filter", .name = "filter",
.table = &initial_table, .table = &initial_table,
.valid_hooks = FILTER_VALID_HOOKS, .valid_hooks = FILTER_VALID_HOOKS,
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
#define NAT_VALID_HOOKS ((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT) | \ #define NAT_VALID_HOOKS ((1 << NF_BR_PRE_ROUTING) | (1 << NF_BR_LOCAL_OUT) | \
(1 << NF_BR_POST_ROUTING)) (1 << NF_BR_POST_ROUTING))
static struct ebt_entries initial_chains[] = static struct ebt_entries initial_chains[] = {
{
{ {
.name = "PREROUTING", .name = "PREROUTING",
.policy = EBT_ACCEPT, .policy = EBT_ACCEPT,
...@@ -30,8 +29,7 @@ static struct ebt_entries initial_chains[] = ...@@ -30,8 +29,7 @@ static struct ebt_entries initial_chains[] =
} }
}; };
static struct ebt_replace_kernel initial_table = static struct ebt_replace_kernel initial_table = {
{
.name = "nat", .name = "nat",
.valid_hooks = NAT_VALID_HOOKS, .valid_hooks = NAT_VALID_HOOKS,
.entries_size = 3 * sizeof(struct ebt_entries), .entries_size = 3 * sizeof(struct ebt_entries),
...@@ -50,8 +48,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks) ...@@ -50,8 +48,7 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
return 0; return 0;
} }
static struct ebt_table frame_nat = static struct ebt_table frame_nat = {
{
.name = "nat", .name = "nat",
.table = &initial_table, .table = &initial_table,
.valid_hooks = NAT_VALID_HOOKS, .valid_hooks = NAT_VALID_HOOKS,
......
...@@ -118,10 +118,10 @@ ebt_dev_check(const char *entry, const struct net_device *device) ...@@ -118,10 +118,10 @@ ebt_dev_check(const char *entry, const struct net_device *device)
/* 1 is the wildcard token */ /* 1 is the wildcard token */
while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i]) while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i])
i++; i++;
return (devname[i] != entry[i] && entry[i] != 1); return devname[i] != entry[i] && entry[i] != 1;
} }
#define FWINV2(bool,invflg) ((bool) ^ !!(e->invflags & invflg)) #define FWINV2(bool, invflg) ((bool) ^ !!(e->invflags & invflg))
/* process standard matches */ /* process standard matches */
static inline int static inline int
ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb, ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb,
...@@ -1441,7 +1441,7 @@ static int copy_everything_to_user(struct ebt_table *t, void __user *user, ...@@ -1441,7 +1441,7 @@ static int copy_everything_to_user(struct ebt_table *t, void __user *user,
return -EFAULT; return -EFAULT;
if (*len != sizeof(struct ebt_replace) + entries_size + if (*len != sizeof(struct ebt_replace) + entries_size +
(tmp.num_counters? nentries * sizeof(struct ebt_counter): 0)) (tmp.num_counters ? nentries * sizeof(struct ebt_counter) : 0))
return -EINVAL; return -EINVAL;
if (tmp.nentries != nentries) { if (tmp.nentries != nentries) {
...@@ -1477,7 +1477,7 @@ static int do_ebt_set_ctl(struct sock *sk, ...@@ -1477,7 +1477,7 @@ static int do_ebt_set_ctl(struct sock *sk,
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM; return -EPERM;
switch(cmd) { switch (cmd) {
case EBT_SO_SET_ENTRIES: case EBT_SO_SET_ENTRIES:
ret = do_replace(net, user, len); ret = do_replace(net, user, len);
break; break;
...@@ -1507,10 +1507,10 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ...@@ -1507,10 +1507,10 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
if (!t) if (!t)
return ret; return ret;
switch(cmd) { switch (cmd) {
case EBT_SO_GET_INFO: case EBT_SO_GET_INFO:
case EBT_SO_GET_INIT_INFO: case EBT_SO_GET_INIT_INFO:
if (*len != sizeof(struct ebt_replace)){ if (*len != sizeof(struct ebt_replace)) {
ret = -EINVAL; ret = -EINVAL;
mutex_unlock(&ebt_mutex); mutex_unlock(&ebt_mutex);
break; break;
...@@ -1525,7 +1525,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ...@@ -1525,7 +1525,7 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
tmp.valid_hooks = t->table->valid_hooks; tmp.valid_hooks = t->table->valid_hooks;
} }
mutex_unlock(&ebt_mutex); mutex_unlock(&ebt_mutex);
if (copy_to_user(user, &tmp, *len) != 0){ if (copy_to_user(user, &tmp, *len) != 0) {
BUGPRINT("c2u Didn't work\n"); BUGPRINT("c2u Didn't work\n");
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -2375,8 +2375,7 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd, ...@@ -2375,8 +2375,7 @@ static int compat_do_ebt_get_ctl(struct sock *sk, int cmd,
} }
#endif #endif
static struct nf_sockopt_ops ebt_sockopts = static struct nf_sockopt_ops ebt_sockopts = {
{
.pf = PF_INET, .pf = PF_INET,
.set_optmin = EBT_BASE_CTL, .set_optmin = EBT_BASE_CTL,
.set_optmax = EBT_SO_SET_MAX + 1, .set_optmax = EBT_SO_SET_MAX + 1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册