提交 901fb38d 编写于 作者: D David S. Miller

Merge branch 'ipmr-cleanups'

Nikolay Aleksandrov says:

====================
net: ipmr: cleanups and minor improvements

Since I'll have to work with ipmr, I decided to clean it up and do some
minor improvements. Functionally there're almost no changes except the
SLAB_PANIC removal. Most of the patches just re-design some functions to
be clearer and more concise and try to remove the ifdef web that was
inside. There's more information in each commit. This is the first set,
the end goal is to introduce complete netlink support and control over
the mfc and vif devices.
I've tried to test all of the setsockopt/getsockopt options, and also
made builds with various ipmr kconfig options turned on and off.

v2: change patch 7 to keep SLAB_PANIC and just drop the unnecessary null
check
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
...@@ -4,15 +4,13 @@ ...@@ -4,15 +4,13 @@
#include <linux/sockios.h> #include <linux/sockios.h>
#include <linux/types.h> #include <linux/types.h>
/* /* Based on the MROUTING 3.5 defines primarily to keep
* Based on the MROUTING 3.5 defines primarily to keep * source compatibility with BSD.
* source compatibility with BSD.
* *
* See the mrouted code for the original history. * See the mrouted code for the original history.
*
* Protocol Independent Multicast (PIM) data structures included
* Carlos Picoto (cap@di.fc.ul.pt)
* *
* Protocol Independent Multicast (PIM) data structures included
* Carlos Picoto (cap@di.fc.ul.pt)
*/ */
#define MRT_BASE 200 #define MRT_BASE 200
...@@ -34,15 +32,13 @@ ...@@ -34,15 +32,13 @@
#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
#define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define SIOCGETRPF (SIOCPROTOPRIVATE+2)
#define MAXVIFS 32 #define MAXVIFS 32
typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */
typedef unsigned short vifi_t; typedef unsigned short vifi_t;
#define ALL_VIFS ((vifi_t)(-1)) #define ALL_VIFS ((vifi_t)(-1))
/* /* Same idea as select */
* Same idea as select
*/
#define VIFM_SET(n,m) ((m)|=(1<<(n))) #define VIFM_SET(n,m) ((m)|=(1<<(n)))
#define VIFM_CLR(n,m) ((m)&=~(1<<(n))) #define VIFM_CLR(n,m) ((m)&=~(1<<(n)))
#define VIFM_ISSET(n,m) ((m)&(1<<(n))) #define VIFM_ISSET(n,m) ((m)&(1<<(n)))
...@@ -50,11 +46,9 @@ typedef unsigned short vifi_t; ...@@ -50,11 +46,9 @@ typedef unsigned short vifi_t;
#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom))
#define VIFM_SAME(m1,m2) ((m1)==(m2)) #define VIFM_SAME(m1,m2) ((m1)==(m2))
/* /* Passed by mrouted for an MRT_ADD_VIF - again we use the
* Passed by mrouted for an MRT_ADD_VIF - again we use the * mrouted 3.6 structures for compatibility
* mrouted 3.6 structures for compatibility
*/ */
struct vifctl { struct vifctl {
vifi_t vifc_vifi; /* Index of VIF */ vifi_t vifc_vifi; /* Index of VIF */
unsigned char vifc_flags; /* VIFF_ flags */ unsigned char vifc_flags; /* VIFF_ flags */
...@@ -73,10 +67,7 @@ struct vifctl { ...@@ -73,10 +67,7 @@ struct vifctl {
#define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of #define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of
vifc_lcl_addr to find an interface */ vifc_lcl_addr to find an interface */
/* /* Cache manipulation structures for mrouted and PIMd */
* Cache manipulation structures for mrouted and PIMd
*/
struct mfcctl { struct mfcctl {
struct in_addr mfcc_origin; /* Origin of mcast */ struct in_addr mfcc_origin; /* Origin of mcast */
struct in_addr mfcc_mcastgrp; /* Group in question */ struct in_addr mfcc_mcastgrp; /* Group in question */
...@@ -88,10 +79,7 @@ struct mfcctl { ...@@ -88,10 +79,7 @@ struct mfcctl {
int mfcc_expire; int mfcc_expire;
}; };
/* /* Group count retrieval for mrouted */
* Group count retrieval for mrouted
*/
struct sioc_sg_req { struct sioc_sg_req {
struct in_addr src; struct in_addr src;
struct in_addr grp; struct in_addr grp;
...@@ -100,10 +88,7 @@ struct sioc_sg_req { ...@@ -100,10 +88,7 @@ struct sioc_sg_req {
unsigned long wrong_if; unsigned long wrong_if;
}; };
/* /* To get vif packet counts */
* To get vif packet counts
*/
struct sioc_vif_req { struct sioc_vif_req {
vifi_t vifi; /* Which iface */ vifi_t vifi; /* Which iface */
unsigned long icount; /* In packets */ unsigned long icount; /* In packets */
...@@ -112,11 +97,9 @@ struct sioc_vif_req { ...@@ -112,11 +97,9 @@ struct sioc_vif_req {
unsigned long obytes; /* Out bytes */ unsigned long obytes; /* Out bytes */
}; };
/* /* This is the format the mroute daemon expects to see IGMP control
* This is the format the mroute daemon expects to see IGMP control * data. Magically happens to be like an IP packet as per the original
* data. Magically happens to be like an IP packet as per the original
*/ */
struct igmpmsg { struct igmpmsg {
__u32 unused1,unused2; __u32 unused1,unused2;
unsigned char im_msgtype; /* What is this */ unsigned char im_msgtype; /* What is this */
...@@ -126,21 +109,13 @@ struct igmpmsg { ...@@ -126,21 +109,13 @@ struct igmpmsg {
struct in_addr im_src,im_dst; struct in_addr im_src,im_dst;
}; };
/* /* That's all usermode folks */
* That's all usermode folks
*/
#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
/* /* Pseudo messages used by mrouted */
* Pseudo messages used by mrouted
*/
#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ #define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */
#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */
#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
#endif /* _UAPI__LINUX_MROUTE_H */ #endif /* _UAPI__LINUX_MROUTE_H */
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册