24 May, 2019

1 commit


02 Feb, 2019

1 commit

  • This fixes the automatic lmb initialization and reservation for boards
    with more than one DRAM bank.

    This fixes the CVE-2018-18439 and -18440 fixes that only allowed to load
    files into the firs DRAM bank from fs and via tftp.

    Found-by: Heinrich Schuchardt
    Signed-off-by: Simon Goldschmidt
    Tested-by: Heinrich Schuchardt
    Reviewed-by: Simon Glass

    Simon Goldschmidt
     

26 Jan, 2019

1 commit


25 Jan, 2019

3 commits

  • No mainline board enables CONFIG_MCAST_TFTP and there have been
    compilation issues with the code for some time. Additionally, it has a
    potential buffer underrun issue (reported as a side note in
    CVE-2018-18439).

    Remove the multicast TFTP code but keep the driver API for the future
    addition of IPv6.

    Cc: Simon Goldschmidt
    Signed-off-by: Chris Packham
    Acked-by: Joe Hershberger

    Chris Packham
     
  • ether_crc was added to the core net code in commit 53a5c424bf86
    ("multicast tftp: RFC2090") so that other drivers could use it. However
    the only current user of it is tsec.c so move it there.

    Signed-off-by: Chris Packham
    Acked-by: Joe Hershberger

    Chris Packham
     
  • When dealing with two ethernet ports and having "netretry" set
    to "once", it could occur that the connection (e.g. an ARP
    request) failed, hence the status of the netloop was
    "NETLOOP_FAIL". Due to the setting of "netretry", the network
    logic would then switch to the other network interface,
    assigning "ret" with the return value of "net_start_again()".
    If this call succeeded we would return 0 (i.e. success) to
    the caller when in reality the network action failed.

    Signed-off-by: Thomas RIENOESSL
    Reviewed-by: Christian Gmeiner
    Acked-by: Joe Hershberger

    Thomas RIENOESSL
     

17 Jan, 2019

1 commit

  • This fixes CVE-2018-18439 ("insufficient boundary checks in network
    image boot") by using lmb to check for a valid range to store
    received blocks.

    Signed-off-by: Simon Goldschmidt
    Acked-by: Joe Hershberger
    [trini: Always build lib/lmb.o on LMB and lib/fdtdec.o on OF_LIBFDT]
    Signed-off-by: Tom Rini

    Simon Goldschmidt
     

11 Oct, 2018

3 commits

  • Make it possible to add TCP versions of the same, while reusing
    IP portions. This patch should not change any behavior.

    Signed-off-by: Duncan Hare
    Acked-by: Joe Hershberger

    Duncan Hare
     
  • Peter originally sent a fix, but it breaks a number of other things.
    This addresses the original reported issue in a different way.

    That report was:

    > U-Boot has 1 common buffer to send Ethernet frames, pointed to by
    > net_tx_packet. When sending to an IP address without knowing the MAC
    > address, U-Boot makes an ARP request (using the arp_tx_packet buffer)
    > to find out the MAC address of the IP addressr. When a matching ARP
    > reply is received, U-Boot continues sending the frame stored in the
    > net_tx_packet buffer.
    >
    > However, in the mean time, if U-Boot needs to send out any network
    > packets (e.g. replying ping packets or ARP requests for its own IP
    > address etc.), it will use the net_tx_packet buffer to prepare the
    > new packet. Thus this buffer is no longer the original packet meant
    > to be transmitted after the ARP reply. The original packet will be
    > lost.

    This instead uses the ARP tx buffer to send async replies in the case
    where we are actively waiting for an ARP reply.

    Signed-off-by: Joe Hershberger

    Reported-by: Tran Tien Dat
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Joe Hershberger
     
  • This single-sources the state of the ARP.

    Signed-off-by: Joe Hershberger
    Reviewed-by: Simon Glass
    Reviewed-by: Bin Meng

    Joe Hershberger
     

21 Aug, 2018

1 commit

  • When a USB ethernet device is halted, the device driver is removed. When
    this happens the uclass private memory is freed and uclass_priv is set to
    NULL. This causes a data abort when uclass_priv->state is then set to
    ETH_STATE_PASSIVE.

    Fix it by checking if uclass_priv is NULL before setting uclass_priv->state

    Signed-off-by: Jean-Jacques Hiblot
    Acked-by: Joe Hershberger

    Jean-Jacques Hiblot
     

27 Jul, 2018

9 commits


03 Jul, 2018

4 commits

  • Currently we can choose between 2 different types of behavior for the
    serverip variable:

    1) Always overwrite it with the DHCP server IP address (default)
    2) Ignore what the DHCP server says (CONFIG_BOOTP_SERVERIP)

    This patch adds a 3rd option:

    3) Use serverip from DHCP if no serverip is given
    (CONFIG_BOOTP_PREFER_SERVERIP)

    With this new option, we can have the default case that a boot file gets
    loaded from the DHCP provided TFTP server work while allowing users to
    specify their own serverip variable to explicitly use a different tftp
    server.

    Signed-off-by: Alexander Graf
    Acked-by: Joe Hershberger

    Alexander Graf
     
  • We can call commands like dhcp and bootp without arguments or with
    explicit command line arguments that really should tell the code where
    to look for files instead.

    Unfortunately, the current code simply overwrites command line arguments
    in the dhcp case with dhcp values.

    This patch allows the code to preserve the command line values if they
    were set on the command line. That way the semantics are slightly more
    intuitive.

    The reason this patch does that by introducing a new variable is that we
    can not rely on net_boot_file_name[0] being unset, as today it's
    completely legal to call "dhcp" and afterwards run "tftp" and expect the
    latter to repeat the same query as before. I would prefer not to break
    that behavior in case anyone relies on it.

    Signed-off-by: Alexander Graf
    Acked-by: Joe Hershberger

    Alexander Graf
     
  • Add a new command 'wol': Wait for an incoming Wake-on-LAN packet or
    time out if no WoL packed is received.
    If the WoL packet contains a password, it is saved in the environment
    variable 'wolpassword' using the etherwake format (dot or colon
    separated decimals).

    Intended use case: a networked device should boot an alternate image.
    It's attached to a network on a client site, modifying the DHCP server
    configuration or setup of a tftp server is not allowed.
    After power on the device waits a few seconds for a WoL packet. If a
    packet is received, the device boots the alternate image. Otherwise
    it boots the default image.

    This method is a simple way to interact with a system via network even
    if only the MAC address is known. Tools to send WoL packets are
    available on all common platforms.

    Some Ethernet drivers seem to pad the incoming packet. The additional
    padding bytes might be recognized as Wake-on-LAN password bytes.

    By default enabled in pengwyn_defconfig.

    Signed-off-by: Lothar Felten
    Acked-by: Joe Hershberger

    Lothar Felten
     
  • When building without FASTBOOT_FLASH we don't include the intermediate
    update callback to keep the client alive, so ensure we don't try setting
    it here.

    Signed-off-by: Alex Kiernan
    Acked-by: Joe Hershberger

    Alex Kiernan
     

14 Jun, 2018

4 commits

  • That can happen if duplicate UDP packet arrived, and that's not uncommon.
    Anyway, we ignore packets with rpc_id lower than last we sent for other
    requests, so it makes sense to do that for read request as well.

    Signed-off-by: Vasily Khoruzhick
    Acked-by: Joe Hershberger

    Vasily Khoruzhick
     
  • Global variable "net_state" is used in net_loop() state-machine.
    But it happens that some times the net_loop() can be called
    multiple times in the same call stack. For example when the
    netconsole is enabled and we print the message while some other
    net protocol is in action. Netconsole will overwrite the "net_state"
    and that will break the logic for earlier started protocol.

    To protect the state save and restore "net_state" variable each
    time when we enter and exit net_loop().

    Signed-off-by: Leonid Iziumtsev
    Acked-by: Joe Hershberger

    Leonid Iziumtsev
     
  • On devices that have their first network interface provided by a FPGA,
    the initialization of further interfaces will fail if the FPGA is not
    yet programmed. This leads to problems during factory setup when the
    data is supposed to be loaded over secondary netowork interfaces.

    To avoid this, use the uclass_{first,next}_device_check functions to
    initialize as many ethernet devices as possible.

    Signed-off-by: Mario Six
    Acked-by: Joe Hershberger

    Mario Six
     
  • Make sure that TX packets are always cache-aligned.

    Signed-off-by: Mario Six
    Acked-by: Joe Hershberger

    Mario Six
     

30 May, 2018

1 commit

  • Merge UDP fastboot support from AOSP:

    https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8

    Signed-off-by: Alex Kiernan
    Signed-off-by: Alex Deymo
    Signed-off-by: Jocelyn Bohr
    Reviewed-by: Simon Glass

    Alex Kiernan
     

15 May, 2018

1 commit

  • When the following configuration is set

    # CONFIG_CMD_DHCP is not set
    CONFIG_CMD_BOOTP=y
    CONFIG_BOOTP_NTPSERVER=y

    The following compile error is observed

    error: used struct type value where scalar is required
    if (net_ntp_server)
    ^~~~~~~~~~~~~~

    Resolve this by checking net_ntp_server.s_addr instead.

    Signed-off-by: Chris Packham
    Acked-by: Joe Hershberger

    Chris Packham
     

11 May, 2018

1 commit

  • As part of the main conversion a few files were missed. These files had
    additional whitespace after the '*' and before the SPDX tag and my
    previous regex was too strict. This time I did a grep for all SPDX tags
    and then filtered out anything that matched the correct styles.

    Fixes: 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
    Reported-by: Heinrich Schuchardt
    Signed-off-by: Tom Rini

    Tom Rini
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

28 Apr, 2018

1 commit


14 Apr, 2018

3 commits


09 Apr, 2018

1 commit

  • In order that we can use eth_env_* even when CONFIG_NET isn't set, move
    these functions to environment code from net code.

    This fixes failures such as:

    board/ti/am335x/built-in.o: In function `board_late_init':
    board/ti/am335x/board.c:752: undefined reference to `eth_env_set_enetaddr'
    u-boot/board/ti/am335x/board.c:766: undefined reference to `eth_env_set_enetaddr'

    which caters for use cases such as:

    commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment
    variable")

    when Ethernet is required in Linux, but not U-Boot.

    Signed-off-by: Alex Kiernan

    Alex Kiernan
     

23 Mar, 2018

2 commits

  • In the efi_loader main loop we call eth_rx() occasionally. This rx function
    might end up calling into devices that haven't been initialized yet,
    potentially resulting in a lot of transfer timeouts.

    Instead, let's make sure the ethernet device is actually initialized before
    reading from or writing to it.

    Signed-off-by: Alexander Graf
    Acked-by: Joe Hershberger

    Alexander Graf
     
  • The "net_try_count" counter starts from "1".
    And the "retrycnt" contains requested amount of retries.

    With current logic, that means that the actual retry amount
    will be one time less then what we set in "netretry" env.
    For example setting "netretry" to "once" will make "retrycnt"
    equal "1", so no retries will be triggered at all.

    Fix the logic by changing the statement of "if" condition.

    Signed-off-by: Leonid Iziumtsev
    Acked-by: Joe Hershberger

    Leonid Iziumtsev
     

28 Feb, 2018

1 commit