1. 25 9月, 2013 10 次提交
    • T
      NFC Digital: Add initiator NFC-DEP support · 7d0911c0
      Thierry Escande 提交于
      This adds support for NFC-DEP protocol in initiator mode for NFC-A and
      NFC-F technologies.
      
      When a target is detected, the process flow is as follow:
      
      For NFC-A technology:
      1 - The digital stack receives a SEL_RES as the reply of the SEL_REQ
          command.
      2   - If b7 of SEL_RES is set, the peer device is configure for NFC-DEP
            protocol. NFC core is notified through nfc_targets_found().
            Execution continues at step 4.
      3   - Otherwise, it's a tag and the NFC core is notified. Detection
            ends.
      4 - The digital stacks sends an ATR_REQ command containing a randomly
          generated NFCID3 and the general bytes obtained from the LLCP layer
          of NFC core.
      
      For NFC-F technology:
      1 - The digital stack receives a SENSF_RES as the reply of the
          SENSF_REQ command.
      2   - If B1 and B2 of NFCID2 are 0x01 and 0xFE respectively, the peer
            device is configured for NFC-DEP protocol. NFC core is notified
            through nfc_targets_found(). Execution continues at step 4.
      3   - Otherwise it's a type 3 tag. NFC core is notified. Detection
            ends.
      4 - The digital stacks sends an ATR_REQ command containing the NFC-F
          NFCID2 as NFCID3 and the general bytes obtained from the LLCP layer
          of NFC core.
      
      For both technologies:
      5 - The digital stacks receives the ATR_RES response containing the
          NFCID3 and the general bytes of the peer device.
      6 - The digital stack notifies NFC core that the DEP link is up through
          nfc_dep_link_up().
      7 - The NFC core performs data exchange through tm_transceive().
      8 - The digital stack sends a DEP_REQ command containing an I PDU with
          the data from NFC core.
      9 - The digital stack receives a DEP_RES command
      10  - If the DEP_RES response contains a supervisor PDU with timeout
            extension request (RTOX) the digital stack sends a DEP_REQ
            command containing a supervisor PDU acknowledging the RTOX
            request. The execution continues at step 9.
      11  - If the DEP_RES response contains an I PDU, the response data is
            passed back to NFC core through the response callback. The
            execution continues at step 8.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      7d0911c0
    • T
      NFC Digital: Add NFC-F technology support · 8c0695e4
      Thierry Escande 提交于
      This adds polling support for NFC-F technology at 212 kbits/s and 424
      kbits/s. A user space application like neard can send type 3 tag
      commands through the NFC core.
      
      Process flow for NFC-F detection is as follow:
      
      1 - The digital stack sends the SENSF_REQ command to the NFC device.
      2 - A peer device replies with a SENSF_RES response.
      3   - The digital stack notifies the NFC core of the presence of a
            target in the operation field and passes the target NFCID2.
      
      This also adds support for CRC calculation of type CRC-F. The CRC
      calculation is handled by the digital stack if the NFC device doesn't
      support it.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      8c0695e4
    • T
      NFC Digital: Add NFC-A technology support · 2c66daec
      Thierry Escande 提交于
      This adds support for NFC-A technology at 106 kbits/s. The stack can
      detect tags of type 1 and 2. There is no support for collision
      detection. Tags can be read and written by using a user space
      application or a daemon like neard.
      
      The flow of polling operations for NFC-A detection is as follow:
      
      1 - The digital stack sends the SENS_REQ command to the NFC device.
      2 - The NFC device receives a SENS_RES response from a peer device and
          passes it to the digital stack.
      3   - If the SENS_RES response identifies a type 1 tag, detection ends.
            NFC core is notified through nfc_targets_found().
      4   - Otherwise, the digital stack sets the cascade level of NFCID1 to
            CL1 and sends the SDD_REQ command.
      5 - The digital stack selects SEL_CMD and SEL_PAR according to the
          cascade level and sends the SDD_REQ command.
      4 - The digital stack receives a SDD_RES response for the cascade level
          passed in the SDD_REQ command.
      5 - The digital stack analyses (part of) NFCID1 and verify BCC.
      6 - The digital stack sends the SEL_REQ command with the NFCID1
          received in the SDD_RES.
      6 - The peer device replies with a SEL_RES response
      7   - Detection ends if NFCID1 is complete. NFC core notified of new
            target by nfc_targets_found().
      8   - If NFCID1 is not complete, the cascade level is incremented (up
            to and including CL3) and the execution continues at step 5 to
            get the remaining bytes of NFCID1.
      
      Once target detection is done, type 1 and 2 tag commands must be
      handled by a user space application (i.e neard) through the NFC core.
      Responses for type 1 tag are returned directly to user space via NFC
      core.
      Responses of type 2 commands are handled differently. The digital stack
      doesn't analyse the type of commands sent through im_transceive() and
      must differentiate valid responses from error ones.
      The response process flow is as follow:
      
      1 - If the response length is 16 bytes, it is a valid response of a
          READ command. the packet is returned to the NFC core through the
          callback passed to im_transceive(). Processing stops.
      2 - If the response is 1 byte long and is a ACK byte (0x0A), it is a
          valid response of a WRITE command for example. First packet byte
          is set to 0 for no-error and passed back to the NFC core.
          Processing stops.
      3 - Any other response is treated as an error and -EIO error code is
          returned to the NFC core through the response callback.
      
      Moreover, since the driver can't differentiate success response from a
      NACK response, the digital stack has to handle CRC calculation.
      
      Thus, this patch also adds support for CRC calculation. If the driver
      doesn't handle it, the digital stack will calculate CRC and will add it
      to sent frames. CRC will also be checked and removed from received
      frames. Pointers to the correct CRC calculation functions are stored in
      the digital stack device structure when a target is detected. This
      avoids the need to check the current target type for every call to
      im_transceive() and for every response received from a peer device.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      2c66daec
    • T
      NFC Digital: Implement driver commands mechanism · 59ee2361
      Thierry Escande 提交于
      This implements the mechanism used to send commands to the driver in
      initiator mode through in_send_cmd().
      
      Commands are serialized and sent to the driver by using a work item
      on the system workqueue. Responses are handled asynchronously by
      another work item. Once the digital stack receives the response through
      the command_complete callback, the next command is sent to the driver.
      
      This also implements the polling mechanism. It's handled by a work item
      cycling on all supported protocols. The start poll command for a given
      protocol is sent to the driver using the mechanism described above.
      The process continues until a peer is discovered or stop_poll is
      called. This patch implements the poll function for NFC-A that sends a
      SENS_REQ command and waits for the SENS_RES response.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      59ee2361
    • T
      NFC: Digital Protocol stack implementation · 4b10884e
      Thierry Escande 提交于
      This is the initial commit of the NFC Digital Protocol stack
      implementation.
      
      It offers an interface for devices that don't have an embedded NFC
      Digital protocol stack. The driver instantiates the digital stack by
      calling nfc_digital_allocate_device(). Within the nfc_digital_ops
      structure, the driver specifies a set of function pointers for driver
      operations. These functions must be implemented by the driver and are:
      
      in_configure_hw:
      Hardware configuration for RF technology and communication framing in
      initiator mode. This is a synchronous function.
      
      in_send_cmd:
      Initiator mode data exchange using RF technology and framing previously
      set with in_configure_hw. The peer response is returned through
      callback cb. If an io error occurs or the peer didn't reply within the
      specified timeout (ms), the error code is passed back through the resp
      pointer. This is an asynchronous function.
      
      tg_configure_hw:
      Hardware configuration for RF technology and communication framing in
      target mode. This is a synchronous function.
      
      tg_send_cmd:
      Target mode data exchange using RF technology and framing previously
      set with tg_configure_hw. The peer next command is returned through
      callback cb. If an io error occurs or the peer didn't reply within the
      specified timeout (ms), the error code is passed back through the resp
      pointer. This is an asynchronous function.
      
      tg_listen:
      Put the device in listen mode waiting for data from the peer device.
      This is an asynchronous function.
      
      tg_listen_mdaa:
      If supported, put the device in automatic listen mode with mode
      detection and automatic anti-collision. In this mode, the device
      automatically detects the RF technology and executes the
      anti-collision detection using the command responses specified in
      mdaa_params. The mdaa_params structure contains SENS_RES, NFCID1, and
      SEL_RES for 106A RF tech. NFCID2 and system code (sc) for 212F and
      424F. The driver returns the NFC-DEP ATR_REQ command through cb. The
      digital stack deducts the RF tech by analyzing the SoD of the frame
      containing the ATR_REQ command. This is an asynchronous function.
      
      switch_rf:
      Turns device radio on or off. The stack does not call explicitly
      switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
      the device radio on.
      
      abort_cmd:
      Discard the last sent command.
      
      Then the driver registers itself against the digital stack by using
      nfc_digital_register_device() which in turn registers the digital stack
      against the NFC core layer. The digital stack implements common NFC
      operations like dev_up(), dev_down(), start_poll(), stop_poll(), etc.
      
      This patch is only a skeleton and NFC operations are just stubs.
      Signed-off-by: NThierry Escande <thierry.escande@linux.intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      4b10884e
    • S
      NFC: Set active target upon DEP up event reception · e29a9e2a
      Samuel Ortiz 提交于
      As we can potentially get DEP up events without having sent a netlink
      command, we need to set the active target properly from dep_link_is_up.
      Spontaneous DEP up events can come from devices that detected an active
      p2p target. In that case there is no need to call the netlink DEP up
      command as the link is already up and running.
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      e29a9e2a
    • E
      NFC: NCI: Simplify NCI SPI to become a simple framing/checking layer · fa544fff
      Eric Lapuyade 提交于
      NCI SPI layer should not manage the nci dev, this is the job of the nci
      chipset driver. This layer should be limited to frame/deframe nci
      packets, and optionnaly check integrity (crc) and manage the ack/nak
      protocol.
      
      The NCI SPI must not be mixed up with an NCI dev. spi_[dev|device] are
      therefore renamed to a simple spi for more clarity.
      The header and crc sizes are moved to nci.h so that drivers can use
      them to reserve space in outgoing skbs.
      nci_spi_send() is exported to be accessible by drivers.
      Signed-off-by: NEric Lapuyade <eric.lapuyade@intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      fa544fff
    • E
      NFC: NCI: Rename spi ndev -> nsdev and nci_dev -> ndev for consistency · d5937511
      Eric Lapuyade 提交于
      An hci dev is an hdev. An nci dev is an ndev. Calling an nci spi dev an
      ndev is misleading since it's not the same thing. The nci dev contained
      in the nci spi dev is also named inconsistently.
      Signed-off-by: NEric Lapuyade <eric.lapuyade@intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      d5937511
    • E
    • A
      NFC: Export nfc_find_se() · d8eb18ee
      Arron Wang 提交于
      This will be needed by all NFC driver implementing the SE ops.
      Signed-off-by: NArron Wang <arron.wang@intel.com>
      Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
      d8eb18ee
  2. 20 9月, 2013 3 次提交
  3. 19 9月, 2013 1 次提交
  4. 18 9月, 2013 2 次提交
  5. 17 9月, 2013 7 次提交
  6. 16 9月, 2013 2 次提交
  7. 13 9月, 2013 7 次提交
    • M
      Remove GENERIC_HARDIRQ config option · 0244ad00
      Martin Schwidefsky 提交于
      After the last architecture switched to generic hard irqs the config
      options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
      for !CONFIG_GENERIC_HARDIRQS can be removed.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0244ad00
    • P
      netfilter: nf_nat_proto_icmpv6:: fix wrong comparison in icmpv6_manip_pkt · d830f0fa
      Phil Oester 提交于
      In commit 58a317f1 (netfilter: ipv6: add IPv6 NAT support), icmpv6_manip_pkt
      was added with an incorrect comparison of ICMP codes to types.  This causes
      problems when using NAT rules with the --random option.  Correct the
      comparison.
      
      This closes netfilter bugzilla #851, reported by Alexander Neumann.
      Signed-off-by: NPhil Oester <kernel@linuxace.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      d830f0fa
    • H
      bridge: Clamp forward_delay when enabling STP · be4f154d
      Herbert Xu 提交于
      At some point limits were added to forward_delay.  However, the
      limits are only enforced when STP is enabled.  This created a
      scenario where you could have a value outside the allowed range
      while STP is disabled, which then stuck around even after STP
      is enabled.
      
      This patch fixes this by clamping the value when we enable STP.
      
      I had to move the locking around a bit to ensure that there is
      no window where someone could insert a value outside the range
      while we're in the middle of enabling STP.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      
      Cheers,
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be4f154d
    • C
      resubmit bridge: fix message_age_timer calculation · 9a062013
      Chris Healy 提交于
      This changes the message_age_timer calculation to use the BPDU's max age as
      opposed to the local bridge's max age.  This is in accordance with section
      8.6.2.3.2 Step 2 of the 802.1D-1998 sprecification.
      
      With the current implementation, when running with very large bridge
      diameters, convergance will not always occur even if a root bridge is
      configured to have a longer max age.
      
      Tested successfully on bridge diameters of ~200.
      Signed-off-by: NChris Healy <cphealy@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9a062013
    • S
      memcg: rename RESOURCE_MAX to RES_COUNTER_MAX · 6de5a8bf
      Sha Zhengju 提交于
      RESOURCE_MAX is far too general name, change it to RES_COUNTER_MAX.
      Signed-off-by: NSha Zhengju <handai.szj@taobao.com>
      Signed-off-by: NQiang Huang <h.huangqiang@huawei.com>
      Acked-by: NMichal Hocko <mhocko@suse.cz>
      Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
      Cc: Jeff Liu <jeff.liu@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6de5a8bf
    • D
      net: sctp: fix ipv6 ipsec encryption bug in sctp_v6_xmit · 95ee6208
      Daniel Borkmann 提交于
      Alan Chester reported an issue with IPv6 on SCTP that IPsec traffic is not
      being encrypted, whereas on IPv4 it is. Setting up an AH + ESP transport
      does not seem to have the desired effect:
      
      SCTP + IPv4:
      
        22:14:20.809645 IP (tos 0x2,ECT(0), ttl 64, id 0, offset 0, flags [DF], proto AH (51), length 116)
          192.168.0.2 > 192.168.0.5: AH(spi=0x00000042,sumlen=16,seq=0x1): ESP(spi=0x00000044,seq=0x1), length 72
        22:14:20.813270 IP (tos 0x2,ECT(0), ttl 64, id 0, offset 0, flags [DF], proto AH (51), length 340)
          192.168.0.5 > 192.168.0.2: AH(spi=0x00000043,sumlen=16,seq=0x1):
      
      SCTP + IPv6:
      
        22:31:19.215029 IP6 (class 0x02, hlim 64, next-header SCTP (132) payload length: 364)
          fe80::222:15ff:fe87:7fc.3333 > fe80::92e6:baff:fe0d:5a54.36767: sctp
          1) [INIT ACK] [init tag: 747759530] [rwnd: 62464] [OS: 10] [MIS: 10]
      
      Moreover, Alan says:
      
        This problem was seen with both Racoon and Racoon2. Other people have seen
        this with OpenSwan. When IPsec is configured to encrypt all upper layer
        protocols the SCTP connection does not initialize. After using Wireshark to
        follow packets, this is because the SCTP packet leaves Box A unencrypted and
        Box B believes all upper layer protocols are to be encrypted so it drops
        this packet, causing the SCTP connection to fail to initialize. When IPsec
        is configured to encrypt just SCTP, the SCTP packets are observed unencrypted.
      
      In fact, using `socat sctp6-listen:3333 -` on one end and transferring "plaintext"
      string on the other end, results in cleartext on the wire where SCTP eventually
      does not report any errors, thus in the latter case that Alan reports, the
      non-paranoid user might think he's communicating over an encrypted transport on
      SCTP although he's not (tcpdump ... -X):
      
        ...
        0x0030: 5d70 8e1a 0003 001a 177d eb6c 0000 0000  ]p.......}.l....
        0x0040: 0000 0000 706c 6169 6e74 6578 740a 0000  ....plaintext...
      
      Only in /proc/net/xfrm_stat we can see XfrmInTmplMismatch increasing on the
      receiver side. Initial follow-up analysis from Alan's bug report was done by
      Alexey Dobriyan. Also thanks to Vlad Yasevich for feedback on this.
      
      SCTP has its own implementation of sctp_v6_xmit() not calling inet6_csk_xmit().
      This has the implication that it probably never really got updated along with
      changes in inet6_csk_xmit() and therefore does not seem to invoke xfrm handlers.
      
      SCTP's IPv4 xmit however, properly calls ip_queue_xmit() to do the work. Since
      a call to inet6_csk_xmit() would solve this problem, but result in unecessary
      route lookups, let us just use the cached flowi6 instead that we got through
      sctp_v6_get_dst(). Since all SCTP packets are being sent through sctp_packet_transmit(),
      we do the route lookup / flow caching in sctp_transport_route(), hold it in
      tp->dst and skb_dst_set() right after that. If we would alter fl6->daddr in
      sctp_v6_xmit() to np->opt->srcrt, we possibly could run into the same effect
      of not having xfrm layer pick it up, hence, use fl6_update_dst() in sctp_v6_get_dst()
      instead to get the correct source routed dst entry, which we assign to the skb.
      
      Also source address routing example from 62503411 ("sctp: fix sctp to work with
      ipv6 source address routing") still works with this patch! Nevertheless, in RFC5095
      it is actually 'recommended' to not use that anyway due to traffic amplification [1].
      So it seems we're not supposed to do that anyway in sctp_v6_xmit(). Moreover, if
      we overwrite the flow destination here, the lower IPv6 layer will be unable to
      put the correct destination address into IP header, as routing header is added in
      ipv6_push_nfrag_opts() but then probably with wrong final destination. Things aside,
      result of this patch is that we do not have any XfrmInTmplMismatch increase plus on
      the wire with this patch it now looks like:
      
      SCTP + IPv6:
      
        08:17:47.074080 IP6 2620:52:0:102f:7a2b:cbff:fe27:1b0a > 2620:52:0:102f:213:72ff:fe32:7eba:
          AH(spi=0x00005fb4,seq=0x1): ESP(spi=0x00005fb5,seq=0x1), length 72
        08:17:47.074264 IP6 2620:52:0:102f:213:72ff:fe32:7eba > 2620:52:0:102f:7a2b:cbff:fe27:1b0a:
          AH(spi=0x00003d54,seq=0x1): ESP(spi=0x00003d55,seq=0x1), length 296
      
      This fixes Kernel Bugzilla 24412. This security issue seems to be present since
      2.6.18 kernels. Lets just hope some big passive adversary in the wild didn't have
      its fun with that. lksctp-tools IPv6 regression test suite passes as well with
      this patch.
      
       [1] http://www.secdev.org/conf/IPv6_RH_security-csw07.pdfReported-by: NAlan Chester <alan.chester@tekelec.com>
      Reported-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: NVlad Yasevich <vyasevich@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      95ee6208
    • S
      netpoll: Should handle ETH_P_ARP other than ETH_P_IP in netpoll_neigh_reply · b0dd663b
      Sonic Zhang 提交于
      The received ARP request type in the Ethernet packet head is ETH_P_ARP other than ETH_P_IP.
      
      [ Bug introduced by commit b7394d24
        ("netpoll: prepare for ipv6") ]
      Signed-off-by: NSonic Zhang <sonic.zhang@analog.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0dd663b
  8. 12 9月, 2013 8 次提交