Commit 09954dc6 authored by shemminger's avatar shemminger

IP ntable support and header update.

parent 890fe64e
2006-01-10 Masahide NAKAMURA <nakam@linux-ipv6.org>
* Add ip link ntable
2006-01-10 Stephen Hemminger <shemminger@osdl.org>
* Update headers to santized kernel 2.6.15
2006-01-03 Alpt <alpt@freaknet.org> 2006-01-03 Alpt <alpt@freaknet.org>
* Ip man page addition * Ip man page addition
......
...@@ -71,7 +71,8 @@ struct nlmsghdr ...@@ -71,7 +71,8 @@ struct nlmsghdr
#define NLMSG_ALIGNTO 4 #define NLMSG_ALIGNTO 4
#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
...@@ -86,6 +87,8 @@ struct nlmsghdr ...@@ -86,6 +87,8 @@ struct nlmsghdr
#define NLMSG_DONE 0x3 /* End of a dump */ #define NLMSG_DONE 0x3 /* End of a dump */
#define NLMSG_OVERRUN 0x4 /* Data lost */ #define NLMSG_OVERRUN 0x4 /* Data lost */
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
struct nlmsgerr struct nlmsgerr
{ {
int error; int error;
...@@ -108,5 +111,24 @@ enum { ...@@ -108,5 +111,24 @@ enum {
NETLINK_CONNECTED, NETLINK_CONNECTED,
}; };
/*
* <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
* +---------------------+- - -+- - - - - - - - - -+- - -+
* | Header | Pad | Payload | Pad |
* | (struct nlattr) | ing | | ing |
* +---------------------+- - -+- - - - - - - - - -+- - -+
* <-------------- nlattr->nla_len -------------->
*/
struct nlattr
{
__u16 nla_len;
__u16 nla_type;
};
#define NLA_ALIGNTO 4
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif /* __LINUX_NETLINK_H */ #endif /* __LINUX_NETLINK_H */
...@@ -864,6 +864,7 @@ enum rtnetlink_groups { ...@@ -864,6 +864,7 @@ enum rtnetlink_groups {
#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
RTNLGRP_IPV4_ROUTE, RTNLGRP_IPV4_ROUTE,
#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
RTNLGRP_NOP1,
RTNLGRP_IPV6_IFADDR, RTNLGRP_IPV6_IFADDR,
#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
RTNLGRP_IPV6_MROUTE, RTNLGRP_IPV6_MROUTE,
...@@ -874,8 +875,11 @@ enum rtnetlink_groups { ...@@ -874,8 +875,11 @@ enum rtnetlink_groups {
#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO
RTNLGRP_DECnet_IFADDR, RTNLGRP_DECnet_IFADDR,
#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR
RTNLGRP_NOP2,
RTNLGRP_DECnet_ROUTE, RTNLGRP_DECnet_ROUTE,
#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
RTNLGRP_NOP3,
RTNLGRP_NOP4,
RTNLGRP_IPV6_PREFIX, RTNLGRP_IPV6_PREFIX,
#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
__RTNLGRP_MAX __RTNLGRP_MAX
......
...@@ -55,22 +55,6 @@ struct tcphdr { ...@@ -55,22 +55,6 @@ struct tcphdr {
__u16 urg_ptr; __u16 urg_ptr;
}; };
#define TCP_ACTION_FIN (1 << 7)
enum {
TCPF_ESTABLISHED = (1 << 1),
TCPF_SYN_SENT = (1 << 2),
TCPF_SYN_RECV = (1 << 3),
TCPF_FIN_WAIT1 = (1 << 4),
TCPF_FIN_WAIT2 = (1 << 5),
TCPF_TIME_WAIT = (1 << 6),
TCPF_CLOSE = (1 << 7),
TCPF_CLOSE_WAIT = (1 << 8),
TCPF_LAST_ACK = (1 << 9),
TCPF_LISTEN = (1 << 10),
TCPF_CLOSING = (1 << 11)
};
/* /*
* The union cast uses a gcc extension to avoid aliasing problems * The union cast uses a gcc extension to avoid aliasing problems
* (union is compatible to any of its members) * (union is compatible to any of its members)
......
...@@ -27,6 +27,22 @@ struct xfrm_id ...@@ -27,6 +27,22 @@ struct xfrm_id
__u8 proto; __u8 proto;
}; };
struct xfrm_sec_ctx {
__u8 ctx_doi;
__u8 ctx_alg;
__u16 ctx_len;
__u32 ctx_sid;
char ctx_str[0];
};
/* Security Context Domains of Interpretation */
#define XFRM_SC_DOI_RESERVED 0
#define XFRM_SC_DOI_LSM 1
/* Security Context Algorithms */
#define XFRM_SC_ALG_RESERVED 0
#define XFRM_SC_ALG_SELINUX 1
/* Selector, used as selector both on policy rules (SPD) and SAs. */ /* Selector, used as selector both on policy rules (SPD) and SAs. */
struct xfrm_selector struct xfrm_selector
...@@ -146,6 +162,18 @@ enum { ...@@ -146,6 +162,18 @@ enum {
#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)
/*
* Generic LSM security context for comunicating to user space
* NOTE: Same format as sadb_x_sec_ctx
*/
struct xfrm_user_sec_ctx {
__u16 len;
__u16 exttype;
__u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
__u8 ctx_doi;
__u16 ctx_len;
};
struct xfrm_user_tmpl { struct xfrm_user_tmpl {
struct xfrm_id id; struct xfrm_id id;
__u16 family; __u16 family;
...@@ -176,6 +204,7 @@ enum xfrm_attr_type_t { ...@@ -176,6 +204,7 @@ enum xfrm_attr_type_t {
XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
XFRMA_SA, XFRMA_SA,
XFRMA_POLICY, XFRMA_POLICY,
XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */
__XFRMA_MAX __XFRMA_MAX
#define XFRMA_MAX (__XFRMA_MAX - 1) #define XFRMA_MAX (__XFRMA_MAX - 1)
......
IPOBJ=ip.o ipaddress.o iproute.o iprule.o \ IPOBJ=ip.o ipaddress.o iproute.o iprule.o \
rtm_map.o iptunnel.o ipneigh.o iplink.o \ rtm_map.o iptunnel.o ipneigh.o ipntable.o iplink.o \
ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \ ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o \
ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o
......
...@@ -45,7 +45,7 @@ static void usage(void) ...@@ -45,7 +45,7 @@ static void usage(void)
fprintf(stderr, fprintf(stderr,
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
" ip [ -force ] [-batch filename\n" " ip [ -force ] [-batch filename\n"
"where OBJECT := { link | addr | route | rule | neigh | tunnel |\n" "where OBJECT := { link | addr | route | rule | neigh | ntable | tunnel |\n"
" maddr | mroute | monitor | xfrm }\n" " maddr | mroute | monitor | xfrm }\n"
" OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] |\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] |\n"
" -f[amily] { inet | inet6 | ipx | dnet | link } |\n" " -f[amily] { inet | inet6 | ipx | dnet | link } |\n"
...@@ -68,6 +68,8 @@ static const struct cmd { ...@@ -68,6 +68,8 @@ static const struct cmd {
{ "rule", do_iprule }, { "rule", do_iprule },
{ "neighbor", do_ipneigh }, { "neighbor", do_ipneigh },
{ "neighbour", do_ipneigh }, { "neighbour", do_ipneigh },
{ "ntable", do_ipntable },
{ "ntbl", do_ipntable },
{ "link", do_iplink }, { "link", do_iplink },
{ "tunnel", do_iptunnel }, { "tunnel", do_iptunnel },
{ "tunl", do_iptunnel }, { "tunl", do_iptunnel },
......
...@@ -6,6 +6,8 @@ extern int print_addrinfo(const struct sockaddr_nl *who, ...@@ -6,6 +6,8 @@ extern int print_addrinfo(const struct sockaddr_nl *who,
void *arg); void *arg);
extern int print_neigh(const struct sockaddr_nl *who, extern int print_neigh(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg); struct nlmsghdr *n, void *arg);
extern int print_ntable(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg);
extern int ipaddr_list(int argc, char **argv); extern int ipaddr_list(int argc, char **argv);
extern int ipaddr_list_link(int argc, char **argv); extern int ipaddr_list_link(int argc, char **argv);
extern int iproute_monitor(int argc, char **argv); extern int iproute_monitor(int argc, char **argv);
...@@ -13,6 +15,7 @@ extern void iplink_usage(void) __attribute__((noreturn)); ...@@ -13,6 +15,7 @@ extern void iplink_usage(void) __attribute__((noreturn));
extern void iproute_reset_filter(void); extern void iproute_reset_filter(void);
extern void ipaddr_reset_filter(int); extern void ipaddr_reset_filter(int);
extern void ipneigh_reset_filter(void); extern void ipneigh_reset_filter(void);
extern void ipntable_reset_filter(void);
extern int print_route(const struct sockaddr_nl *who, extern int print_route(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg); struct nlmsghdr *n, void *arg);
extern int print_prefix(const struct sockaddr_nl *who, extern int print_prefix(const struct sockaddr_nl *who,
...@@ -21,6 +24,7 @@ extern int do_ipaddr(int argc, char **argv); ...@@ -21,6 +24,7 @@ extern int do_ipaddr(int argc, char **argv);
extern int do_iproute(int argc, char **argv); extern int do_iproute(int argc, char **argv);
extern int do_iprule(int argc, char **argv); extern int do_iprule(int argc, char **argv);
extern int do_ipneigh(int argc, char **argv); extern int do_ipneigh(int argc, char **argv);
extern int do_ipntable(int argc, char **argv);
extern int do_iptunnel(int argc, char **argv); extern int do_iptunnel(int argc, char **argv);
extern int do_iplink(int argc, char **argv); extern int do_iplink(int argc, char **argv);
extern int do_ipmonitor(int argc, char **argv); extern int do_ipmonitor(int argc, char **argv);
......
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