* [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures
@ 2012-01-11 8:35 Pavel Emelyanov
2012-01-11 8:36 ` [PATCH 1/2] inet_diag: Rename inet_diag_req into inet_diag_req_v2 Pavel Emelyanov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2012-01-11 8:35 UTC (permalink / raw)
To: David Miller, Stephen Hemminger, Linux Netdev List
The recent changes to inet_diag broke the compilation of tools using kernel headers.
Fix this by doing two sequential renames:
inet_diag_req -> inet_diag_req_v2
inet_diag_req_compat -> inet_diag_req
After this the changes in the user-space visible part of the inet_diag.h are
* add the inet_diag_req_v2
* extend the INET_DIAG_ extensions list
The set applies to current net tree.
David, Stephen, I'm a little bit confused with the situation with this header. Can
you please comment on the (quite ancient) commit 73c1f4a0 ([TCPDIAG]: Just rename
everything to inet_diag) from acme@? This commit did the similar thing with inet_diag
header -- flushed away the old struct and introduced a new one keeping just the binary
compatibility. Why was the breakage of tools caused by this commit considered as
acceptable?
Thanks,
Pavel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] inet_diag: Rename inet_diag_req into inet_diag_req_v2
2012-01-11 8:35 [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Pavel Emelyanov
@ 2012-01-11 8:36 ` Pavel Emelyanov
2012-01-11 8:37 ` [PATCH 2/2] inet_diag: Rename inet_diag_req_compat into inet_diag_req Pavel Emelyanov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2012-01-11 8:36 UTC (permalink / raw)
To: David Miller, Stephen Hemminger, Linux Netdev List
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
include/linux/inet_diag.h | 12 ++++++------
net/dccp/diag.c | 4 ++--
net/ipv4/inet_diag.c | 34 +++++++++++++++++-----------------
net/ipv4/tcp_diag.c | 4 ++--
net/ipv4/udp_diag.c | 14 +++++++-------
5 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 34e8d52..a5b7e91 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -34,7 +34,7 @@ struct inet_diag_req_compat {
__u32 idiag_dbs; /* Tables to dump (NI) */
};
-struct inet_diag_req {
+struct inet_diag_req_v2 {
__u8 sdiag_family;
__u8 sdiag_protocol;
__u8 idiag_ext;
@@ -143,12 +143,12 @@ struct netlink_callback;
struct inet_diag_handler {
void (*dump)(struct sk_buff *skb,
struct netlink_callback *cb,
- struct inet_diag_req *r,
+ struct inet_diag_req_v2 *r,
struct nlattr *bc);
int (*dump_one)(struct sk_buff *in_skb,
const struct nlmsghdr *nlh,
- struct inet_diag_req *req);
+ struct inet_diag_req_v2 *req);
void (*idiag_get_info)(struct sock *sk,
struct inet_diag_msg *r,
@@ -158,15 +158,15 @@ struct inet_diag_handler {
struct inet_connection_sock;
int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
- struct sk_buff *skb, struct inet_diag_req *req,
+ struct sk_buff *skb, struct inet_diag_req_v2 *req,
u32 pid, u32 seq, u16 nlmsg_flags,
const struct nlmsghdr *unlh);
void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
- struct netlink_callback *cb, struct inet_diag_req *r,
+ struct netlink_callback *cb, struct inet_diag_req_v2 *r,
struct nlattr *bc);
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
struct sk_buff *in_skb, const struct nlmsghdr *nlh,
- struct inet_diag_req *req);
+ struct inet_diag_req_v2 *req);
int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index 8f16257..028fc43 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -49,13 +49,13 @@ static void dccp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
}
static void dccp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
inet_diag_dump_icsk(&dccp_hashinfo, skb, cb, r, bc);
}
static int dccp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
- struct inet_diag_req *req)
+ struct inet_diag_req_v2 *req)
{
return inet_diag_dump_one_icsk(&dccp_hashinfo, in_skb, nlh, req);
}
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 2240a8e..cf23a7c 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -71,7 +71,7 @@ static inline void inet_diag_unlock_handler(
}
int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
- struct sk_buff *skb, struct inet_diag_req *req,
+ struct sk_buff *skb, struct inet_diag_req_v2 *req,
u32 pid, u32 seq, u16 nlmsg_flags,
const struct nlmsghdr *unlh)
{
@@ -193,7 +193,7 @@ nlmsg_failure:
EXPORT_SYMBOL_GPL(inet_sk_diag_fill);
static int inet_csk_diag_fill(struct sock *sk,
- struct sk_buff *skb, struct inet_diag_req *req,
+ struct sk_buff *skb, struct inet_diag_req_v2 *req,
u32 pid, u32 seq, u16 nlmsg_flags,
const struct nlmsghdr *unlh)
{
@@ -202,7 +202,7 @@ static int inet_csk_diag_fill(struct sock *sk,
}
static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
- struct sk_buff *skb, struct inet_diag_req *req,
+ struct sk_buff *skb, struct inet_diag_req_v2 *req,
u32 pid, u32 seq, u16 nlmsg_flags,
const struct nlmsghdr *unlh)
{
@@ -253,7 +253,7 @@ nlmsg_failure:
}
static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
- struct inet_diag_req *r, u32 pid, u32 seq, u16 nlmsg_flags,
+ struct inet_diag_req_v2 *r, u32 pid, u32 seq, u16 nlmsg_flags,
const struct nlmsghdr *unlh)
{
if (sk->sk_state == TCP_TIME_WAIT)
@@ -264,7 +264,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
}
int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_skb,
- const struct nlmsghdr *nlh, struct inet_diag_req *req)
+ const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req)
{
int err;
struct sock *sk;
@@ -333,7 +333,7 @@ EXPORT_SYMBOL_GPL(inet_diag_dump_one_icsk);
static int inet_diag_get_exact(struct sk_buff *in_skb,
const struct nlmsghdr *nlh,
- struct inet_diag_req *req)
+ struct inet_diag_req_v2 *req)
{
const struct inet_diag_handler *handler;
int err;
@@ -540,7 +540,7 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
static int inet_csk_diag_dump(struct sock *sk,
struct sk_buff *skb,
struct netlink_callback *cb,
- struct inet_diag_req *r,
+ struct inet_diag_req_v2 *r,
const struct nlattr *bc)
{
if (!inet_diag_bc_sk(bc, sk))
@@ -554,7 +554,7 @@ static int inet_csk_diag_dump(struct sock *sk,
static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
struct sk_buff *skb,
struct netlink_callback *cb,
- struct inet_diag_req *r,
+ struct inet_diag_req_v2 *r,
const struct nlattr *bc)
{
if (bc != NULL) {
@@ -639,7 +639,7 @@ nlmsg_failure:
static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
struct netlink_callback *cb,
- struct inet_diag_req *r,
+ struct inet_diag_req_v2 *r,
const struct nlattr *bc)
{
struct inet_diag_entry entry;
@@ -721,7 +721,7 @@ out:
}
void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
- struct netlink_callback *cb, struct inet_diag_req *r, struct nlattr *bc)
+ struct netlink_callback *cb, struct inet_diag_req_v2 *r, struct nlattr *bc)
{
int i, num;
int s_i, s_num;
@@ -872,7 +872,7 @@ out:
EXPORT_SYMBOL_GPL(inet_diag_dump_icsk);
static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
const struct inet_diag_handler *handler;
@@ -887,12 +887,12 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
struct nlattr *bc = NULL;
- int hdrlen = sizeof(struct inet_diag_req);
+ int hdrlen = sizeof(struct inet_diag_req_v2);
if (nlmsg_attrlen(cb->nlh, hdrlen))
bc = nlmsg_find_attr(cb->nlh, hdrlen, INET_DIAG_REQ_BYTECODE);
- return __inet_diag_dump(skb, cb, (struct inet_diag_req *)NLMSG_DATA(cb->nlh), bc);
+ return __inet_diag_dump(skb, cb, (struct inet_diag_req_v2 *)NLMSG_DATA(cb->nlh), bc);
}
static inline int inet_diag_type2proto(int type)
@@ -910,7 +910,7 @@ static inline int inet_diag_type2proto(int type)
static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *cb)
{
struct inet_diag_req_compat *rc = NLMSG_DATA(cb->nlh);
- struct inet_diag_req req;
+ struct inet_diag_req_v2 req;
struct nlattr *bc = NULL;
int hdrlen = sizeof(struct inet_diag_req_compat);
@@ -930,7 +930,7 @@ static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
const struct nlmsghdr *nlh)
{
struct inet_diag_req_compat *rc = NLMSG_DATA(nlh);
- struct inet_diag_req req;
+ struct inet_diag_req_v2 req;
req.sdiag_family = rc->idiag_family;
req.sdiag_protocol = inet_diag_type2proto(nlh->nlmsg_type);
@@ -970,7 +970,7 @@ static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
{
- int hdrlen = sizeof(struct inet_diag_req);
+ int hdrlen = sizeof(struct inet_diag_req_v2);
if (nlmsg_len(h) < hdrlen)
return -EINVAL;
@@ -990,7 +990,7 @@ static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
inet_diag_dump, NULL, 0);
}
- return inet_diag_get_exact(skb, h, (struct inet_diag_req *)NLMSG_DATA(h));
+ return inet_diag_get_exact(skb, h, (struct inet_diag_req_v2 *)NLMSG_DATA(h));
}
static struct sock_diag_handler inet_diag_handler = {
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 8cd357a..ed3f2ad 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -35,13 +35,13 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
}
static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc);
}
static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
- struct inet_diag_req *req)
+ struct inet_diag_req_v2 *req)
{
return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req);
}
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 69f8a7c..e5e18cb 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -19,7 +19,7 @@
#include <linux/sock_diag.h>
static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
- struct netlink_callback *cb, struct inet_diag_req *req,
+ struct netlink_callback *cb, struct inet_diag_req_v2 *req,
struct nlattr *bc)
{
if (!inet_diag_bc_sk(bc, sk))
@@ -30,7 +30,7 @@ static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
}
static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb,
- const struct nlmsghdr *nlh, struct inet_diag_req *req)
+ const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req)
{
int err = -EINVAL;
struct sock *sk;
@@ -88,7 +88,7 @@ out_nosk:
}
static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
int num, s_num, slot, s_slot;
@@ -136,13 +136,13 @@ done:
}
static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
udp_dump(&udp_table, skb, cb, r, bc);
}
static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
- struct inet_diag_req *req)
+ struct inet_diag_req_v2 *req)
{
return udp_dump_one(&udp_table, in_skb, nlh, req);
}
@@ -154,13 +154,13 @@ static const struct inet_diag_handler udp_diag_handler = {
};
static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
- struct inet_diag_req *r, struct nlattr *bc)
+ struct inet_diag_req_v2 *r, struct nlattr *bc)
{
udp_dump(&udplite_table, skb, cb, r, bc);
}
static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
- struct inet_diag_req *req)
+ struct inet_diag_req_v2 *req)
{
return udp_dump_one(&udplite_table, in_skb, nlh, req);
}
--
1.5.5.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] inet_diag: Rename inet_diag_req_compat into inet_diag_req
2012-01-11 8:35 [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Pavel Emelyanov
2012-01-11 8:36 ` [PATCH 1/2] inet_diag: Rename inet_diag_req into inet_diag_req_v2 Pavel Emelyanov
@ 2012-01-11 8:37 ` Pavel Emelyanov
2012-01-11 16:52 ` [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Stephen Hemminger
2012-01-11 20:58 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Pavel Emelyanov @ 2012-01-11 8:37 UTC (permalink / raw)
To: David Miller, Stephen Hemminger, Linux Netdev List
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
include/linux/inet_diag.h | 2 +-
net/ipv4/inet_diag.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index a5b7e91..f1362b5 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -22,7 +22,7 @@ struct inet_diag_sockid {
/* Request structure */
-struct inet_diag_req_compat {
+struct inet_diag_req {
__u8 idiag_family; /* Family of addresses. */
__u8 idiag_src_len;
__u8 idiag_dst_len;
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index cf23a7c..fcf2818 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -909,10 +909,10 @@ static inline int inet_diag_type2proto(int type)
static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *cb)
{
- struct inet_diag_req_compat *rc = NLMSG_DATA(cb->nlh);
+ struct inet_diag_req *rc = NLMSG_DATA(cb->nlh);
struct inet_diag_req_v2 req;
struct nlattr *bc = NULL;
- int hdrlen = sizeof(struct inet_diag_req_compat);
+ int hdrlen = sizeof(struct inet_diag_req);
req.sdiag_family = AF_UNSPEC; /* compatibility */
req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type);
@@ -929,7 +929,7 @@ static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *c
static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
const struct nlmsghdr *nlh)
{
- struct inet_diag_req_compat *rc = NLMSG_DATA(nlh);
+ struct inet_diag_req *rc = NLMSG_DATA(nlh);
struct inet_diag_req_v2 req;
req.sdiag_family = rc->idiag_family;
@@ -943,7 +943,7 @@ static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
{
- int hdrlen = sizeof(struct inet_diag_req_compat);
+ int hdrlen = sizeof(struct inet_diag_req);
if (nlh->nlmsg_type >= INET_DIAG_GETSOCK_MAX ||
nlmsg_len(nlh) < hdrlen)
--
1.5.5.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures
2012-01-11 8:35 [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Pavel Emelyanov
2012-01-11 8:36 ` [PATCH 1/2] inet_diag: Rename inet_diag_req into inet_diag_req_v2 Pavel Emelyanov
2012-01-11 8:37 ` [PATCH 2/2] inet_diag: Rename inet_diag_req_compat into inet_diag_req Pavel Emelyanov
@ 2012-01-11 16:52 ` Stephen Hemminger
2012-01-11 20:58 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2012-01-11 16:52 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, Stephen Hemminger, Linux Netdev List
On Wed, 11 Jan 2012 12:35:32 +0400
Pavel Emelyanov <xemul@parallels.com> wrote:
> The recent changes to inet_diag broke the compilation of tools using kernel headers.
>
> Fix this by doing two sequential renames:
>
> inet_diag_req -> inet_diag_req_v2
> inet_diag_req_compat -> inet_diag_req
>
> After this the changes in the user-space visible part of the inet_diag.h are
> * add the inet_diag_req_v2
> * extend the INET_DIAG_ extensions list
>
> The set applies to current net tree.
Tested and build succeeds.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Minor nit, it really didn't have to be two patches.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures
2012-01-11 8:35 [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Pavel Emelyanov
` (2 preceding siblings ...)
2012-01-11 16:52 ` [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Stephen Hemminger
@ 2012-01-11 20:58 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-01-11 20:58 UTC (permalink / raw)
To: xemul; +Cc: shemminger, netdev
From: Pavel Emelyanov <xemul@parallels.com>
Date: Wed, 11 Jan 2012 12:35:32 +0400
> The recent changes to inet_diag broke the compilation of tools using kernel headers.
>
> Fix this by doing two sequential renames:
>
> inet_diag_req -> inet_diag_req_v2
> inet_diag_req_compat -> inet_diag_req
>
> After this the changes in the user-space visible part of the inet_diag.h are
> * add the inet_diag_req_v2
> * extend the INET_DIAG_ extensions list
>
> The set applies to current net tree.
Both applied, thanks.
> David, Stephen, I'm a little bit confused with the situation with this header. Can
> you please comment on the (quite ancient) commit 73c1f4a0 ([TCPDIAG]: Just rename
> everything to inet_diag) from acme@? This commit did the similar thing with inet_diag
> header -- flushed away the old struct and introduced a new one keeping just the binary
> compatibility. Why was the breakage of tools caused by this commit considered as
> acceptable?
Sigh... we simply didn't notice it back then, and that's the end of
it. Can you please stop bringing up this point now? Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-11 20:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 8:35 [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Pavel Emelyanov
2012-01-11 8:36 ` [PATCH 1/2] inet_diag: Rename inet_diag_req into inet_diag_req_v2 Pavel Emelyanov
2012-01-11 8:37 ` [PATCH 2/2] inet_diag: Rename inet_diag_req_compat into inet_diag_req Pavel Emelyanov
2012-01-11 16:52 ` [PATCH 0/2] inet_diag: Fix old/new inet_diag_req-s structures Stephen Hemminger
2012-01-11 20:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).