Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78155
b: refs/heads/master
c: b854272
h: refs/heads/master
i:
  78153: c63f755
  78151: 2b534da
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Jan 28, 2008
1 parent 6f1cb78 commit 10c7a67
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad5d20a63940fcfb40af76ba06148f36d5d0b433
refs/heads/master: b854272b3c732316676e9128f7b9e6f1e1ff88b0
9 changes: 9 additions & 0 deletions trunk/net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <net/rtnetlink.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include "br_private.h"

static inline size_t br_nlmsg_size(void)
Expand Down Expand Up @@ -107,9 +108,13 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
*/
static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
struct net_device *dev;
int idx;

if (net != &init_net)
return 0;

idx = 0;
for_each_netdev(&init_net, dev) {
/* not a bridge port */
Expand All @@ -135,12 +140,16 @@ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
*/
static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct ifinfomsg *ifm;
struct nlattr *protinfo;
struct net_device *dev;
struct net_bridge_port *p;
u8 new_state;

if (net != &init_net)
return -EINVAL;

if (nlmsg_len(nlh) < sizeof(*ifm))
return -EINVAL;

Expand Down
11 changes: 11 additions & 0 deletions trunk/net/core/fib_rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
struct nlattr *tb[FRA_MAX+1];
int err = -EINVAL, unresolved = 0;

if (net != &init_net)
return -EINVAL;

if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh)))
goto errout;

Expand Down Expand Up @@ -358,12 +361,16 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)

static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct fib_rule_hdr *frh = nlmsg_data(nlh);
struct fib_rules_ops *ops = NULL;
struct fib_rule *rule, *tmp;
struct nlattr *tb[FRA_MAX+1];
int err = -EINVAL;

if (net != &init_net)
return -EINVAL;

if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh)))
goto errout;

Expand Down Expand Up @@ -539,9 +546,13 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,

static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
struct fib_rules_ops *ops;
int idx = 0, family;

if (net != &init_net)
return -EINVAL;

family = rtnl_msg_family(cb->nlh);
if (family != AF_UNSPEC) {
/* Protocol specific dump request */
Expand Down
18 changes: 18 additions & 0 deletions trunk/net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,9 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct net_device *dev = NULL;
int err = -EINVAL;

if (net != &init_net)
return -EINVAL;

if (nlmsg_len(nlh) < sizeof(*ndm))
goto out;

Expand Down Expand Up @@ -1515,6 +1518,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct net_device *dev = NULL;
int err;

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL);
if (err < 0)
goto out;
Expand Down Expand Up @@ -1789,11 +1795,15 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {

static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct neigh_table *tbl;
struct ndtmsg *ndtmsg;
struct nlattr *tb[NDTA_MAX+1];
int err;

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ndtmsg), tb, NDTA_MAX,
nl_neightbl_policy);
if (err < 0)
Expand Down Expand Up @@ -1913,11 +1923,15 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)

static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
int family, tidx, nidx = 0;
int tbl_skip = cb->args[0];
int neigh_skip = cb->args[1];
struct neigh_table *tbl;

if (net != &init_net)
return 0;

family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family;

read_lock(&neigh_tbl_lock);
Expand Down Expand Up @@ -2042,9 +2056,13 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,

static int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
struct neigh_table *tbl;
int t, family, s_t;

if (net != &init_net)
return 0;

read_lock(&neigh_tbl_lock);
family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family;
s_t = cb->args[0];
Expand Down
19 changes: 19 additions & 0 deletions trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
int s_idx = cb->args[0];
struct net_device *dev;

if (net != &init_net)
return 0;

idx = 0;
for_each_netdev(net, dev) {
if (idx < s_idx)
Expand Down Expand Up @@ -905,6 +908,9 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct nlattr *tb[IFLA_MAX+1];
char ifname[IFNAMSIZ];

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
if (err < 0)
goto errout;
Expand Down Expand Up @@ -953,6 +959,9 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct nlattr *tb[IFLA_MAX+1];
int err;

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
if (err < 0)
return err;
Expand Down Expand Up @@ -1034,6 +1043,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct nlattr *linkinfo[IFLA_INFO_MAX+1];
int err;

if (net != &init_net)
return -EINVAL;

#ifdef CONFIG_KMOD
replay:
#endif
Expand Down Expand Up @@ -1160,6 +1172,9 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
struct sk_buff *nskb;
int err;

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
if (err < 0)
return err;
Expand Down Expand Up @@ -1195,9 +1210,13 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)

static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
int idx;
int s_idx = cb->family;

if (net != &init_net)
return 0;

if (s_idx == 0)
s_idx = 1;
for (idx=1; idx<NPROTO; idx++) {
Expand Down
14 changes: 13 additions & 1 deletion trunk/net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,15 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {

static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct nlattr *tb[IFA_MAX+1];
struct dn_dev *dn_db;
struct ifaddrmsg *ifm;
struct dn_ifaddr *ifa, **ifap;
int err;
int err = -EINVAL;

if (net != &init_net)
goto errout;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
if (err < 0)
Expand Down Expand Up @@ -681,13 +685,17 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)

static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct nlattr *tb[IFA_MAX+1];
struct net_device *dev;
struct dn_dev *dn_db;
struct ifaddrmsg *ifm;
struct dn_ifaddr *ifa;
int err;

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
if (err < 0)
return err;
Expand Down Expand Up @@ -793,11 +801,15 @@ static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)

static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
int idx, dn_idx = 0, skip_ndevs, skip_naddr;
struct net_device *dev;
struct dn_dev *dn_db;
struct dn_ifaddr *ifa;

if (net != &init_net)
return 0;

skip_ndevs = cb->args[0];
skip_naddr = cb->args[1];

Expand Down
8 changes: 8 additions & 0 deletions trunk/net/decnet/dn_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,14 @@ static int dn_fib_check_attr(struct rtmsg *r, struct rtattr **rta)

static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct dn_fib_table *tb;
struct rtattr **rta = arg;
struct rtmsg *r = NLMSG_DATA(nlh);

if (net != &init_net)
return -EINVAL;

if (dn_fib_check_attr(r, rta))
return -EINVAL;

Expand All @@ -522,10 +526,14 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *

static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct dn_fib_table *tb;
struct rtattr **rta = arg;
struct rtmsg *r = NLMSG_DATA(nlh);

if (net != &init_net)
return -EINVAL;

if (dn_fib_check_attr(r, rta))
return -EINVAL;

Expand Down
8 changes: 8 additions & 0 deletions trunk/net/decnet/dn_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
*/
static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = in_skb->sk->sk_net;
struct rtattr **rta = arg;
struct rtmsg *rtm = NLMSG_DATA(nlh);
struct dn_route *rt = NULL;
Expand All @@ -1519,6 +1520,9 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
struct sk_buff *skb;
struct flowi fl;

if (net != &init_net)
return -EINVAL;

memset(&fl, 0, sizeof(fl));
fl.proto = DNPROTO_NSP;

Expand Down Expand Up @@ -1596,10 +1600,14 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
*/
int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
struct dn_route *rt;
int h, s_h;
int idx, s_idx;

if (net != &init_net)
return 0;

if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
return -EINVAL;
if (!(((struct rtmsg *)NLMSG_DATA(cb->nlh))->rtm_flags&RTM_F_CLONED))
Expand Down
4 changes: 4 additions & 0 deletions trunk/net/decnet/dn_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,16 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,

int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
unsigned int h, s_h;
unsigned int e = 0, s_e;
struct dn_fib_table *tb;
struct hlist_node *node;
int dumped = 0;

if (net != &init_net)
return 0;

if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) &&
((struct rtmsg *)NLMSG_DATA(cb->nlh))->rtm_flags&RTM_F_CLONED)
return dn_cache_dump(skb, cb);
Expand Down
12 changes: 12 additions & 0 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,

static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct nlattr *tb[IFA_MAX+1];
struct in_device *in_dev;
struct ifaddrmsg *ifm;
Expand All @@ -449,6 +450,9 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg

ASSERT_RTNL();

if (net != &init_net)
return -EINVAL;

err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy);
if (err < 0)
goto errout;
Expand Down Expand Up @@ -560,10 +564,14 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)

static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct net *net = skb->sk->sk_net;
struct in_ifaddr *ifa;

ASSERT_RTNL();

if (net != &init_net)
return -EINVAL;

ifa = rtm_to_ifaddr(nlh);
if (IS_ERR(ifa))
return PTR_ERR(ifa);
Expand Down Expand Up @@ -1174,12 +1182,16 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,

static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = skb->sk->sk_net;
int idx, ip_idx;
struct net_device *dev;
struct in_device *in_dev;
struct in_ifaddr *ifa;
int s_ip_idx, s_idx = cb->args[0];

if (net != &init_net)
return 0;

s_ip_idx = ip_idx = cb->args[1];
idx = 0;
for_each_netdev(&init_net, dev) {
Expand Down
Loading

0 comments on commit 10c7a67

Please sign in to comment.