Commit 1e57b71b authored by Antonin Décimo's avatar Antonin Décimo Committed by Juliusz Chroboczek

Reformat kernel_netlink.c.

parent a1043879
...@@ -651,13 +651,13 @@ get_old_if(const char *ifname) ...@@ -651,13 +651,13 @@ get_old_if(const char *ifname)
if(num_old_if >= MAX_INTERFACES) if(num_old_if >= MAX_INTERFACES)
return -1; return -1;
if(num_old_if >= max_old_if) { if(num_old_if >= max_old_if) {
int n = max_old_if == 0 ? 4 : 2 * max_old_if; int n = max_old_if == 0 ? 4 : 2 * max_old_if;
struct old_if *new = struct old_if *new =
realloc(old_if, n * sizeof(struct old_if)); realloc(old_if, n * sizeof(struct old_if));
if(new != NULL) { if(new != NULL) {
old_if = new; old_if = new;
max_old_if = n; max_old_if = n;
} }
} }
if(num_old_if >= max_old_if) if(num_old_if >= max_old_if)
return -1; return -1;
...@@ -690,11 +690,11 @@ kernel_setup_interface(int setup, const char *ifname, int ifindex) ...@@ -690,11 +690,11 @@ kernel_setup_interface(int setup, const char *ifname, int ifindex)
fprintf(stderr, fprintf(stderr,
"Warning: cannot save old configuration for %s.\n", "Warning: cannot save old configuration for %s.\n",
ifname); ifname);
if(old_if[i].rp_filter) { if(old_if[i].rp_filter) {
rc = write_proc(buf, 0); rc = write_proc(buf, 0);
if(rc < 0) if(rc < 0)
return -1; return -1;
} }
} else { } else {
if(i >= 0 && old_if[i].rp_filter > 0) if(i >= 0 && old_if[i].rp_filter > 0)
rc = write_proc(buf, old_if[i].rp_filter); rc = write_proc(buf, old_if[i].rp_filter);
...@@ -1085,17 +1085,17 @@ kernel_route(int operation, int table, ...@@ -1085,17 +1085,17 @@ kernel_route(int operation, int table,
rta->rta_type = RTA_OIF; rta->rta_type = RTA_OIF;
*(int*)RTA_DATA(rta) = ifindex; *(int*)RTA_DATA(rta) = ifindex;
#define ADD_IPARG(type, addr) \ #define ADD_IPARG(type, addr) \
do if(ipv4) { \ do if(ipv4) { \
rta = RTA_NEXT(rta, len); \ rta = RTA_NEXT(rta, len); \
rta->rta_len = RTA_LENGTH(sizeof(struct in_addr)); \ rta->rta_len = RTA_LENGTH(sizeof(struct in_addr)); \
rta->rta_type = type; \ rta->rta_type = type; \
memcpy(RTA_DATA(rta), addr + 12, sizeof(struct in_addr)); \ memcpy(RTA_DATA(rta), addr + 12, sizeof(struct in_addr)); \
} else { \ } else { \
rta = RTA_NEXT(rta, len); \ rta = RTA_NEXT(rta, len); \
rta->rta_len = RTA_LENGTH(sizeof(struct in6_addr)); \ rta->rta_len = RTA_LENGTH(sizeof(struct in6_addr)); \
rta->rta_type = type; \ rta->rta_type = type; \
memcpy(RTA_DATA(rta), addr, sizeof(struct in6_addr)); \ memcpy(RTA_DATA(rta), addr, sizeof(struct in6_addr)); \
} while (0) } while (0)
ADD_IPARG(RTA_GATEWAY, gate); ADD_IPARG(RTA_GATEWAY, gate);
...@@ -1203,10 +1203,10 @@ print_kernel_route(int add, int protocol, int type, ...@@ -1203,10 +1203,10 @@ print_kernel_route(int add, int protocol, int type,
} }
kdebugf("%s kernel route: dest: %s/%d gw: %s metric: %d if: %s " kdebugf("%s kernel route: dest: %s/%d gw: %s metric: %d if: %s "
"(proto: %d, type: %d)", "(proto: %d, type: %d)",
add == RTM_NEWROUTE ? "Add" : "Delete", add == RTM_NEWROUTE ? "Add" : "Delete",
addr_prefix, route->plen, addr_gw, route->metric, ifname, addr_prefix, route->plen, addr_gw, route->metric, ifname,
protocol, type); protocol, type);
} }
static int static int
......
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