* Re: [PATCH] ipv6: ipv6_create_tempaddr cleanup
From: Hannes Frederic Sowa @ 2013-09-01 18:35 UTC (permalink / raw)
To: Petr Holasek; +Cc: David S. Miller, netdev, linux-kernel
In-Reply-To: <1377874958-2426-1-git-send-email-pholasek@redhat.com>
On Fri, Aug 30, 2013 at 05:02:38PM +0200, Petr Holasek wrote:
> This two-liner removes max_addresses variable which is now unecessary related
> to patch [ipv6: remove max_addresses check from ipv6_create_tempaddr].
>
> Signed-off-by: Petr Holasek <pholasek@redhat.com>
Uh, yes, I missed that. Thanks a lot!
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
^ permalink raw reply
* [PATCH net-next] drivers/net: Convert uses of compare_ether_addr to ether_addr_equal
From: Joe Perches @ 2013-09-01 18:51 UTC (permalink / raw)
To: netdev; +Cc: e1000-devel, linux-wireless, linux-kernel, users
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Done via cocci script: (and a little typing)
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ++--
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | 4 ++--
drivers/net/ethernet/tile/tilegx.c | 2 +-
drivers/net/usb/qmi_wwan.c | 2 +-
drivers/net/vxlan.c | 7 +++----
drivers/net/wireless/ath/carl9170/rx.c | 4 ++--
drivers/net/wireless/rt2x00/rt2x00dev.c | 4 ++--
drivers/net/wireless/rtlwifi/base.c | 2 +-
drivers/net/wireless/rtlwifi/ps.c | 2 +-
drivers/net/wireless/rtlwifi/rtl8188ee/trx.c | 9 +++++----
drivers/net/wireless/rtlwifi/rtl8723ae/trx.c | 20 ++++++++++----------
11 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 1f5166a..59a62bb 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -488,8 +488,8 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
* source pruning.
*/
if ((skb->pkt_type & (PACKET_BROADCAST | PACKET_MULTICAST)) &&
- !(compare_ether_addr(adapter->netdev->dev_addr,
- eth_hdr(skb)->h_source))) {
+ ether_addr_equal(adapter->netdev->dev_addr,
+ eth_hdr(skb)->h_source)) {
dev_kfree_skb_irq(skb);
goto next_desc;
}
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
index eb49cd6..f1261b1 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
@@ -1639,14 +1639,14 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
if (!is_valid_ether_addr(mac) || vf >= num_vfs)
return -EINVAL;
- if (!compare_ether_addr(adapter->mac_addr, mac)) {
+ if (ether_addr_equal(adapter->mac_addr, mac)) {
netdev_err(netdev, "MAC address is already in use by the PF\n");
return -EINVAL;
}
for (i = 0; i < num_vfs; i++) {
vf_info = &sriov->vf_info[i];
- if (!compare_ether_addr(vf_info->vp->mac, mac)) {
+ if (ether_addr_equal(vf_info->vp->mac, mac)) {
netdev_err(netdev,
"MAC address is already in use by VF %d\n",
i);
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 907b577..b05304e 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -544,7 +544,7 @@ static inline bool filter_packet(struct net_device *dev, void *buf)
/* Filter out packets that aren't for us. */
if (!(dev->flags & IFF_PROMISC) &&
!is_multicast_ether_addr(buf) &&
- compare_ether_addr(dev->dev_addr, buf) != 0)
+ !ether_addr_equal(dev->dev_addr, buf))
return true;
return false;
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 606eba2..3a81315 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -323,7 +323,7 @@ next_desc:
/* Never use the same address on both ends of the link, even
* if the buggy firmware told us to.
*/
- if (!compare_ether_addr(dev->net->dev_addr, default_modem_addr))
+ if (ether_addr_equal(dev->net->dev_addr, default_modem_addr))
eth_hw_addr_random(dev->net);
/* make MAC addr easily distinguishable from an IP header */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index c3dd6e4..92ae31d 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -371,7 +371,7 @@ static struct vxlan_fdb *__vxlan_find_mac(struct vxlan_dev *vxlan,
struct vxlan_fdb *f;
hlist_for_each_entry_rcu(f, head, hlist) {
- if (compare_ether_addr(mac, f->eth_addr) == 0)
+ if (ether_addr_equal(mac, f->eth_addr))
return f;
}
@@ -903,8 +903,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
skb->protocol = eth_type_trans(skb, vxlan->dev);
/* Ignore packet loops (and multicast echo) */
- if (compare_ether_addr(eth_hdr(skb)->h_source,
- vxlan->dev->dev_addr) == 0)
+ if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr))
goto drop;
if ((vxlan->flags & VXLAN_F_LEARN) &&
@@ -1054,7 +1053,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
if (n) {
bool diff;
- diff = compare_ether_addr(eth_hdr(skb)->h_dest, n->ha) != 0;
+ diff = !ether_addr_equal(eth_hdr(skb)->h_dest, n->ha);
if (diff) {
memcpy(eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,
dev->addr_len);
diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 4684dd9..e935f61 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -602,8 +602,8 @@ static void carl9170_ba_check(struct ar9170 *ar, void *data, unsigned int len)
if (bar->start_seq_num == entry_bar->start_seq_num &&
TID_CHECK(bar->control, entry_bar->control) &&
- compare_ether_addr(bar->ra, entry_bar->ta) == 0 &&
- compare_ether_addr(bar->ta, entry_bar->ra) == 0) {
+ ether_addr_equal(bar->ra, entry_bar->ta) &&
+ ether_addr_equal(bar->ta, entry_bar->ra)) {
struct ieee80211_tx_info *tx_info;
tx_info = IEEE80211_SKB_CB(entry_skb);
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index b16521e..712eea9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -566,10 +566,10 @@ static void rt2x00lib_rxdone_check_ba(struct rt2x00_dev *rt2x00dev,
#undef TID_CHECK
- if (compare_ether_addr(ba->ra, entry->ta))
+ if (!ether_addr_equal(ba->ra, entry->ta))
continue;
- if (compare_ether_addr(ba->ta, entry->ra))
+ if (!ether_addr_equal(ba->ta, entry->ra))
continue;
/* Mark BAR since we received the according BA */
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 7651f5a..8bb4a9a 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -1304,7 +1304,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb)
return;
/* and only beacons from the associated BSSID, please */
- if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid))
+ if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
return;
rtlpriv->link_info.bcn_rx_inperiod++;
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index 298b615..b593d24 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -923,7 +923,7 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len)
return;
/* and only beacons from the associated BSSID, please */
- if (compare_ether_addr(hdr->addr3, rtlpriv->mac80211.bssid))
+ if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
return;
/* check if this really is a beacon */
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
index a8871d6..68685a8 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
@@ -305,13 +305,14 @@ static void _rtl88ee_translate_rx_signal_stuff(struct ieee80211_hw *hw,
psaddr = ieee80211_get_SA(hdr);
memcpy(pstatus->psaddr, psaddr, ETH_ALEN);
- addr = (!compare_ether_addr(mac->bssid, (ufc & IEEE80211_FCTL_TODS) ?
- hdr->addr1 : (ufc & IEEE80211_FCTL_FROMDS) ?
- hdr->addr2 : hdr->addr3));
+ addr = ether_addr_equal(mac->bssid,
+ (ufc & IEEE80211_FCTL_TODS) ? hdr->addr1 :
+ (ufc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
+ hdr->addr3);
match_bssid = ((IEEE80211_FTYPE_CTL != type) && (!pstatus->hwerror) &&
(!pstatus->crc) && (!pstatus->icv)) && addr;
- addr = (!compare_ether_addr(praddr, rtlefuse->dev_addr));
+ addr = ether_addr_equal(praddr, rtlefuse->dev_addr);
packet_toself = match_bssid && addr;
if (ieee80211_is_beacon(fc))
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
index c72758d..bcd82a1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
@@ -255,16 +255,16 @@ static void _rtl8723ae_translate_rx_signal_stuff(struct ieee80211_hw *hw,
type = WLAN_FC_GET_TYPE(fc);
praddr = hdr->addr1;
- packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) &&
- (!compare_ether_addr(mac->bssid,
- (le16_to_cpu(fc) & IEEE80211_FCTL_TODS) ?
- hdr->addr1 : (le16_to_cpu(fc) &
- IEEE80211_FCTL_FROMDS) ?
- hdr->addr2 : hdr->addr3)) && (!pstatus->hwerror) &&
- (!pstatus->crc) && (!pstatus->icv));
-
- packet_toself = packet_matchbssid &&
- (!compare_ether_addr(praddr, rtlefuse->dev_addr));
+ packet_matchbssid =
+ ((IEEE80211_FTYPE_CTL != type) &&
+ ether_addr_equal(mac->bssid,
+ (le16_to_cpu(fc) & IEEE80211_FCTL_TODS) ? hdr->addr1 :
+ (le16_to_cpu(fc) & IEEE80211_FCTL_FROMDS) ? hdr->addr2 :
+ hdr->addr3) &&
+ (!pstatus->hwerror) && (!pstatus->crc) && (!pstatus->icv));
+
+ packet_toself = (packet_matchbssid &&
+ ether_addr_equal(praddr, rtlefuse->dev_addr));
if (ieee80211_is_beacon(fc))
packet_beacon = true;
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related
* Re: ICMPv6: treat dest unreachable codes 5 and 6 as EACCES, not EPROTO
From: Hannes Frederic Sowa @ 2013-09-01 18:54 UTC (permalink / raw)
To: Jiri Bohac; +Cc: Hideaki YOSHIFUJI, David S. Miller, netdev
In-Reply-To: <20130830091844.GA2706@midget.suse.cz>
On Fri, Aug 30, 2013 at 11:18:45AM +0200, Jiri Bohac wrote:
> RFC 4443 has defined two additional codes for ICMPv6 type 1 (destination
> unreachable) messages:
> 5 - Source address failed ingress/egress policy
> 6 - Reject route to destination
>
> Now they are treated as protocol error and icmpv6_err_convert() converts them
> to EPROTO.
>
> RFC 4443 says:
> "Codes 5 and 6 are more informative subsets of code 1."
>
> Treat codes 5 and 6 as code 1 (EACCES)
>
> Btw, connect() returning -EPROTO confuses firefox, so that fallback to
> other/IPv4 addresses does not work:
> https://bugzilla.mozilla.org/show_bug.cgi?id=910773
>
>
> Signed-off-by: Jiri Bohac <jbohac@suse.cz>
I would also propose it for stable.
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Thanks,
Hannes
^ permalink raw reply
* [PATCH] Fix for loading non-namespace aware ipv4 protocols without CONFIG_NAMESPACES
From: Paul Wouters @ 2013-09-01 19:30 UTC (permalink / raw)
To: James Morris, David S. Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 433 bytes --]
Attached is a trivial patch to allow inet_add_protocol on kernels without CONFIG_NAMESPACES to load non-namespace aware (out of kernel) modules.
For IPv6, there is no such check. Some discussion of that can be found in the archive: http://www.spinics.net/lists/netdev/msg225184.html
I'm ambivalent on whether the check should be there (like in ipv4) or not (like in ipv6). But if it is there, it should use the proper #ifdef.
Paul
[-- Attachment #2: ipv4-protocol-nonamespace.patch --]
[-- Type: text/x-patch, Size: 841 bytes --]
commit 9e3ddb21568284fb9061a91bbd3158909b1dec45
Author: Paul Wouters <pwouters@redhat.com>
Date: Sun Sep 1 15:18:37 2013 -0400
* Fix for loading non-namespace aware ipv4 protocols without
CONFIG_NAMESPACES set. IPv6 does not have this check.
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index ce84846..b5f785c 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -37,11 +37,13 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
{
+#ifdef CONFIG_NAMESPACES
if (!prot->netns_ok) {
pr_err("Protocol %u is not namespace aware, cannot register.\n",
protocol);
return -EINVAL;
}
+#endif
return !cmpxchg((const struct net_protocol **)&inet_protos[protocol],
NULL, prot) ? 0 : -1;
^ permalink raw reply related
* [PATCH v2 -next 1/2] tcp: syncookies: reduce cookie lifetime to 128 seconds
From: Florian Westphal @ 2013-09-01 19:55 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
We currently accept cookies that were created less than 4 minutes ago
(ie, cookies with counter delta 0-3). Combined with the 8 mss table
values, this yields 32 possible values (out of 2**32) that will be valid.
Reducing the lifetime to < 2 minutes halves the guessing chance while
still providing a large enough period.
While at it, get rid of jiffies value -- they overflow too quickly on
32 bit platforms.
getnstimeofday is used to create a counter that increments every 64s.
perf shows getnstimeofday cost is negible compared to sha_transform;
'ordinary' sequence number generation uses getnstimeofday, too.
Reported-by: Jakob Lell <jakob@jakoblell.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Changes since v1:
- add comment explaining MAX_SYNCOOKIE_AGE value
- add sentence about 'getnstimeofday' cost to commit message
- rebase on net-next master
include/net/tcp.h | 19 +++++++++++++++++++
net/ipv4/syncookies.c | 31 ++++++++++---------------------
net/ipv6/syncookies.c | 24 +++++++-----------------
3 files changed, 35 insertions(+), 38 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6a6a88d..7d9205c 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -482,6 +482,24 @@ extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
struct ip_options *opt);
#ifdef CONFIG_SYN_COOKIES
+#include <linux/ktime.h>
+
+/* Syncookies use a monotonic timer which increments every 64 seconds.
+ * This counter is used both as a hash input and partially encoded into
+ * the cookie value. A cookie is only validated further if the delta
+ * between the current counter value and the encoded one is less than this,
+ * i.e. a sent cookie is valid only at most for 128 seconds (or less if
+ * the counter advances immediately after a cookie is generated).
+ */
+#define MAX_SYNCOOKIE_AGE 2
+
+static inline u32 tcp_cookie_time(void)
+{
+ struct timespec now;
+ getnstimeofday(&now);
+ return now.tv_sec >> 6; /* 64 seconds granularity */
+}
+
extern u32 __cookie_v4_init_sequence(const struct iphdr *iph,
const struct tcphdr *th, u16 *mssp);
extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 14a15c4..b6ea297 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -89,8 +89,7 @@ __u32 cookie_init_timestamp(struct request_sock *req)
static __u32 secure_tcp_syn_cookie(__be32 saddr, __be32 daddr, __be16 sport,
- __be16 dport, __u32 sseq, __u32 count,
- __u32 data)
+ __be16 dport, __u32 sseq, __u32 data)
{
/*
* Compute the secure sequence number.
@@ -102,7 +101,7 @@ static __u32 secure_tcp_syn_cookie(__be32 saddr, __be32 daddr, __be16 sport,
* As an extra hack, we add a small "data" value that encodes the
* MSS into the second hash value.
*/
-
+ u32 count = tcp_cookie_time();
return (cookie_hash(saddr, daddr, sport, dport, 0, 0) +
sseq + (count << COOKIEBITS) +
((cookie_hash(saddr, daddr, sport, dport, count, 1) + data)
@@ -114,22 +113,21 @@ static __u32 secure_tcp_syn_cookie(__be32 saddr, __be32 daddr, __be16 sport,
* If the syncookie is bad, the data returned will be out of
* range. This must be checked by the caller.
*
- * The count value used to generate the cookie must be within
- * "maxdiff" if the current (passed-in) "count". The return value
- * is (__u32)-1 if this test fails.
+ * The count value used to generate the cookie must be less than
+ * MAX_SYNCOOKIE_AGE minutes in the past.
+ * The return value (__u32)-1 if this test fails.
*/
static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr,
- __be16 sport, __be16 dport, __u32 sseq,
- __u32 count, __u32 maxdiff)
+ __be16 sport, __be16 dport, __u32 sseq)
{
- __u32 diff;
+ u32 diff, count = tcp_cookie_time();
/* Strip away the layers from the cookie */
cookie -= cookie_hash(saddr, daddr, sport, dport, 0, 0) + sseq;
/* Cookie is now reduced to (count * 2^24) ^ (hash % 2^24) */
diff = (count - (cookie >> COOKIEBITS)) & ((__u32) - 1 >> COOKIEBITS);
- if (diff >= maxdiff)
+ if (diff >= MAX_SYNCOOKIE_AGE)
return (__u32)-1;
return (cookie -
@@ -173,7 +171,7 @@ u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
return secure_tcp_syn_cookie(iph->saddr, iph->daddr,
th->source, th->dest, ntohl(th->seq),
- jiffies / (HZ * 60), mssind);
+ mssind);
}
EXPORT_SYMBOL_GPL(__cookie_v4_init_sequence);
@@ -189,13 +187,6 @@ __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mssp)
}
/*
- * This (misnamed) value is the age of syncookie which is permitted.
- * Its ideal value should be dependent on TCP_TIMEOUT_INIT and
- * sysctl_tcp_retries1. It's a rather complicated formula (exponential
- * backoff) to compute at runtime so it's currently hardcoded here.
- */
-#define COUNTER_TRIES 4
-/*
* Check if a ack sequence number is a valid syncookie.
* Return the decoded mss if it is, or 0 if not.
*/
@@ -204,9 +195,7 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
{
__u32 seq = ntohl(th->seq) - 1;
__u32 mssind = check_tcp_syn_cookie(cookie, iph->saddr, iph->daddr,
- th->source, th->dest, seq,
- jiffies / (HZ * 60),
- COUNTER_TRIES);
+ th->source, th->dest, seq);
return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0;
}
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index bf63ac8..13ca0a0 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -36,14 +36,6 @@ static __u16 const msstab[] = {
9000 - 60,
};
-/*
- * This (misnamed) value is the age of syncookie which is permitted.
- * Its ideal value should be dependent on TCP_TIMEOUT_INIT and
- * sysctl_tcp_retries1. It's a rather complicated formula (exponential
- * backoff) to compute at runtime so it's currently hardcoded here.
- */
-#define COUNTER_TRIES 4
-
static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst)
@@ -86,8 +78,9 @@ static u32 cookie_hash(const struct in6_addr *saddr, const struct in6_addr *dadd
static __u32 secure_tcp_syn_cookie(const struct in6_addr *saddr,
const struct in6_addr *daddr,
__be16 sport, __be16 dport, __u32 sseq,
- __u32 count, __u32 data)
+ __u32 data)
{
+ u32 count = tcp_cookie_time();
return (cookie_hash(saddr, daddr, sport, dport, 0, 0) +
sseq + (count << COOKIEBITS) +
((cookie_hash(saddr, daddr, sport, dport, count, 1) + data)
@@ -96,15 +89,14 @@ static __u32 secure_tcp_syn_cookie(const struct in6_addr *saddr,
static __u32 check_tcp_syn_cookie(__u32 cookie, const struct in6_addr *saddr,
const struct in6_addr *daddr, __be16 sport,
- __be16 dport, __u32 sseq, __u32 count,
- __u32 maxdiff)
+ __be16 dport, __u32 sseq)
{
- __u32 diff;
+ __u32 diff, count = tcp_cookie_time();
cookie -= cookie_hash(saddr, daddr, sport, dport, 0, 0) + sseq;
diff = (count - (cookie >> COOKIEBITS)) & ((__u32) -1 >> COOKIEBITS);
- if (diff >= maxdiff)
+ if (diff >= MAX_SYNCOOKIE_AGE)
return (__u32)-1;
return (cookie -
@@ -125,8 +117,7 @@ u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
*mssp = msstab[mssind];
return secure_tcp_syn_cookie(&iph->saddr, &iph->daddr, th->source,
- th->dest, ntohl(th->seq),
- jiffies / (HZ * 60), mssind);
+ th->dest, ntohl(th->seq), mssind);
}
EXPORT_SYMBOL_GPL(__cookie_v6_init_sequence);
@@ -146,8 +137,7 @@ int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
{
__u32 seq = ntohl(th->seq) - 1;
__u32 mssind = check_tcp_syn_cookie(cookie, &iph->saddr, &iph->daddr,
- th->source, th->dest, seq,
- jiffies / (HZ * 60), COUNTER_TRIES);
+ th->source, th->dest, seq);
return mssind < ARRAY_SIZE(msstab) ? msstab[mssind] : 0;
}
--
1.8.1.5
^ permalink raw reply related
* [PATCH 2/2] tcp: syncookies: reduce mss table to four values
From: Florian Westphal @ 2013-09-01 19:55 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
In-Reply-To: <1378065356-25509-1-git-send-email-fw@strlen.de>
Halve mss table size to make blind cookie guessing more difficult.
This is sad since the tables were already small, but there
is little alternative except perhaps adding more precise mss information
in the tcp timestamp. Timestamps are unfortunately not ubiquitous.
Guessing all possible cookie values still has 8-in 2**32 chance.
Reported-by: Jakob Lell <jakob@jakoblell.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
Changes since v1:
- add comment explaining mss choices
net/ipv4/syncookies.c | 23 ++++++++++++-----------
net/ipv6/syncookies.c | 6 +-----
2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index b6ea297..b47f477 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -136,22 +136,23 @@ static __u32 check_tcp_syn_cookie(__u32 cookie, __be32 saddr, __be32 daddr,
}
/*
- * MSS Values are taken from the 2009 paper
- * 'Measuring TCP Maximum Segment Size' by S. Alcock and R. Nelson:
- * - values 1440 to 1460 accounted for 80% of observed mss values
- * - values outside the 536-1460 range are rare (<0.2%).
+ * MSS Values are chosen based on the 2011 paper
+ * 'An Analysis of TCP Maximum Segement Sizes' by S. Alcock and R. Nelson: Values ...
+ * .. lower than 536 are rare (< 0.2%)
+ * .. between 537 and 1299 account for less than < 1.5% of observed values
+ * .. in the 1300-1349 range account for about 15 to 20% of observed mss values
+ * .. exceeding 1460 are very rare (< 0.04%)
+ *
+ * 1460 is the single most frequently announced mss value (30 to 46% depending
+ * on monitor location)
*
* Table must be sorted.
*/
static __u16 const msstab[] = {
- 64,
- 512,
- 536,
- 1024,
- 1440,
+ 536,
+ 1300,
+ 1440, /* 1440, 1452: PPPoE */
1460,
- 4312,
- 8960,
};
/*
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 13ca0a0..7198640 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -26,13 +26,9 @@
/* Table must be sorted. */
static __u16 const msstab[] = {
- 64,
- 512,
- 536,
- 1280 - 60,
+ 1280 - 60, /* IPV6_MIN_MTU - 60 */
1480 - 60,
1500 - 60,
- 4460 - 60,
9000 - 60,
};
--
1.8.1.5
^ permalink raw reply related
* WLAN setting "Power Management:on" lost after suspend
From: Toralf Förster @ 2013-09-01 20:01 UTC (permalink / raw)
To: netdev
After an s2disk I've to run "iwconfig wlp3s0 power on" again at a
ThinkPad T420 although I did it before suspend.
(kernel 3.11-rc7+, but older kernels shows same behaviour)
Is this intended ?
--
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
^ permalink raw reply
* [PATCH net-next] llc: Use normal etherdevice.h tests
From: Joe Perches @ 2013-09-01 20:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David Miller, netdev, LKML
Convert the llc_<foo> static inlines to the
equivalents from etherdevice.h and remove
the llc_<foo> static inline functions.
llc_mac_null -> is_zero_ether_addr
llc_mac_multicast -> is_multicast_ether_addr
llc_mac_match -> ether_addr_equal
Signed-off-by: Joe Perches <joe@perches.com>
---
include/net/llc_if.h | 30 ------------------------------
net/llc/af_llc.c | 6 +++---
net/llc/llc_conn.c | 6 +++---
net/llc/llc_sap.c | 4 ++--
4 files changed, 8 insertions(+), 38 deletions(-)
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index b595a00..f0cb909 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -62,36 +62,6 @@
#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
#define LLC_STATUS_RESET_DONE 8 /* */
-/**
- * llc_mac_null - determines if a address is a null mac address
- * @mac: Mac address to test if null.
- *
- * Determines if a given address is a null mac address. Returns 0 if the
- * address is not a null mac, 1 if the address is a null mac.
- */
-static inline int llc_mac_null(const u8 *mac)
-{
- return is_zero_ether_addr(mac);
-}
-
-static inline int llc_mac_multicast(const u8 *mac)
-{
- return is_multicast_ether_addr(mac);
-}
-/**
- * llc_mac_match - determines if two mac addresses are the same
- * @mac1: First mac address to compare.
- * @mac2: Second mac address to compare.
- *
- * Determines if two given mac address are the same. Returns 0 if there
- * is not a complete match up to len, 1 if a complete match up to len is
- * found.
- */
-static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
-{
- return !compare_ether_addr(mac1, mac2);
-}
-
extern int llc_establish_connection(struct sock *sk, u8 *lmac,
u8 *dmac, u8 dsap);
extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 48aaa89..6cba486 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -321,12 +321,12 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
if (llc->dev) {
if (!addr->sllc_arphrd)
addr->sllc_arphrd = llc->dev->type;
- if (llc_mac_null(addr->sllc_mac))
+ if (is_zero_ether_addr(addr->sllc_mac))
memcpy(addr->sllc_mac, llc->dev->dev_addr,
IFHWADDRLEN);
if (addr->sllc_arphrd != llc->dev->type ||
- !llc_mac_match(addr->sllc_mac,
- llc->dev->dev_addr)) {
+ !ether_addr_equal(addr->sllc_mac,
+ llc->dev->dev_addr)) {
rc = -EINVAL;
llc->dev = NULL;
}
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 0d0d416..cd87241 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -478,8 +478,8 @@ static inline bool llc_estab_match(const struct llc_sap *sap,
return llc->laddr.lsap == laddr->lsap &&
llc->daddr.lsap == daddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac) &&
- llc_mac_match(llc->daddr.mac, daddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac) &&
+ ether_addr_equal(llc->daddr.mac, daddr->mac);
}
/**
@@ -550,7 +550,7 @@ static inline bool llc_listener_match(const struct llc_sap *sap,
return sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN &&
llc->laddr.lsap == laddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac);
}
static struct sock *__llc_lookup_listener(struct llc_sap *sap,
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 78be45c..e585069 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -302,7 +302,7 @@ static inline bool llc_dgram_match(const struct llc_sap *sap,
return sk->sk_type == SOCK_DGRAM &&
llc->laddr.lsap == laddr->lsap &&
- llc_mac_match(llc->laddr.mac, laddr->mac);
+ ether_addr_equal(llc->laddr.mac, laddr->mac);
}
/**
@@ -425,7 +425,7 @@ void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_decode_da(skb, laddr.mac);
llc_pdu_decode_dsap(skb, &laddr.lsap);
- if (llc_mac_multicast(laddr.mac)) {
+ if (is_multicast_ether_addr(laddr.mac)) {
llc_sap_mcast(sap, &laddr, skb);
kfree_skb(skb);
} else {
^ permalink raw reply related
* Re: [PATCH v3] ipv6:introduce function to find route for redirect
From: Hannes Frederic Sowa @ 2013-09-01 21:08 UTC (permalink / raw)
To: Duan Jiong; +Cc: davem, netdev
In-Reply-To: <52217A8D.9010008@cn.fujitsu.com>
On Sat, Aug 31, 2013 at 01:09:33PM +0800, Duan Jiong wrote:
> RFC 4861 says that the IP source address of the Redirect is the
> same as the current first-hop router for the specified ICMP
> Destination Address, so the gateway should be taken into
> consideration when we find the route for redirect.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
This patch looks good!
Maybe you could also point to commit
a6279458c534d01ccc39498aba61c93083ee0372 ("NDISC: Search over all possible
rules on receipt of redirect.") and where the check went away?
The bug is only "exploitable" on layer-2 because the source address of the
redirect is checked to be a valid link-local address but it makes spoofing a
lot easier in the same L2 domain nonetheless.
Nice work!
Some smaller comments inline:
> ---
> Changes for v3:
> 1.Fix the comments style problems
>
> net/ipv6/ah6.c | 2 +-
> net/ipv6/esp6.c | 2 +-
> net/ipv6/icmp.c | 2 +-
> net/ipv6/ipcomp6.c | 2 +-
> net/ipv6/ndisc.c | 3 ++-
> net/ipv6/route.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++-----
> 6 files changed, 78 insertions(+), 11 deletions(-)
>
> diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
> index bb02e17..73784c3 100644
> --- a/net/ipv6/ah6.c
> +++ b/net/ipv6/ah6.c
> @@ -628,7 +628,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
> index aeac0dc..d3618a7 100644
> --- a/net/ipv6/esp6.c
> +++ b/net/ipv6/esp6.c
> @@ -447,7 +447,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
> index 7cfc8d2..73681c2 100644
> --- a/net/ipv6/icmp.c
> +++ b/net/ipv6/icmp.c
> @@ -92,7 +92,7 @@ static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> if (type == ICMPV6_PKT_TOOBIG)
> ip6_update_pmtu(skb, net, info, 0, 0);
> else if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
>
> if (!(type & ICMPV6_INFOMSG_MASK))
> if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)
> diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
> index 7af5aee..5636a91 100644
> --- a/net/ipv6/ipcomp6.c
> +++ b/net/ipv6/ipcomp6.c
> @@ -76,7 +76,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
> return;
>
> if (type == NDISC_REDIRECT)
> - ip6_redirect(skb, net, 0, 0);
> + ip6_redirect(skb, net, skb->dev->ifindex, 0);
> else
> ip6_update_pmtu(skb, net, info, 0, 0);
> xfrm_state_put(x);
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 04d31c2..90f474b 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -1370,7 +1370,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
> return;
>
> if (!ndopts.nd_opts_rh) {
> - ip6_redirect_no_header(skb, dev_net(skb->dev), 0, 0);
> + ip6_redirect_no_header(skb, dev_net(skb->dev),
> + skb->dev->ifindex, 0);
This is not indented correctly. skb->dev->ifindex should be placed right below
the upper skb variable.
> return;
> }
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 8d9a93e..2e1d378 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1157,6 +1157,74 @@ void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu)
> }
> EXPORT_SYMBOL_GPL(ip6_sk_update_pmtu);
>
> +/* Handle redirects */
> +struct ip6rd_flowi {
> + struct flowi6 fl6;
> + struct in6_addr gateway;
> +};
> +
> +static struct rt6_info *__ip6_route_redirect(struct net *net,
> + struct fib6_table *table,
> + struct flowi6 *fl6,
> + int flags)
> +{
> + struct ip6rd_flowi *rdfl = (struct ip6rd_flowi *)fl6;
> + struct rt6_info *rt;
> + struct fib6_node *fn;
> +
> + /* Get the "current" route for this destination and
> + * check if the redirect has come from approriate router.
> + *
> + * RFC 4861 specifies that redirects should only be
> + * accepted if they come from the nexthop to the target.
> + * Due to the way the routes are chosen, this notion
> + * is a bit fuzzy and one might need to check all possible
> + * routes.
> + */
> +
> + read_lock_bh(&table->tb6_lock);
> + fn = fib6_lookup(&table->tb6_root, &fl6->daddr, &fl6->saddr);
> +restart:
> + for (rt = fn->leaf; rt; rt = rt->dst.rt6_next) {
> + if (rt6_check_expired(rt))
> + continue;
[1] (backreference for a comment below)
> + if (!(rt->rt6i_flags & RTF_GATEWAY))
> + continue;
> + if (fl6->flowi6_oif != rt->dst.dev->ifindex)
> + continue;
> + if (!ipv6_addr_equal(&rdfl->gateway, &rt->rt6i_gateway))
> + continue;
> + break;
> + }
> +
> + if (!rt)
> + rt = net->ipv6.ip6_null_entry;
> + BACKTRACK(net, &fl6->saddr);
> +out:
> + dst_hold(&rt->dst);
> +
> + read_unlock_bh(&table->tb6_lock);
> +
> + return rt;
> +};
> +
> +static struct dst_entry *ip6_route_redirect(const struct flowi6 *fl6,
> + const struct in6_addr *gateway,
> + struct net *net)
The ordering of the arguments could be in the same style as the other
ip6_route_* functions (net, flow, gateway). But that is not that important.
> +{
> + int flags = RT6_LOOKUP_F_HAS_SADDR;
> + struct ip6rd_flowi rdfl;
> +
> + rdfl.fl6 = *fl6;
> + rdfl.gateway = *gateway;
> +
> + if (rt6_need_strict(&fl6->daddr))
> + flags |= RT6_LOOKUP_F_IFACE;
This is not needed because you do the matching on interfaces yourself
in __ip6_route_redirect. The flag should currently not be checked on
this code path down in fib6_rule_lookup.
> +
> + return fib6_rule_lookup(net, &rdfl.fl6,
> + flags, __ip6_route_redirect);
This line jumped a bit too far to the right, too. ;)
> +}
> +
> void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
Maybe we should rename oif to iif now?
> {
> const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
> @@ -1171,9 +1239,8 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
> fl6.saddr = iph->saddr;
> fl6.flowlabel = ip6_flowinfo(iph);
>
> - dst = ip6_route_output(net, NULL, &fl6);
> - if (!dst->error)
> - rt6_do_redirect(dst, NULL, skb);
> + dst = ip6_route_redirect(&fl6, &ipv6_hdr(skb)->saddr, net);
> + rt6_do_redirect(dst, NULL, skb);
What is the reason you left out the dst.error check? E.g. if a system had a
prohbit rule it is possible to circumvent this with a redirect packet now.
I would think about placing this check at [1] and fail the lookup
early. rt6_do_redirect does check for null-entry, so you could omit the
check here, then.
> dst_release(dst);
> }
> EXPORT_SYMBOL_GPL(ip6_redirect);
> @@ -1193,9 +1260,8 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
> fl6.daddr = msg->dest;
> fl6.saddr = iph->daddr;
>
> - dst = ip6_route_output(net, NULL, &fl6);
> - if (!dst->error)
> - rt6_do_redirect(dst, NULL, skb);
> + dst = ip6_route_redirect(&fl6, &iph->saddr, net);
> + rt6_do_redirect(dst, NULL, skb);
Likewise.
> dst_release(dst);
> }
Thanks,
Hannes
^ permalink raw reply
* [PATCH net-next] bcm87xx: Add MODULE_DEVICE_TABLE
From: Ben Hutchings @ 2013-09-01 21:33 UTC (permalink / raw)
To: David Miller; +Cc: David Daney, netdev
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
bcm87xx currently isn't auto-loaded if built as a module.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
Compile-tested only.
Ben.
drivers/net/phy/bcm87xx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c
index 7997895..f5b44ff 100644
--- a/drivers/net/phy/bcm87xx.c
+++ b/drivers/net/phy/bcm87xx.c
@@ -230,4 +230,11 @@ static void __exit bcm87xx_exit(void)
}
module_exit(bcm87xx_exit);
+static struct mdio_device_id __maybe_unused bcm87xx_tbl[] = {
+ { PHY_ID_BCM8706, 0xffffffff },
+ { PHY_ID_BCM8727, 0xffffffff },
+ { }
+};
+
MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(mdio, bcm87xx_tbl);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply related
* Re: Realtek r8168 hangs when sending data at full speed on a gigabit link
From: Francois Romieu @ 2013-09-01 21:36 UTC (permalink / raw)
To: Frédéric Leroy; +Cc: netdev, Realtek linux nic maintainers
In-Reply-To: <5221C226.9040209@starox.org>
Frédéric Leroy <fredo@starox.org> :
[...]
> For triggering the bug, I use iperf, which either works, or hangs almost
> immediately
> with multiple threads :
>
> iperf -c myiperfserver -P 3 -t 60
>
> Could you help me to fix this ?
Does it behave the same if you don't load the vbox modules at all ?
--
Ueimor
^ permalink raw reply
* [PATCH] batman: Remove reference to compare_ether_addr
From: Joe Perches @ 2013-09-01 22:45 UTC (permalink / raw)
To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
Cc: David S. Miller, b.a.t.m.a.n, netdev, LKML
This function is being removed, rename the reference.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/batman-adv/main.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 5e9aebb..7333cf8 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -253,7 +253,7 @@ static inline void batadv_dbg(int type __always_unused,
/* returns 1 if they are the same ethernet addr
*
- * note: can't use compare_ether_addr() as it requires aligned memory
+ * note: can't use ether_addr_equal() as it requires aligned memory
*/
static inline int batadv_compare_eth(const void *data1, const void *data2)
{
^ permalink raw reply related
* [PATCH net-hext] wireless: scan: Remove comment to compare_ether_addr
From: Joe Perches @ 2013-09-01 22:48 UTC (permalink / raw)
To: Johannes Berg
Cc: John W. Linville, David S. Miller, linux-wireless, netdev, LKML
This function is being removed, so remove the reference to it.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/wireless/scan.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index ad1e406..eeb7148 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -465,10 +465,6 @@ static int cmp_bss(struct cfg80211_bss *a,
}
}
- /*
- * we can't use compare_ether_addr here since we need a < > operator.
- * The binary return value of compare_ether_addr isn't enough
- */
r = memcmp(a->bssid, b->bssid, sizeof(a->bssid));
if (r)
return r;
^ permalink raw reply related
* [PATCH] net: netx-eth: remove unnecessary casting when using dev_get_platdata()
From: Jingoo Han @ 2013-09-02 0:37 UTC (permalink / raw)
To: 'David S. Miller'
Cc: netdev, 'Sergei Shtylyov', 'Jingoo Han'
Casting from 'void *' is unnecessary when using dev_get_platdata().
Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/net/ethernet/netx-eth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c
index 235fd51..e6f0a43 100644
--- a/drivers/net/ethernet/netx-eth.c
+++ b/drivers/net/ethernet/netx-eth.c
@@ -390,7 +390,7 @@ static int netx_eth_drv_probe(struct platform_device *pdev)
priv = netdev_priv(ndev);
- pdata = (struct netxeth_platform_data *)dev_get_platdata(&pdev->dev);
+ pdata = dev_get_platdata(&pdev->dev);
priv->xc = request_xc(pdata->xcno, &pdev->dev);
if (!priv->xc) {
dev_err(&pdev->dev, "unable to request xc engine\n");
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next v12 06/11] vxlan: add ipv6 support
From: Cong Wang @ 2013-09-02 1:17 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, David S. Miller, David Stevens
In-Reply-To: <20130831102726.21896150@nehalam.linuxnetplumber.net>
On Sat, 2013-08-31 at 10:27 -0700, Stephen Hemminger wrote:
> On Sat, 31 Aug 2013 13:44:33 +0800
> Cong Wang <amwang@redhat.com> wrote:
>
> > +#if IS_ENABLED(CONFIG_IPV6)
> > + } else {
> > + ipv6_stub->ipv6_sock_mc_join(sk, ifindex,
> > + &ip->sin6.sin6_addr);
> > +#endif
>
> This isn't safe against IPv6 module getting unloaded. You either
> have to figure out a reference count method, or disable IPv6
> module unload.
>
> Since it can only be forced unload anyway, I still argue
> it should just be disabled (by removing the module exit hook
> and code).
I will send a patch to remove ipv6 module exit code, since there is
other problem too.
Thanks!
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-02 1:37 UTC (permalink / raw)
To: David Miller
Cc: Li Frank-B20596, netdev@vger.kernel.org,
bhutchings@solarflare.com, l.stach@pengutronix.de
In-Reply-To: <20130830.175909.1743525148095642605.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Data: Saturday, August 31, 2013 5:59 AM
> To: Duan Fugang-B38611
> Cc: Li Frank-B20596; netdev@vger.kernel.org; bhutchings@solarflare.com;
> l.stach@pengutronix.de
> Subject: Re: [PATCH] net: fec: fix the error to get the previous BD entry
>
> From: Fugang Duan <B38611@freescale.com>
> Date: Fri, 30 Aug 2013 12:35:25 +0800
>
> > When the current BD is the first BD, the previous BD entry must be the
> > last BD, not "bdp - 1".
> >
> > Add BD entry check to get the previous BD entry correctly.
> >
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
>
> The correct fix is to put this logic into fec_enet_get_prevdesc().
> With this current limitation, the function is completely useless.
Due to get tx & rx previous description use the same function fec_enet_get_prevdesc(). If put the logic into fec_enet_get_prevdesc(),
I think it is better to split the function to fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
If you agree it, I will submit one patch to do it.
Thanks,
Andy
^ permalink raw reply
* Re: [PATCH] virtio-net: Set RXCSUM feature if GUEST_CSUM is available
From: Rusty Russell @ 2013-09-02 1:47 UTC (permalink / raw)
To: David Miller, thuth; +Cc: netdev, mst, virtualization
In-Reply-To: <20130829.155704.248095796202059854.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> From: Thomas Huth <thuth@linux.vnet.ibm.com>
> Date: Tue, 27 Aug 2013 17:09:02 +0200
>
>> If the VIRTIO_NET_F_GUEST_CSUM virtio feature is available, the guest
>> does not have to calculate the checksums on all received packets. This
>> is pretty much the same feature as RX checksum offloading on real
>> network cards, so the virtio-net driver should report this by setting
>> the NETIF_F_RXCSUM flag. When the user now runs "ethtool -k", he or she
>> can see whether the virtio-net interface has to calculate RX checksums
>> or not.
>>
>> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
>
> Can one of the virtio_net folks please review this?
Hmm, so NETIF_F_RXCSUM only exists for ethtool's benefit. Weird.
But this patch is correct:
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Thanks,
Rusty.
^ permalink raw reply
* Re: [PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300
From: Chen Gang @ 2013-09-02 1:48 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Yoshinori Sato, Kees Cook, David Miller, netdev
In-Reply-To: <20130830143639.GA16269@windriver.com>
On 08/30/2013 10:36 PM, Paul Gortmaker wrote:
> [[PATCH] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300] On 30/08/2013 (Fri 11:29) Chen Gang wrote:
>
>> Only H8300H_AKI3068NET and H8300H_H8MAX can support NE_H8300 (or it
>> will no related irq and base address).
>
> Do you have an H83000 and really know that is true? I'm guessing no.
>
> Looking at the driver, it is kind of broken that it only assigns I/O and
> irq for two platforms, but the H8300 arch Kconfig.cpu only allows building
> a single platform in a given kernel anyway, so a dependency fix is
> probably acceptable here.
>
OK, thanks.
> Given that, what you really want to indicate is something like:
>
> Currently only H8300H_AKI3068NET and H8300H_H8MAX define default
> I/O base and IRQ values for the NE_H8300 driver. Hence builds
> for other H8300H platforms will fail as per below. Since H8300H
> does not support multi platform builds, we simply limit building
> the driver to those two platforms specifically.
>
Hmm... that sounds good to me.
>>
>> The release error:
>>
>> CC [M] drivers/net/hamradio/bpqether.o
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> This file has nothing to do with the problem in question. [If you are
> going to do a "make -j30" in testing, then at least restart with -j1 to
> properly capture the error message.]
>
Oh, it is a waste, which I should remove, thanks.
> Please update the commit log appropriately and resubmit.
>
OK, I will send patch v2.
> Paul.
> --
>
>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_dev':
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: 'h8300_ne_base' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/ethernet/8390/ne-h8300.c:117:23: error: bit-field '<anonymous>' width not an integer constant
>> drivers/net/ethernet/8390/ne-h8300.c:119:20: error: 'h8300_ne_irq' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c: In function 'init_module':
>> drivers/net/ethernet/8390/ne-h8300.c:647:21: error: 'h8300_ne_base' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:648:15: error: 'h8300_ne_irq' undeclared (first use in this function)
>> drivers/net/ethernet/8390/ne-h8300.c:661:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]
>>
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>> drivers/net/ethernet/8390/Kconfig | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
>> index a5f91e1..becef25 100644
>> --- a/drivers/net/ethernet/8390/Kconfig
>> +++ b/drivers/net/ethernet/8390/Kconfig
>> @@ -148,7 +148,7 @@ config PCMCIA_PCNET
>>
>> config NE_H8300
>> tristate "NE2000 compatible support for H8/300"
>> - depends on H8300
>> + depends on H8300H_AKI3068NET || H8300H_H8MAX
>> ---help---
>> Say Y here if you want to use the NE2000 compatible
>> controller on the Renesas H8/300 processor.
>> --
>> 1.7.7.6
>
>
Thanks.
--
Chen Gang
^ permalink raw reply
* [PATCH net-next] vxlan: fix flowi6_proto value
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
From: Cong Wang <amwang@redhat.com>
It should be IPPROTO_UDP.
Signed-off-by: Cong Wang <amwang@redhat.com>
---
drivers/net/vxlan.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3ffb22d..0fcf3f7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1671,7 +1671,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
fl6.flowi6_oif = rdst->remote_ifindex;
fl6.daddr = dst->sin6.sin6_addr;
fl6.saddr = vxlan->saddr.sin6.sin6_addr;
- fl6.flowi6_proto = skb->protocol;
+ fl6.flowi6_proto = IPPROTO_UDP;
if (ipv6_stub->ipv6_dst_lookup(sk, &ndst, &fl6)) {
netdev_dbg(dev, "no route to %pI6\n",
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next] vxlan: include net/ip6_checksum.h for csum_ipv6_magic()
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
In-Reply-To: <1378087613-15279-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Fengguang reported a compile warning:
drivers/net/vxlan.c: In function 'vxlan6_xmit_skb':
drivers/net/vxlan.c:1352:3: error: implicit declaration of function 'csum_ipv6_magic' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
this patch fixes it.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
drivers/net/vxlan.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0fcf3f7..6b560f3 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -44,6 +44,7 @@
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <net/ip6_tunnel.h>
+#include <net/ip6_checksum.h>
#endif
#define VXLAN_VERSION "0.1"
--
1.7.7.6
^ permalink raw reply related
* [PATCH net-next] net: make snmp_mib_free static inline
From: Cong Wang @ 2013-09-02 2:06 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Cong Wang
In-Reply-To: <1378087613-15279-1-git-send-email-amwang@redhat.com>
From: Cong Wang <amwang@redhat.com>
Fengguang reported:
net/built-in.o: In function `in6_dev_finish_destroy':
(.text+0x4ca7d): undefined reference to `snmp_mib_free'
this is due to snmp_mib_free() is defined when CONFIG_INET is enabled,
but in6_dev_finish_destroy() is now moved to core kernel.
I think snmp_mib_free() is small enough to be inlined, so just make it
static inline.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
include/net/ip.h | 12 +++++++++++-
net/ipv4/af_inet.c | 12 ------------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index a68f838..48f5597 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -194,7 +194,17 @@ static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp
}
#endif
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
-extern void snmp_mib_free(void __percpu *ptr[2]);
+
+static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
+{
+ int i;
+
+ BUG_ON(ptr == NULL);
+ for (i = 0; i < SNMP_ARRAY_SZ; i++) {
+ free_percpu(ptr[i]);
+ ptr[i] = NULL;
+ }
+}
extern struct local_ports {
seqlock_t lock;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b4d0be2..7a1874b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1532,18 +1532,6 @@ int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align)
}
EXPORT_SYMBOL_GPL(snmp_mib_init);
-void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
-{
- int i;
-
- BUG_ON(ptr == NULL);
- for (i = 0; i < SNMP_ARRAY_SZ; i++) {
- free_percpu(ptr[i]);
- ptr[i] = NULL;
- }
-}
-EXPORT_SYMBOL_GPL(snmp_mib_free);
-
#ifdef CONFIG_IP_MULTICAST
static const struct net_protocol igmp_protocol = {
.handler = igmp_rcv,
--
1.7.7.6
^ permalink raw reply related
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-02 2:09 UTC (permalink / raw)
To: Duan Fugang-B38611, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE0167B047@039-SN2MPN1-021.039d.mgd.msft.net>
>
> Due to get tx & rx previous description use the same function
> fec_enet_get_prevdesc(). If put the logic into fec_enet_get_prevdesc(), I
> think it is better to split the function to
> fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
>
> If you agree it, I will submit one patch to do it.
It doesn't looks good to split to two functions.
Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get first entry of queue?
Best regards
Frank Li
>
> Thanks,
> Andy
^ permalink raw reply
* [PATCH v2] drivers: net: ethernet: 8390: Kconfig: add H8300H_AKI3068NET and H8300H_H8MAX dependancy for NE_H8300
From: Chen Gang @ 2013-09-02 2:20 UTC (permalink / raw)
To: Paul Gortmaker; +Cc: Yoshinori Sato, Kees Cook, David Miller, netdev
In-Reply-To: <20130830143639.GA16269@windriver.com>
Currently only H8300H_AKI3068NET and H8300H_H8MAX define default
I/O base and IRQ values for the NE_H8300 driver. Hence builds
for other H8300H platforms will fail as per below. Since H8300H
does not support multi platform builds, we simply limit building
the driver to those two platforms specifically.
The release error:
drivers/net/ethernet/8390/ne-h8300.c: In function 'init_dev':
drivers/net/ethernet/8390/ne-h8300.c:117:23: error: 'h8300_ne_base' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:117:23: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/8390/ne-h8300.c:117:23: error: bit-field '<anonymous>' width not an integer constant
drivers/net/ethernet/8390/ne-h8300.c:119:20: error: 'h8300_ne_irq' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c: In function 'init_module':
drivers/net/ethernet/8390/ne-h8300.c:647:21: error: 'h8300_ne_base' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:648:15: error: 'h8300_ne_irq' undeclared (first use in this function)
drivers/net/ethernet/8390/ne-h8300.c:661:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat]
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
drivers/net/ethernet/8390/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index a5f91e1..becef25 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -148,7 +148,7 @@ config PCMCIA_PCNET
config NE_H8300
tristate "NE2000 compatible support for H8/300"
- depends on H8300
+ depends on H8300H_AKI3068NET || H8300H_H8MAX
---help---
Say Y here if you want to use the NE2000 compatible
controller on the Renesas H8/300 processor.
--
1.7.7.6
^ permalink raw reply related
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Duan Fugang-B38611 @ 2013-09-02 2:23 UTC (permalink / raw)
To: Li Frank-B20596, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <1F990F8245A4214A8CC4BFFBD9F790F908B40731@039-SN1MPN1-001.039d.mgd.msft.net>
From: Li Frank-B20596
Data: Monday, September 02, 2013 10:10 AM + 800
> To: Duan Fugang-B38611; David Miller
> Cc: netdev@vger.kernel.org; bhutchings@solarflare.com;
> l.stach@pengutronix.de
> Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry
>
> >
> > Due to get tx & rx previous description use the same function
> > fec_enet_get_prevdesc(). If put the logic into
> > fec_enet_get_prevdesc(), I think it is better to split the function to
> > fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
> >
> > If you agree it, I will submit one patch to do it.
>
> It doesn't looks good to split to two functions.
> Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get
> first entry of queue?
Yes, this check can get the first entry of queue, but the ring size is different for rx and tx ring.
In current driver, there have no tx/rx ring size variable define in struct fec_enet_private.
And, if change fec_enet_get_prevdesc(), the fec_enet_get_nextdesc() may need to do related logic change for nicety code.
> Best regards
> Frank Li
^ permalink raw reply
* RE: [PATCH] net: fec: fix the error to get the previous BD entry
From: Li Frank-B20596 @ 2013-09-02 2:25 UTC (permalink / raw)
To: Duan Fugang-B38611, David Miller
Cc: netdev@vger.kernel.org, bhutchings@solarflare.com,
l.stach@pengutronix.de
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE0167E411@039-SN2MPN1-021.039d.mgd.msft.net>
> > > Due to get tx & rx previous description use the same function
> > > fec_enet_get_prevdesc(). If put the logic into
> > > fec_enet_get_prevdesc(), I think it is better to split the function
> > > to fec_enet_get_tx_prevdesc(),fec_enet_get_rx_prevdesc().
> > >
> > > If you agree it, I will submit one patch to do it.
> >
> > It doesn't looks good to split to two functions.
> > Can we use if (p == fep->tx_base || p == fep->rx_base) to check if get
> > first entry of queue?
>
> Yes, this check can get the first entry of queue, but the ring size is
> different for rx and tx ring.
> In current driver, there have no tx/rx ring size variable define in struct
> fec_enet_private.
>
> And, if change fec_enet_get_prevdesc(), the fec_enet_get_nextdesc() may need
> to do related logic change for nicety code.
Yes, it should be better handle this logical in get_prevdesc and get_nextdesc.
So we have unified place to handle wrap.
>
> > Best regards
> > Frank Li
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox