Merge branch 'master' into for-next
Sync with Linus' tree to be able to apply pending patches that are based on newer code already present upstream.
This commit is contained in:
@@ -205,7 +205,7 @@ int register_vlan_dev(struct net_device *dev)
|
||||
grp->nr_vlans++;
|
||||
|
||||
if (ngrp) {
|
||||
if (ops->ndo_vlan_rx_register)
|
||||
if (ops->ndo_vlan_rx_register && (real_dev->features & NETIF_F_HW_VLAN_RX))
|
||||
ops->ndo_vlan_rx_register(real_dev, ngrp);
|
||||
rcu_assign_pointer(real_dev->vlgrp, ngrp);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,31 @@ bool vlan_do_receive(struct sk_buff **skbp)
|
||||
return false;
|
||||
|
||||
skb->dev = vlan_dev;
|
||||
if (skb->pkt_type == PACKET_OTHERHOST) {
|
||||
/* Our lower layer thinks this is not local, let's make sure.
|
||||
* This allows the VLAN to have a different MAC than the
|
||||
* underlying device, and still route correctly. */
|
||||
if (!compare_ether_addr(eth_hdr(skb)->h_dest,
|
||||
vlan_dev->dev_addr))
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
}
|
||||
|
||||
if (!(vlan_dev_info(vlan_dev)->flags & VLAN_FLAG_REORDER_HDR)) {
|
||||
unsigned int offset = skb->data - skb_mac_header(skb);
|
||||
|
||||
/*
|
||||
* vlan_insert_tag expect skb->data pointing to mac header.
|
||||
* So change skb->data before calling it and change back to
|
||||
* original position later
|
||||
*/
|
||||
skb_push(skb, offset);
|
||||
skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci);
|
||||
if (!skb)
|
||||
return false;
|
||||
skb_pull(skb, offset + VLAN_HLEN);
|
||||
skb_reset_mac_len(skb);
|
||||
}
|
||||
|
||||
skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci);
|
||||
skb->vlan_tci = 0;
|
||||
|
||||
@@ -31,22 +56,8 @@ bool vlan_do_receive(struct sk_buff **skbp)
|
||||
u64_stats_update_begin(&rx_stats->syncp);
|
||||
rx_stats->rx_packets++;
|
||||
rx_stats->rx_bytes += skb->len;
|
||||
|
||||
switch (skb->pkt_type) {
|
||||
case PACKET_BROADCAST:
|
||||
break;
|
||||
case PACKET_MULTICAST:
|
||||
if (skb->pkt_type == PACKET_MULTICAST)
|
||||
rx_stats->rx_multicast++;
|
||||
break;
|
||||
case PACKET_OTHERHOST:
|
||||
/* Our lower layer thinks this is not local, let's make sure.
|
||||
* This allows the VLAN to have a different MAC than the
|
||||
* underlying device, and still route correctly. */
|
||||
if (!compare_ether_addr(eth_hdr(skb)->h_dest,
|
||||
vlan_dev->dev_addr))
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
break;
|
||||
}
|
||||
u64_stats_update_end(&rx_stats->syncp);
|
||||
|
||||
return true;
|
||||
@@ -89,18 +100,13 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
|
||||
}
|
||||
EXPORT_SYMBOL(vlan_gro_frags);
|
||||
|
||||
static struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
|
||||
static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
|
||||
{
|
||||
if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) {
|
||||
if (skb_cow(skb, skb_headroom(skb)) < 0)
|
||||
skb = NULL;
|
||||
if (skb) {
|
||||
/* Lifted from Gleb's VLAN code... */
|
||||
memmove(skb->data - ETH_HLEN,
|
||||
skb->data - VLAN_ETH_HLEN, 12);
|
||||
skb->mac_header += VLAN_HLEN;
|
||||
}
|
||||
}
|
||||
if (skb_cow(skb, skb_headroom(skb)) < 0)
|
||||
return NULL;
|
||||
memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
|
||||
skb->mac_header += VLAN_HLEN;
|
||||
skb_reset_mac_len(skb);
|
||||
return skb;
|
||||
}
|
||||
|
||||
@@ -161,7 +167,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
|
||||
skb_pull_rcsum(skb, VLAN_HLEN);
|
||||
vlan_set_encap_proto(skb, vhdr);
|
||||
|
||||
skb = vlan_check_reorder_header(skb);
|
||||
skb = vlan_reorder_header(skb);
|
||||
if (unlikely(!skb))
|
||||
goto err_free;
|
||||
|
||||
|
||||
@@ -586,9 +586,14 @@ static void vlan_dev_uninit(struct net_device *dev)
|
||||
static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
|
||||
{
|
||||
struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
|
||||
u32 old_features = features;
|
||||
|
||||
features &= real_dev->features;
|
||||
features &= real_dev->vlan_features;
|
||||
|
||||
if (old_features & NETIF_F_SOFT_FEATURES)
|
||||
features |= old_features & NETIF_F_SOFT_FEATURES;
|
||||
|
||||
if (dev_ethtool_get_rx_csum(real_dev))
|
||||
features |= NETIF_F_RXCSUM;
|
||||
features |= NETIF_F_LLTX;
|
||||
|
||||
@@ -608,11 +608,11 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
|
||||
goto encrypt;
|
||||
|
||||
auth:
|
||||
if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
|
||||
if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
|
||||
return 0;
|
||||
|
||||
hci_conn_auth(conn, sec_level, auth_type);
|
||||
return 0;
|
||||
if (!hci_conn_auth(conn, sec_level, auth_type))
|
||||
return 0;
|
||||
|
||||
encrypt:
|
||||
if (conn->link_mode & HCI_LM_ENCRYPT)
|
||||
|
||||
@@ -477,14 +477,16 @@ static void hci_setup_event_mask(struct hci_dev *hdev)
|
||||
* command otherwise */
|
||||
u8 events[8] = { 0xff, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
/* Events for 1.2 and newer controllers */
|
||||
if (hdev->lmp_ver > 1) {
|
||||
events[4] |= 0x01; /* Flow Specification Complete */
|
||||
events[4] |= 0x02; /* Inquiry Result with RSSI */
|
||||
events[4] |= 0x04; /* Read Remote Extended Features Complete */
|
||||
events[5] |= 0x08; /* Synchronous Connection Complete */
|
||||
events[5] |= 0x10; /* Synchronous Connection Changed */
|
||||
}
|
||||
/* CSR 1.1 dongles does not accept any bitfield so don't try to set
|
||||
* any event mask for pre 1.2 devices */
|
||||
if (hdev->lmp_ver <= 1)
|
||||
return;
|
||||
|
||||
events[4] |= 0x01; /* Flow Specification Complete */
|
||||
events[4] |= 0x02; /* Inquiry Result with RSSI */
|
||||
events[4] |= 0x04; /* Read Remote Extended Features Complete */
|
||||
events[5] |= 0x08; /* Synchronous Connection Complete */
|
||||
events[5] |= 0x10; /* Synchronous Connection Changed */
|
||||
|
||||
if (hdev->features[3] & LMP_RSSI_INQ)
|
||||
events[4] |= 0x04; /* Inquiry Result with RSSI */
|
||||
|
||||
@@ -4002,21 +4002,30 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
|
||||
}
|
||||
} else if (sk->sk_state == BT_CONNECT2) {
|
||||
struct l2cap_conn_rsp rsp;
|
||||
__u16 result;
|
||||
__u16 res, stat;
|
||||
|
||||
if (!status) {
|
||||
sk->sk_state = BT_CONFIG;
|
||||
result = L2CAP_CR_SUCCESS;
|
||||
if (bt_sk(sk)->defer_setup) {
|
||||
struct sock *parent = bt_sk(sk)->parent;
|
||||
res = L2CAP_CR_PEND;
|
||||
stat = L2CAP_CS_AUTHOR_PEND;
|
||||
parent->sk_data_ready(parent, 0);
|
||||
} else {
|
||||
sk->sk_state = BT_CONFIG;
|
||||
res = L2CAP_CR_SUCCESS;
|
||||
stat = L2CAP_CS_NO_INFO;
|
||||
}
|
||||
} else {
|
||||
sk->sk_state = BT_DISCONN;
|
||||
l2cap_sock_set_timer(sk, HZ / 10);
|
||||
result = L2CAP_CR_SEC_BLOCK;
|
||||
res = L2CAP_CR_SEC_BLOCK;
|
||||
stat = L2CAP_CS_NO_INFO;
|
||||
}
|
||||
|
||||
rsp.scid = cpu_to_le16(chan->dcid);
|
||||
rsp.dcid = cpu_to_le16(chan->scid);
|
||||
rsp.result = cpu_to_le16(result);
|
||||
rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
|
||||
rsp.result = cpu_to_le16(res);
|
||||
rsp.status = cpu_to_le16(stat);
|
||||
l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP,
|
||||
sizeof(rsp), &rsp);
|
||||
}
|
||||
|
||||
@@ -413,6 +413,7 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __us
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&cinfo, 0, sizeof(cinfo));
|
||||
cinfo.hci_handle = chan->conn->hcon->handle;
|
||||
memcpy(cinfo.dev_class, chan->conn->hcon->dev_class, 3);
|
||||
|
||||
|
||||
@@ -788,6 +788,7 @@ static int rfcomm_sock_getsockopt_old(struct socket *sock, int optname, char __u
|
||||
|
||||
l2cap_sk = rfcomm_pi(sk)->dlc->session->sock->sk;
|
||||
|
||||
memset(&cinfo, 0, sizeof(cinfo));
|
||||
cinfo.hci_handle = conn->hcon->handle;
|
||||
memcpy(cinfo.dev_class, conn->hcon->dev_class, 3);
|
||||
|
||||
|
||||
@@ -369,6 +369,15 @@ static void __sco_sock_close(struct sock *sk)
|
||||
|
||||
case BT_CONNECTED:
|
||||
case BT_CONFIG:
|
||||
if (sco_pi(sk)->conn) {
|
||||
sk->sk_state = BT_DISCONN;
|
||||
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
|
||||
hci_conn_put(sco_pi(sk)->conn->hcon);
|
||||
sco_pi(sk)->conn->hcon = NULL;
|
||||
} else
|
||||
sco_chan_del(sk, ECONNRESET);
|
||||
break;
|
||||
|
||||
case BT_CONNECT:
|
||||
case BT_DISCONN:
|
||||
sco_chan_del(sk, ECONNRESET);
|
||||
@@ -819,7 +828,9 @@ static void sco_chan_del(struct sock *sk, int err)
|
||||
conn->sk = NULL;
|
||||
sco_pi(sk)->conn = NULL;
|
||||
sco_conn_unlock(conn);
|
||||
hci_conn_put(conn->hcon);
|
||||
|
||||
if (conn->hcon)
|
||||
hci_conn_put(conn->hcon);
|
||||
}
|
||||
|
||||
sk->sk_state = BT_CLOSED;
|
||||
|
||||
@@ -49,7 +49,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
skb_pull(skb, ETH_HLEN);
|
||||
|
||||
rcu_read_lock();
|
||||
if (is_multicast_ether_addr(dest)) {
|
||||
if (is_broadcast_ether_addr(dest))
|
||||
br_flood_deliver(br, skb);
|
||||
else if (is_multicast_ether_addr(dest)) {
|
||||
if (unlikely(netpoll_tx_running(dev))) {
|
||||
br_flood_deliver(br, skb);
|
||||
goto out;
|
||||
@@ -243,6 +245,7 @@ int br_netpoll_enable(struct net_bridge_port *p)
|
||||
goto out;
|
||||
|
||||
np->dev = p->dev;
|
||||
strlcpy(np->dev_name, p->dev->name, IFNAMSIZ);
|
||||
|
||||
err = __netpoll_setup(np);
|
||||
if (err) {
|
||||
|
||||
@@ -60,7 +60,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
|
||||
br = p->br;
|
||||
br_fdb_update(br, p, eth_hdr(skb)->h_source);
|
||||
|
||||
if (is_multicast_ether_addr(dest) &&
|
||||
if (!is_broadcast_ether_addr(dest) && is_multicast_ether_addr(dest) &&
|
||||
br_multicast_rcv(br, p, skb))
|
||||
goto drop;
|
||||
|
||||
@@ -77,7 +77,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
|
||||
|
||||
dst = NULL;
|
||||
|
||||
if (is_multicast_ether_addr(dest)) {
|
||||
if (is_broadcast_ether_addr(dest))
|
||||
skb2 = skb;
|
||||
else if (is_multicast_ether_addr(dest)) {
|
||||
mdst = br_mdb_get(br, skb);
|
||||
if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
|
||||
if ((mdst && mdst->mglist) ||
|
||||
|
||||
@@ -1379,8 +1379,11 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
|
||||
if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
|
||||
return -EINVAL;
|
||||
|
||||
if (iph->protocol != IPPROTO_IGMP)
|
||||
if (iph->protocol != IPPROTO_IGMP) {
|
||||
if ((iph->daddr & IGMP_LOCAL_GROUP_MASK) != IGMP_LOCAL_GROUP)
|
||||
BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = ntohs(iph->tot_len);
|
||||
if (skb->len < len || len < ip_hdrlen(skb))
|
||||
@@ -1424,7 +1427,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br,
|
||||
switch (ih->type) {
|
||||
case IGMP_HOST_MEMBERSHIP_REPORT:
|
||||
case IGMPV2_HOST_MEMBERSHIP_REPORT:
|
||||
BR_INPUT_SKB_CB(skb2)->mrouters_only = 1;
|
||||
BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
|
||||
err = br_ip4_multicast_add_group(br, port, ih->group);
|
||||
break;
|
||||
case IGMPV3_HOST_MEMBERSHIP_REPORT:
|
||||
@@ -1543,7 +1546,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
|
||||
goto out;
|
||||
}
|
||||
mld = (struct mld_msg *)skb_transport_header(skb2);
|
||||
BR_INPUT_SKB_CB(skb2)->mrouters_only = 1;
|
||||
BR_INPUT_SKB_CB(skb)->mrouters_only = 1;
|
||||
err = br_ip6_multicast_add_group(br, port, &mld->mld_mca);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -104,10 +104,16 @@ static void fake_update_pmtu(struct dst_entry *dst, u32 mtu)
|
||||
{
|
||||
}
|
||||
|
||||
static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dst_ops fake_dst_ops = {
|
||||
.family = AF_INET,
|
||||
.protocol = cpu_to_be16(ETH_P_IP),
|
||||
.update_pmtu = fake_update_pmtu,
|
||||
.cow_metrics = fake_cow_metrics,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -255,7 +255,7 @@ static void cfmuxl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
|
||||
|
||||
if (cfsrvl_phyid_match(layer, phyid) && layer->ctrlcmd) {
|
||||
|
||||
if ((ctrl == _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND ||
|
||||
if ((ctrl == _CAIF_CTRLCMD_PHYIF_DOWN_IND ||
|
||||
ctrl == CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND) &&
|
||||
layer->id != 0) {
|
||||
|
||||
|
||||
@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
|
||||
calc_layout(osdc, vino, layout, off, plen, req, ops);
|
||||
req->r_file_layout = *layout; /* keep a copy */
|
||||
|
||||
/* in case it differs from natural alignment that calc_layout
|
||||
filled in for us */
|
||||
/* in case it differs from natural (file) alignment that
|
||||
calc_layout filled in for us */
|
||||
req->r_num_pages = calc_pages_for(page_align, *plen);
|
||||
req->r_page_alignment = page_align;
|
||||
|
||||
ceph_osdc_build_request(req, off, plen, ops,
|
||||
@@ -1144,6 +1145,13 @@ static void handle_osds_timeout(struct work_struct *work)
|
||||
round_jiffies_relative(delay));
|
||||
}
|
||||
|
||||
static void complete_request(struct ceph_osd_request *req)
|
||||
{
|
||||
if (req->r_safe_callback)
|
||||
req->r_safe_callback(req, NULL);
|
||||
complete_all(&req->r_safe_completion); /* fsync waiter */
|
||||
}
|
||||
|
||||
/*
|
||||
* handle osd op reply. either call the callback if it is specified,
|
||||
* or do the completion to wake up the waiting thread.
|
||||
@@ -1226,11 +1234,8 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
|
||||
else
|
||||
complete_all(&req->r_completion);
|
||||
|
||||
if (flags & CEPH_OSD_FLAG_ONDISK) {
|
||||
if (req->r_safe_callback)
|
||||
req->r_safe_callback(req, msg);
|
||||
complete_all(&req->r_safe_completion); /* fsync waiter */
|
||||
}
|
||||
if (flags & CEPH_OSD_FLAG_ONDISK)
|
||||
complete_request(req);
|
||||
|
||||
done:
|
||||
dout("req=%p req->r_linger=%d\n", req, req->r_linger);
|
||||
@@ -1732,6 +1737,7 @@ int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
|
||||
__cancel_request(req);
|
||||
__unregister_request(osdc, req);
|
||||
mutex_unlock(&osdc->request_mutex);
|
||||
complete_request(req);
|
||||
dout("wait_request tid %llu canceled/timed out\n", req->r_tid);
|
||||
return rc;
|
||||
}
|
||||
@@ -2022,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
|
||||
int want = calc_pages_for(req->r_page_alignment, data_len);
|
||||
|
||||
if (unlikely(req->r_num_pages < want)) {
|
||||
pr_warning("tid %lld reply %d > expected %d pages\n",
|
||||
tid, want, m->nr_pages);
|
||||
pr_warning("tid %lld reply has %d bytes %d pages, we"
|
||||
" had only %d pages ready\n", tid, data_len,
|
||||
want, req->r_num_pages);
|
||||
*skip = 1;
|
||||
ceph_msg_put(m);
|
||||
m = NULL;
|
||||
|
||||
@@ -3114,7 +3114,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
skb_reset_transport_header(skb);
|
||||
skb->mac_len = skb->network_header - skb->mac_header;
|
||||
skb_reset_mac_len(skb);
|
||||
|
||||
pt_prev = NULL;
|
||||
|
||||
@@ -6178,6 +6178,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
|
||||
oldsd->output_queue = NULL;
|
||||
oldsd->output_queue_tailp = &oldsd->output_queue;
|
||||
}
|
||||
/* Append NAPI poll list from offline CPU. */
|
||||
if (!list_empty(&oldsd->poll_list)) {
|
||||
list_splice_init(&oldsd->poll_list, &sd->poll_list);
|
||||
raise_softirq_irqoff(NET_RX_SOFTIRQ);
|
||||
}
|
||||
|
||||
raise_softirq_irqoff(NET_TX_SOFTIRQ);
|
||||
local_irq_enable();
|
||||
@@ -6264,29 +6269,23 @@ err_name:
|
||||
/**
|
||||
* netdev_drivername - network driver for the device
|
||||
* @dev: network device
|
||||
* @buffer: buffer for resulting name
|
||||
* @len: size of buffer
|
||||
*
|
||||
* Determine network driver for device.
|
||||
*/
|
||||
char *netdev_drivername(const struct net_device *dev, char *buffer, int len)
|
||||
const char *netdev_drivername(const struct net_device *dev)
|
||||
{
|
||||
const struct device_driver *driver;
|
||||
const struct device *parent;
|
||||
|
||||
if (len <= 0 || !buffer)
|
||||
return buffer;
|
||||
buffer[0] = 0;
|
||||
const char *empty = "";
|
||||
|
||||
parent = dev->dev.parent;
|
||||
|
||||
if (!parent)
|
||||
return buffer;
|
||||
return empty;
|
||||
|
||||
driver = parent->driver;
|
||||
if (driver && driver->name)
|
||||
strlcpy(buffer, driver->name, len);
|
||||
return buffer;
|
||||
return driver->name;
|
||||
return empty;
|
||||
}
|
||||
|
||||
static int __netdev_printk(const char *level, const struct net_device *dev,
|
||||
|
||||
@@ -190,7 +190,8 @@ void *dst_alloc(struct dst_ops *ops, struct net_device *dev,
|
||||
dst->lastuse = jiffies;
|
||||
dst->flags = flags;
|
||||
dst->next = NULL;
|
||||
dst_entries_add(ops, 1);
|
||||
if (!(flags & DST_NOCOUNT))
|
||||
dst_entries_add(ops, 1);
|
||||
return dst;
|
||||
}
|
||||
EXPORT_SYMBOL(dst_alloc);
|
||||
@@ -243,7 +244,8 @@ again:
|
||||
neigh_release(neigh);
|
||||
}
|
||||
|
||||
dst_entries_add(dst->ops, -1);
|
||||
if (!(dst->flags & DST_NOCOUNT))
|
||||
dst_entries_add(dst->ops, -1);
|
||||
|
||||
if (dst->ops->destroy)
|
||||
dst->ops->destroy(dst);
|
||||
|
||||
@@ -1179,9 +1179,14 @@ static void remove_queue_kobjects(struct net_device *net)
|
||||
#endif
|
||||
}
|
||||
|
||||
static const void *net_current_ns(void)
|
||||
static void *net_grab_current_ns(void)
|
||||
{
|
||||
return current->nsproxy->net_ns;
|
||||
struct net *ns = current->nsproxy->net_ns;
|
||||
#ifdef CONFIG_NET_NS
|
||||
if (ns)
|
||||
atomic_inc(&ns->passive);
|
||||
#endif
|
||||
return ns;
|
||||
}
|
||||
|
||||
static const void *net_initial_ns(void)
|
||||
@@ -1196,22 +1201,13 @@ static const void *net_netlink_ns(struct sock *sk)
|
||||
|
||||
struct kobj_ns_type_operations net_ns_type_operations = {
|
||||
.type = KOBJ_NS_TYPE_NET,
|
||||
.current_ns = net_current_ns,
|
||||
.grab_current_ns = net_grab_current_ns,
|
||||
.netlink_ns = net_netlink_ns,
|
||||
.initial_ns = net_initial_ns,
|
||||
.drop_ns = net_drop_ns,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(net_ns_type_operations);
|
||||
|
||||
static void net_kobj_ns_exit(struct net *net)
|
||||
{
|
||||
kobj_ns_exit(KOBJ_NS_TYPE_NET, net);
|
||||
}
|
||||
|
||||
static struct pernet_operations kobj_net_ops = {
|
||||
.exit = net_kobj_ns_exit,
|
||||
};
|
||||
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
|
||||
{
|
||||
@@ -1339,6 +1335,5 @@ EXPORT_SYMBOL(netdev_class_remove_file);
|
||||
int netdev_kobject_init(void)
|
||||
{
|
||||
kobj_ns_type_register(&net_ns_type_operations);
|
||||
register_pernet_subsys(&kobj_net_ops);
|
||||
return class_register(&net_class);
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ static __net_init int setup_net(struct net *net)
|
||||
LIST_HEAD(net_exit_list);
|
||||
|
||||
atomic_set(&net->count, 1);
|
||||
atomic_set(&net->passive, 1);
|
||||
|
||||
#ifdef NETNS_REFCNT_DEBUG
|
||||
atomic_set(&net->use_count, 0);
|
||||
@@ -210,6 +211,13 @@ static void net_free(struct net *net)
|
||||
kmem_cache_free(net_cachep, net);
|
||||
}
|
||||
|
||||
void net_drop_ns(void *p)
|
||||
{
|
||||
struct net *ns = p;
|
||||
if (ns && atomic_dec_and_test(&ns->passive))
|
||||
net_free(ns);
|
||||
}
|
||||
|
||||
struct net *copy_net_ns(unsigned long flags, struct net *old_net)
|
||||
{
|
||||
struct net *net;
|
||||
@@ -230,7 +238,7 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
|
||||
}
|
||||
mutex_unlock(&net_mutex);
|
||||
if (rv < 0) {
|
||||
net_free(net);
|
||||
net_drop_ns(net);
|
||||
return ERR_PTR(rv);
|
||||
}
|
||||
return net;
|
||||
@@ -286,7 +294,7 @@ static void cleanup_net(struct work_struct *work)
|
||||
/* Finally it is safe to free my network namespace structure */
|
||||
list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
|
||||
list_del_init(&net->exit_list);
|
||||
net_free(net);
|
||||
net_drop_ns(net);
|
||||
}
|
||||
}
|
||||
static DECLARE_WORK(net_cleanup_work, cleanup_net);
|
||||
@@ -310,19 +318,17 @@ struct net *get_net_ns_by_fd(int fd)
|
||||
struct file *file;
|
||||
struct net *net;
|
||||
|
||||
net = ERR_PTR(-EINVAL);
|
||||
file = proc_ns_fget(fd);
|
||||
if (!file)
|
||||
goto out;
|
||||
if (IS_ERR(file))
|
||||
return ERR_CAST(file);
|
||||
|
||||
ei = PROC_I(file->f_dentry->d_inode);
|
||||
if (ei->ns_ops != &netns_operations)
|
||||
goto out;
|
||||
if (ei->ns_ops == &netns_operations)
|
||||
net = get_net(ei->ns);
|
||||
else
|
||||
net = ERR_PTR(-EINVAL);
|
||||
|
||||
net = get_net(ei->ns);
|
||||
out:
|
||||
if (file)
|
||||
fput(file);
|
||||
fput(file);
|
||||
return net;
|
||||
}
|
||||
|
||||
|
||||
@@ -792,6 +792,13 @@ int netpoll_setup(struct netpoll *np)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (ndev->master) {
|
||||
printk(KERN_ERR "%s: %s is a slave device, aborting.\n",
|
||||
np->name, np->dev_name);
|
||||
err = -EBUSY;
|
||||
goto put;
|
||||
}
|
||||
|
||||
if (!netif_running(ndev)) {
|
||||
unsigned long atmost, atleast;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 pid,
|
||||
pr_debug("%s\n", __func__);
|
||||
|
||||
if (!buf)
|
||||
goto out;
|
||||
return -EMSGSIZE;
|
||||
|
||||
hdr = genlmsg_put(msg, 0, seq, &nl802154_family, flags,
|
||||
IEEE802154_LIST_PHY);
|
||||
@@ -65,6 +65,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 pid,
|
||||
pages * sizeof(uint32_t), buf);
|
||||
|
||||
mutex_unlock(&phy->pib_lock);
|
||||
kfree(buf);
|
||||
return genlmsg_end(msg, hdr);
|
||||
|
||||
nla_put_failure:
|
||||
|
||||
@@ -465,8 +465,10 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
if (addr_len < sizeof(struct sockaddr_in))
|
||||
goto out;
|
||||
|
||||
if (addr->sin_family != AF_INET)
|
||||
if (addr->sin_family != AF_INET) {
|
||||
err = -EAFNOSUPPORT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
|
||||
|
||||
@@ -676,6 +678,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
|
||||
|
||||
lock_sock(sk2);
|
||||
|
||||
sock_rps_record_flow(sk2);
|
||||
WARN_ON(!((1 << sk2->sk_state) &
|
||||
(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE)));
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ static int valid_cc(const void *bc, int len, int cc)
|
||||
return 0;
|
||||
if (cc == len)
|
||||
return 1;
|
||||
if (op->yes < 4)
|
||||
if (op->yes < 4 || op->yes & 3)
|
||||
return 0;
|
||||
len -= op->yes;
|
||||
bc += op->yes;
|
||||
@@ -447,11 +447,11 @@ static int valid_cc(const void *bc, int len, int cc)
|
||||
|
||||
static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
|
||||
{
|
||||
const unsigned char *bc = bytecode;
|
||||
const void *bc = bytecode;
|
||||
int len = bytecode_len;
|
||||
|
||||
while (len > 0) {
|
||||
struct inet_diag_bc_op *op = (struct inet_diag_bc_op *)bc;
|
||||
const struct inet_diag_bc_op *op = bc;
|
||||
|
||||
//printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len);
|
||||
switch (op->code) {
|
||||
@@ -462,22 +462,20 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
|
||||
case INET_DIAG_BC_S_LE:
|
||||
case INET_DIAG_BC_D_GE:
|
||||
case INET_DIAG_BC_D_LE:
|
||||
if (op->yes < 4 || op->yes > len + 4)
|
||||
return -EINVAL;
|
||||
case INET_DIAG_BC_JMP:
|
||||
if (op->no < 4 || op->no > len + 4)
|
||||
if (op->no < 4 || op->no > len + 4 || op->no & 3)
|
||||
return -EINVAL;
|
||||
if (op->no < len &&
|
||||
!valid_cc(bytecode, bytecode_len, len - op->no))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case INET_DIAG_BC_NOP:
|
||||
if (op->yes < 4 || op->yes > len + 4)
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (op->yes < 4 || op->yes > len + 4 || op->yes & 3)
|
||||
return -EINVAL;
|
||||
bc += op->yes;
|
||||
len -= op->yes;
|
||||
}
|
||||
|
||||
@@ -799,9 +799,9 @@ static int __ip_append_data(struct sock *sk,
|
||||
int csummode = CHECKSUM_NONE;
|
||||
struct rtable *rt = (struct rtable *)cork->dst;
|
||||
|
||||
exthdrlen = transhdrlen ? rt->dst.header_len : 0;
|
||||
length += exthdrlen;
|
||||
transhdrlen += exthdrlen;
|
||||
skb = skb_peek_tail(queue);
|
||||
|
||||
exthdrlen = !skb ? rt->dst.header_len : 0;
|
||||
mtu = cork->fragsize;
|
||||
|
||||
hh_len = LL_RESERVED_SPACE(rt->dst.dev);
|
||||
@@ -825,12 +825,10 @@ static int __ip_append_data(struct sock *sk,
|
||||
!exthdrlen)
|
||||
csummode = CHECKSUM_PARTIAL;
|
||||
|
||||
skb = skb_peek_tail(queue);
|
||||
|
||||
cork->length += length;
|
||||
if (((length > mtu) || (skb && skb_is_gso(skb))) &&
|
||||
(sk->sk_protocol == IPPROTO_UDP) &&
|
||||
(rt->dst.dev->features & NETIF_F_UFO)) {
|
||||
(rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) {
|
||||
err = ip_ufo_append_data(sk, queue, getfrag, from, length,
|
||||
hh_len, fragheaderlen, transhdrlen,
|
||||
mtu, flags);
|
||||
@@ -883,17 +881,16 @@ alloc_new_skb:
|
||||
else
|
||||
alloclen = fraglen;
|
||||
|
||||
alloclen += exthdrlen;
|
||||
|
||||
/* The last fragment gets additional space at tail.
|
||||
* Note, with MSG_MORE we overallocate on fragments,
|
||||
* because we have no idea what fragment will be
|
||||
* the last.
|
||||
*/
|
||||
if (datalen == length + fraggap) {
|
||||
if (datalen == length + fraggap)
|
||||
alloclen += rt->dst.trailer_len;
|
||||
/* make sure mtu is not reached */
|
||||
if (datalen > mtu - fragheaderlen - rt->dst.trailer_len)
|
||||
datalen -= ALIGN(rt->dst.trailer_len, 8);
|
||||
}
|
||||
|
||||
if (transhdrlen) {
|
||||
skb = sock_alloc_send_skb(sk,
|
||||
alloclen + hh_len + 15,
|
||||
@@ -926,11 +923,11 @@ alloc_new_skb:
|
||||
/*
|
||||
* Find where to start putting bytes.
|
||||
*/
|
||||
data = skb_put(skb, fraglen);
|
||||
data = skb_put(skb, fraglen + exthdrlen);
|
||||
skb_set_network_header(skb, exthdrlen);
|
||||
skb->transport_header = (skb->network_header +
|
||||
fragheaderlen);
|
||||
data += fragheaderlen;
|
||||
data += fragheaderlen + exthdrlen;
|
||||
|
||||
if (fraggap) {
|
||||
skb->csum = skb_copy_and_csum_bits(
|
||||
@@ -1064,7 +1061,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
|
||||
*/
|
||||
*rtp = NULL;
|
||||
cork->fragsize = inet->pmtudisc == IP_PMTUDISC_PROBE ?
|
||||
rt->dst.dev->mtu : dst_mtu(rt->dst.path);
|
||||
rt->dst.dev->mtu : dst_mtu(&rt->dst);
|
||||
cork->dst = &rt->dst;
|
||||
cork->length = 0;
|
||||
cork->tx_flags = ipc->tx_flags;
|
||||
|
||||
@@ -17,51 +17,35 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
|
||||
const struct iphdr *iph = ip_hdr(skb);
|
||||
struct rtable *rt;
|
||||
struct flowi4 fl4 = {};
|
||||
unsigned long orefdst;
|
||||
__be32 saddr = iph->saddr;
|
||||
__u8 flags = 0;
|
||||
unsigned int hh_len;
|
||||
unsigned int type;
|
||||
|
||||
type = inet_addr_type(net, iph->saddr);
|
||||
if (skb->sk && inet_sk(skb->sk)->transparent)
|
||||
type = RTN_LOCAL;
|
||||
if (addr_type == RTN_UNSPEC)
|
||||
addr_type = type;
|
||||
if (!skb->sk && addr_type != RTN_LOCAL) {
|
||||
if (addr_type == RTN_UNSPEC)
|
||||
addr_type = inet_addr_type(net, saddr);
|
||||
if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
|
||||
flags |= FLOWI_FLAG_ANYSRC;
|
||||
else
|
||||
saddr = 0;
|
||||
}
|
||||
|
||||
/* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
|
||||
* packets with foreign saddr to appear on the NF_INET_LOCAL_OUT hook.
|
||||
*/
|
||||
if (addr_type == RTN_LOCAL) {
|
||||
fl4.daddr = iph->daddr;
|
||||
if (type == RTN_LOCAL)
|
||||
fl4.saddr = iph->saddr;
|
||||
fl4.flowi4_tos = RT_TOS(iph->tos);
|
||||
fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
|
||||
fl4.flowi4_mark = skb->mark;
|
||||
fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : 0;
|
||||
rt = ip_route_output_key(net, &fl4);
|
||||
if (IS_ERR(rt))
|
||||
return -1;
|
||||
fl4.daddr = iph->daddr;
|
||||
fl4.saddr = saddr;
|
||||
fl4.flowi4_tos = RT_TOS(iph->tos);
|
||||
fl4.flowi4_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0;
|
||||
fl4.flowi4_mark = skb->mark;
|
||||
fl4.flowi4_flags = skb->sk ? inet_sk_flowi_flags(skb->sk) : flags;
|
||||
rt = ip_route_output_key(net, &fl4);
|
||||
if (IS_ERR(rt))
|
||||
return -1;
|
||||
|
||||
/* Drop old route. */
|
||||
skb_dst_drop(skb);
|
||||
skb_dst_set(skb, &rt->dst);
|
||||
} else {
|
||||
/* non-local src, find valid iif to satisfy
|
||||
* rp-filter when calling ip_route_input. */
|
||||
fl4.daddr = iph->saddr;
|
||||
rt = ip_route_output_key(net, &fl4);
|
||||
if (IS_ERR(rt))
|
||||
return -1;
|
||||
|
||||
orefdst = skb->_skb_refdst;
|
||||
if (ip_route_input(skb, iph->daddr, iph->saddr,
|
||||
RT_TOS(iph->tos), rt->dst.dev) != 0) {
|
||||
dst_release(&rt->dst);
|
||||
return -1;
|
||||
}
|
||||
dst_release(&rt->dst);
|
||||
refdst_drop(orefdst);
|
||||
}
|
||||
/* Drop old route. */
|
||||
skb_dst_drop(skb);
|
||||
skb_dst_set(skb, &rt->dst);
|
||||
|
||||
if (skb_dst(skb)->error)
|
||||
return -1;
|
||||
|
||||
@@ -203,7 +203,8 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp)
|
||||
else
|
||||
pmsg->outdev_name[0] = '\0';
|
||||
|
||||
if (entry->indev && entry->skb->dev) {
|
||||
if (entry->indev && entry->skb->dev &&
|
||||
entry->skb->mac_header != entry->skb->network_header) {
|
||||
pmsg->hw_type = entry->skb->dev->type;
|
||||
pmsg->hw_addrlen = dev_parse_header(entry->skb,
|
||||
pmsg->hw_addr);
|
||||
@@ -402,7 +403,8 @@ ipq_dev_drop(int ifindex)
|
||||
static inline void
|
||||
__ipq_rcv_skb(struct sk_buff *skb)
|
||||
{
|
||||
int status, type, pid, flags, nlmsglen, skblen;
|
||||
int status, type, pid, flags;
|
||||
unsigned int nlmsglen, skblen;
|
||||
struct nlmsghdr *nlh;
|
||||
|
||||
skblen = skb->len;
|
||||
|
||||
@@ -566,7 +566,7 @@ check_entry(const struct ipt_entry *e, const char *name)
|
||||
const struct xt_entry_target *t;
|
||||
|
||||
if (!ip_checkentry(&e->ip)) {
|
||||
duprintf("ip check failed %p %s.\n", e, par->match->name);
|
||||
duprintf("ip check failed %p %s.\n", e, name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
* error messages (RELATED) and information requests (see below) */
|
||||
if (ip_hdr(skb)->protocol == IPPROTO_ICMP &&
|
||||
(ctinfo == IP_CT_RELATED ||
|
||||
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY))
|
||||
ctinfo == IP_CT_RELATED_REPLY))
|
||||
return XT_CONTINUE;
|
||||
|
||||
/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
|
||||
@@ -321,12 +321,12 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
ct->mark = hash;
|
||||
break;
|
||||
case IP_CT_RELATED:
|
||||
case IP_CT_RELATED+IP_CT_IS_REPLY:
|
||||
case IP_CT_RELATED_REPLY:
|
||||
/* FIXME: we don't handle expectations at the
|
||||
* moment. they can arrive on a different node than
|
||||
* the master connection (e.g. FTP passive mode) */
|
||||
case IP_CT_ESTABLISHED:
|
||||
case IP_CT_ESTABLISHED+IP_CT_IS_REPLY:
|
||||
case IP_CT_ESTABLISHED_REPLY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -60,7 +60,7 @@ masquerade_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
nat = nfct_nat(ct);
|
||||
|
||||
NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
|
||||
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
|
||||
ctinfo == IP_CT_RELATED_REPLY));
|
||||
|
||||
/* Source address is 0.0.0.0 - locally generated packet that is
|
||||
* probably not supposed to be masqueraded.
|
||||
|
||||
@@ -40,7 +40,6 @@ static void send_reset(struct sk_buff *oldskb, int hook)
|
||||
struct iphdr *niph;
|
||||
const struct tcphdr *oth;
|
||||
struct tcphdr _otcph, *tcph;
|
||||
unsigned int addr_type;
|
||||
|
||||
/* IP header checks: fragment. */
|
||||
if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET))
|
||||
@@ -55,6 +54,9 @@ static void send_reset(struct sk_buff *oldskb, int hook)
|
||||
if (oth->rst)
|
||||
return;
|
||||
|
||||
if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
|
||||
return;
|
||||
|
||||
/* Check checksum */
|
||||
if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP))
|
||||
return;
|
||||
@@ -101,19 +103,11 @@ static void send_reset(struct sk_buff *oldskb, int hook)
|
||||
nskb->csum_start = (unsigned char *)tcph - nskb->head;
|
||||
nskb->csum_offset = offsetof(struct tcphdr, check);
|
||||
|
||||
addr_type = RTN_UNSPEC;
|
||||
if (hook != NF_INET_FORWARD
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
|| (nskb->nf_bridge && nskb->nf_bridge->mask & BRNF_BRIDGED)
|
||||
#endif
|
||||
)
|
||||
addr_type = RTN_LOCAL;
|
||||
|
||||
/* ip_route_me_harder expects skb->dst to be set */
|
||||
skb_dst_set_noref(nskb, skb_dst(oldskb));
|
||||
|
||||
nskb->protocol = htons(ETH_P_IP);
|
||||
if (ip_route_me_harder(nskb, addr_type))
|
||||
if (ip_route_me_harder(nskb, RTN_UNSPEC))
|
||||
goto free_nskb;
|
||||
|
||||
niph->ttl = ip4_dst_hoplimit(skb_dst(nskb));
|
||||
|
||||
@@ -25,7 +25,8 @@ MODULE_LICENSE("GPL");
|
||||
static inline bool match_ip(const struct sk_buff *skb,
|
||||
const struct ipt_ecn_info *einfo)
|
||||
{
|
||||
return (ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect;
|
||||
return ((ip_hdr(skb)->tos & IPT_ECN_IP_MASK) == einfo->ip_ect) ^
|
||||
!!(einfo->invert & IPT_ECN_OP_MATCH_IP);
|
||||
}
|
||||
|
||||
static inline bool match_tcp(const struct sk_buff *skb,
|
||||
@@ -76,8 +77,6 @@ static bool ecn_mt(const struct sk_buff *skb, struct xt_action_param *par)
|
||||
return false;
|
||||
|
||||
if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR)) {
|
||||
if (ip_hdr(skb)->protocol != IPPROTO_TCP)
|
||||
return false;
|
||||
if (!match_tcp(skb, info, &par->hotdrop))
|
||||
return false;
|
||||
}
|
||||
@@ -97,7 +96,7 @@ static int ecn_mt_check(const struct xt_mtchk_param *par)
|
||||
return -EINVAL;
|
||||
|
||||
if (info->operation & (IPT_ECN_OP_MATCH_ECE|IPT_ECN_OP_MATCH_CWR) &&
|
||||
ip->proto != IPPROTO_TCP) {
|
||||
(ip->proto != IPPROTO_TCP || ip->invflags & IPT_INV_PROTO)) {
|
||||
pr_info("cannot match TCP bits in rule for non-tcp packets\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static unsigned int ipv4_confirm(unsigned int hooknum,
|
||||
|
||||
/* This is where we call the helper: as the packet goes out. */
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
|
||||
if (!ct || ctinfo == IP_CT_RELATED_REPLY)
|
||||
goto out;
|
||||
|
||||
help = nfct_help(ct);
|
||||
@@ -121,7 +121,9 @@ static unsigned int ipv4_confirm(unsigned int hooknum,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status)) {
|
||||
/* adjust seqs for loopback traffic only in outgoing direction */
|
||||
if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
|
||||
!nf_is_loopback_packet(skb)) {
|
||||
typeof(nf_nat_seq_adjust_hook) seq_adjust;
|
||||
|
||||
seq_adjust = rcu_dereference(nf_nat_seq_adjust_hook);
|
||||
|
||||
@@ -160,7 +160,7 @@ icmp_error_message(struct net *net, struct nf_conn *tmpl, struct sk_buff *skb,
|
||||
/* Update skb to refer to this connection */
|
||||
skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general;
|
||||
skb->nfctinfo = *ctinfo;
|
||||
return -NF_ACCEPT;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
/* Small and modified version of icmp_rcv */
|
||||
|
||||
@@ -433,7 +433,7 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct,
|
||||
|
||||
/* Must be RELATED */
|
||||
NF_CT_ASSERT(skb->nfctinfo == IP_CT_RELATED ||
|
||||
skb->nfctinfo == IP_CT_RELATED+IP_CT_IS_REPLY);
|
||||
skb->nfctinfo == IP_CT_RELATED_REPLY);
|
||||
|
||||
/* Redirects on non-null nats must be dropped, else they'll
|
||||
start talking to each other without our translation, and be
|
||||
|
||||
@@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *skb, const struct iphdr *iph, void *data
|
||||
|
||||
if (skb->ip_summed != CHECKSUM_PARTIAL) {
|
||||
if (!(rt->rt_flags & RTCF_LOCAL) &&
|
||||
skb->dev->features & NETIF_F_V4_CSUM) {
|
||||
(!skb->dev || skb->dev->features & NETIF_F_V4_CSUM)) {
|
||||
skb->ip_summed = CHECKSUM_PARTIAL;
|
||||
skb->csum_start = skb_headroom(skb) +
|
||||
skb_network_offset(skb) +
|
||||
|
||||
@@ -53,7 +53,7 @@ ipt_snat_target(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
|
||||
/* Connection must be valid and new. */
|
||||
NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
|
||||
ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
|
||||
ctinfo == IP_CT_RELATED_REPLY));
|
||||
NF_CT_ASSERT(par->out != NULL);
|
||||
|
||||
return nf_nat_setup_info(ct, &mr->range[0], IP_NAT_MANIP_SRC);
|
||||
|
||||
@@ -116,7 +116,7 @@ nf_nat_fn(unsigned int hooknum,
|
||||
|
||||
switch (ctinfo) {
|
||||
case IP_CT_RELATED:
|
||||
case IP_CT_RELATED+IP_CT_IS_REPLY:
|
||||
case IP_CT_RELATED_REPLY:
|
||||
if (ip_hdr(skb)->protocol == IPPROTO_ICMP) {
|
||||
if (!nf_nat_icmp_reply_translation(ct, ctinfo,
|
||||
hooknum, skb))
|
||||
@@ -144,7 +144,7 @@ nf_nat_fn(unsigned int hooknum,
|
||||
default:
|
||||
/* ESTABLISHED */
|
||||
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
|
||||
ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY));
|
||||
ctinfo == IP_CT_ESTABLISHED_REPLY);
|
||||
}
|
||||
|
||||
return nf_nat_packet(ct, ctinfo, hooknum, skb);
|
||||
|
||||
@@ -1316,6 +1316,23 @@ reject_redirect:
|
||||
;
|
||||
}
|
||||
|
||||
static bool peer_pmtu_expired(struct inet_peer *peer)
|
||||
{
|
||||
unsigned long orig = ACCESS_ONCE(peer->pmtu_expires);
|
||||
|
||||
return orig &&
|
||||
time_after_eq(jiffies, orig) &&
|
||||
cmpxchg(&peer->pmtu_expires, orig, 0) == orig;
|
||||
}
|
||||
|
||||
static bool peer_pmtu_cleaned(struct inet_peer *peer)
|
||||
{
|
||||
unsigned long orig = ACCESS_ONCE(peer->pmtu_expires);
|
||||
|
||||
return orig &&
|
||||
cmpxchg(&peer->pmtu_expires, orig, 0) == orig;
|
||||
}
|
||||
|
||||
static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
|
||||
{
|
||||
struct rtable *rt = (struct rtable *)dst;
|
||||
@@ -1331,14 +1348,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
|
||||
rt_genid(dev_net(dst->dev)));
|
||||
rt_del(hash, rt);
|
||||
ret = NULL;
|
||||
} else if (rt->peer &&
|
||||
rt->peer->pmtu_expires &&
|
||||
time_after_eq(jiffies, rt->peer->pmtu_expires)) {
|
||||
unsigned long orig = rt->peer->pmtu_expires;
|
||||
|
||||
if (cmpxchg(&rt->peer->pmtu_expires, orig, 0) == orig)
|
||||
dst_metric_set(dst, RTAX_MTU,
|
||||
rt->peer->pmtu_orig);
|
||||
} else if (rt->peer && peer_pmtu_expired(rt->peer)) {
|
||||
dst_metric_set(dst, RTAX_MTU, rt->peer->pmtu_orig);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -1531,8 +1542,10 @@ unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
|
||||
|
||||
static void check_peer_pmtu(struct dst_entry *dst, struct inet_peer *peer)
|
||||
{
|
||||
unsigned long expires = peer->pmtu_expires;
|
||||
unsigned long expires = ACCESS_ONCE(peer->pmtu_expires);
|
||||
|
||||
if (!expires)
|
||||
return;
|
||||
if (time_before(jiffies, expires)) {
|
||||
u32 orig_dst_mtu = dst_mtu(dst);
|
||||
if (peer->pmtu_learned < orig_dst_mtu) {
|
||||
@@ -1555,10 +1568,11 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
|
||||
rt_bind_peer(rt, rt->rt_dst, 1);
|
||||
peer = rt->peer;
|
||||
if (peer) {
|
||||
unsigned long pmtu_expires = ACCESS_ONCE(peer->pmtu_expires);
|
||||
|
||||
if (mtu < ip_rt_min_pmtu)
|
||||
mtu = ip_rt_min_pmtu;
|
||||
if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
|
||||
unsigned long pmtu_expires;
|
||||
if (!pmtu_expires || mtu < peer->pmtu_learned) {
|
||||
|
||||
pmtu_expires = jiffies + ip_rt_mtu_expires;
|
||||
if (!pmtu_expires)
|
||||
@@ -1612,13 +1626,14 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
|
||||
rt_bind_peer(rt, rt->rt_dst, 0);
|
||||
|
||||
peer = rt->peer;
|
||||
if (peer && peer->pmtu_expires)
|
||||
if (peer) {
|
||||
check_peer_pmtu(dst, peer);
|
||||
|
||||
if (peer && peer->redirect_learned.a4 &&
|
||||
peer->redirect_learned.a4 != rt->rt_gateway) {
|
||||
if (check_peer_redir(dst, peer))
|
||||
return NULL;
|
||||
if (peer->redirect_learned.a4 &&
|
||||
peer->redirect_learned.a4 != rt->rt_gateway) {
|
||||
if (check_peer_redir(dst, peer))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
rt->rt_peer_genid = rt_peer_genid();
|
||||
@@ -1649,14 +1664,8 @@ static void ipv4_link_failure(struct sk_buff *skb)
|
||||
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0);
|
||||
|
||||
rt = skb_rtable(skb);
|
||||
if (rt &&
|
||||
rt->peer &&
|
||||
rt->peer->pmtu_expires) {
|
||||
unsigned long orig = rt->peer->pmtu_expires;
|
||||
|
||||
if (cmpxchg(&rt->peer->pmtu_expires, orig, 0) == orig)
|
||||
dst_metric_set(&rt->dst, RTAX_MTU, rt->peer->pmtu_orig);
|
||||
}
|
||||
if (rt && rt->peer && peer_pmtu_cleaned(rt->peer))
|
||||
dst_metric_set(&rt->dst, RTAX_MTU, rt->peer->pmtu_orig);
|
||||
}
|
||||
|
||||
static int ip_rt_bug(struct sk_buff *skb)
|
||||
@@ -1770,8 +1779,7 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
|
||||
sizeof(u32) * RTAX_MAX);
|
||||
dst_init_metrics(&rt->dst, peer->metrics, false);
|
||||
|
||||
if (peer->pmtu_expires)
|
||||
check_peer_pmtu(&rt->dst, peer);
|
||||
check_peer_pmtu(&rt->dst, peer);
|
||||
if (peer->redirect_learned.a4 &&
|
||||
peer->redirect_learned.a4 != rt->rt_gateway) {
|
||||
rt->rt_gateway = peer->redirect_learned.a4;
|
||||
@@ -1894,9 +1902,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
||||
|
||||
hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
|
||||
rth = rt_intern_hash(hash, rth, skb, dev->ifindex);
|
||||
err = 0;
|
||||
if (IS_ERR(rth))
|
||||
err = PTR_ERR(rth);
|
||||
return IS_ERR(rth) ? PTR_ERR(rth) : 0;
|
||||
|
||||
e_nobufs:
|
||||
return -ENOBUFS;
|
||||
@@ -2775,7 +2781,8 @@ static int rt_fill_info(struct net *net,
|
||||
struct rtable *rt = skb_rtable(skb);
|
||||
struct rtmsg *r;
|
||||
struct nlmsghdr *nlh;
|
||||
long expires;
|
||||
long expires = 0;
|
||||
const struct inet_peer *peer = rt->peer;
|
||||
u32 id = 0, ts = 0, tsage = 0, error;
|
||||
|
||||
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags);
|
||||
@@ -2823,15 +2830,16 @@ static int rt_fill_info(struct net *net,
|
||||
NLA_PUT_BE32(skb, RTA_MARK, rt->rt_mark);
|
||||
|
||||
error = rt->dst.error;
|
||||
expires = (rt->peer && rt->peer->pmtu_expires) ?
|
||||
rt->peer->pmtu_expires - jiffies : 0;
|
||||
if (rt->peer) {
|
||||
if (peer) {
|
||||
inet_peer_refcheck(rt->peer);
|
||||
id = atomic_read(&rt->peer->ip_id_count) & 0xffff;
|
||||
if (rt->peer->tcp_ts_stamp) {
|
||||
ts = rt->peer->tcp_ts;
|
||||
tsage = get_seconds() - rt->peer->tcp_ts_stamp;
|
||||
id = atomic_read(&peer->ip_id_count) & 0xffff;
|
||||
if (peer->tcp_ts_stamp) {
|
||||
ts = peer->tcp_ts;
|
||||
tsage = get_seconds() - peer->tcp_ts_stamp;
|
||||
}
|
||||
expires = ACCESS_ONCE(peer->pmtu_expires);
|
||||
if (expires)
|
||||
expires -= jiffies;
|
||||
}
|
||||
|
||||
if (rt_is_input_route(rt)) {
|
||||
|
||||
@@ -3220,7 +3220,7 @@ __setup("thash_entries=", set_thash_entries);
|
||||
void __init tcp_init(void)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
unsigned long nr_pages, limit;
|
||||
unsigned long limit;
|
||||
int i, max_share, cnt;
|
||||
unsigned long jiffy = jiffies;
|
||||
|
||||
@@ -3277,13 +3277,7 @@ void __init tcp_init(void)
|
||||
sysctl_tcp_max_orphans = cnt / 2;
|
||||
sysctl_max_syn_backlog = max(128, cnt / 256);
|
||||
|
||||
/* Set the pressure threshold to be a fraction of global memory that
|
||||
* is up to 1/2 at 256 MB, decreasing toward zero with the amount of
|
||||
* memory, with a floor of 128 pages.
|
||||
*/
|
||||
nr_pages = totalram_pages - totalhigh_pages;
|
||||
limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
|
||||
limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
|
||||
limit = nr_free_buffer_pages() / 8;
|
||||
limit = max(limit, 128UL);
|
||||
sysctl_tcp_mem[0] = limit / 4 * 3;
|
||||
sysctl_tcp_mem[1] = limit;
|
||||
|
||||
@@ -1589,6 +1589,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
goto discard;
|
||||
|
||||
if (nsk != sk) {
|
||||
sock_rps_save_rxhash(nsk, skb->rxhash);
|
||||
if (tcp_child_process(sk, nsk, skb)) {
|
||||
rsk = nsk;
|
||||
goto reset;
|
||||
|
||||
@@ -1249,6 +1249,9 @@ csum_copy_err:
|
||||
|
||||
if (noblock)
|
||||
return -EAGAIN;
|
||||
|
||||
/* starting over for a new packet */
|
||||
msg->msg_flags &= ~MSG_TRUNC;
|
||||
goto try_again;
|
||||
}
|
||||
|
||||
@@ -2206,16 +2209,10 @@ void __init udp_table_init(struct udp_table *table, const char *name)
|
||||
|
||||
void __init udp_init(void)
|
||||
{
|
||||
unsigned long nr_pages, limit;
|
||||
unsigned long limit;
|
||||
|
||||
udp_table_init(&udp_table, "UDP");
|
||||
/* Set the pressure threshold up by the same strategy of TCP. It is a
|
||||
* fraction of global memory that is up to 1/2 at 256 MB, decreasing
|
||||
* toward zero with the amount of memory, with a floor of 128 pages.
|
||||
*/
|
||||
nr_pages = totalram_pages - totalhigh_pages;
|
||||
limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
|
||||
limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
|
||||
limit = nr_free_buffer_pages() / 8;
|
||||
limit = max(limit, 128UL);
|
||||
sysctl_udp_mem[0] = limit / 4 * 3;
|
||||
sysctl_udp_mem[1] = limit;
|
||||
|
||||
@@ -32,7 +32,12 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
|
||||
dst = skb_dst(skb);
|
||||
mtu = dst_mtu(dst);
|
||||
if (skb->len > mtu) {
|
||||
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
|
||||
if (skb->sk)
|
||||
ip_local_error(skb->sk, EMSGSIZE, ip_hdr(skb)->daddr,
|
||||
inet_sk(skb->sk)->inet_dport, mtu);
|
||||
else
|
||||
icmp_send(skb, ICMP_DEST_UNREACH,
|
||||
ICMP_FRAG_NEEDED, htonl(mtu));
|
||||
ret = -EMSGSIZE;
|
||||
}
|
||||
out:
|
||||
|
||||
@@ -272,6 +272,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
||||
|
||||
if (addr_len < SIN6_LEN_RFC2133)
|
||||
return -EINVAL;
|
||||
|
||||
if (addr->sin6_family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
addr_type = ipv6_addr_type(&addr->sin6_addr);
|
||||
if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -204,7 +204,8 @@ ipq_build_packet_message(struct nf_queue_entry *entry, int *errp)
|
||||
else
|
||||
pmsg->outdev_name[0] = '\0';
|
||||
|
||||
if (entry->indev && entry->skb->dev) {
|
||||
if (entry->indev && entry->skb->dev &&
|
||||
entry->skb->mac_header != entry->skb->network_header) {
|
||||
pmsg->hw_type = entry->skb->dev->type;
|
||||
pmsg->hw_addrlen = dev_parse_header(entry->skb, pmsg->hw_addr);
|
||||
}
|
||||
@@ -403,7 +404,8 @@ ipq_dev_drop(int ifindex)
|
||||
static inline void
|
||||
__ipq_rcv_skb(struct sk_buff *skb)
|
||||
{
|
||||
int status, type, pid, flags, nlmsglen, skblen;
|
||||
int status, type, pid, flags;
|
||||
unsigned int nlmsglen, skblen;
|
||||
struct nlmsghdr *nlh;
|
||||
|
||||
skblen = skb->len;
|
||||
|
||||
@@ -160,7 +160,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
|
||||
|
||||
/* This is where we call the helper: as the packet goes out. */
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (!ct || ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY)
|
||||
if (!ct || ctinfo == IP_CT_RELATED_REPLY)
|
||||
goto out;
|
||||
|
||||
help = nfct_help(ct);
|
||||
|
||||
@@ -177,7 +177,7 @@ icmpv6_error_message(struct net *net, struct nf_conn *tmpl,
|
||||
/* Update skb to refer to this connection */
|
||||
skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general;
|
||||
skb->nfctinfo = *ctinfo;
|
||||
return -NF_ACCEPT;
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -228,9 +228,10 @@ static struct rt6_info ip6_blk_hole_entry_template = {
|
||||
|
||||
/* allocate dst with ip6_dst_ops */
|
||||
static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops,
|
||||
struct net_device *dev)
|
||||
struct net_device *dev,
|
||||
int flags)
|
||||
{
|
||||
struct rt6_info *rt = dst_alloc(ops, dev, 0, 0, 0);
|
||||
struct rt6_info *rt = dst_alloc(ops, dev, 0, 0, flags);
|
||||
|
||||
memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
|
||||
|
||||
@@ -1042,7 +1043,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
|
||||
if (unlikely(idev == NULL))
|
||||
return NULL;
|
||||
|
||||
rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev);
|
||||
rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, dev, 0);
|
||||
if (unlikely(rt == NULL)) {
|
||||
in6_dev_put(idev);
|
||||
goto out;
|
||||
@@ -1062,14 +1063,6 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
|
||||
dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255);
|
||||
rt->dst.output = ip6_output;
|
||||
|
||||
#if 0 /* there's no chance to use these for ndisc */
|
||||
rt->dst.flags = ipv6_addr_type(addr) & IPV6_ADDR_UNICAST
|
||||
? DST_HOST
|
||||
: 0;
|
||||
ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
|
||||
rt->rt6i_dst.plen = 128;
|
||||
#endif
|
||||
|
||||
spin_lock_bh(&icmp6_dst_lock);
|
||||
rt->dst.next = icmp6_dst_gc_list;
|
||||
icmp6_dst_gc_list = &rt->dst;
|
||||
@@ -1214,7 +1207,7 @@ int ip6_route_add(struct fib6_config *cfg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL);
|
||||
rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops, NULL, DST_NOCOUNT);
|
||||
|
||||
if (rt == NULL) {
|
||||
err = -ENOMEM;
|
||||
@@ -1244,7 +1237,7 @@ int ip6_route_add(struct fib6_config *cfg)
|
||||
ipv6_addr_prefix(&rt->rt6i_dst.addr, &cfg->fc_dst, cfg->fc_dst_len);
|
||||
rt->rt6i_dst.plen = cfg->fc_dst_len;
|
||||
if (rt->rt6i_dst.plen == 128)
|
||||
rt->dst.flags = DST_HOST;
|
||||
rt->dst.flags |= DST_HOST;
|
||||
|
||||
#ifdef CONFIG_IPV6_SUBTREES
|
||||
ipv6_addr_prefix(&rt->rt6i_src.addr, &cfg->fc_src, cfg->fc_src_len);
|
||||
@@ -1734,7 +1727,7 @@ static struct rt6_info * ip6_rt_copy(struct rt6_info *ort)
|
||||
{
|
||||
struct net *net = dev_net(ort->rt6i_dev);
|
||||
struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops,
|
||||
ort->dst.dev);
|
||||
ort->dst.dev, 0);
|
||||
|
||||
if (rt) {
|
||||
rt->dst.input = ort->dst.input;
|
||||
@@ -2013,7 +2006,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
|
||||
{
|
||||
struct net *net = dev_net(idev->dev);
|
||||
struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops,
|
||||
net->loopback_dev);
|
||||
net->loopback_dev, 0);
|
||||
struct neighbour *neigh;
|
||||
|
||||
if (rt == NULL) {
|
||||
@@ -2025,7 +2018,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
|
||||
|
||||
in6_dev_hold(idev);
|
||||
|
||||
rt->dst.flags = DST_HOST;
|
||||
rt->dst.flags |= DST_HOST;
|
||||
rt->dst.input = ip6_input;
|
||||
rt->dst.output = ip6_output;
|
||||
rt->rt6i_idev = idev;
|
||||
|
||||
@@ -1644,6 +1644,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
* the new socket..
|
||||
*/
|
||||
if(nsk != sk) {
|
||||
sock_rps_save_rxhash(nsk, skb->rxhash);
|
||||
if (tcp_child_process(sk, nsk, skb))
|
||||
goto reset;
|
||||
if (opt_skb)
|
||||
|
||||
@@ -453,8 +453,11 @@ csum_copy_err:
|
||||
}
|
||||
unlock_sock_fast(sk, slow);
|
||||
|
||||
if (flags & MSG_DONTWAIT)
|
||||
if (noblock)
|
||||
return -EAGAIN;
|
||||
|
||||
/* starting over for a new packet */
|
||||
msg->msg_flags &= ~MSG_TRUNC;
|
||||
goto try_again;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,8 @@ static inline void iriap_start_watchdog_timer(struct iriap_cb *self,
|
||||
iriap_watchdog_timer_expired);
|
||||
}
|
||||
|
||||
static struct lock_class_key irias_objects_key;
|
||||
|
||||
/*
|
||||
* Function iriap_init (void)
|
||||
*
|
||||
@@ -114,6 +116,9 @@ int __init iriap_init(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
lockdep_set_class_and_name(&irias_objects->hb_spinlock, &irias_objects_key,
|
||||
"irias_objects");
|
||||
|
||||
/*
|
||||
* Register some default services for IrLMP
|
||||
*/
|
||||
|
||||
@@ -258,7 +258,7 @@ static int l2tp_dfs_seq_open(struct inode *inode, struct file *file)
|
||||
*/
|
||||
pd->net = get_net_ns_by_pid(current->pid);
|
||||
if (IS_ERR(pd->net)) {
|
||||
rc = -PTR_ERR(pd->net);
|
||||
rc = PTR_ERR(pd->net);
|
||||
goto err_free_pd;
|
||||
}
|
||||
|
||||
|
||||
@@ -965,6 +965,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
|
||||
|
||||
mutex_lock(&sdata->u.ibss.mtx);
|
||||
|
||||
sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
|
||||
memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
|
||||
sdata->u.ibss.ssid_len = 0;
|
||||
|
||||
active_ibss = ieee80211_sta_active_ibss(sdata);
|
||||
|
||||
if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
|
||||
@@ -999,8 +1003,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
|
||||
kfree_skb(skb);
|
||||
|
||||
skb_queue_purge(&sdata->skb_queue);
|
||||
memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
|
||||
sdata->u.ibss.ssid_len = 0;
|
||||
|
||||
del_timer_sync(&sdata->u.ibss.timer);
|
||||
|
||||
|
||||
@@ -775,9 +775,6 @@ struct ieee80211_local {
|
||||
|
||||
int tx_headroom; /* required headroom for hardware/radiotap */
|
||||
|
||||
/* count for keys needing tailroom space allocation */
|
||||
int crypto_tx_tailroom_needed_cnt;
|
||||
|
||||
/* Tasklet and skb queue to process calls from IRQ mode. All frames
|
||||
* added to skb_queue will be processed, but frames in
|
||||
* skb_queue_unreliable may be dropped if the total length of these
|
||||
|
||||
@@ -1145,6 +1145,10 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
|
||||
+ IEEE80211_ENCRYPT_HEADROOM;
|
||||
ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
|
||||
|
||||
ret = dev_alloc_name(ndev, ndev->name);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
ieee80211_assign_perm_addr(local, ndev, type);
|
||||
memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
|
||||
SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
|
||||
|
||||
@@ -101,11 +101,6 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
|
||||
|
||||
if (!ret) {
|
||||
key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
|
||||
|
||||
if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
|
||||
(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
|
||||
key->local->crypto_tx_tailroom_needed_cnt--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -161,10 +156,6 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
|
||||
key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
|
||||
|
||||
key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
|
||||
|
||||
if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
|
||||
(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)))
|
||||
key->local->crypto_tx_tailroom_needed_cnt++;
|
||||
}
|
||||
|
||||
void ieee80211_key_removed(struct ieee80211_key_conf *key_conf)
|
||||
@@ -403,10 +394,8 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
|
||||
ieee80211_aes_key_free(key->u.ccmp.tfm);
|
||||
if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
|
||||
ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
|
||||
if (key->local) {
|
||||
if (key->local)
|
||||
ieee80211_debugfs_key_remove(key);
|
||||
key->local->crypto_tx_tailroom_needed_cnt--;
|
||||
}
|
||||
|
||||
kfree(key);
|
||||
}
|
||||
@@ -468,8 +457,6 @@ int ieee80211_key_link(struct ieee80211_key *key,
|
||||
|
||||
ieee80211_debugfs_key_add(key);
|
||||
|
||||
key->local->crypto_tx_tailroom_needed_cnt++;
|
||||
|
||||
ret = ieee80211_key_enable_hw_accel(key);
|
||||
|
||||
mutex_unlock(&sdata->local->key_mtx);
|
||||
@@ -511,12 +498,8 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
|
||||
|
||||
mutex_lock(&sdata->local->key_mtx);
|
||||
|
||||
sdata->local->crypto_tx_tailroom_needed_cnt = 0;
|
||||
|
||||
list_for_each_entry(key, &sdata->key_list, list) {
|
||||
sdata->local->crypto_tx_tailroom_needed_cnt++;
|
||||
list_for_each_entry(key, &sdata->key_list, list)
|
||||
ieee80211_key_enable_hw_accel(key);
|
||||
}
|
||||
|
||||
mutex_unlock(&sdata->local->key_mtx);
|
||||
}
|
||||
|
||||
@@ -232,9 +232,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
|
||||
WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type));
|
||||
}
|
||||
|
||||
ieee80211_stop_queues_by_reason(&sdata->local->hw,
|
||||
IEEE80211_QUEUE_STOP_REASON_CSA);
|
||||
|
||||
/* channel_type change automatically detected */
|
||||
ieee80211_hw_config(local, 0);
|
||||
|
||||
@@ -248,9 +245,6 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
ieee80211_wake_queues_by_reason(&sdata->local->hw,
|
||||
IEEE80211_QUEUE_STOP_REASON_CSA);
|
||||
|
||||
ht_opmode = le16_to_cpu(hti->operation_mode);
|
||||
|
||||
/* if bss configuration changed store the new one */
|
||||
|
||||
@@ -1480,7 +1480,12 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
|
||||
{
|
||||
int tail_need = 0;
|
||||
|
||||
if (may_encrypt && local->crypto_tx_tailroom_needed_cnt) {
|
||||
/*
|
||||
* This could be optimised, devices that do full hardware
|
||||
* crypto (including TKIP MMIC) need no tailroom... But we
|
||||
* have no drivers for such devices currently.
|
||||
*/
|
||||
if (may_encrypt) {
|
||||
tail_need = IEEE80211_ENCRYPT_TAILROOM;
|
||||
tail_need -= skb_tailroom(skb);
|
||||
tail_need = max_t(int, tail_need, 0);
|
||||
|
||||
@@ -154,7 +154,13 @@ update_iv:
|
||||
return RX_CONTINUE;
|
||||
|
||||
mic_fail:
|
||||
mac80211_ev_michael_mic_failure(rx->sdata, rx->key->conf.keyidx,
|
||||
/*
|
||||
* In some cases the key can be unset - e.g. a multicast packet, in
|
||||
* a driver that supports HW encryption. Send up the key idx only if
|
||||
* the key is set.
|
||||
*/
|
||||
mac80211_ev_michael_mic_failure(rx->sdata,
|
||||
rx->key ? rx->key->conf.keyidx : -1,
|
||||
(void *) skb->data, NULL, GFP_ATOMIC);
|
||||
return RX_DROP_UNUSABLE;
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ ip_set_destroy(struct sock *ctnl, struct sk_buff *skb,
|
||||
if (!attr[IPSET_ATTR_SETNAME]) {
|
||||
for (i = 0; i < ip_set_max; i++) {
|
||||
if (ip_set_list[i] != NULL && ip_set_list[i]->ref) {
|
||||
ret = IPSET_ERR_BUSY;
|
||||
ret = -IPSET_ERR_BUSY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,8 +146,9 @@ hash_ipportnet4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
{
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_ipportnet4_elem data =
|
||||
{ .cidr = h->nets[0].cidr || HOST_MASK };
|
||||
struct hash_ipportnet4_elem data = {
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
@@ -394,8 +395,9 @@ hash_ipportnet6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
{
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_ipportnet6_elem data =
|
||||
{ .cidr = h->nets[0].cidr || HOST_MASK };
|
||||
struct hash_ipportnet6_elem data = {
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -131,7 +131,9 @@ hash_net4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
{
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_net4_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
|
||||
struct hash_net4_elem data = {
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
@@ -296,7 +298,9 @@ hash_net6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
{
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_net6_elem data = { .cidr = h->nets[0].cidr || HOST_MASK };
|
||||
struct hash_net6_elem data = {
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -144,7 +144,8 @@ hash_netport4_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_netport4_elem data = {
|
||||
.cidr = h->nets[0].cidr || HOST_MASK };
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
@@ -357,7 +358,8 @@ hash_netport6_kadt(struct ip_set *set, const struct sk_buff *skb,
|
||||
const struct ip_set_hash *h = set->data;
|
||||
ipset_adtfn adtfn = set->variant->adt[adt];
|
||||
struct hash_netport6_elem data = {
|
||||
.cidr = h->nets[0].cidr || HOST_MASK };
|
||||
.cidr = h->nets[0].cidr ? h->nets[0].cidr : HOST_MASK
|
||||
};
|
||||
|
||||
if (data.cidr == 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -776,8 +776,16 @@ static void ip_vs_conn_expire(unsigned long data)
|
||||
if (cp->control)
|
||||
ip_vs_control_del(cp);
|
||||
|
||||
if (cp->flags & IP_VS_CONN_F_NFCT)
|
||||
if (cp->flags & IP_VS_CONN_F_NFCT) {
|
||||
ip_vs_conn_drop_conntrack(cp);
|
||||
/* Do not access conntracks during subsys cleanup
|
||||
* because nf_conntrack_find_get can not be used after
|
||||
* conntrack cleanup for the net.
|
||||
*/
|
||||
smp_rmb();
|
||||
if (ipvs->enable)
|
||||
ip_vs_conn_drop_conntrack(cp);
|
||||
}
|
||||
|
||||
ip_vs_pe_put(cp->pe);
|
||||
kfree(cp->pe_data);
|
||||
|
||||
@@ -1772,7 +1772,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET,
|
||||
.hooknum = NF_INET_LOCAL_IN,
|
||||
.priority = 99,
|
||||
.priority = NF_IP_PRI_NAT_SRC - 2,
|
||||
},
|
||||
/* After packet filtering, forward packet through VS/DR, VS/TUN,
|
||||
* or VS/NAT(change destination), so that filtering rules can be
|
||||
@@ -1782,7 +1782,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET,
|
||||
.hooknum = NF_INET_LOCAL_IN,
|
||||
.priority = 101,
|
||||
.priority = NF_IP_PRI_NAT_SRC - 1,
|
||||
},
|
||||
/* Before ip_vs_in, change source only for VS/NAT */
|
||||
{
|
||||
@@ -1790,7 +1790,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET,
|
||||
.hooknum = NF_INET_LOCAL_OUT,
|
||||
.priority = -99,
|
||||
.priority = NF_IP_PRI_NAT_DST + 1,
|
||||
},
|
||||
/* After mangle, schedule and forward local requests */
|
||||
{
|
||||
@@ -1798,7 +1798,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET,
|
||||
.hooknum = NF_INET_LOCAL_OUT,
|
||||
.priority = -98,
|
||||
.priority = NF_IP_PRI_NAT_DST + 2,
|
||||
},
|
||||
/* After packet filtering (but before ip_vs_out_icmp), catch icmp
|
||||
* destined for 0.0.0.0/0, which is for incoming IPVS connections */
|
||||
@@ -1824,7 +1824,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET6,
|
||||
.hooknum = NF_INET_LOCAL_IN,
|
||||
.priority = 99,
|
||||
.priority = NF_IP6_PRI_NAT_SRC - 2,
|
||||
},
|
||||
/* After packet filtering, forward packet through VS/DR, VS/TUN,
|
||||
* or VS/NAT(change destination), so that filtering rules can be
|
||||
@@ -1834,7 +1834,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET6,
|
||||
.hooknum = NF_INET_LOCAL_IN,
|
||||
.priority = 101,
|
||||
.priority = NF_IP6_PRI_NAT_SRC - 1,
|
||||
},
|
||||
/* Before ip_vs_in, change source only for VS/NAT */
|
||||
{
|
||||
@@ -1842,7 +1842,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET,
|
||||
.hooknum = NF_INET_LOCAL_OUT,
|
||||
.priority = -99,
|
||||
.priority = NF_IP6_PRI_NAT_DST + 1,
|
||||
},
|
||||
/* After mangle, schedule and forward local requests */
|
||||
{
|
||||
@@ -1850,7 +1850,7 @@ static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
.pf = PF_INET6,
|
||||
.hooknum = NF_INET_LOCAL_OUT,
|
||||
.priority = -98,
|
||||
.priority = NF_IP6_PRI_NAT_DST + 2,
|
||||
},
|
||||
/* After packet filtering (but before ip_vs_out_icmp), catch icmp
|
||||
* destined for 0.0.0.0/0, which is for incoming IPVS connections */
|
||||
@@ -1945,6 +1945,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net)
|
||||
{
|
||||
EnterFunction(2);
|
||||
net_ipvs(net)->enable = 0; /* Disable packet reception */
|
||||
smp_wmb();
|
||||
__ip_vs_sync_cleanup(net);
|
||||
LeaveFunction(2);
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
|
||||
|
||||
/* It exists; we have (non-exclusive) reference. */
|
||||
if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) {
|
||||
*ctinfo = IP_CT_ESTABLISHED + IP_CT_IS_REPLY;
|
||||
*ctinfo = IP_CT_ESTABLISHED_REPLY;
|
||||
/* Please set reply bit if this packet OK */
|
||||
*set_reply = 1;
|
||||
} else {
|
||||
@@ -922,6 +922,9 @@ nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
|
||||
ret = -ret;
|
||||
goto out;
|
||||
}
|
||||
/* ICMP[v6] protocol trackers may assign one conntrack. */
|
||||
if (skb->nfct)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ct = resolve_normal_ct(net, tmpl, skb, dataoff, pf, protonum,
|
||||
@@ -1143,7 +1146,7 @@ static void nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb)
|
||||
/* This ICMP is in reverse direction to the packet which caused it */
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL)
|
||||
ctinfo = IP_CT_RELATED + IP_CT_IS_REPLY;
|
||||
ctinfo = IP_CT_RELATED_REPLY;
|
||||
else
|
||||
ctinfo = IP_CT_RELATED;
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ static int help(struct sk_buff *skb,
|
||||
|
||||
/* Until there's been traffic both ways, don't look in packets. */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
|
||||
ctinfo != IP_CT_ESTABLISHED_REPLY) {
|
||||
pr_debug("ftp: Conntrackinfo = %u\n", ctinfo);
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
@@ -571,10 +571,9 @@ static int h245_help(struct sk_buff *skb, unsigned int protoff,
|
||||
int ret;
|
||||
|
||||
/* Until there's been traffic both ways, don't look in packets. */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
|
||||
if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
pr_debug("nf_ct_h245: skblen = %u\n", skb->len);
|
||||
|
||||
spin_lock_bh(&nf_h323_lock);
|
||||
@@ -1125,10 +1124,9 @@ static int q931_help(struct sk_buff *skb, unsigned int protoff,
|
||||
int ret;
|
||||
|
||||
/* Until there's been traffic both ways, don't look in packets. */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
|
||||
if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
|
||||
pr_debug("nf_ct_q931: skblen = %u\n", skb->len);
|
||||
|
||||
spin_lock_bh(&nf_h323_lock);
|
||||
|
||||
@@ -125,8 +125,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* Until there's been traffic both ways, don't look in packets. */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY)
|
||||
if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* Not a full tcp header? */
|
||||
|
||||
@@ -519,8 +519,7 @@ conntrack_pptp_help(struct sk_buff *skb, unsigned int protoff,
|
||||
u_int16_t msg;
|
||||
|
||||
/* don't do any tracking before tcp handshake complete */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY)
|
||||
if (ctinfo != IP_CT_ESTABLISHED && ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
|
||||
nexthdr_off = protoff;
|
||||
|
||||
@@ -78,7 +78,7 @@ static int help(struct sk_buff *skb,
|
||||
ct_sane_info = &nfct_help(ct)->help.ct_sane_info;
|
||||
/* Until there's been traffic both ways, don't look in packets. */
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED+IP_CT_IS_REPLY)
|
||||
ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* Not a full tcp header? */
|
||||
|
||||
@@ -1423,7 +1423,7 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff,
|
||||
typeof(nf_nat_sip_seq_adjust_hook) nf_nat_sip_seq_adjust;
|
||||
|
||||
if (ctinfo != IP_CT_ESTABLISHED &&
|
||||
ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY)
|
||||
ctinfo != IP_CT_ESTABLISHED_REPLY)
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* No Data ? */
|
||||
|
||||
@@ -456,7 +456,8 @@ __build_packet_message(struct nfulnl_instance *inst,
|
||||
if (skb->mark)
|
||||
NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark));
|
||||
|
||||
if (indev && skb->dev) {
|
||||
if (indev && skb->dev &&
|
||||
skb->mac_header != skb->network_header) {
|
||||
struct nfulnl_msg_packet_hw phw;
|
||||
int len = dev_parse_header(skb, phw.hw_addr);
|
||||
if (len > 0) {
|
||||
|
||||
@@ -335,7 +335,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
|
||||
if (entskb->mark)
|
||||
NLA_PUT_BE32(skb, NFQA_MARK, htonl(entskb->mark));
|
||||
|
||||
if (indev && entskb->dev) {
|
||||
if (indev && entskb->dev &&
|
||||
entskb->mac_header != entskb->network_header) {
|
||||
struct nfqnl_msg_packet_hw phw;
|
||||
int len = dev_parse_header(entskb, phw.hw_addr);
|
||||
if (len) {
|
||||
|
||||
@@ -143,9 +143,9 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par,
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (ct && !nf_ct_is_untracked(ct) &&
|
||||
((iph->protocol != IPPROTO_ICMP &&
|
||||
ctinfo == IP_CT_IS_REPLY + IP_CT_ESTABLISHED) ||
|
||||
ctinfo == IP_CT_ESTABLISHED_REPLY) ||
|
||||
(iph->protocol == IPPROTO_ICMP &&
|
||||
ctinfo == IP_CT_IS_REPLY + IP_CT_RELATED)) &&
|
||||
ctinfo == IP_CT_RELATED_REPLY)) &&
|
||||
(ct->status & IPS_SRC_NAT_DONE)) {
|
||||
|
||||
daddr = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
|
||||
|
||||
@@ -804,6 +804,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
} else {
|
||||
h.h2->tp_vlan_tci = 0;
|
||||
}
|
||||
h.h2->tp_padding = 0;
|
||||
hdrlen = sizeof(*h.h2);
|
||||
break;
|
||||
default:
|
||||
@@ -1736,6 +1737,7 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||
} else {
|
||||
aux.tp_vlan_tci = 0;
|
||||
}
|
||||
aux.tp_padding = 0;
|
||||
put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,9 +251,8 @@ static void dev_watchdog(unsigned long arg)
|
||||
}
|
||||
|
||||
if (some_queue_timedout) {
|
||||
char drivername[64];
|
||||
WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n",
|
||||
dev->name, netdev_drivername(dev, drivername, 64), i);
|
||||
dev->name, netdev_drivername(dev), i);
|
||||
dev->netdev_ops->ndo_tx_timeout(dev);
|
||||
}
|
||||
if (!mod_timer(&dev->watchdog_timer,
|
||||
|
||||
@@ -1058,7 +1058,6 @@ SCTP_STATIC __init int sctp_init(void)
|
||||
int status = -EINVAL;
|
||||
unsigned long goal;
|
||||
unsigned long limit;
|
||||
unsigned long nr_pages;
|
||||
int max_share;
|
||||
int order;
|
||||
|
||||
@@ -1148,15 +1147,7 @@ SCTP_STATIC __init int sctp_init(void)
|
||||
/* Initialize handle used for association ids. */
|
||||
idr_init(&sctp_assocs_id);
|
||||
|
||||
/* Set the pressure threshold to be a fraction of global memory that
|
||||
* is up to 1/2 at 256 MB, decreasing toward zero with the amount of
|
||||
* memory, with a floor of 128 pages.
|
||||
* Note this initializes the data in sctpv6_prot too
|
||||
* Unabashedly stolen from tcp_init
|
||||
*/
|
||||
nr_pages = totalram_pages - totalhigh_pages;
|
||||
limit = min(nr_pages, 1UL<<(28-PAGE_SHIFT)) >> (20-PAGE_SHIFT);
|
||||
limit = (limit * (nr_pages >> (20-PAGE_SHIFT))) >> (PAGE_SHIFT-11);
|
||||
limit = nr_free_buffer_pages() / 8;
|
||||
limit = max(limit, 128UL);
|
||||
sysctl_sctp_mem[0] = limit / 4 * 3;
|
||||
sysctl_sctp_mem[1] = limit;
|
||||
|
||||
@@ -2073,10 +2073,33 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
|
||||
static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
|
||||
unsigned int optlen)
|
||||
{
|
||||
struct sctp_association *asoc;
|
||||
struct sctp_ulpevent *event;
|
||||
|
||||
if (optlen > sizeof(struct sctp_event_subscribe))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
|
||||
return -EFAULT;
|
||||
|
||||
/*
|
||||
* At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
|
||||
* if there is no data to be sent or retransmit, the stack will
|
||||
* immediately send up this notification.
|
||||
*/
|
||||
if (sctp_ulpevent_type_enabled(SCTP_SENDER_DRY_EVENT,
|
||||
&sctp_sk(sk)->subscribe)) {
|
||||
asoc = sctp_id2assoc(sk, 0);
|
||||
|
||||
if (asoc && sctp_outq_is_empty(&asoc->outqueue)) {
|
||||
event = sctp_ulpevent_make_sender_dry_event(asoc,
|
||||
GFP_ATOMIC);
|
||||
if (!event)
|
||||
return -ENOMEM;
|
||||
|
||||
sctp_ulpq_tail_event(&asoc->ulpq, event);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -577,13 +577,13 @@ retry:
|
||||
}
|
||||
inode = &gss_msg->inode->vfs_inode;
|
||||
for (;;) {
|
||||
prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE);
|
||||
prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_KILLABLE);
|
||||
spin_lock(&inode->i_lock);
|
||||
if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) {
|
||||
break;
|
||||
}
|
||||
spin_unlock(&inode->i_lock);
|
||||
if (signalled()) {
|
||||
if (fatal_signal_pending(current)) {
|
||||
err = -ERESTARTSYS;
|
||||
goto out_intr;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <linux/sunrpc/gss_krb5.h>
|
||||
#include <linux/sunrpc/xdr.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/sunrpc/gss_krb5_enctypes.h>
|
||||
|
||||
#ifdef RPC_DEBUG
|
||||
# define RPCDBG_FACILITY RPCDBG_AUTH
|
||||
@@ -750,7 +751,7 @@ static struct gss_api_mech gss_kerberos_mech = {
|
||||
.gm_ops = &gss_kerberos_ops,
|
||||
.gm_pf_num = ARRAY_SIZE(gss_kerberos_pfs),
|
||||
.gm_pfs = gss_kerberos_pfs,
|
||||
.gm_upcall_enctypes = "18,17,16,23,3,1,2",
|
||||
.gm_upcall_enctypes = KRB5_SUPPORTED_ENCTYPES,
|
||||
};
|
||||
|
||||
static int __init init_kerberos_module(void)
|
||||
|
||||
@@ -1061,7 +1061,7 @@ call_allocate(struct rpc_task *task)
|
||||
|
||||
dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid);
|
||||
|
||||
if (RPC_IS_ASYNC(task) || !signalled()) {
|
||||
if (RPC_IS_ASYNC(task) || !fatal_signal_pending(current)) {
|
||||
task->tk_action = call_allocate;
|
||||
rpc_delay(task, HZ>>4);
|
||||
return;
|
||||
@@ -1175,6 +1175,9 @@ call_bind_status(struct rpc_task *task)
|
||||
status = -EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
if (task->tk_rebind_retry == 0)
|
||||
break;
|
||||
task->tk_rebind_retry--;
|
||||
rpc_delay(task, 3*HZ);
|
||||
goto retry_timeout;
|
||||
case -ETIMEDOUT:
|
||||
|
||||
@@ -792,6 +792,7 @@ static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *ta
|
||||
/* Initialize retry counters */
|
||||
task->tk_garb_retry = 2;
|
||||
task->tk_cred_retry = 2;
|
||||
task->tk_rebind_retry = 2;
|
||||
|
||||
task->tk_priority = task_setup_data->priority - RPC_PRIORITY_LOW;
|
||||
task->tk_owner = current->tgid;
|
||||
|
||||
@@ -3406,11 +3406,11 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
|
||||
i = 0;
|
||||
if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) {
|
||||
nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) {
|
||||
request->ssids[i].ssid_len = nla_len(attr);
|
||||
if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) {
|
||||
if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) {
|
||||
err = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
request->ssids[i].ssid_len = nla_len(attr);
|
||||
memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr));
|
||||
i++;
|
||||
}
|
||||
@@ -3572,12 +3572,11 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
|
||||
if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) {
|
||||
nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS],
|
||||
tmp) {
|
||||
request->ssids[i].ssid_len = nla_len(attr);
|
||||
if (request->ssids[i].ssid_len >
|
||||
IEEE80211_MAX_SSID_LEN) {
|
||||
if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) {
|
||||
err = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
request->ssids[i].ssid_len = nla_len(attr);
|
||||
memcpy(request->ssids[i].ssid, nla_data(attr),
|
||||
nla_len(attr));
|
||||
i++;
|
||||
@@ -6464,7 +6463,8 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
|
||||
if (addr)
|
||||
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type);
|
||||
NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id);
|
||||
if (key_id != -1)
|
||||
NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id);
|
||||
if (tsc)
|
||||
NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
|
||||
static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
|
||||
static void xfrm_init_pmtu(struct dst_entry *dst);
|
||||
static int stale_bundle(struct dst_entry *dst);
|
||||
static int xfrm_bundle_ok(struct xfrm_dst *xdst, int family);
|
||||
static int xfrm_bundle_ok(struct xfrm_dst *xdst);
|
||||
|
||||
|
||||
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
|
||||
@@ -2241,7 +2241,7 @@ static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie)
|
||||
|
||||
static int stale_bundle(struct dst_entry *dst)
|
||||
{
|
||||
return !xfrm_bundle_ok((struct xfrm_dst *)dst, AF_UNSPEC);
|
||||
return !xfrm_bundle_ok((struct xfrm_dst *)dst);
|
||||
}
|
||||
|
||||
void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
|
||||
@@ -2313,7 +2313,7 @@ static void xfrm_init_pmtu(struct dst_entry *dst)
|
||||
* still valid.
|
||||
*/
|
||||
|
||||
static int xfrm_bundle_ok(struct xfrm_dst *first, int family)
|
||||
static int xfrm_bundle_ok(struct xfrm_dst *first)
|
||||
{
|
||||
struct dst_entry *dst = &first->u.dst;
|
||||
struct xfrm_dst *last;
|
||||
|
||||
@@ -265,7 +265,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
|
||||
bitnr = bitnr & 0x1F;
|
||||
replay_esn->bmp[nr] |= (1U << bitnr);
|
||||
} else {
|
||||
nr = replay_esn->replay_window >> 5;
|
||||
nr = (replay_esn->replay_window - 1) >> 5;
|
||||
for (i = 0; i <= nr; i++)
|
||||
replay_esn->bmp[i] = 0;
|
||||
|
||||
@@ -471,7 +471,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq)
|
||||
bitnr = bitnr & 0x1F;
|
||||
replay_esn->bmp[nr] |= (1U << bitnr);
|
||||
} else {
|
||||
nr = replay_esn->replay_window >> 5;
|
||||
nr = (replay_esn->replay_window - 1) >> 5;
|
||||
for (i = 0; i <= nr; i++)
|
||||
replay_esn->bmp[i] = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user