-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 41923 b: refs/heads/master c: d62f9ed h: refs/heads/master i: 41921: 51dcd9b 41919: 0fe4f61 v: v3
- Loading branch information
Patrick McHardy
authored and
David S. Miller
committed
Dec 3, 2006
1 parent
d589847
commit ee85923
Showing
7 changed files
with
260 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: f8eb24a89afa12b48fa7e39775faea6d64b8e538 | ||
refs/heads/master: d62f9ed4a490309bd9e5df0b42ba5d096e7b5902 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/* nf_sysctl.c netfilter sysctl registration/unregistation | ||
* | ||
* Copyright (c) 2006 Patrick McHardy <kaber@trash.net> | ||
*/ | ||
#include <linux/module.h> | ||
#include <linux/sysctl.h> | ||
#include <linux/string.h> | ||
#include <linux/slab.h> | ||
|
||
static void | ||
path_free(struct ctl_table *path, struct ctl_table *table) | ||
{ | ||
struct ctl_table *t, *next; | ||
|
||
for (t = path; t != NULL && t != table; t = next) { | ||
next = t->child; | ||
kfree(t); | ||
} | ||
} | ||
|
||
static struct ctl_table * | ||
path_dup(struct ctl_table *path, struct ctl_table *table) | ||
{ | ||
struct ctl_table *t, *last = NULL, *tmp; | ||
|
||
for (t = path; t != NULL; t = t->child) { | ||
/* twice the size since path elements are terminated by an | ||
* empty element */ | ||
tmp = kmemdup(t, 2 * sizeof(*t), GFP_KERNEL); | ||
if (tmp == NULL) { | ||
if (last != NULL) | ||
path_free(path, table); | ||
return NULL; | ||
} | ||
|
||
if (last != NULL) | ||
last->child = tmp; | ||
else | ||
path = tmp; | ||
last = tmp; | ||
} | ||
|
||
if (last != NULL) | ||
last->child = table; | ||
else | ||
path = table; | ||
|
||
return path; | ||
} | ||
|
||
struct ctl_table_header * | ||
nf_register_sysctl_table(struct ctl_table *path, struct ctl_table *table) | ||
{ | ||
struct ctl_table_header *header; | ||
|
||
path = path_dup(path, table); | ||
if (path == NULL) | ||
return NULL; | ||
header = register_sysctl_table(path, 0); | ||
if (header == NULL) | ||
path_free(path, table); | ||
return header; | ||
} | ||
EXPORT_SYMBOL_GPL(nf_register_sysctl_table); | ||
|
||
void | ||
nf_unregister_sysctl_table(struct ctl_table_header *header, | ||
struct ctl_table *table) | ||
{ | ||
struct ctl_table *path = header->ctl_table; | ||
|
||
unregister_sysctl_table(header); | ||
path_free(path, table); | ||
} | ||
EXPORT_SYMBOL_GPL(nf_unregister_sysctl_table); | ||
|
||
/* net/netfilter */ | ||
static struct ctl_table nf_net_netfilter_table[] = { | ||
{ | ||
.ctl_name = NET_NETFILTER, | ||
.procname = "netfilter", | ||
.mode = 0555, | ||
}, | ||
{ | ||
.ctl_name = 0 | ||
} | ||
}; | ||
struct ctl_table nf_net_netfilter_sysctl_path[] = { | ||
{ | ||
.ctl_name = CTL_NET, | ||
.procname = "net", | ||
.mode = 0555, | ||
.child = nf_net_netfilter_table, | ||
}, | ||
{ | ||
.ctl_name = 0 | ||
} | ||
}; | ||
EXPORT_SYMBOL_GPL(nf_net_netfilter_sysctl_path); | ||
|
||
/* net/ipv4/netfilter */ | ||
static struct ctl_table nf_net_ipv4_netfilter_table[] = { | ||
{ | ||
.ctl_name = NET_IPV4_NETFILTER, | ||
.procname = "netfilter", | ||
.mode = 0555, | ||
}, | ||
{ | ||
.ctl_name = 0 | ||
} | ||
}; | ||
static struct ctl_table nf_net_ipv4_table[] = { | ||
{ | ||
.ctl_name = NET_IPV4, | ||
.procname = "ipv4", | ||
.mode = 0555, | ||
.child = nf_net_ipv4_netfilter_table, | ||
}, | ||
{ | ||
.ctl_name = 0 | ||
} | ||
}; | ||
struct ctl_table nf_net_ipv4_netfilter_sysctl_path[] = { | ||
{ | ||
.ctl_name = CTL_NET, | ||
.procname = "net", | ||
.mode = 0555, | ||
.child = nf_net_ipv4_table, | ||
}, | ||
{ | ||
.ctl_name = 0 | ||
} | ||
}; | ||
EXPORT_SYMBOL_GPL(nf_net_ipv4_netfilter_sysctl_path); |