diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2018-10-01 22:24:26 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2018-10-01 22:24:45 +0200 |
commit | 83428fac8fca8b72f1a9508e4928eb70d9332444 (patch) | |
tree | 1041f504b34291f808c758afaf734586c222d72e | |
parent | aeec2a0c6b6bc16a2e43de8f79ddee1bf3d1af40 (diff) |
iprule: coding style fixes
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r-- | iprule.c | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -68,7 +68,9 @@ const struct uci_blob_param_list rule_attr_list = { }; /* interface based rules are dynamic. */ -static bool rule_ready(struct iprule *rule) { +static bool +rule_ready(struct iprule *rule) +{ if (rule->flags & IPRULE_OUT && !rule->out_dev[0]) return false; @@ -109,10 +111,8 @@ iprule_parse_mark(const char *mark, struct iprule *rule) } /* called on interface changes of the incoming interface */ -static void rule_in_cb( - struct interface_user *dep, - struct interface *iface, - enum interface_event ev) +static void +rule_in_cb(struct interface_user *dep, struct interface *iface, enum interface_event ev) { struct iprule *rule = container_of(dep, struct iprule, in_iface_user); @@ -120,7 +120,8 @@ static void rule_in_cb( case IFEV_UP: if (!iface->l3_dev.dev) break; - memcpy(rule->in_dev, iface->l3_dev.dev->ifname, sizeof(rule->in_dev)); + + strcpy(rule->in_dev, iface->l3_dev.dev->ifname); if (rule_ready(rule)) system_add_iprule(rule); break; @@ -129,6 +130,7 @@ static void rule_in_cb( case IFEV_FREE: if (rule_ready(rule)) system_del_iprule(rule); + rule->in_dev[0] = 0; break; default: @@ -137,10 +139,8 @@ static void rule_in_cb( } /* called on interface changes of the outgoing interface */ -static void rule_out_cb( - struct interface_user *dep, - struct interface *iface, - enum interface_event ev) +static void +rule_out_cb(struct interface_user *dep, struct interface *iface, enum interface_event ev) { struct iprule *rule = container_of(dep, struct iprule, out_iface_user); @@ -148,7 +148,8 @@ static void rule_out_cb( case IFEV_UP: if (!iface->l3_dev.dev) break; - memcpy(rule->out_dev, iface->l3_dev.dev->ifname, sizeof(rule->out_dev)); + + strcpy(rule->out_dev, iface->l3_dev.dev->ifname); if (rule_ready(rule)) system_add_iprule(rule); break; @@ -157,6 +158,7 @@ static void rule_out_cb( case IFEV_FREE: if (rule_ready(rule)) system_del_iprule(rule); + rule->out_dev[0] = 0; break; default: @@ -165,10 +167,9 @@ static void rule_out_cb( } /* called on all interface events */ -static void generic_interface_cb( - struct interface_user *dep, - struct interface *iface, - enum interface_event ev) +static void +generic_interface_cb(struct interface_user *dep, + struct interface *iface, enum interface_event ev) { struct iprule *rule; |