Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/davem/net-2.6

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  [IPV4]: Explicitly call fib_get_table() in fib_frontend.c
  [NET]: Use BUILD_BUG_ON in net/core/flowi.c
  [NET]: Remove in-code externs for some functions from net/core/dev.c
  [NET]: Don't declare extern variables in net/core/sysctl_net_core.c
  [TCP]: Remove unneeded implicit type cast when calling tcp_minshall_update()
  [NET]: Treat the sign of the result of skb_headroom() consistently
  [9P]: Fix missing unlock before return in p9_mux_poll_start
  [PKT_SCHED]: Fix sch_prio.c build with CONFIG_NETDEVICES_MULTIQUEUE
  [IPV4] ip_gre: sendto/recvfrom NBMA address
  [SCTP]: Consolidate sctp_ulpq_renege_xxx functions
  [NETLINK]: Fix ACK processing after netlink_dump_start
  [VLAN]: MAINTAINERS update
  [DCCP]: Implement SIOCINQ/FIONREAD
  [NET]: Validate device addr prior to interface-up
  • Loading branch information
Linus Torvalds committed Oct 25, 2007
2 parents 22fa8d5 + 03cf786 commit 06dbbfe
Show file tree
Hide file tree
Showing 26 changed files with 133 additions and 83 deletions.
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4148,6 +4148,12 @@ W: http://linuxtv.org
T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
S: Maintained

VLAN (802.1Q)
P: Patrick McHardy
M: kaber@trash.net
L: netdev@vger.kernel.org
S: Maintained

VT1211 HARDWARE MONITOR DRIVER
P: Juerg Haefliger
M: juergh@gmail.com
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/rrunner.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen
*/

/*
* These are checked at init time to see if they are at least 256KB
* and increased to 256KB if they are not. This is done to avoid ending
* up with socket buffers smaller than the MTU size,
* sysctl_[wr]mem_max are checked at init time to see if they are at
* least 256KB and increased to 256KB if they are not. This is done to
* avoid ending up with socket buffers smaller than the MTU size,
*/
extern __u32 sysctl_wmem_max;
extern __u32 sysctl_rmem_max;

static int __devinit rr_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
Expand Down
2 changes: 2 additions & 0 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ struct net_device
#define HAVE_SET_MAC_ADDR
int (*set_mac_address)(struct net_device *dev,
void *addr);
#define HAVE_VALIDATE_ADDR
int (*validate_addr)(struct net_device *dev);
#define HAVE_PRIVATE_IOCTL
int (*do_ioctl)(struct net_device *dev,
struct ifreq *ifr, int cmd);
Expand Down
4 changes: 2 additions & 2 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
*
* Return the number of bytes of free space at the head of an &sk_buff.
*/
static inline int skb_headroom(const struct sk_buff *skb)
static inline unsigned int skb_headroom(const struct sk_buff *skb)
{
return skb->data - skb->head;
}
Expand Down Expand Up @@ -1347,7 +1347,7 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
* Returns true if modifying the header part of the cloned buffer
* does not requires the data to be copied.
*/
static inline int skb_clone_writable(struct sk_buff *skb, int len)
static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
{
return !skb_header_cloned(skb) &&
skb_headroom(skb) + len <= skb->hdr_len;
Expand Down
2 changes: 1 addition & 1 deletion include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
return left <= tcp_max_burst(tp);
}

static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
const struct sk_buff *skb)
{
if (skb->len < mss)
Expand Down
2 changes: 2 additions & 0 deletions include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
extern struct sock *xfrm_nl;
extern u32 sysctl_xfrm_aevent_etime;
extern u32 sysctl_xfrm_aevent_rseqth;
extern int sysctl_xfrm_larval_drop;
extern u32 sysctl_xfrm_acq_expires;

extern struct mutex xfrm_cfg_mutex;

Expand Down
4 changes: 3 additions & 1 deletion net/9p/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ static int p9_mux_poll_start(struct p9_conn *m)
}

if (i >= ARRAY_SIZE(p9_mux_poll_tasks)) {
if (vptlast == NULL)
if (vptlast == NULL) {
mutex_unlock(&p9_mux_task_lock);
return -ENOMEM;
}

P9_DPRINTK(P9_DEBUG_MUX, "put in proc %d\n", i);
list_add(&m->mux_list, &vptlast->mux_list);
Expand Down
20 changes: 11 additions & 9 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@
#include <linux/ctype.h>
#include <linux/if_arp.h>

#include "net-sysfs.h"

/*
* The list of packet types we will receive (as opposed to discard)
* and the routines to invoke.
Expand Down Expand Up @@ -249,10 +251,6 @@ static RAW_NOTIFIER_HEAD(netdev_chain);

DEFINE_PER_CPU(struct softnet_data, softnet_data);

extern int netdev_kobject_init(void);
extern int netdev_register_kobject(struct net_device *);
extern void netdev_unregister_kobject(struct net_device *);

#ifdef CONFIG_DEBUG_LOCK_ALLOC
/*
* register_netdevice() inits dev->_xmit_lock and sets lockdep class
Expand Down Expand Up @@ -1007,17 +1005,20 @@ int dev_open(struct net_device *dev)
* Call device private open method
*/
set_bit(__LINK_STATE_START, &dev->state);
if (dev->open) {

if (dev->validate_addr)
ret = dev->validate_addr(dev);

if (!ret && dev->open)
ret = dev->open(dev);
if (ret)
clear_bit(__LINK_STATE_START, &dev->state);
}

/*
* If it went open OK then:
*/

if (!ret) {
if (ret)
clear_bit(__LINK_STATE_START, &dev->state);
else {
/*
* Set the flags.
*/
Expand All @@ -1038,6 +1039,7 @@ int dev_open(struct net_device *dev)
*/
call_netdevice_notifiers(NETDEV_UP, dev);
}

return ret;
}

Expand Down
5 changes: 1 addition & 4 deletions net/core/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ typedef u64 flow_compare_t;
typedef u32 flow_compare_t;
#endif

extern void flowi_is_missized(void);

/* I hear what you're saying, use memcmp. But memcmp cannot make
* important assumptions that we can here, such as alignment and
* constant size.
Expand All @@ -153,8 +151,7 @@ static int flow_key_compare(struct flowi *key1, struct flowi *key2)
flow_compare_t *k1, *k1_lim, *k2;
const int n_elem = sizeof(struct flowi) / sizeof(flow_compare_t);

if (sizeof(struct flowi) % sizeof(flow_compare_t))
flowi_is_missized();
BUILD_BUG_ON(sizeof(struct flowi) % sizeof(flow_compare_t));

k1 = (flow_compare_t *) key1;
k1_lim = k1 + n_elem;
Expand Down
2 changes: 2 additions & 0 deletions net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <linux/wireless.h>
#include <net/iw_handler.h>

#include "net-sysfs.h"

#ifdef CONFIG_SYSFS
static const char fmt_hex[] = "%#x\n";
static const char fmt_long_hex[] = "%#lx\n";
Expand Down
8 changes: 8 additions & 0 deletions net/core/net-sysfs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef __NET_SYSFS_H__
#define __NET_SYSFS_H__

int netdev_kobject_init(void);
int netdev_register_kobject(struct net_device *);
void netdev_unregister_kobject(struct net_device *);

#endif
17 changes: 2 additions & 15 deletions net/core/sysctl_net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,12 @@
#include <linux/sysctl.h>
#include <linux/module.h>
#include <linux/socket.h>
#include <linux/netdevice.h>
#include <net/sock.h>
#include <net/xfrm.h>

#ifdef CONFIG_SYSCTL

extern int netdev_max_backlog;
extern int weight_p;

extern __u32 sysctl_wmem_max;
extern __u32 sysctl_rmem_max;

extern int sysctl_core_destroy_delay;

#ifdef CONFIG_XFRM
extern u32 sysctl_xfrm_aevent_etime;
extern u32 sysctl_xfrm_aevent_rseqth;
extern int sysctl_xfrm_larval_drop;
extern u32 sysctl_xfrm_acq_expires;
#endif

ctl_table core_table[] = {
#ifdef CONFIG_NET
{
Expand Down
33 changes: 31 additions & 2 deletions net/dccp/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <net/sock.h>
#include <net/xfrm.h>

#include <asm/ioctls.h>
#include <asm/semaphore.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
Expand Down Expand Up @@ -378,8 +379,36 @@ EXPORT_SYMBOL_GPL(dccp_poll);

int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
{
dccp_pr_debug("entry\n");
return -ENOIOCTLCMD;
int rc = -ENOTCONN;

lock_sock(sk);

if (sk->sk_state == DCCP_LISTEN)
goto out;

switch (cmd) {
case SIOCINQ: {
struct sk_buff *skb;
unsigned long amount = 0;

skb = skb_peek(&sk->sk_receive_queue);
if (skb != NULL) {
/*
* We will only return the amount of this packet since
* that is all that will be read.
*/
amount = skb->len;
}
rc = put_user(amount, (int __user *)arg);
}
break;
default:
rc = -ENOIOCTLCMD;
break;
}
out:
release_sock(sk);
return rc;
}

EXPORT_SYMBOL_GPL(dccp_ioctl);
Expand Down
9 changes: 9 additions & 0 deletions net/ethernet/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}

static int eth_validate_addr(struct net_device *dev)
{
if (!is_valid_ether_addr(dev->dev_addr))
return -EINVAL;

return 0;
}

const struct header_ops eth_header_ops ____cacheline_aligned = {
.create = eth_header,
.parse = eth_header_parse,
Expand All @@ -317,6 +325,7 @@ void ether_setup(struct net_device *dev)

dev->change_mtu = eth_change_mtu;
dev->set_mac_address = eth_mac_addr;
dev->validate_addr = eth_validate_addr;

dev->type = ARPHRD_ETHER;
dev->hard_header_len = ETH_HLEN;
Expand Down
12 changes: 7 additions & 5 deletions net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ struct net_device * ip_dev_find(__be32 addr)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res;
struct net_device *dev = NULL;
struct fib_table *local_table;

#ifdef CONFIG_IP_MULTIPLE_TABLES
res.r = NULL;
#endif

if (!ip_fib_local_table ||
ip_fib_local_table->tb_lookup(ip_fib_local_table, &fl, &res))
local_table = fib_get_table(RT_TABLE_LOCAL);
if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
return NULL;
if (res.type != RTN_LOCAL)
goto out;
Expand All @@ -152,6 +153,7 @@ unsigned inet_addr_type(__be32 addr)
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res;
unsigned ret = RTN_BROADCAST;
struct fib_table *local_table;

if (ZERONET(addr) || BADCLASS(addr))
return RTN_BROADCAST;
Expand All @@ -162,10 +164,10 @@ unsigned inet_addr_type(__be32 addr)
res.r = NULL;
#endif

if (ip_fib_local_table) {
local_table = fib_get_table(RT_TABLE_LOCAL);
if (local_table) {
ret = RTN_UNICAST;
if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
&fl, &res)) {
if (!local_table->tb_lookup(local_table, &fl, &res)) {
ret = res.type;
fib_res_put(&res);
}
Expand Down
14 changes: 12 additions & 2 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct rtable *rt; /* Route to the other host */
struct net_device *tdev; /* Device to other host */
struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */
unsigned int max_headroom; /* The extra header space needed */
int gre_hlen;
__be32 dst;
int mtu;
Expand Down Expand Up @@ -1033,7 +1033,6 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
return 0;
}

#ifdef CONFIG_NET_IPGRE_BROADCAST
/* Nice toy. Unfortunately, useless in real life :-)
It allows to construct virtual multiprotocol broadcast "LAN"
over the Internet, provided multicast routing is tuned.
Expand Down Expand Up @@ -1092,10 +1091,19 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
return -t->hlen;
}

static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr)
{
struct iphdr *iph = (struct iphdr*) skb_mac_header(skb);
memcpy(haddr, &iph->saddr, 4);
return 4;
}

static const struct header_ops ipgre_header_ops = {
.create = ipgre_header,
.parse = ipgre_header_parse,
};

#ifdef CONFIG_NET_IPGRE_BROADCAST
static int ipgre_open(struct net_device *dev)
{
struct ip_tunnel *t = netdev_priv(dev);
Expand Down Expand Up @@ -1197,6 +1205,8 @@ static int ipgre_tunnel_init(struct net_device *dev)
dev->stop = ipgre_close;
}
#endif
} else {
dev->header_ops = &ipgre_header_ops;
}

if (!tdev && tunnel->parms.link)
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ip_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static inline int ip_finish_output2(struct sk_buff *skb)
struct dst_entry *dst = skb->dst;
struct rtable *rt = (struct rtable *)dst;
struct net_device *dev = dst->dev;
int hh_len = LL_RESERVED_SPACE(dev);
unsigned int hh_len = LL_RESERVED_SPACE(dev);

if (rt->rt_type == RTN_MULTICAST)
IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
struct net_device *tdev; /* Device to other host */
struct iphdr *old_iph = ip_hdr(skb);
struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */
unsigned int max_headroom; /* The extra header space needed */
__be32 dst = tiph->daddr;
int mtu;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/ipvs/ip_vs_xmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
__be16 df = old_iph->frag_off;
sk_buff_data_t old_transport_header = skb->transport_header;
struct iphdr *iph; /* Our new IP header */
int max_headroom; /* The extra header space needed */
unsigned int max_headroom; /* The extra header space needed */
int mtu;

EnterFunction(10);
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -3909,7 +3909,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,

while (before(start, end)) {
struct sk_buff *nskb;
int header = skb_headroom(skb);
unsigned int header = skb_headroom(skb);
int copy = SKB_MAX_ORDER(header, 0);

/* Too big header? This can happen with IPv6. */
Expand Down
Loading

0 comments on commit 06dbbfe

Please sign in to comment.