mirror of
https://github.com/Qortal/Brooklyn.git
synced 2025-02-22 07:05:54 +00:00
O shut up T3Q. You'll never be the man your mother was.
This commit is contained in:
parent
604a706f77
commit
2da4b5c5e4
@ -87,6 +87,13 @@ static void ax25_kill_by_device(struct net_device *dev)
|
|||||||
ax25_for_each(s, &ax25_list) {
|
ax25_for_each(s, &ax25_list) {
|
||||||
if (s->ax25_dev == ax25_dev) {
|
if (s->ax25_dev == ax25_dev) {
|
||||||
sk = s->sk;
|
sk = s->sk;
|
||||||
|
if (!sk) {
|
||||||
|
spin_unlock_bh(&ax25_list_lock);
|
||||||
|
s->ax25_dev = NULL;
|
||||||
|
ax25_disconnect(s, ENETUNREACH);
|
||||||
|
spin_lock_bh(&ax25_list_lock);
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
sock_hold(sk);
|
sock_hold(sk);
|
||||||
spin_unlock_bh(&ax25_list_lock);
|
spin_unlock_bh(&ax25_list_lock);
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
|
@ -4083,6 +4083,7 @@ void hci_release_dev(struct hci_dev *hdev)
|
|||||||
hci_dev_unlock(hdev);
|
hci_dev_unlock(hdev);
|
||||||
|
|
||||||
ida_simple_remove(&hci_index_ida, hdev->id);
|
ida_simple_remove(&hci_index_ida, hdev->id);
|
||||||
|
kfree_skb(hdev->sent_cmd);
|
||||||
kfree(hdev);
|
kfree(hdev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(hci_release_dev);
|
EXPORT_SYMBOL(hci_release_dev);
|
||||||
|
@ -213,7 +213,7 @@ static ssize_t speed_show(struct device *dev,
|
|||||||
if (!rtnl_trylock())
|
if (!rtnl_trylock())
|
||||||
return restart_syscall();
|
return restart_syscall();
|
||||||
|
|
||||||
if (netif_running(netdev)) {
|
if (netif_running(netdev) && netif_device_present(netdev)) {
|
||||||
struct ethtool_link_ksettings cmd;
|
struct ethtool_link_ksettings cmd;
|
||||||
|
|
||||||
if (!__ethtool_get_link_ksettings(netdev, &cmd))
|
if (!__ethtool_get_link_ksettings(netdev, &cmd))
|
||||||
|
@ -446,6 +446,7 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
|
|||||||
struct page *page;
|
struct page *page;
|
||||||
struct sk_buff *trailer;
|
struct sk_buff *trailer;
|
||||||
int tailen = esp->tailen;
|
int tailen = esp->tailen;
|
||||||
|
unsigned int allocsz;
|
||||||
|
|
||||||
/* this is non-NULL only with TCP/UDP Encapsulation */
|
/* this is non-NULL only with TCP/UDP Encapsulation */
|
||||||
if (x->encap) {
|
if (x->encap) {
|
||||||
@ -455,6 +456,10 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES);
|
||||||
|
if (allocsz > ESP_SKB_FRAG_MAXSIZE)
|
||||||
|
goto cow;
|
||||||
|
|
||||||
if (!skb_cloned(skb)) {
|
if (!skb_cloned(skb)) {
|
||||||
if (tailen <= skb_tailroom(skb)) {
|
if (tailen <= skb_tailroom(skb)) {
|
||||||
nfrags = 1;
|
nfrags = 1;
|
||||||
|
@ -159,6 +159,9 @@ static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x,
|
|||||||
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
|
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proto == IPPROTO_IPV6)
|
||||||
|
skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP4;
|
||||||
|
|
||||||
__skb_pull(skb, skb_transport_offset(skb));
|
__skb_pull(skb, skb_transport_offset(skb));
|
||||||
ops = rcu_dereference(inet_offloads[proto]);
|
ops = rcu_dereference(inet_offloads[proto]);
|
||||||
if (likely(ops && ops->callbacks.gso_segment))
|
if (likely(ops && ops->callbacks.gso_segment))
|
||||||
|
@ -1663,11 +1663,13 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
|
|||||||
if (!copied)
|
if (!copied)
|
||||||
copied = used;
|
copied = used;
|
||||||
break;
|
break;
|
||||||
} else if (used <= len) {
|
}
|
||||||
|
if (WARN_ON_ONCE(used > len))
|
||||||
|
used = len;
|
||||||
seq += used;
|
seq += used;
|
||||||
copied += used;
|
copied += used;
|
||||||
offset += used;
|
offset += used;
|
||||||
}
|
|
||||||
/* If recv_actor drops the lock (e.g. TCP splice
|
/* If recv_actor drops the lock (e.g. TCP splice
|
||||||
* receive) the skb pointer might be invalid when
|
* receive) the skb pointer might be invalid when
|
||||||
* getting here: tcp_collapse might have deleted it
|
* getting here: tcp_collapse might have deleted it
|
||||||
|
@ -5000,6 +5000,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
|
|||||||
nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
|
nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
spin_lock_bh(&ifa->lock);
|
||||||
if (!((ifa->flags&IFA_F_PERMANENT) &&
|
if (!((ifa->flags&IFA_F_PERMANENT) &&
|
||||||
(ifa->prefered_lft == INFINITY_LIFE_TIME))) {
|
(ifa->prefered_lft == INFINITY_LIFE_TIME))) {
|
||||||
preferred = ifa->prefered_lft;
|
preferred = ifa->prefered_lft;
|
||||||
@ -5021,6 +5022,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
|
|||||||
preferred = INFINITY_LIFE_TIME;
|
preferred = INFINITY_LIFE_TIME;
|
||||||
valid = INFINITY_LIFE_TIME;
|
valid = INFINITY_LIFE_TIME;
|
||||||
}
|
}
|
||||||
|
spin_unlock_bh(&ifa->lock);
|
||||||
|
|
||||||
if (!ipv6_addr_any(&ifa->peer_addr)) {
|
if (!ipv6_addr_any(&ifa->peer_addr)) {
|
||||||
if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 ||
|
if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 ||
|
||||||
|
@ -483,6 +483,7 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
|
|||||||
struct page *page;
|
struct page *page;
|
||||||
struct sk_buff *trailer;
|
struct sk_buff *trailer;
|
||||||
int tailen = esp->tailen;
|
int tailen = esp->tailen;
|
||||||
|
unsigned int allocsz;
|
||||||
|
|
||||||
if (x->encap) {
|
if (x->encap) {
|
||||||
int err = esp6_output_encap(x, skb, esp);
|
int err = esp6_output_encap(x, skb, esp);
|
||||||
@ -491,6 +492,10 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allocsz = ALIGN(skb->data_len + tailen, L1_CACHE_BYTES);
|
||||||
|
if (allocsz > ESP_SKB_FRAG_MAXSIZE)
|
||||||
|
goto cow;
|
||||||
|
|
||||||
if (!skb_cloned(skb)) {
|
if (!skb_cloned(skb)) {
|
||||||
if (tailen <= skb_tailroom(skb)) {
|
if (tailen <= skb_tailroom(skb)) {
|
||||||
nfrags = 1;
|
nfrags = 1;
|
||||||
|
@ -198,6 +198,9 @@ static struct sk_buff *xfrm6_beet_gso_segment(struct xfrm_state *x,
|
|||||||
ipv6_skip_exthdr(skb, 0, &proto, &frag);
|
ipv6_skip_exthdr(skb, 0, &proto, &frag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proto == IPPROTO_IPIP)
|
||||||
|
skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP6;
|
||||||
|
|
||||||
__skb_pull(skb, skb_transport_offset(skb));
|
__skb_pull(skb, skb_transport_offset(skb));
|
||||||
ops = rcu_dereference(inet6_offloads[proto]);
|
ops = rcu_dereference(inet6_offloads[proto]);
|
||||||
if (likely(ops && ops->callbacks.gso_segment))
|
if (likely(ops && ops->callbacks.gso_segment))
|
||||||
|
@ -2623,7 +2623,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return xfrm_migrate(&sel, dir, XFRM_POLICY_TYPE_MAIN, m, i,
|
return xfrm_migrate(&sel, dir, XFRM_POLICY_TYPE_MAIN, m, i,
|
||||||
kma ? &k : NULL, net, NULL);
|
kma ? &k : NULL, net, NULL, 0);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
|
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
|
||||||
* Copyright 2007-2010, Intel Corporation
|
* Copyright 2007-2010, Intel Corporation
|
||||||
* Copyright(c) 2015-2017 Intel Deutschland GmbH
|
* Copyright(c) 2015-2017 Intel Deutschland GmbH
|
||||||
* Copyright (C) 2018 - 2021 Intel Corporation
|
* Copyright (C) 2018 - 2022 Intel Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/ieee80211.h>
|
#include <linux/ieee80211.h>
|
||||||
@ -626,6 +626,14 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (test_sta_flag(sta, WLAN_STA_MFP) &&
|
||||||
|
!test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
|
||||||
|
ht_dbg(sdata,
|
||||||
|
"MFP STA not authorized - deny BA session request %pM tid %d\n",
|
||||||
|
sta->sta.addr, tid);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 802.11n-2009 11.5.1.1: If the initiating STA is an HT STA, is a
|
* 802.11n-2009 11.5.1.1: If the initiating STA is an HT STA, is a
|
||||||
* member of an IBSS, and has no other existing Block Ack agreement
|
* member of an IBSS, and has no other existing Block Ack agreement
|
||||||
|
@ -61,10 +61,6 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
|
|||||||
r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
|
r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
|
||||||
r->idiag_retrans = asoc->rtx_data_chunks;
|
r->idiag_retrans = asoc->rtx_data_chunks;
|
||||||
r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
|
r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
|
||||||
} else {
|
|
||||||
r->idiag_timer = 0;
|
|
||||||
r->idiag_retrans = 0;
|
|
||||||
r->idiag_expires = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,13 +140,14 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
|
|||||||
r = nlmsg_data(nlh);
|
r = nlmsg_data(nlh);
|
||||||
BUG_ON(!sk_fullsock(sk));
|
BUG_ON(!sk_fullsock(sk));
|
||||||
|
|
||||||
|
r->idiag_timer = 0;
|
||||||
|
r->idiag_retrans = 0;
|
||||||
|
r->idiag_expires = 0;
|
||||||
if (asoc) {
|
if (asoc) {
|
||||||
inet_diag_msg_sctpasoc_fill(r, sk, asoc);
|
inet_diag_msg_sctpasoc_fill(r, sk, asoc);
|
||||||
} else {
|
} else {
|
||||||
inet_diag_msg_common_fill(r, sk);
|
inet_diag_msg_common_fill(r, sk);
|
||||||
r->idiag_state = sk->sk_state;
|
r->idiag_state = sk->sk_state;
|
||||||
r->idiag_timer = 0;
|
|
||||||
r->idiag_retrans = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inet_diag_msg_attrs_fill(sk, skb, r, ext, user_ns, net_admin))
|
if (inet_diag_msg_attrs_fill(sk, skb, r, ext, user_ns, net_admin))
|
||||||
|
@ -352,16 +352,18 @@ static int tipc_enable_bearer(struct net *net, const char *name,
|
|||||||
goto rejected;
|
goto rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create monitoring data before accepting activate messages */
|
||||||
|
if (tipc_mon_create(net, bearer_id)) {
|
||||||
|
bearer_disable(net, b);
|
||||||
|
kfree_skb(skb);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
test_and_set_bit_lock(0, &b->up);
|
test_and_set_bit_lock(0, &b->up);
|
||||||
rcu_assign_pointer(tn->bearer_list[bearer_id], b);
|
rcu_assign_pointer(tn->bearer_list[bearer_id], b);
|
||||||
if (skb)
|
if (skb)
|
||||||
tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr);
|
tipc_bearer_xmit_skb(net, bearer_id, skb, &b->bcast_addr);
|
||||||
|
|
||||||
if (tipc_mon_create(net, bearer_id)) {
|
|
||||||
bearer_disable(net, b);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
pr_info("Enabled bearer <%s>, priority %u\n", name, prio);
|
pr_info("Enabled bearer <%s>, priority %u\n", name, prio);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -2285,6 +2285,11 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case STATE_MSG:
|
case STATE_MSG:
|
||||||
|
/* Validate Gap ACK blocks, drop if invalid */
|
||||||
|
glen = tipc_get_gap_ack_blks(&ga, l, hdr, true);
|
||||||
|
if (glen > dlen)
|
||||||
|
break;
|
||||||
|
|
||||||
l->rcv_nxt_state = msg_seqno(hdr) + 1;
|
l->rcv_nxt_state = msg_seqno(hdr) + 1;
|
||||||
|
|
||||||
/* Update own tolerance if peer indicates a non-zero value */
|
/* Update own tolerance if peer indicates a non-zero value */
|
||||||
@ -2310,10 +2315,6 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive Gap ACK blocks from peer if any */
|
|
||||||
glen = tipc_get_gap_ack_blks(&ga, l, hdr, true);
|
|
||||||
if(glen > dlen)
|
|
||||||
break;
|
|
||||||
tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr,
|
tipc_mon_rcv(l->net, data + glen, dlen - glen, l->addr,
|
||||||
&l->mon_state, l->bearer_id);
|
&l->mon_state, l->bearer_id);
|
||||||
|
|
||||||
|
@ -17525,7 +17525,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
|
|||||||
wdev->chandef = *chandef;
|
wdev->chandef = *chandef;
|
||||||
wdev->preset_chandef = *chandef;
|
wdev->preset_chandef = *chandef;
|
||||||
|
|
||||||
if (wdev->iftype == NL80211_IFTYPE_STATION &&
|
if ((wdev->iftype == NL80211_IFTYPE_STATION ||
|
||||||
|
wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
|
||||||
!WARN_ON(!wdev->current_bss))
|
!WARN_ON(!wdev->current_bss))
|
||||||
cfg80211_update_assoc_bss_entry(wdev, chandef->chan);
|
cfg80211_update_assoc_bss_entry(wdev, chandef->chan);
|
||||||
|
|
||||||
|
@ -4259,7 +4259,7 @@ static bool xfrm_migrate_selector_match(const struct xfrm_selector *sel_cmp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *sel,
|
static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *sel,
|
||||||
u8 dir, u8 type, struct net *net)
|
u8 dir, u8 type, struct net *net, u32 if_id)
|
||||||
{
|
{
|
||||||
struct xfrm_policy *pol, *ret = NULL;
|
struct xfrm_policy *pol, *ret = NULL;
|
||||||
struct hlist_head *chain;
|
struct hlist_head *chain;
|
||||||
@ -4268,7 +4268,8 @@ static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *
|
|||||||
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
|
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
|
||||||
chain = policy_hash_direct(net, &sel->daddr, &sel->saddr, sel->family, dir);
|
chain = policy_hash_direct(net, &sel->daddr, &sel->saddr, sel->family, dir);
|
||||||
hlist_for_each_entry(pol, chain, bydst) {
|
hlist_for_each_entry(pol, chain, bydst) {
|
||||||
if (xfrm_migrate_selector_match(sel, &pol->selector) &&
|
if ((if_id == 0 || pol->if_id == if_id) &&
|
||||||
|
xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||||
pol->type == type) {
|
pol->type == type) {
|
||||||
ret = pol;
|
ret = pol;
|
||||||
priority = ret->priority;
|
priority = ret->priority;
|
||||||
@ -4280,7 +4281,8 @@ static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *
|
|||||||
if ((pol->priority >= priority) && ret)
|
if ((pol->priority >= priority) && ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (xfrm_migrate_selector_match(sel, &pol->selector) &&
|
if ((if_id == 0 || pol->if_id == if_id) &&
|
||||||
|
xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||||
pol->type == type) {
|
pol->type == type) {
|
||||||
ret = pol;
|
ret = pol;
|
||||||
break;
|
break;
|
||||||
@ -4396,7 +4398,7 @@ static int xfrm_migrate_check(const struct xfrm_migrate *m, int num_migrate)
|
|||||||
int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
||||||
struct xfrm_migrate *m, int num_migrate,
|
struct xfrm_migrate *m, int num_migrate,
|
||||||
struct xfrm_kmaddress *k, struct net *net,
|
struct xfrm_kmaddress *k, struct net *net,
|
||||||
struct xfrm_encap_tmpl *encap)
|
struct xfrm_encap_tmpl *encap, u32 if_id)
|
||||||
{
|
{
|
||||||
int i, err, nx_cur = 0, nx_new = 0;
|
int i, err, nx_cur = 0, nx_new = 0;
|
||||||
struct xfrm_policy *pol = NULL;
|
struct xfrm_policy *pol = NULL;
|
||||||
@ -4415,14 +4417,14 @@ int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Stage 1 - find policy */
|
/* Stage 1 - find policy */
|
||||||
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net)) == NULL) {
|
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id)) == NULL) {
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stage 2 - find and update state(s) */
|
/* Stage 2 - find and update state(s) */
|
||||||
for (i = 0, mp = m; i < num_migrate; i++, mp++) {
|
for (i = 0, mp = m; i < num_migrate; i++, mp++) {
|
||||||
if ((x = xfrm_migrate_state_find(mp, net))) {
|
if ((x = xfrm_migrate_state_find(mp, net, if_id))) {
|
||||||
x_cur[nx_cur] = x;
|
x_cur[nx_cur] = x;
|
||||||
nx_cur++;
|
nx_cur++;
|
||||||
xc = xfrm_state_migrate(x, mp, encap);
|
xc = xfrm_state_migrate(x, mp, encap);
|
||||||
|
@ -1578,9 +1578,6 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
|
|||||||
memcpy(&x->mark, &orig->mark, sizeof(x->mark));
|
memcpy(&x->mark, &orig->mark, sizeof(x->mark));
|
||||||
memcpy(&x->props.smark, &orig->props.smark, sizeof(x->props.smark));
|
memcpy(&x->props.smark, &orig->props.smark, sizeof(x->props.smark));
|
||||||
|
|
||||||
if (xfrm_init_state(x) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
x->props.flags = orig->props.flags;
|
x->props.flags = orig->props.flags;
|
||||||
x->props.extra_flags = orig->props.extra_flags;
|
x->props.extra_flags = orig->props.extra_flags;
|
||||||
|
|
||||||
@ -1605,7 +1602,8 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)
|
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net,
|
||||||
|
u32 if_id)
|
||||||
{
|
{
|
||||||
unsigned int h;
|
unsigned int h;
|
||||||
struct xfrm_state *x = NULL;
|
struct xfrm_state *x = NULL;
|
||||||
@ -1621,6 +1619,8 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
|||||||
continue;
|
continue;
|
||||||
if (m->reqid && x->props.reqid != m->reqid)
|
if (m->reqid && x->props.reqid != m->reqid)
|
||||||
continue;
|
continue;
|
||||||
|
if (if_id != 0 && x->if_id != if_id)
|
||||||
|
continue;
|
||||||
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
||||||
m->old_family) ||
|
m->old_family) ||
|
||||||
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
||||||
@ -1636,6 +1636,8 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
|||||||
if (x->props.mode != m->mode ||
|
if (x->props.mode != m->mode ||
|
||||||
x->id.proto != m->proto)
|
x->id.proto != m->proto)
|
||||||
continue;
|
continue;
|
||||||
|
if (if_id != 0 && x->if_id != if_id)
|
||||||
|
continue;
|
||||||
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
||||||
m->old_family) ||
|
m->old_family) ||
|
||||||
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
||||||
@ -1662,6 +1664,11 @@ struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
|
|||||||
if (!xc)
|
if (!xc)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
xc->props.family = m->new_family;
|
||||||
|
|
||||||
|
if (xfrm_init_state(xc) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
memcpy(&xc->id.daddr, &m->new_daddr, sizeof(xc->id.daddr));
|
memcpy(&xc->id.daddr, &m->new_daddr, sizeof(xc->id.daddr));
|
||||||
memcpy(&xc->props.saddr, &m->new_saddr, sizeof(xc->props.saddr));
|
memcpy(&xc->props.saddr, &m->new_saddr, sizeof(xc->props.saddr));
|
||||||
|
|
||||||
|
@ -629,13 +629,8 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
|
|||||||
|
|
||||||
xfrm_smark_init(attrs, &x->props.smark);
|
xfrm_smark_init(attrs, &x->props.smark);
|
||||||
|
|
||||||
if (attrs[XFRMA_IF_ID]) {
|
if (attrs[XFRMA_IF_ID])
|
||||||
x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||||
if (!x->if_id) {
|
|
||||||
err = -EINVAL;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
|
err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
|
||||||
if (err)
|
if (err)
|
||||||
@ -1431,13 +1426,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
|
|
||||||
mark = xfrm_mark_get(attrs, &m);
|
mark = xfrm_mark_get(attrs, &m);
|
||||||
|
|
||||||
if (attrs[XFRMA_IF_ID]) {
|
if (attrs[XFRMA_IF_ID])
|
||||||
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||||
if (!if_id) {
|
|
||||||
err = -EINVAL;
|
|
||||||
goto out_noput;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p->info.seq) {
|
if (p->info.seq) {
|
||||||
x = xfrm_find_acq_byseq(net, mark, p->info.seq);
|
x = xfrm_find_acq_byseq(net, mark, p->info.seq);
|
||||||
@ -1750,13 +1740,8 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us
|
|||||||
|
|
||||||
xfrm_mark_get(attrs, &xp->mark);
|
xfrm_mark_get(attrs, &xp->mark);
|
||||||
|
|
||||||
if (attrs[XFRMA_IF_ID]) {
|
if (attrs[XFRMA_IF_ID])
|
||||||
xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||||
if (!xp->if_id) {
|
|
||||||
err = -EINVAL;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return xp;
|
return xp;
|
||||||
error:
|
error:
|
||||||
@ -2607,6 +2592,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
struct net *net = sock_net(skb->sk);
|
struct net *net = sock_net(skb->sk);
|
||||||
struct xfrm_encap_tmpl *encap = NULL;
|
struct xfrm_encap_tmpl *encap = NULL;
|
||||||
|
u32 if_id = 0;
|
||||||
|
|
||||||
if (attrs[XFRMA_MIGRATE] == NULL)
|
if (attrs[XFRMA_MIGRATE] == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -2631,7 +2617,10 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap);
|
if (attrs[XFRMA_IF_ID])
|
||||||
|
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||||
|
|
||||||
|
err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap, if_id);
|
||||||
|
|
||||||
kfree(encap);
|
kfree(encap);
|
||||||
|
|
||||||
|
@ -374,6 +374,16 @@ run_cmd() {
|
|||||||
return $rc
|
return $rc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_cmd_bg() {
|
||||||
|
cmd="$*"
|
||||||
|
|
||||||
|
if [ "$VERBOSE" = "1" ]; then
|
||||||
|
printf " COMMAND: %s &\n" "${cmd}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$cmd 2>&1 &
|
||||||
|
}
|
||||||
|
|
||||||
# Find the auto-generated name for this namespace
|
# Find the auto-generated name for this namespace
|
||||||
nsname() {
|
nsname() {
|
||||||
eval echo \$NS_$1
|
eval echo \$NS_$1
|
||||||
@ -670,10 +680,10 @@ setup_nettest_xfrm() {
|
|||||||
[ ${1} -eq 6 ] && proto="-6" || proto=""
|
[ ${1} -eq 6 ] && proto="-6" || proto=""
|
||||||
port=${2}
|
port=${2}
|
||||||
|
|
||||||
run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
|
run_cmd_bg "${ns_a}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
|
||||||
nettest_pids="${nettest_pids} $!"
|
nettest_pids="${nettest_pids} $!"
|
||||||
|
|
||||||
run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
|
run_cmd_bg "${ns_b}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
|
||||||
nettest_pids="${nettest_pids} $!"
|
nettest_pids="${nettest_pids} $!"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +875,6 @@ setup_ovs_bridge() {
|
|||||||
setup() {
|
setup() {
|
||||||
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
|
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
|
||||||
|
|
||||||
cleanup
|
|
||||||
for arg do
|
for arg do
|
||||||
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
|
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
|
||||||
done
|
done
|
||||||
@ -876,7 +885,7 @@ trace() {
|
|||||||
|
|
||||||
for arg do
|
for arg do
|
||||||
[ "${ns_cmd}" = "" ] && ns_cmd="${arg}" && continue
|
[ "${ns_cmd}" = "" ] && ns_cmd="${arg}" && continue
|
||||||
${ns_cmd} tcpdump -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
${ns_cmd} tcpdump --immediate-mode -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
||||||
tcpdump_pids="${tcpdump_pids} $!"
|
tcpdump_pids="${tcpdump_pids} $!"
|
||||||
ns_cmd=
|
ns_cmd=
|
||||||
done
|
done
|
||||||
@ -1836,6 +1845,10 @@ run_test() {
|
|||||||
|
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
|
# Since cleanup() relies on variables modified by this subshell, it
|
||||||
|
# has to run in this context.
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
if [ "$VERBOSE" = "1" ]; then
|
if [ "$VERBOSE" = "1" ]; then
|
||||||
printf "\n##########################################################################\n\n"
|
printf "\n##########################################################################\n\n"
|
||||||
fi
|
fi
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
#define MAP_FIXED_NOREPLACE 0x100000
|
#define MAP_FIXED_NOREPLACE 0x100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BASE_ADDRESS (256ul * 1024 * 1024)
|
|
||||||
|
|
||||||
|
|
||||||
static void dump_maps(void)
|
static void dump_maps(void)
|
||||||
{
|
{
|
||||||
char cmd[32];
|
char cmd[32];
|
||||||
@ -28,18 +25,46 @@ static void dump_maps(void)
|
|||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long find_base_addr(unsigned long size)
|
||||||
|
{
|
||||||
|
void *addr;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||||
|
addr = mmap(NULL, size, PROT_NONE, flags, -1, 0);
|
||||||
|
if (addr == MAP_FAILED) {
|
||||||
|
printf("Error: couldn't map the space we need for the test\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (munmap(addr, size) != 0) {
|
||||||
|
printf("Error: couldn't map the space we need for the test\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (unsigned long)addr;
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
unsigned long base_addr;
|
||||||
unsigned long flags, addr, size, page_size;
|
unsigned long flags, addr, size, page_size;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
page_size = sysconf(_SC_PAGE_SIZE);
|
page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
|
||||||
|
//let's find a base addr that is free before we start the tests
|
||||||
|
size = 5 * page_size;
|
||||||
|
base_addr = find_base_addr(size);
|
||||||
|
if (!base_addr) {
|
||||||
|
printf("Error: couldn't map the space we need for the test\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
|
flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
|
||||||
|
|
||||||
// Check we can map all the areas we need below
|
// Check we can map all the areas we need below
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS;
|
addr = base_addr;
|
||||||
size = 5 * page_size;
|
size = 5 * page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
|
|
||||||
@ -60,7 +85,7 @@ int main(void)
|
|||||||
printf("unmap() successful\n");
|
printf("unmap() successful\n");
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS + page_size;
|
addr = base_addr + page_size;
|
||||||
size = 3 * page_size;
|
size = 3 * page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -80,7 +105,7 @@ int main(void)
|
|||||||
* +4 | free | new
|
* +4 | free | new
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS;
|
addr = base_addr;
|
||||||
size = 5 * page_size;
|
size = 5 * page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -101,7 +126,7 @@ int main(void)
|
|||||||
* +4 | free |
|
* +4 | free |
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS + (2 * page_size);
|
addr = base_addr + (2 * page_size);
|
||||||
size = page_size;
|
size = page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -121,7 +146,7 @@ int main(void)
|
|||||||
* +4 | free | new
|
* +4 | free | new
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS + (3 * page_size);
|
addr = base_addr + (3 * page_size);
|
||||||
size = 2 * page_size;
|
size = 2 * page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -141,7 +166,7 @@ int main(void)
|
|||||||
* +4 | free |
|
* +4 | free |
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS;
|
addr = base_addr;
|
||||||
size = 2 * page_size;
|
size = 2 * page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -161,7 +186,7 @@ int main(void)
|
|||||||
* +4 | free |
|
* +4 | free |
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS;
|
addr = base_addr;
|
||||||
size = page_size;
|
size = page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -181,7 +206,7 @@ int main(void)
|
|||||||
* +4 | free | new
|
* +4 | free | new
|
||||||
*/
|
*/
|
||||||
errno = 0;
|
errno = 0;
|
||||||
addr = BASE_ADDRESS + (4 * page_size);
|
addr = base_addr + (4 * page_size);
|
||||||
size = page_size;
|
size = page_size;
|
||||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||||
@ -192,7 +217,7 @@ int main(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = BASE_ADDRESS;
|
addr = base_addr;
|
||||||
size = 5 * page_size;
|
size = 5 * page_size;
|
||||||
if (munmap((void *)addr, size) != 0) {
|
if (munmap((void *)addr, size) != 0) {
|
||||||
dump_maps();
|
dump_maps();
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <linux/mman.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user