patch-2.1.99 linux/net/core/rtnetlink.c

Next file: linux/net/core/sock.c
Previous file: linux/net/core/dev.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.98/linux/net/core/rtnetlink.c linux/net/core/rtnetlink.c
@@ -63,6 +63,19 @@
 	rtnl_shunlock();
 }
 
+int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
+{
+	memset(tb, 0, sizeof(struct rtattr*)*maxattr);
+
+	while (RTA_OK(rta, len)) {
+		unsigned flavor = rta->rta_type;
+		if (flavor && flavor <= maxattr)
+			tb[flavor-1] = rta;
+		rta = RTA_NEXT(rta, len);
+	}
+	return 0;
+}
+
 #ifdef CONFIG_RTNETLINK
 struct sock *rtnl;
 
@@ -109,6 +122,19 @@
 	memcpy(RTA_DATA(rta), data, attrlen);
 }
 
+int rtnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
+{
+	int err = 0;
+
+	NETLINK_CB(skb).dst_groups = group;
+	if (echo)
+		atomic_inc(&skb->users);
+	netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
+	if (echo)
+		err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
+	return err;
+}
+
 #ifdef CONFIG_RTNL_OLD_IFINFO
 static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct device *dev,
 				 int type, pid_t pid, u32 seq)
@@ -132,7 +158,7 @@
 	strncpy(r->ifi_name, dev->name, IFNAMSIZ-1);
 	r->ifi_qdiscname[0] = 0;
 	r->ifi_qdisc = dev->qdisc_sleeping->handle;
-	if (dev->qdisc_sleeping->ops)
+	if (dev->qdisc_sleeping)
 		strcpy(r->ifi_qdiscname, dev->qdisc_sleeping->ops->id);
 	if (dev->get_stats) {
 		struct net_device_stats *stats = dev->get_stats(dev);
@@ -175,7 +201,7 @@
 	}
 	if (dev->ifindex != dev->iflink)
 		RTA_PUT(skb, IFLA_LINK, sizeof(int), &dev->iflink);
-	if (dev->qdisc_sleeping->ops)
+	if (dev->qdisc_sleeping)
 		RTA_PUT(skb, IFLA_QDISC,
 			strlen(dev->qdisc_sleeping->ops->id) + 1,
 			dev->qdisc_sleeping->ops->id);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov