Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] ibmveth: Fix leak when recycling skb and hypervisor returns error
From: David Miller @ 2011-08-25  0:56 UTC (permalink / raw)
  To: anton; +Cc: santil, netdev
In-Reply-To: <20110825105520.5ba7ae90@kryten>

From: Anton Blanchard <anton@samba.org>
Date: Thu, 25 Aug 2011 10:55:20 +1000

>> Please generate this patch against Linus's tree, instead of -next
> 
> Sure, here it is.

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 3/4] net: ipv6: convert to SKB frag APIs
From: David Miller @ 2011-08-25  0:52 UTC (permalink / raw)
  To: ian.campbell; +Cc: netdev, kuznet, pekkas, jmorris, yoshfuji, kaber
In-Reply-To: <1314092701-4347-3-git-send-email-ian.campbell@citrix.com>

From: Ian Campbell <ian.campbell@citrix.com>
Date: Tue, 23 Aug 2011 10:45:00 +0100

> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/4] net: ipv4: convert to SKB frag APIs
From: David Miller @ 2011-08-25  0:52 UTC (permalink / raw)
  To: ian.campbell; +Cc: netdev, kuznet, pekkas, jmorris, yoshfuji, kaber
In-Reply-To: <1314092701-4347-2-git-send-email-ian.campbell@citrix.com>

From: Ian Campbell <ian.campbell@citrix.com>
Date: Tue, 23 Aug 2011 10:44:59 +0100

> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Applied.

^ permalink raw reply

* Re: [RFC] per-containers tcp buffer limitation
From: Glauber Costa @ 2011-08-25  1:28 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: netdev, David Miller, Linux Containers, Pavel Emelyanov
In-Reply-To: <m1k4a2qqew.fsf@fess.ebiederm.org>

On 08/24/2011 09:35 PM, Eric W. Biederman wrote:
> Glauber Costa<glommer@parallels.com>  writes:
>
>> Hello,
>>
>> This is a proof of concept of some code I have here to limit tcp send and
>> receive buffers per-container (in our case). At this phase, I am more concerned
>> in discussing my approach, so please curse my family no further than the 3rd
>> generation.
>>
>> The problem we're trying to attack here, is that buffers can grow and fill
>> non-reclaimable kernel memory. When doing containers, we can't afford having a
>> malicious container pinning kernel memory at will, therefore exhausting all the
>> others.
>>
>> So here a container will be seen in the host system as a group of tasks, grouped
>> in a cgroup. This cgroup will have files allowing us to specify global
>> per-cgroup limits on buffers. For that purpose, I created a new sockets cgroup -
>> didn't really think any other one of the existing would do here.
>>
>> As for the network code per-se, I tried to keep the same code that deals with
>> memory schedule as a basis and make it per-cgroup.
>> You will notice that struct proto now take function pointers to values
>> controlling memory pressure and will return per-cgroup data instead of global
>> ones. So the current behavior is maintained: after the first threshold is hit,
>> we enter memory pressure. After that, allocations are suppressed.
>>
>> Only tcp code was really touched here. udp had the pointers filled, but we're
>> not really controlling anything. But the fact that this lives in generic code,
>> makes it easier to do the same for other protocols in the future.
>>
>> For this patch specifically, I am not touching - just provisioning -
>> rmem and wmem specific knobs. I should also #ifdef a lot of this, but hey,
>> remember: rfc...
>>
>> One drawback of this approach I found, is that cgroups does not really work well
>> with modules. A lot of the network code is modularized, so this would have to be
>> fixed somehow.
>>
>> Let me know what you think.
>
> Can you implement this by making the existing network sysctls per
> network namespace?
>
> At a quick skim it looks to me like you can make the existing sysctls
> per network namespace and solve the issues you are aiming at solving and
> that should make the code much simpler, than your proof of concept code.
>
> Any implementation of this needs to answer the question how much
> overhead does this extra accounting add.  I don't have a clue how much
> overhead you are adding but you are making structures larger and I
> suspect adding at least another cache line miss, so I suspect your
> changes will impact real world socket performance.

Hi Eric,

Thanks for your attention.

So, this that you propose was my first implementation. I ended up 
throwing it away after playing with it for a while.

One of the first problems that arise from that, is that the sysctls are
a tunable visible from inside the container. Those limits, however, are 
to be set from the outside world. The code is not much better than that 
either, and instead of creating new cgroup structures and linking them 
to the protocol, we end up doing it for net ns. We end up increasing 
structures just the same...

Also, since we're doing resource control, it seems more natural to use 
cgroups. Now, the fact that there are no correlation whatsoever between 
cgroups and namespaces does bother me. But that's another story, much 
more broader and general than this patch.

About overhead, since this is the first RFC, I did not care about 
measuring. However, it seems trivial to me to guarantee that at least 
that it won't impose a significant performance penalty when it is 
compiled out. If we're moving forward with this implementation, I will
include data in the next release so we can discuss in this basis.

^ permalink raw reply

* (unknown), 
From: con@telus.net @ 2011-08-25  1:39 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 27 bytes --]

KINDLY DOWNLOAD ATTACHMENT

[-- Attachment #2: NOTIFICATION BOARD.txt --]
[-- Type: application/octet-stream, Size: 674 bytes --]

You have been selected in the on-going COCA COLA award held this August
2011.We the Promo Board are pleased to inform you that you alongside four(4)
otherlucky winners have been approved for a payment of 1,000 000GBP (One
Million Pounds Sterling).
If you did receive this email, it means you are one of the five(5)lucky
winners.

*CLAIMS PROCESSING OFFICER:
*Name:Mr TOMMY ROGER
E.mail: claimsgroup222@qatar.io

You are also advised to provide him with the under listed information
as soon as possible:

*NAME IN FULL:
*DELIVERY ADDRESS:
*SEX:
*AGE:
*COUNTRY:
*NATIONALITY:
*OCCUPATION:
*PHONE:

We are glad to have you as one of our luckly winners.

^ permalink raw reply

* Re: [PATCH] tcp: bound RTO to minimum
From: Yuchung Cheng @ 2011-08-25  1:50 UTC (permalink / raw)
  To: Hagen Paul Pfeifer; +Cc: netdev, eric.dumazet
In-Reply-To: <1314229310-8074-1-git-send-email-hagen@jauu.net>

On Wed, Aug 24, 2011 at 4:41 PM, Hagen Paul Pfeifer <hagen@jauu.net> wrote:
> Check if calculated RTO is less then TCP_RTO_MIN. If this is true we
> adjust the value to TCP_RTO_MIN.
>
but tp->rttvar is already lower-bounded via tcp_rto_min()?

static inline void tcp_set_rto(struct sock *sk)
{
...

  /* NOTE: clamping at TCP_RTO_MIN is not required, current algo
   * guarantees that rto is higher.
   */
  tcp_bound_rto(sk);
}

^ permalink raw reply

* Re: [RFC] per-containers tcp buffer limitation
From: KAMEZAWA Hiroyuki @ 2011-08-25  1:49 UTC (permalink / raw)
  To: Glauber Costa
  Cc: Eric W. Biederman, Linux Containers, netdev, David Miller,
	Pavel Emelyanov
In-Reply-To: <4E55A55B.8090608@parallels.com>

On Wed, 24 Aug 2011 22:28:59 -0300
Glauber Costa <glommer@parallels.com> wrote:

> On 08/24/2011 09:35 PM, Eric W. Biederman wrote:
> > Glauber Costa<glommer@parallels.com>  writes:
> >
> >> Hello,
> >>
> >> This is a proof of concept of some code I have here to limit tcp send and
> >> receive buffers per-container (in our case). At this phase, I am more concerned
> >> in discussing my approach, so please curse my family no further than the 3rd
> >> generation.
> >>
> >> The problem we're trying to attack here, is that buffers can grow and fill
> >> non-reclaimable kernel memory. When doing containers, we can't afford having a
> >> malicious container pinning kernel memory at will, therefore exhausting all the
> >> others.
> >>
> >> So here a container will be seen in the host system as a group of tasks, grouped
> >> in a cgroup. This cgroup will have files allowing us to specify global
> >> per-cgroup limits on buffers. For that purpose, I created a new sockets cgroup -
> >> didn't really think any other one of the existing would do here.
> >>
> >> As for the network code per-se, I tried to keep the same code that deals with
> >> memory schedule as a basis and make it per-cgroup.
> >> You will notice that struct proto now take function pointers to values
> >> controlling memory pressure and will return per-cgroup data instead of global
> >> ones. So the current behavior is maintained: after the first threshold is hit,
> >> we enter memory pressure. After that, allocations are suppressed.
> >>
> >> Only tcp code was really touched here. udp had the pointers filled, but we're
> >> not really controlling anything. But the fact that this lives in generic code,
> >> makes it easier to do the same for other protocols in the future.
> >>
> >> For this patch specifically, I am not touching - just provisioning -
> >> rmem and wmem specific knobs. I should also #ifdef a lot of this, but hey,
> >> remember: rfc...
> >>
> >> One drawback of this approach I found, is that cgroups does not really work well
> >> with modules. A lot of the network code is modularized, so this would have to be
> >> fixed somehow.
> >>
> >> Let me know what you think.
> >
> > Can you implement this by making the existing network sysctls per
> > network namespace?
> >
> > At a quick skim it looks to me like you can make the existing sysctls
> > per network namespace and solve the issues you are aiming at solving and
> > that should make the code much simpler, than your proof of concept code.
> >
> > Any implementation of this needs to answer the question how much
> > overhead does this extra accounting add.  I don't have a clue how much
> > overhead you are adding but you are making structures larger and I
> > suspect adding at least another cache line miss, so I suspect your
> > changes will impact real world socket performance.
> 
> Hi Eric,
> 
> Thanks for your attention.
> 
> So, this that you propose was my first implementation. I ended up 
> throwing it away after playing with it for a while.
> 
> One of the first problems that arise from that, is that the sysctls are
> a tunable visible from inside the container. Those limits, however, are 
> to be set from the outside world. The code is not much better than that 
> either, and instead of creating new cgroup structures and linking them 
> to the protocol, we end up doing it for net ns. We end up increasing 
> structures just the same...
> 
> Also, since we're doing resource control, it seems more natural to use 
> cgroups. Now, the fact that there are no correlation whatsoever between 
> cgroups and namespaces does bother me. But that's another story, much 
> more broader and general than this patch.
> 

I think using cgroup makes sense. A question in mind is whehter it is
better to integrate this kind of 'memory usage' controls to memcg or not.

How do you think ? IMHO, having cgroup per class of object is messy.
...
How about adding 
	memory.tcp_mem 
to memcg ?

Or, adding kmem cgroup ?

> About overhead, since this is the first RFC, I did not care about 
> measuring. However, it seems trivial to me to guarantee that at least 
> that it won't impose a significant performance penalty when it is 
> compiled out. If we're moving forward with this implementation, I will
> include data in the next release so we can discuss in this basis.
> 

IMHO, you should show performance number even if RFC. Then, people will
see patch with more interests.

Thanks,
-Kame

^ permalink raw reply

* Re: [RFC] per-containers tcp buffer limitation
From: Eric W. Biederman @ 2011-08-25  2:16 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: Glauber Costa, Linux Containers, netdev, David Miller,
	Pavel Emelyanov
In-Reply-To: <20110825104956.41c4b60e.kamezawa.hiroyu@jp.fujitsu.com>

KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:

> On Wed, 24 Aug 2011 22:28:59 -0300
> Glauber Costa <glommer@parallels.com> wrote:
>
>> On 08/24/2011 09:35 PM, Eric W. Biederman wrote:
>> > Glauber Costa<glommer@parallels.com>  writes:
>> Hi Eric,
>> 
>> Thanks for your attention.
>> 
>> So, this that you propose was my first implementation. I ended up 
>> throwing it away after playing with it for a while.
>> 
>> One of the first problems that arise from that, is that the sysctls are
>> a tunable visible from inside the container. Those limits, however, are 
>> to be set from the outside world. The code is not much better than that 
>> either, and instead of creating new cgroup structures and linking them 
>> to the protocol, we end up doing it for net ns. We end up increasing 
>> structures just the same...

You don't need to add a netns member to sockets.

But I do agree that there are odd permission issues with using the
existing sysctls and making them per namespace.

However almost everything I have seen with memory limits I have found
very strange.  They all seem like a very bad version of disabling memory
over commits.

>> Also, since we're doing resource control, it seems more natural to use 
>> cgroups. Now, the fact that there are no correlation whatsoever between 
>> cgroups and namespaces does bother me. But that's another story, much 
>> more broader and general than this patch.
>> 
>
> I think using cgroup makes sense. A question in mind is whehter it is
> better to integrate this kind of 'memory usage' controls to memcg or
> not.

Maybe.  When sockets start getting a cgroup member I start wondering,
how many cgroup members will sockets potentially belong to.

> How do you think ? IMHO, having cgroup per class of object is messy.
> ...
> How about adding 
> 	memory.tcp_mem 
> to memcg ?
>
> Or, adding kmem cgroup ?
>
>> About overhead, since this is the first RFC, I did not care about 
>> measuring. However, it seems trivial to me to guarantee that at least 
>> that it won't impose a significant performance penalty when it is 
>> compiled out. If we're moving forward with this implementation, I will
>> include data in the next release so we can discuss in this basis.
>> 
>
> IMHO, you should show performance number even if RFC. Then, people will
> see patch with more interests.

And also compiled out doesn't really count.  Cgroups are something you
want people to compile into distributions for the common case, and you
don't want to impose a noticeable performance penalty for the common
case.

Eric

^ permalink raw reply

* Re: [PATCH] [IEEE802.15.4] 6LoWPAN basic support
From: David Miller @ 2011-08-25  2:36 UTC (permalink / raw)
  To: alex.bluesman.smirnov; +Cc: netdev
In-Reply-To: <1313519811-22352-1-git-send-email-alex.bluesman.smirnov@gmail.com>

From: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Date: Tue, 16 Aug 2011 22:36:51 +0400

> This patch provides base support for transmission of IPv6 packets as
> well as the formation of IPv6 link-local addresses and statelessly
> autoconfigured addresses on top of IEEE 802.15.4 networks.
> 
> For more information please look at the RFC4944 "Compression Format
> for IPv6 Datagrams in Low Power and Losst Networks (6LoWPAN).
> 
> Signed-off-by: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>

Patch applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] ipv4: one more case for non-local saddr in ICMP
From: David Miller @ 2011-08-25  2:37 UTC (permalink / raw)
  To: ja; +Cc: netdev, herbert
In-Reply-To: <alpine.LFD.2.00.1108151857420.1481@ja.ssi.bg>

From: Julian Anastasov <ja@ssi.bg>
Date: Mon, 15 Aug 2011 19:21:23 +0300 (EEST)

> 	May be there is one more case that we can avoid using
> non-local source for ICMP errors: xfrm_lookup, num_xfrms = 0 when
> reverse "Flow passes untransformed". Avoid using the input route
> if xfrm_lookup returns same dst.
> 
> Signed-off-by: Julian Anastasov <ja@ssi.bg>

Julian I'm going to defer on this patch unless you think there is
a real pressing reason to apply it.

Thanks.

^ permalink raw reply

* Re: [PATCH net-next v5 1/2] af-packet: Added TPACKET_V3 headers.
From: David Miller @ 2011-08-25  2:43 UTC (permalink / raw)
  To: loke.chetan; +Cc: netdev
In-Reply-To: <1313785096-911-2-git-send-email-loke.chetan@gmail.com>

From: Chetan Loke <loke.chetan@gmail.com>
Date: Fri, 19 Aug 2011 16:18:15 -0400

> Added TPACKET_V3 definitions.
> 
> Signed-off-by: Chetan Loke <loke.chetan@gmail.com>

Applied.

I would suggest, as a follow-up patch, we add some appropriate
prefixes to these new datastructures added to if_packet.h as
these are exposed to userspace.

For example "hdr_v1", "bd_ts", "bd_header_u", and "block_desc" are
just asking for namespace conflicts with something other API in
userspace or the user's own datastructures.

^ permalink raw reply

* Re: [PATCH net-next v5 2/2] af-packet: TPACKET_V3 flexible buffer implementation.
From: David Miller @ 2011-08-25  2:43 UTC (permalink / raw)
  To: loke.chetan; +Cc: netdev
In-Reply-To: <1313785096-911-3-git-send-email-loke.chetan@gmail.com>

From: Chetan Loke <loke.chetan@gmail.com>
Date: Fri, 19 Aug 2011 16:18:16 -0400

> 1) Blocks can be configured with non-static frame-size.
> 2) Read/poll is at a block-level(as opposed to packet-level).
> 3) Added poll timeout to avoid indefinite user-space wait on idle links.
> 4) Added user-configurable knobs:
>    4.1) block::timeout.
>    4.2) tpkt_hdr::sk_rxhash.
> 
> 
> Changes:
> C1) tpacket_rcv()
>     C1.1) packet_current_frame() is replaced by packet_current_rx_frame()
>           The bulk of the processing is then moved in the following chain:
>           packet_current_rx_frame()
>             __packet_lookup_frame_in_block
>               fill_curr_block()
>               or
>                 retire_current_block
>                 dispatch_next_block
>               or
>               return NULL(queue is plugged/paused)
> 
> Signed-off-by: Chetan Loke <loke.chetan@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v4] Proportional Rate Reduction for TCP.
From: David Miller @ 2011-08-25  2:43 UTC (permalink / raw)
  To: nanditad; +Cc: netdev, therbert, mattmathis, ycheng
In-Reply-To: <1313994117-7374-1-git-send-email-nanditad@google.com>

From: Nandita Dukkipati <nanditad@google.com>
Date: Sun, 21 Aug 2011 23:21:57 -0700

> This patch implements Proportional Rate Reduction (PRR) for TCP.
> PRR is an algorithm that determines TCP's sending rate in fast
> recovery. PRR avoids excessive window reductions and aims for
> the actual congestion window size at the end of recovery to be as
> close as possible to the window determined by the congestion control
> algorithm. PRR also improves accuracy of the amount of data sent
> during loss recovery.
> 
> The patch implements the recommended flavor of PRR called PRR-SSRB
> (Proportional rate reduction with slow start reduction bound) and
> replaces the existing rate halving algorithm. PRR improves upon the
> existing Linux fast recovery under a number of conditions including:
>   1) burst losses where the losses implicitly reduce the amount of
> outstanding data (pipe) below the ssthresh value selected by the
> congestion control algorithm and,
>   2) losses near the end of short flows where application runs out of
> data to send.
> 
> As an example, with the existing rate halving implementation a single
> loss event can cause a connection carrying short Web transactions to
> go into the slow start mode after the recovery. This is because during
> recovery Linux pulls the congestion window down to packets_in_flight+1
> on every ACK. A short Web response often runs out of new data to send
> and its pipe reduces to zero by the end of recovery when all its packets
> are drained from the network. Subsequent HTTP responses using the same
> connection will have to slow start to raise cwnd to ssthresh. PRR on
> the other hand aims for the cwnd to be as close as possible to ssthresh
> by the end of recovery.
> 
> A description of PRR and a discussion of its performance can be found at
> the following links:
> - IETF Draft:
>     http://tools.ietf.org/html/draft-mathis-tcpm-proportional-rate-reduction-01
> - IETF Slides:
>     http://www.ietf.org/proceedings/80/slides/tcpm-6.pdf
>     http://tools.ietf.org/agenda/81/slides/tcpm-2.pdf
> - Paper to appear in Internet Measurements Conference (IMC) 2011:
>     Improving TCP Loss Recovery
>     Nandita Dukkipati, Matt Mathis, Yuchung Cheng
> 
> Signed-off-by: Nandita Dukkipati <nanditad@google.com>

Applied.

^ permalink raw reply

* Re: [PATCH 0/2] sctp: patches for HEARTBEAT bug fix and improvement
From: David Miller @ 2011-08-25  2:43 UTC (permalink / raw)
  To: micchie; +Cc: netdev, weiyj.lk
In-Reply-To: <D42EEC2F-E0C8-4620-9841-98F7E68C88FA@sfc.wide.ad.jp>

From: Michio Honda <micchie@sfc.wide.ad.jp>
Date: Tue, 23 Aug 2011 00:44:32 +0900

> Series of 2 patches for bug fix and improvement around HEARTBEAT after the 
> ASCONF event
> 
> Michio Honda (2):
>   sctp: HEARTBEAT negotiation after ASCONF
>   sctp: Bundle HEAERTBEAT into ASCONF_ACK

Both applied.

^ permalink raw reply

* Re: [Patch] Scm: Remove unnecessary pid & credential references in Unix socket's send and receive path
From: David Miller @ 2011-08-25  2:43 UTC (permalink / raw)
  To: tim.c.chen
  Cc: eric.dumazet, viro, ebiederm, ak, matt.fleming, linux-kernel,
	netdev
In-Reply-To: <1314061046.2576.2922.camel@schen9-DESK>

From: Tim Chen <tim.c.chen@linux.intel.com>
Date: Mon, 22 Aug 2011 17:57:26 -0700

> On Mon, 2011-08-22 at 17:40 -0700, David Miller wrote:
>> From: Tim Chen <tim.c.chen@linux.intel.com>
>> Date: Fri, 19 Aug 2011 09:44:58 -0700
>> 
>> > -		/* Only send the fds in the first buffer */
>> > -		err = unix_scm_to_skb(siocb->scm, skb, !fds_sent);
>> > +		/* Only send the fds and no ref to pid in the first buffer */
>> > +		if (fds_sent)
>> > +			err = unix_scm_to_skb(siocb->scm, skb, !fds_sent, true);
>> > +		else
>> > +			err = unix_scm_to_skb(siocb->scm, skb, !fds_sent, false);
>> 
>> Just set this final boolean the way the third argument is, there is no
>> reason to replicate the entire function call twice just to set the
>> final argument to what "fds_sent" evaluates to as a boolean.
>> 
>> 		err = unix_scm_to_skb(siocb->scm, skb, !fds_sent, fds_sent);
>> 
>> ought to suffice.
> 
> Good point.  Patch updated as suggested.

Applied.

^ permalink raw reply

* Re: pull request: wireless 2011-08-22
From: Jeff Chua @ 2011-08-25  3:33 UTC (permalink / raw)
  To: David Miller, IvDoorn; +Cc: linville, linux-wireless, netdev, linux-kernel
In-Reply-To: <20110822.123326.1795268471389412471.davem@davemloft.net>

On Tue, Aug 23, 2011 at 3:33 AM, David Miller <davem@davemloft.net> wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
> Date: Mon, 22 Aug 2011 15:01:37 -0400
>
>> This is a batch of fixes intended for 3.1.  Included is rewrite of an
>> earlier iwlagn fix that was revealed to be flawed (bad pointer access
>> during module unload), a fix for a memory leak, and a trio of rt2x00
>> fixes with detailed changelogs.  These have all been in linux-next
>> for the last week with no reported complaints.
>>
>> Please let me know if there are problems!
>
> Pulled, thanks John.

I'm using the rt2800usb module for the Buffalo WLI-UC-GNM using ad-hoc mode.

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0411 ProdID=01a2 Rev= 1.01
S:  Manufacturer=Ralink
S:  Product=802.11 n WLAN

It works ok, but after idling for a while, it does not response, and
module needs to unloaded and modprobe again to make it work.

The same mac80211 and cfg80211 works for iwlagn and no problem with
idling timeout.

Is there any parameter to control the rt2800usb to make turn off power saving?

I've tried "iwconfig lwan0 power timeout 0 power off" but no effect.

Linux 3.1.0-rc3 with commit caca9510ff4e5d842c0589110243d60927836222.

Thanks,
Jeff.

^ permalink raw reply

* [PATCH net-next v2 00/10] Fix net header dependencies
From: Ben Hutchings @ 2011-08-25  4:38 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]

Various networking headers depend on definitions from others which they
don't include.  We can't fix all of these, because some definitions are
duplicated between kernel headers and glibc headers and we cannot tell
which is the right one to include.  We also have to be wary of
introducing a dependency cycle.

Since v1, I've dropped the patches to <linux/scc.h> and <linux/if_ppp.h>
and added the acknowledgements I got last time.

Ben.

Ben Hutchings (10):
  headers, pppox: Add missing #include to <linux/if_pppox.h>
  headers, ax25: Add missing #include to <linux/netrom.h>,
    <linux/rose.h>
  headers, pppol2tp: Use __kernel_pid_t in <linux/pppol2tp.h>
  headers, net: Use __kernel_sa_family_t in more definitions shared
    with userland
  headers, net: Define struct __kernel_sockaddr, replacing struct
    sockaddr
  headers, netfilter: Use kernel type names __u8, __u16, __u32
  headers, tipc: Add missing #include to <linux/tipc_config.h> for
    userland
  headers, netfilter: Add missing #include <limits.h> for userland
  headers, xtables: Add missing #include <linux/netfilter.h>
  headers, can: Add missing #include to <linux/can/bcm.h>

 include/linux/atalk.h                     |    3 ++-
 include/linux/ax25.h                      |    2 +-
 include/linux/caif/caif_socket.h          |    7 +------
 include/linux/can.h                       |    2 +-
 include/linux/can/bcm.h                   |    1 +
 include/linux/if.h                        |   12 ++++++------
 include/linux/if_pppol2tp.h               |    2 +-
 include/linux/if_pppox.h                  |    9 +++++----
 include/linux/in.h                        |    2 +-
 include/linux/ipx.h                       |    2 +-
 include/linux/irda.h                      |    9 +++------
 include/linux/l2tp.h                      |    7 ++++---
 include/linux/llc.h                       |   10 +++++++---
 include/linux/netfilter/xt_connlimit.h    |    1 +
 include/linux/netfilter/xt_conntrack.h    |    1 +
 include/linux/netfilter/xt_iprange.h      |    1 +
 include/linux/netfilter_arp/arp_tables.h  |   14 +++++++-------
 include/linux/netfilter_decnet.h          |    3 +++
 include/linux/netfilter_ipv4.h            |    3 +++
 include/linux/netfilter_ipv4/ip_tables.h  |   20 ++++++++++----------
 include/linux/netfilter_ipv6.h            |    3 +++
 include/linux/netfilter_ipv6/ip6_tables.h |   22 +++++++++++-----------
 include/linux/netlink.h                   |    2 +-
 include/linux/netrom.h                    |    2 ++
 include/linux/phonet.h                    |    6 ++++--
 include/linux/rose.h                      |    7 +++++--
 include/linux/socket.h                    |   17 +++++++++--------
 include/linux/tipc_config.h               |    4 ++++
 include/linux/un.h                        |    4 +++-
 include/linux/x25.h                       |    3 ++-
 30 files changed, 104 insertions(+), 77 deletions(-)

-- 
1.7.5.4



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply

* [PATCH net-next v2 01/10] headers, pppox: Add missing #include to <linux/if_pppox.h>
From: Ben Hutchings @ 2011-08-25  4:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Michal Ostrowski
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

<linux/if_ppox.h> uses ETH_ALEN, defined in <linux/if_ether.h>.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/if_pppox.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 397921b..60e5558 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -20,8 +20,8 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-#ifdef  __KERNEL__
 #include <linux/if_ether.h>
+#ifdef  __KERNEL__
 #include <linux/if.h>
 #include <linux/netdevice.h>
 #include <linux/ppp_channel.h>
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 02/10] headers, ax25: Add missing #include to <linux/netrom.h>, <linux/rose.h>
From: Ben Hutchings @ 2011-08-25  4:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Ralf Baechle, linux-hams
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

These headers use the ax25_address type defined in <linux/ax25.h>.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
---
 include/linux/netrom.h |    2 ++
 include/linux/rose.h   |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/netrom.h b/include/linux/netrom.h
index 6939b32..af7313c 100644
--- a/include/linux/netrom.h
+++ b/include/linux/netrom.h
@@ -7,6 +7,8 @@
 #ifndef	NETROM_KERNEL_H
 #define	NETROM_KERNEL_H
 
+#include <linux/ax25.h>
+
 #define NETROM_MTU	236
 
 #define NETROM_T1	1
diff --git a/include/linux/rose.h b/include/linux/rose.h
index c7b4b18..e8289cd 100644
--- a/include/linux/rose.h
+++ b/include/linux/rose.h
@@ -7,6 +7,8 @@
 #ifndef	ROSE_KERNEL_H
 #define	ROSE_KERNEL_H
 
+#include <linux/ax25.h>
+
 #define ROSE_MTU	251
 
 #define ROSE_MAX_DIGIS 6
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 03/10] headers, pppol2tp: Use __kernel_pid_t in <linux/pppol2tp.h>
From: Ben Hutchings @ 2011-08-25  4:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

<linux/types.h> defines __kernel_pid_t for userland; pid_t is
defined elsewhere (and potentially differently).

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/if_pppol2tp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index 184bc55..23cefa1 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -39,7 +39,7 @@ struct pppol2tp_addr {
  * bits. So we need a different sockaddr structure.
  */
 struct pppol2tpv3_addr {
-	pid_t	pid;			/* pid that owns the fd.
+	__kernel_pid_t	pid;		/* pid that owns the fd.
 					 * 0 => current */
 	int	fd;			/* FD of UDP or IP socket to use */
 
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 04/10] headers, net: Use __kernel_sa_family_t in more definitions shared with userland
From: Ben Hutchings @ 2011-08-25  4:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 11414 bytes --]

Complete the work started with commit
6602a4baf4d1a73cc4685a39ef859e1c5ddf654c ('net: Make userland include
of netlink.h more sane').

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/atalk.h            |    3 ++-
 include/linux/ax25.h             |    2 +-
 include/linux/caif/caif_socket.h |    7 +------
 include/linux/can.h              |    2 +-
 include/linux/if_pppox.h         |    7 ++++---
 include/linux/in.h               |    2 +-
 include/linux/ipx.h              |    2 +-
 include/linux/irda.h             |    9 +++------
 include/linux/l2tp.h             |    7 ++++---
 include/linux/llc.h              |   10 +++++++---
 include/linux/netlink.h          |    2 +-
 include/linux/phonet.h           |    5 +++--
 include/linux/rose.h             |    5 +++--
 include/linux/un.h               |    4 +++-
 include/linux/x25.h              |    3 ++-
 15 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d34c187..f57c368 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <asm/byteorder.h>
+#include <linux/socket.h>
 
 /*
  * AppleTalk networking structures
@@ -28,7 +29,7 @@ struct atalk_addr {
 };
 
 struct sockaddr_at {
-	sa_family_t	  sat_family;
+	__kernel_sa_family_t sat_family;
 	__u8		  sat_port;
 	struct atalk_addr sat_addr;
 	char		  sat_zero[8];
diff --git a/include/linux/ax25.h b/include/linux/ax25.h
index 56c11f0..74c89a4 100644
--- a/include/linux/ax25.h
+++ b/include/linux/ax25.h
@@ -47,7 +47,7 @@ typedef struct {
 } ax25_address;
 
 struct sockaddr_ax25 {
-	sa_family_t	sax25_family;
+	__kernel_sa_family_t sax25_family;
 	ax25_address	sax25_call;
 	int		sax25_ndigis;
 	/* Digipeater ax25_address sets follow */
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
index d9cb19b..3f3bac6 100644
--- a/include/linux/caif/caif_socket.h
+++ b/include/linux/caif/caif_socket.h
@@ -9,12 +9,7 @@
 #define _LINUX_CAIF_SOCKET_H
 
 #include <linux/types.h>
-
-#ifdef __KERNEL__
 #include <linux/socket.h>
-#else
-#include <sys/socket.h>
-#endif
 
 /**
  * enum caif_link_selector -    Physical Link Selection.
@@ -144,7 +139,7 @@ enum caif_debug_service {
  * CAIF Channel. It defines the service to connect to on the modem.
  */
 struct sockaddr_caif {
-	sa_family_t  family;
+	__kernel_sa_family_t  family;
 	union {
 		struct {
 			__u8  type;		/* type: enum caif_at_type */
diff --git a/include/linux/can.h b/include/linux/can.h
index d183333..bb047dc 100644
--- a/include/linux/can.h
+++ b/include/linux/can.h
@@ -78,7 +78,7 @@ struct can_frame {
  * @can_addr:    protocol specific address information
  */
 struct sockaddr_can {
-	sa_family_t can_family;
+	__kernel_sa_family_t can_family;
 	int         can_ifindex;
 	union {
 		/* transport protocol class address information (e.g. ISOTP) */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 60e5558..b5f927f 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -20,6 +20,7 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
+#include <linux/socket.h>
 #include <linux/if_ether.h>
 #ifdef  __KERNEL__
 #include <linux/if.h>
@@ -63,7 +64,7 @@ struct pptp_addr {
 #define PX_MAX_PROTO   3
 
 struct sockaddr_pppox {
-	sa_family_t     sa_family;            /* address family, AF_PPPOX */
+	__kernel_sa_family_t sa_family;       /* address family, AF_PPPOX */
 	unsigned int    sa_protocol;          /* protocol identifier */
 	union {
 		struct pppoe_addr  pppoe;
@@ -77,7 +78,7 @@ struct sockaddr_pppox {
  * type instead.
  */
 struct sockaddr_pppol2tp {
-	sa_family_t     sa_family;      /* address family, AF_PPPOX */
+	__kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
 	unsigned int    sa_protocol;    /* protocol identifier */
 	struct pppol2tp_addr pppol2tp;
 } __attribute__((packed));
@@ -86,7 +87,7 @@ struct sockaddr_pppol2tp {
  * bits. So we need a different sockaddr structure.
  */
 struct sockaddr_pppol2tpv3 {
-	sa_family_t     sa_family;      /* address family, AF_PPPOX */
+	__kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
 	unsigned int    sa_protocol;    /* protocol identifier */
 	struct pppol2tpv3_addr pppol2tp;
 } __attribute__((packed));
diff --git a/include/linux/in.h b/include/linux/in.h
index beeb6de..01129c0 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -182,7 +182,7 @@ struct in_pktinfo {
 /* Structure describing an Internet (IP) socket address. */
 #define __SOCK_SIZE__	16		/* sizeof(struct sockaddr)	*/
 struct sockaddr_in {
-  sa_family_t		sin_family;	/* Address family		*/
+  __kernel_sa_family_t	sin_family;	/* Address family		*/
   __be16		sin_port;	/* Port number			*/
   struct in_addr	sin_addr;	/* Internet address		*/
 
diff --git a/include/linux/ipx.h b/include/linux/ipx.h
index aabb1d2..3d48014 100644
--- a/include/linux/ipx.h
+++ b/include/linux/ipx.h
@@ -7,7 +7,7 @@
 #define IPX_MTU		576
 
 struct sockaddr_ipx {
-	sa_family_t	sipx_family;
+	__kernel_sa_family_t sipx_family;
 	__be16		sipx_port;
 	__be32		sipx_network;
 	unsigned char 	sipx_node[IPX_NODE_LEN];
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 00bdad0..a014c32 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -26,12 +26,9 @@
 #define KERNEL_IRDA_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
-/* Please do *not* add any #include in this file, this file is
- * included as-is in user space.
- * Please fix the calling file to properly included needed files before
- * this one, or preferably to include <net/irda/irda.h> instead.
- * Jean II */
+/* Note that this file is shared with user space. */
 
 /* Hint bit positions for first hint byte */
 #define HINT_PNP         0x01
@@ -125,7 +122,7 @@ enum {
 #define LSAP_ANY              0xff
 
 struct sockaddr_irda {
-	sa_family_t sir_family;   /* AF_IRDA */
+	__kernel_sa_family_t sir_family; /* AF_IRDA */
 	__u8        sir_lsap_sel; /* LSAP selector */
 	__u32       sir_addr;     /* Device address */
 	char        sir_name[25]; /* Usually <service>:IrDA:TinyTP */
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
index 4bdb31d..e77d7f9 100644
--- a/include/linux/l2tp.h
+++ b/include/linux/l2tp.h
@@ -8,8 +8,8 @@
 #define _LINUX_L2TP_H_
 
 #include <linux/types.h>
-#ifdef __KERNEL__
 #include <linux/socket.h>
+#ifdef __KERNEL__
 #include <linux/in.h>
 #else
 #include <netinet/in.h>
@@ -26,14 +26,15 @@
 #define __SOCK_SIZE__	16		/* sizeof(struct sockaddr)	*/
 struct sockaddr_l2tpip {
 	/* The first fields must match struct sockaddr_in */
-	sa_family_t	l2tp_family;	/* AF_INET */
+	__kernel_sa_family_t l2tp_family; /* AF_INET */
 	__be16		l2tp_unused;	/* INET port number (unused) */
 	struct in_addr	l2tp_addr;	/* Internet address */
 
 	__u32		l2tp_conn_id;	/* Connection ID of tunnel */
 
 	/* Pad to size of `struct sockaddr'. */
-	unsigned char	__pad[sizeof(struct sockaddr) - sizeof(sa_family_t) -
+	unsigned char	__pad[sizeof(struct sockaddr) -
+			      sizeof(__kernel_sa_family_t) -
 			      sizeof(__be16) - sizeof(struct in_addr) -
 			      sizeof(__u32)];
 };
diff --git a/include/linux/llc.h b/include/linux/llc.h
index ad7074b..a2418ae 100644
--- a/include/linux/llc.h
+++ b/include/linux/llc.h
@@ -12,16 +12,20 @@
  *
  * See the GNU General Public License for more details.
  */
+
+#include <linux/socket.h>
+
 #define __LLC_SOCK_SIZE__ 16	/* sizeof(sockaddr_llc), word align. */
 struct sockaddr_llc {
-	sa_family_t     sllc_family;	/* AF_LLC */
-	sa_family_t	sllc_arphrd;	/* ARPHRD_ETHER */
+	__kernel_sa_family_t sllc_family; /* AF_LLC */
+	__kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */
 	unsigned char   sllc_test;
 	unsigned char   sllc_xid;
 	unsigned char	sllc_ua;	/* UA data, only for SOCK_STREAM. */
 	unsigned char   sllc_sap;
 	unsigned char   sllc_mac[IFHWADDRLEN];
-	unsigned char   __pad[__LLC_SOCK_SIZE__ - sizeof(sa_family_t) * 2 -
+	unsigned char   __pad[__LLC_SOCK_SIZE__ -
+			      sizeof(__kernel_sa_family_t) * 2 -
 			      sizeof(unsigned char) * 4 - IFHWADDRLEN];
 };
 
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 180540a..8180cd9 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -1,7 +1,7 @@
 #ifndef __LINUX_NETLINK_H
 #define __LINUX_NETLINK_H
 
-#include <linux/socket.h> /* for sa_family_t */
+#include <linux/socket.h> /* for __kernel_sa_family_t */
 #include <linux/types.h>
 
 #define NETLINK_ROUTE		0	/* Routing/device hook				*/
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 6fb1384..f53a416 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -24,6 +24,7 @@
 #define LINUX_PHONET_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
 /* Automatic protocol selection */
 #define PN_PROTO_TRANSPORT	0
@@ -96,11 +97,11 @@ struct phonetmsg {
 
 /* Phonet socket address structure */
 struct sockaddr_pn {
-	sa_family_t spn_family;
+	__kernel_sa_family_t spn_family;
 	__u8 spn_obj;
 	__u8 spn_dev;
 	__u8 spn_resource;
-	__u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
+	__u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
 } __attribute__((packed));
 
 /* Well known address */
diff --git a/include/linux/rose.h b/include/linux/rose.h
index e8289cd..1fcfe95 100644
--- a/include/linux/rose.h
+++ b/include/linux/rose.h
@@ -7,6 +7,7 @@
 #ifndef	ROSE_KERNEL_H
 #define	ROSE_KERNEL_H
 
+#include <linux/socket.h>
 #include <linux/ax25.h>
 
 #define ROSE_MTU	251
@@ -46,7 +47,7 @@ typedef struct {
 } rose_address;
 
 struct sockaddr_rose {
-	sa_family_t	srose_family;
+	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
 	ax25_address	srose_call;
 	int		srose_ndigis;
@@ -54,7 +55,7 @@ struct sockaddr_rose {
 };
 
 struct full_sockaddr_rose {
-	sa_family_t	srose_family;
+	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
 	ax25_address	srose_call;
 	unsigned int	srose_ndigis;
diff --git a/include/linux/un.h b/include/linux/un.h
index 45561c5..3ed3e46 100644
--- a/include/linux/un.h
+++ b/include/linux/un.h
@@ -1,10 +1,12 @@
 #ifndef _LINUX_UN_H
 #define _LINUX_UN_H
 
+#include <linux/socket.h>
+
 #define UNIX_PATH_MAX	108
 
 struct sockaddr_un {
-	sa_family_t sun_family;	/* AF_UNIX */
+	__kernel_sa_family_t sun_family; /* AF_UNIX */
 	char sun_path[UNIX_PATH_MAX];	/* pathname */
 };
 
diff --git a/include/linux/x25.h b/include/linux/x25.h
index 6450a7f..810cce6 100644
--- a/include/linux/x25.h
+++ b/include/linux/x25.h
@@ -12,6 +12,7 @@
 #define	X25_KERNEL_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
 #define	SIOCX25GSUBSCRIP	(SIOCPROTOPRIVATE + 0)
 #define	SIOCX25SSUBSCRIP	(SIOCPROTOPRIVATE + 1)
@@ -57,7 +58,7 @@ struct x25_address {
  *	Linux X.25 Address structure, used for bind, and connect mostly.
  */
 struct sockaddr_x25 {
-	sa_family_t	   sx25_family;		/* Must be AF_X25 */
+	__kernel_sa_family_t sx25_family;	/* Must be AF_X25 */
 	struct x25_address sx25_addr;		/* X.121 Address */
 };
 
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 05/10] headers, net: Define struct __kernel_sockaddr, replacing struct sockaddr
From: Ben Hutchings @ 2011-08-25  4:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 3210 bytes --]

Commit 9c501935a3cdcf6b1d35aaee3aa11c7a7051a305 ('net: Support
inclusion of <linux/socket.h> before <sys/socket.h>') removed the
definition of struct sockaddr for userland.

But we still have several headers using struct sockaddr, and we
shouldn't make them include <sys/socket.h> as that risks recursive
inclusion in future.  Define and use an identical struct
__kernel_sockaddr instead.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/if.h     |   12 ++++++------
 include/linux/phonet.h |    3 ++-
 include/linux/socket.h |   17 +++++++++--------
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/include/linux/if.h b/include/linux/if.h
index db20bd4..f9ce5fb 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -20,7 +20,7 @@
 #define _LINUX_IF_H
 
 #include <linux/types.h>		/* for "__kernel_caddr_t" et al	*/
-#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
+#include <linux/socket.h>		/* for "struct __kernel_sockaddr" et al	*/
 #include <linux/compiler.h>		/* for "__user" et al           */
 
 #define	IFNAMSIZ	16
@@ -176,11 +176,11 @@ struct ifreq {
 	} ifr_ifrn;
 	
 	union {
-		struct	sockaddr ifru_addr;
-		struct	sockaddr ifru_dstaddr;
-		struct	sockaddr ifru_broadaddr;
-		struct	sockaddr ifru_netmask;
-		struct  sockaddr ifru_hwaddr;
+		struct	__kernel_sockaddr ifru_addr;
+		struct	__kernel_sockaddr ifru_dstaddr;
+		struct	__kernel_sockaddr ifru_broadaddr;
+		struct	__kernel_sockaddr ifru_netmask;
+		struct  __kernel_sockaddr ifru_hwaddr;
 		short	ifru_flags;
 		int	ifru_ivalue;
 		int	ifru_mtu;
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f53a416..9aba9ce 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -101,7 +101,8 @@ struct sockaddr_pn {
 	__u8 spn_obj;
 	__u8 spn_dev;
 	__u8 spn_resource;
-	__u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
+	__u8 spn_zero[sizeof(struct __kernel_sockaddr) -
+		      sizeof(__kernel_sa_family_t) - 3];
 } __attribute__((packed));
 
 /* Well known address */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index d0e77f6..f13ad7b 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -10,6 +10,14 @@
 
 typedef unsigned short __kernel_sa_family_t;
 
+/*
+ *	1003.1g requires sa_family_t and that sa_data is char.
+ */
+struct __kernel_sockaddr {
+	__kernel_sa_family_t sa_family;	/* address family, AF_xxx	*/
+	char		sa_data[14];	/* 14 bytes of protocol address	*/
+};
+
 struct __kernel_sockaddr_storage {
 	__kernel_sa_family_t	ss_family;		/* address family */
 	/* Following field(s) are implementation specific */
@@ -39,15 +47,8 @@ extern void socket_seq_show(struct seq_file *seq);
 
 typedef __kernel_sa_family_t	sa_family_t;
 
-/*
- *	1003.1g requires sa_family_t and that sa_data is char.
- */
+#define sockaddr __kernel_sockaddr
  
-struct sockaddr {
-	sa_family_t	sa_family;	/* address family, AF_xxx	*/
-	char		sa_data[14];	/* 14 bytes of protocol address	*/
-};
-
 struct linger {
 	int		l_onoff;	/* Linger active		*/
 	int		l_linger;	/* How long to linger for	*/
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 06/10] headers, netfilter: Use kernel type names __u8, __u16, __u32
From: Ben Hutchings @ 2011-08-25  4:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Patrick McHardy, netfilter-devel
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 5343 bytes --]

These types are guaranteed to be defined by <linux/types.h> for
both userland and kernel, unlike u_intN_t.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Patrick McHardy <kaber@trash.net>
---
 include/linux/netfilter_arp/arp_tables.h  |   14 +++++++-------
 include/linux/netfilter_ipv4/ip_tables.h  |   20 ++++++++++----------
 include/linux/netfilter_ipv6/ip6_tables.h |   22 +++++++++++-----------
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index adbf4bf..e08565d 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -52,7 +52,7 @@ struct arpt_arp {
 	struct in_addr smsk, tmsk;
 
 	/* Device hw address length, src+target device addresses */
-	u_int8_t arhln, arhln_mask;
+	__u8 arhln, arhln_mask;
 	struct arpt_devaddr_info src_devaddr;
 	struct arpt_devaddr_info tgt_devaddr;
 
@@ -71,9 +71,9 @@ struct arpt_arp {
 	unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int16_t invflags;
+	__u16 invflags;
 };
 
 /* Values for "flag" field in struct arpt_ip (general arp structure).
@@ -102,9 +102,9 @@ struct arpt_entry
 	struct arpt_arp arp;
 
 	/* Size of arpt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of arpt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -260,8 +260,8 @@ extern unsigned int arpt_do_table(struct sk_buff *skb,
 
 struct compat_arpt_entry {
 	struct arpt_arp arp;
-	u_int16_t target_offset;
-	u_int16_t next_offset;
+	__u16 target_offset;
+	__u16 next_offset;
 	compat_uint_t comefrom;
 	struct compat_xt_counters counters;
 	unsigned char elems[0];
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 64a5d95..db79231 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -81,12 +81,12 @@ struct ipt_ip {
 	unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
 
 	/* Protocol, 0 = ANY */
-	u_int16_t proto;
+	__u16 proto;
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int8_t invflags;
+	__u8 invflags;
 };
 
 /* Values for "flag" field in struct ipt_ip (general ip structure). */
@@ -114,9 +114,9 @@ struct ipt_entry {
 	unsigned int nfcache;
 
 	/* Size of ipt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of ipt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -149,9 +149,9 @@ struct ipt_entry {
 
 /* ICMP matching stuff */
 struct ipt_icmp {
-	u_int8_t type;				/* type to match */
-	u_int8_t code[2];			/* range of code */
-	u_int8_t invflags;			/* Inverse flags */
+	__u8 type;				/* type to match */
+	__u8 code[2];				/* range of code */
+	__u8 invflags;				/* Inverse flags */
 };
 
 /* Values for "inv" field for struct ipt_icmp. */
@@ -288,8 +288,8 @@ extern unsigned int ipt_do_table(struct sk_buff *skb,
 struct compat_ipt_entry {
 	struct ipt_ip ip;
 	compat_uint_t nfcache;
-	u_int16_t target_offset;
-	u_int16_t next_offset;
+	__u16 target_offset;
+	__u16 next_offset;
 	compat_uint_t comefrom;
 	struct compat_xt_counters counters;
 	unsigned char elems[0];
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index c9784f7..f549adc 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -81,14 +81,14 @@ struct ip6t_ip6 {
 	 *   MH do not match any packets.
 	 * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol.
 	 */
-	u_int16_t proto;
+	__u16 proto;
 	/* TOS to match iff flags & IP6T_F_TOS */
-	u_int8_t tos;
+	__u8 tos;
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int8_t invflags;
+	__u8 invflags;
 };
 
 /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
@@ -118,9 +118,9 @@ struct ip6t_entry {
 	unsigned int nfcache;
 
 	/* Size of ipt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of ipt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -186,9 +186,9 @@ struct ip6t_error {
 
 /* ICMP matching stuff */
 struct ip6t_icmp {
-	u_int8_t type;				/* type to match */
-	u_int8_t code[2];			/* range of code */
-	u_int8_t invflags;			/* Inverse flags */
+	__u8 type;				/* type to match */
+	__u8 code[2];				/* range of code */
+	__u8 invflags;				/* Inverse flags */
 };
 
 /* Values for "inv" field for struct ipt_icmp. */
@@ -298,8 +298,8 @@ extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 struct compat_ip6t_entry {
 	struct ip6t_ip6 ipv6;
 	compat_uint_t nfcache;
-	u_int16_t target_offset;
-	u_int16_t next_offset;
+	__u16 target_offset;
+	__u16 next_offset;
 	compat_uint_t comefrom;
 	struct compat_xt_counters counters;
 	unsigned char elems[0];
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 07/10] headers, tipc: Add missing #include to <linux/tipc_config.h> for userland
From: Ben Hutchings @ 2011-08-25  4:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jon Maloy, Allan Stephens, tipc-discussion
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

<linux/tipc_config.h> defines inline functions using ntohs() etc.
For userland these are defined in <arpa/inet.h>.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/tipc_config.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 0db2395..9730b0e 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -41,6 +41,10 @@
 #include <linux/string.h>
 #include <asm/byteorder.h>
 
+#ifndef __KERNEL__
+#include <arpa/inet.h> /* for ntohs etc. */
+#endif
+
 /*
  * Configuration
  *
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related

* [PATCH net-next v2 08/10] headers, netfilter: Add missing #include <limits.h> for userland
From: Ben Hutchings @ 2011-08-25  4:45 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Patrick McHardy, netfilter-devel
In-Reply-To: <1314247131.27179.116.camel@deadeye>

[-- Attachment #1: Type: text/plain, Size: 1623 bytes --]

Various headers use INT_MIN and INT_MAX, which are defined for
userland in <limits.h>.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Patrick McHardy <kaber@trash.net>
---
 include/linux/netfilter_decnet.h |    3 +++
 include/linux/netfilter_ipv4.h   |    3 +++
 include/linux/netfilter_ipv6.h   |    3 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/netfilter_decnet.h b/include/linux/netfilter_decnet.h
index 6f42536..0b09732 100644
--- a/include/linux/netfilter_decnet.h
+++ b/include/linux/netfilter_decnet.h
@@ -11,6 +11,9 @@
 
 /* only for userspace compatibility */
 #ifndef __KERNEL__
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_DN_SRC		0x0001
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 29c7727..fa0946c 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -9,6 +9,9 @@
 
 /* only for userspace compatibility */
 #ifndef __KERNEL__
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_IP_SRC		0x0001
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 1f7e300..57c0251 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -12,6 +12,9 @@
 
 /* only for userspace compatibility */
 #ifndef __KERNEL__
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_IP6_SRC              0x0001
-- 
1.7.5.4




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox