1. 24 Mar, 2015 26 commits
    • Hannes Frederic Sowa's avatar
      ipv6: generation of stable privacy addresses for link-local and autoconf · 622c81d5
      Hannes Frederic Sowa authored
      This patch implements the stable privacy address generation for
      link-local and autoconf addresses as specified in RFC7217.
      
        RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key)
      
      is the RID (random identifier). As the hash function F we chose one
      round of sha1. Prefix will be either the link-local prefix or the
      router advertised one. As Net_Iface we use the MAC address of the
      device. DAD_Counter and secret_key are implemented as specified.
      
      We don't use Network_ID, as it couples the code too closely to other
      subsystems. It is specified as optional in the RFC.
      
      As Net_Iface we only use the MAC address: we simply have no stable
      identifier in the kernel we could possibly use: because this code might
      run very early, we cannot depend on names, as they might be changed by
      user space early on during the boot process.
      
      A new address generation mode is introduced,
      IN6_ADDR_GEN_MODE_STABLE_PRIVACY. With iproute2 one can switch back to
      none or eui64 address configuration mode although the stable_secret is
      already set.
      
      We refuse writes to ipv6/conf/all/stable_secret but only allow
      ipv6/conf/default/stable_secret and the interface specific file to be
      written to. The default stable_secret is used as the parameter for the
      namespace, the interface specific can overwrite the secret, e.g. when
      switching a network configuration from one system to another while
      inheriting the secret.
      
      Cc: Erik Kline <ek@google.com>
      Cc: Fernando Gont <fgont@si6networks.com>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Cc: YOSHIFUJI Hideaki/吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      622c81d5
    • Hannes Frederic Sowa's avatar
      ipv6: introduce secret_stable to ipv6_devconf · 3d1bec99
      Hannes Frederic Sowa authored
      This patch implements the procfs logic for the stable_address knob:
      The secret is formatted as an ipv6 address and will be stored per
      interface and per namespace. We track initialized flag and return EIO
      errors until the secret is set.
      
      We don't inherit the secret to newly created namespaces.
      
      Cc: Erik Kline <ek@google.com>
      Cc: Fernando Gont <fgont@si6networks.com>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Cc: YOSHIFUJI Hideaki/吉藤英明 <hideaki.yoshifuji@miraclelinux.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d1bec99
    • Hannes Frederic Sowa's avatar
      lib: EXPORT_SYMBOL sha_init · ab2bb324
      Hannes Frederic Sowa authored
      We need this symbol later on in ipv6.ko, thus export it via EXPORT_SYMBOL
      like sha_transform already is.
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab2bb324
    • David S. Miller's avatar
      Merge branch 'bcmgenet-next' · 7f163d07
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: bcmgenet: integrated GPHY power up/down
      
      This patch series implements integrated Gigabit PHY power up/down, which allows
      us to save close to 300mW on some designs when the Gigabit PHY is known to be
      unused (e.g: during bcmgenet_close or bcmgenet_suspend not doing Wake-on-LAN).
      
      Changes in v2:
      
      - drop an extra bcmgenet_ext_readl in bcmgenet_phy_power_set
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7f163d07
    • Florian Fainelli's avatar
      net: bcmgenet: power down and up GPHY during suspend/resume · a6f31f5e
      Florian Fainelli authored
      In case the interface is not used, power down the integrated GPHY during
      suspend. Similarly to bcmgenet_open(), bcmgenet_resume() powers on the GPHY
      prior to any UniMAC activity.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6f31f5e
    • Florian Fainelli's avatar
      net: bcmgenet: power up and down integrated GPHY when unused · a642c4f7
      Florian Fainelli authored
      Power up the GPHY while we are bringing-up the network interface, and
      conversely, upon bring down, power the GPHY down. In order to avoid
      creating hardware hazards, make sure that the GPHY gets powered on
      during bcmgenet_open() prior to the UniMAC being reset as the UniMAC may
      start creating activity towards the GPHY if we reverse the steps.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a642c4f7
    • Florian Fainelli's avatar
      net: bcmgenet: implement GPHY power down sequence · a9d608c1
      Florian Fainelli authored
      Implement the GPHY power down sequence by setting all power down bits, putting
      the GPHY in reset, and finally cutting the 25Mhz reference clock.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a9d608c1
    • Florian Fainelli's avatar
      net: bcmgenet: fix GPHY power-up sequence · 0c81a8ee
      Florian Fainelli authored
      We were missing a number of extra steps and delays to power-up the GPHY, update
      the sequence to reflect the proper procedure here.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c81a8ee
    • Florian Fainelli's avatar
      net: bcmgenet: rename bcmgenet_ephy_power_up · 8212c983
      Florian Fainelli authored
      In preparation for implementing the power down GPHY sequence, rename
      bcmgenet_ephy_power_up to illustrate that it is not EPHY specific but
      PHY agnostic, and add an "enable" argument.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8212c983
    • Florian Fainelli's avatar
      net: bcmgenet: update bcmgenet_ephy_power_up to clear CK25_DIS bit · 0d017e21
      Florian Fainelli authored
      The CK25_DIS bit controls whether a 25Mhz clock is fed to the GPHY or
      not, in preparation for powering down the integrated GPHY when relevant,
      make sure we clear that bit.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0d017e21
    • Florian Fainelli's avatar
      net: bcmgenet: propagate errors from bcmgenet_power_down · ca8cf341
      Florian Fainelli authored
      If bcmgenet_power_down() fails, we would want to propagate a return
      value from bcmgenet_wol_power_down_cfg() to know about this.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca8cf341
    • David S. Miller's avatar
      Merge branch 'rhashtable-next' · cc330b55
      David S. Miller authored
      Herbert Xu says:
      
      ====================
      rhashtable: Multiple rehashing
      
      This series introduces multiple rehashing.
      
      Recall that the original implementation in br_multicast used
      two list pointers per hash node and therefore is limited to at
      most one rehash at a time since you need one list pointer for
      the old table and one for the new table.
      
      Thanks to Josh Triplett's suggestion of using a single list pointer
      we're no longer limited by that.  So it is perfectly OK to have
      an arbitrary number of tables in existence at any one time.
      
      The reader and removal simply has to walk from the oldest table
      to the newest table in order not to miss anything.  Insertion
      without lookup are just as easy as we simply go to the last table
      that we can find and add the entry there.
      
      However, insertion with uniqueness lookup is more complicated
      because we need to ensure that two simultaneous insertions of the
      same key do not both succeed.  To achieve this, all insertions
      including those without lookups are required to obtain the bucket
      lock from the oldest hash table that is still alive.  This is
      determined by having the rehasher (there is only one rehashing
      thread in the system) keep a pointer of where it is up to.  If
      a bucket has already been rehashed then it is dead, i.e., there
      cannot be any more insertions to it, otherwise it is considered
      alive.  This guarantees that the same key cannot be inserted
      in two different tables in parallel.
      
      Patch 1 is actually a bug fix for the walker.
      
      Patch 2-5 eliminates unnecessary out-of-line copies of jhash.
      
      Patch 6 makes rhashtable_shrink shrink to fit.
      
      Patch 7 introduces multiple rehashing.  This means that if we
      decide to grow then we will grow regardless of whether the previous
      one has finished.  However, this is still asynchronous meaning
      that if insertions come fast enough we may still end up with a
      table that is overutilised.
      
      Patch 8 adds support for GFP_ATOMIC allocations of struct bucket_table.
      
      Finally patch 9 enables immediate rehashing.  This is done either
      when the table reaches 100% utilisation, or when the chain length
      exceeds 16 (the latter can be disabled on request, e.g., for
      nft_hash.
      
      With these patches the system should no longer have any trouble
      dealing with fast insertions on a small table.  In the worst
      case you end up with a list of tables that's log N in length
      while the rehasher catches up.
      
      v3 restores rhashtable_shrink and fixes a number of bugs in the
      multiple rehashing patches (7 and 9).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc330b55
    • Herbert Xu's avatar
      rhashtable: Add immediate rehash during insertion · ccd57b1b
      Herbert Xu authored
      This patch reintroduces immediate rehash during insertion.  If
      we find during insertion that the table is full or the chain
      length exceeds a set limit (currently 16 but may be disabled
      with insecure_elasticity) then we will force an immediate rehash.
      The rehash will contain an expansion if the table utilisation
      exceeds 75%.
      
      If this rehash fails then the insertion will fail.  Otherwise the
      insertion will be reattempted in the new hash table.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccd57b1b
    • Herbert Xu's avatar
      rhashtable: Allow GFP_ATOMIC bucket table allocation · b9ecfdaa
      Herbert Xu authored
      This patch adds the ability to allocate bucket table with GFP_ATOMIC
      instead of GFP_KERNEL.  This is needed when we perform an immediate
      rehash during insertion.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9ecfdaa
    • Herbert Xu's avatar
      rhashtable: Add multiple rehash support · b824478b
      Herbert Xu authored
      This patch adds the missing bits to allow multiple rehashes.  The
      read-side as well as remove already handle this correctly.  So it's
      only the rehasher and insertion that need modification to handle
      this.
      
      Note that this patch doesn't actually enable it so for now rehashing
      is still only performed by the worker thread.
      
      This patch also disables the explicit expand/shrink interface because
      the table is meant to expand and shrink automatically, and continuing
      to export these interfaces unnecessarily complicates the life of the
      rehasher since the rehash process is now composed of two parts.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b824478b
    • Herbert Xu's avatar
      rhashtable: Shrink to fit · 18093d1c
      Herbert Xu authored
      This patch changes rhashtable_shrink to shrink to the smallest
      size possible rather than halving the table.  This is needed
      because with multiple rehashing we will defer shrinking until
      all other rehashing is done, meaning that when we do shrink
      we may be able to shrink a lot.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18093d1c
    • Herbert Xu's avatar
      tipc: Use default rhashtable hashfn · 6d022949
      Herbert Xu authored
      This patch removes the explicit jhash value for the hashfn parameter
      of rhashtable.  The default is now jhash so removing the setting
      makes no difference apart from making one less copy of jhash in
      the kernel.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6d022949
    • Herbert Xu's avatar
      netlink: Use default rhashtable hashfn · 11b58ba1
      Herbert Xu authored
      This patch removes the explicit jhash value for the hashfn parameter
      of rhashtable.  As the key length is a multiple of 4, this means that
      we will actually end up using jhash2.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11b58ba1
    • Herbert Xu's avatar
      rhashtable: Allow hashfn to be unset · 31ccde2d
      Herbert Xu authored
      Since every current rhashtable user uses jhash as their hash
      function, the fact that jhash is an inline function causes each
      user to generate a copy of its code.
      
      This function provides a solution to this problem by allowing
      hashfn to be unset.  In which case rhashtable will automatically
      set it to jhash.  Furthermore, if the key length is a multiple
      of 4, we will switch over to jhash2.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31ccde2d
    • Herbert Xu's avatar
      rhashtable: Eliminate unnecessary branch in rht_key_hashfn · de91b25c
      Herbert Xu authored
      When rht_key_hashfn is called from rhashtable itself and params
      is equal to ht->p, there is no point in checking params.key_len
      and falling back to ht->p.key_len.
      
      For some reason gcc couldn't figure out that params is the same
      as ht->p.  So let's help it by only checking params.key_len when
      it's a constant.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de91b25c
    • Herbert Xu's avatar
      rhashtable: Add barrier to ensure we see new tables in walker · d88252f9
      Herbert Xu authored
      The walker is a lockless reader so it too needs an smp_rmb before
      reading the future_tbl field in order to see any new tables that
      may contain elements that we should have walked over.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d88252f9
    • David S. Miller's avatar
      Merge tag 'linux-can-next-for-4.1-20150323' of... · e167359b
      David S. Miller authored
      Merge tag 'linux-can-next-for-4.1-20150323' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can-next 2015-03-23
      
      this is a pull request of 6 patches for net-next/master.
      
      A patch by Florian Westphal, converts the skb->destructor to use
      sock_efree() instead of own destructor. Ahmed S. Darwish's patch
      converts the kvaser_usb driver to use unregister_candev(). A patch by
      me removes a return from a void function in the m_can driver. Yegor
      Yefremov contributes a patch for combined rx/tx LED trigger support. A
      sparse warning in the esd_usb2 driver was fixes by Thomas Körper. Ben
      Dooks converts the at91_can driver to use endian agnostic IO accessors.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e167359b
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next · 40451fd0
      David S. Miller authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter updates for net-next
      
      The following patchset contains Netfilter updates for net-next.
      Basically, more incremental updates for br_netfilter from Florian
      Westphal, small nf_tables updates (including one fix for rb-tree
      locking) and small two-liner to add extra validation for the REJECT6
      target.
      
      More specifically, they are:
      
      1) Use the conntrack status flags from br_netfilter to know that DNAT is
         happening. Patch for Florian Westphal.
      
      2) nf_bridge->physoutdev == NULL already indicates that the traffic is
         bridged, so let's get rid of the BRNF_BRIDGED flag. Also from Florian.
      
      3) Another patch to prepare voidization of seq_printf/seq_puts/seq_putc,
         from Joe Perches.
      
      4) Consolidation of nf_tables_newtable() error path.
      
      5) Kill nf_bridge_pad used by br_netfilter from ip_fragment(),
         from Florian Westphal.
      
      6) Access rb-tree root node inside the lock and remove unnecessary
         locking from the get path (we already hold nfnl_lock there), from
         Patrick McHardy.
      
      7) You cannot use a NFT_SET_ELEM_INTERVAL_END when the set doesn't
         support interval, also from Patrick.
      
      8) Enforce IP6T_F_PROTO from ip6t_REJECT to make sure the core is
         actually restricting matches to TCP.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      40451fd0
    • Alexander Drozdov's avatar
      af_packet: pass checksum validation status to the user · 682f048b
      Alexander Drozdov authored
      Introduce TP_STATUS_CSUM_VALID tp_status flag to tell the
      af_packet user that at least the transport header checksum
      has been already validated.
      
      For now, the flag may be set for incoming packets only.
      Signed-off-by: default avatarAlexander Drozdov <al.drozdov@gmail.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      682f048b
    • Alexander Drozdov's avatar
      af_packet: make tpacket_rcv to not set status value before run_filter · 68c2e5de
      Alexander Drozdov authored
      It is just an optimization. We don't need the value of status variable
      if the packet is filtered.
      Signed-off-by: default avatarAlexander Drozdov <al.drozdov@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      68c2e5de
    • Fan Du's avatar
      inet: fix double request socket freeing · c6973669
      Fan Du authored
      Eric Hugne reported following error :
      
      I'm hitting this warning on latest net-next when i try to SSH into a machine
      with eth0 added to a bridge (but i think the problem is older than that)
      
      Steps to reproduce:
      node2 ~ # brctl addif br0 eth0
      [  223.758785] device eth0 entered promiscuous mode
      node2 ~ # ip link set br0 up
      [  244.503614] br0: port 1(eth0) entered forwarding state
      [  244.505108] br0: port 1(eth0) entered forwarding state
      node2 ~ # [  251.160159] ------------[ cut here ]------------
      [  251.160831] WARNING: CPU: 0 PID: 3 at include/net/request_sock.h:102 tcp_v4_err+0x6b1/0x720()
      [  251.162077] Modules linked in:
      [  251.162496] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.0.0-rc3+ #18
      [  251.163334] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [  251.164078]  ffffffff81a8365c ffff880038a6ba18 ffffffff8162ace4 0000000000009898
      [  251.165084]  0000000000000000 ffff880038a6ba58 ffffffff8104da85 ffff88003fa437c0
      [  251.166195]  ffff88003fa437c0 ffff88003fa74e00 ffff88003fa43bb8 ffff88003fad99a0
      [  251.167203] Call Trace:
      [  251.167533]  [<ffffffff8162ace4>] dump_stack+0x45/0x57
      [  251.168206]  [<ffffffff8104da85>] warn_slowpath_common+0x85/0xc0
      [  251.169239]  [<ffffffff8104db65>] warn_slowpath_null+0x15/0x20
      [  251.170271]  [<ffffffff81559d51>] tcp_v4_err+0x6b1/0x720
      [  251.171408]  [<ffffffff81630d03>] ? _raw_read_lock_irq+0x3/0x10
      [  251.172589]  [<ffffffff81534e20>] ? inet_del_offload+0x40/0x40
      [  251.173366]  [<ffffffff81569295>] icmp_socket_deliver+0x65/0xb0
      [  251.174134]  [<ffffffff815693a2>] icmp_unreach+0xc2/0x280
      [  251.174820]  [<ffffffff8156a82d>] icmp_rcv+0x2bd/0x3a0
      [  251.175473]  [<ffffffff81534ea2>] ip_local_deliver_finish+0x82/0x1e0
      [  251.176282]  [<ffffffff815354d8>] ip_local_deliver+0x88/0x90
      [  251.177004]  [<ffffffff815350f0>] ip_rcv_finish+0xf0/0x310
      [  251.177693]  [<ffffffff815357bc>] ip_rcv+0x2dc/0x390
      [  251.178336]  [<ffffffff814f5da3>] __netif_receive_skb_core+0x713/0xa20
      [  251.179170]  [<ffffffff814f7fca>] __netif_receive_skb+0x1a/0x80
      [  251.179922]  [<ffffffff814f97d4>] process_backlog+0x94/0x120
      [  251.180639]  [<ffffffff814f9612>] net_rx_action+0x1e2/0x310
      [  251.181356]  [<ffffffff81051267>] __do_softirq+0xa7/0x290
      [  251.182046]  [<ffffffff81051469>] run_ksoftirqd+0x19/0x30
      [  251.182726]  [<ffffffff8106cc23>] smpboot_thread_fn+0x153/0x1d0
      [  251.183485]  [<ffffffff8106cad0>] ? SyS_setgroups+0x130/0x130
      [  251.184228]  [<ffffffff8106935e>] kthread+0xee/0x110
      [  251.184871]  [<ffffffff81069270>] ? kthread_create_on_node+0x1b0/0x1b0
      [  251.185690]  [<ffffffff81631108>] ret_from_fork+0x58/0x90
      [  251.186385]  [<ffffffff81069270>] ? kthread_create_on_node+0x1b0/0x1b0
      [  251.187216] ---[ end trace c947fc7b24e42ea1 ]---
      [  259.542268] br0: port 1(eth0) entered forwarding state
      
      Remove the double calls to reqsk_put()
      
      [edumazet] :
      
      I got confused because reqsk_timer_handler() _has_ to call
      reqsk_put(req) after calling inet_csk_reqsk_queue_drop(), as
      the timer handler holds a reference on req.
      Signed-off-by: default avatarFan Du <fan.du@intel.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Fixes: fa76ce73 ("inet: get rid of central tcp/dccp listener timer")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6973669
  2. 23 Mar, 2015 14 commits