Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,141
    Quote Originally Posted by paul- View Post
    Are you doing something that would be setting an environment variable called UTMAC?
    Nope. As written here and elsewhere the only peculiarities on my systems are a 1.5MB archive tgz, a thick asound.conf, and one or 2 processes launched after startup.

    When I take such a config to my home network, it runs fine, IIRC. Don't get all hot and bothered about it, it's not pCP (or SL), it is the network I tell you
    Get 2 of these between your pCP clients and a slow DHCP server like a Pi and I bet you'll have my "problem".
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  2. #12
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,486
    Quote Originally Posted by epoch1970 View Post
    In the case of rebooting, this works because the switches and other devices in the path haven't had time to unlearn the MAC of the client yet, so the whole DHCP lease deal is faster than with a really cold start and SL can report an ID.
    sorry....

    • client sends a broadcast with his mac and the ip 0.0.0.0
    • dhcp server answers him
    • client tells this particular server "need IP address"
    • Server may check fpr a free ip and tells it to the client
    • client tells server thanks i am using it


    All devices even Switches always "unlearn" foreign MAC Addresses - thats the only way for them to be up2date if something is changed somewhere.

    cheers

  3. #13
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    973
    I'm not bothered by it, I was merely trying to avoid confusion about the pCP startup process. And how the MAC address is delivered to the LMS server. Your system must take over 20 seconds to get a valid IP address (timeout in pCP). The mac address used by the LMS server does not come from any switching equip or the packet headers. Squeezelite detects hardware address (unless overridden with the -m) That address is broadcast to the LMS server in the Slimproto HELO packet.

  4. #14
    Senior Member
    Join Date
    Apr 2008
    Location
    Paris, France
    Posts
    2,141
    Quote Originally Posted by paul- View Post
    Your system must take over 20 seconds to get a valid IP address (timeout in pCP).
    That is quite possible.
    I haven't timed it really (or don't remember), these machines are on 24/7. What really mattered was clients always latching into the right VLAN and getting their IP address, and that they do very reliably.

    @Django.
    If you're keen have a look at the configuration guide for the switch model I linked above. On page 135 (english edition) you can read
    Aging Time
    Set the length of time that a dynamic entry remains in the MAC address table after the entry is used or updated. The valid values are from 10 to 630 seconds, and the default value is 300.
    A short aging time is applicable to networks where network topology changes frequently, and a long aging time is applicable to stable networks. We recommend that you keep the default value if you are unsure about settings in your case.
    So yes we are both right. Switches do unlearn MACs.
    3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9 (linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa • IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin Rehfeld • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

  5. #15
    Junior Member
    Join Date
    Sep 2015
    Posts
    21
    I've sended Gerrelt an e-mail with the link of this topic. Let's see if he will reply.

  6. #16
    Hi K.Clemens,

    Thank you for your e-mail and heads-up for this problem (edit: and of course thanks to everyone joining in on this thread).
    This finally explains why my living room and kitchen squeezelite-raspberries weren't always synchronized in the morning.

    Indeed on the latest Raspbian Stretch the "ifconfig" command (used for determining MAC address) gives a different output then on earlier versions, which made my code incorrect.

    I've now changed my script so that it basically uses the script proposed by DJanGo (thanks!).
    At first it executes these commands to get the wlan0 mac addres, or the eth0 mac address:

    Code:
    # get mac address from wifi adapter or on board network card
    SL_MAC_ADDRESS=$(cat /sys/class/net/wlan0/address)
    [ -n "$SL_MAC_ADDRESS" ] || SL_MAC_ADDRESS=$(cat /sys/class/net/eth0/address)
    Then it loads the squeezelite_settings.sh file, in which the mac address might be set too.
    After loading the settings, it checks if the MAC adddres has a correct format. If the format isn't correct, it generates a random mac address:

    Code:
    # check if valid mac address is obtained
    if [[ ! "$SL_MAC_ADDRESS" =~ ^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$ ]]; then
      echo "Warning: no valid mac addres found in SL_MAC_ADDRESS, generating random one."
      hexchars="0123456789ABCDEF"
      RANDOMMAC=$( for i in {1..12} ; do echo -n ${hexchars:$(( $RANDOM % 16 )):1} ; done | sed -e 's/\(..\)/:\1/g' )
      SL_MAC_ADDRESS=${RANDOMMAC:1}
    fi
    This way the mac address will allways be set.

    One additional benefit might be that if you would enter "random" as value in SL_MAC_ADDRESS in the settings file, it will force the script to use a random mac address.
    This might be usefull when using multiple squeezelite instances on one machine.
    A "drawback" is that the player will have a different mac address after each reboot.

    I've tested these changes on piCore, Raspbian Jessie and Raspbian Stretch.

    Comments/suggestions, welcome!

    Greetings,
    Gerrelt.
    Last edited by Gerrelt; 2017-12-09 at 14:12.

  7. #17
    Junior Member
    Join Date
    Sep 2015
    Posts
    21
    Gerrelt,

    A big thank you for keeping your scripts up-to-date.

    Just wondering why someone would use a random MAC adress? Probably I'm scripting all my things wrong (trial & error style :d) but I juse JSON with MAC adresses. So if the MAC adress keeps on changing, my scripts stop working. Offcourse this is not the case since I give a specific MAC adress in the squeezelite_settings.sh file.

  8. #18
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,486
    Hi,

    in the case of using a rpi3 not with lan or the builtin (worst) wlan - or the new adapternames - your script would'nt get the real mac of the used adapter.

    squeezelite (unless you told it with -m) always uses a mac from an active adapter.

    My script unset your var SL_MAC_ADDRESS cause in your squeezelite init script is this code:
    Code:
        # add mac address if set
        if [ ! -z "$SL_MAC_ADDRESS" ]; then
           DAEMON_ARGS="${DAEMON_ARGS} -m ${SL_MAC_ADDRESS}"    
        fi
    That didnt make any sense, if you force SL_MAC_ADDRESS to a (random) mac

    Just unset the SL_MAC_ADDRESS...

    @ K.Clemens:

    my lms player scripts always checks lms for active players amd lms tolds me what id/ mac addreses are in use right now.
    may thats an option for you?

  9. #19
    Hi DJanGo,

    Thank you for your feedback.
    You are right, that piece of code is useless now, it will always use -m with my lateste change. I will try to add a check not to check for MAC address validity when the variable is empty.

    Are you sure squeezelite now uses the correct MAC address when not using the -m option? In the first days of squeezelite (in 2012) it didn't do that. It used a blank MAC address (IIRC), which was a problem when using more then one raspberry with squeezelite. LMS would see them both as the same player.
    Anyway, I will see if it does that when implementing above change.

    Greetings,
    Gerrelt.

  10. #20
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,486
    Quote Originally Posted by Gerrelt View Post
    Are you sure squeezelite now uses the correct MAC address when not using the -m option? In the first days of squeezelite (in 2012) it didn't do that. It used a blank MAC address (IIRC), which was a problem when using more then one raspberry with squeezelite.
    Hi Gerrelt,

    iam using the localplayer plugin from the very first version and i never had any issues without using -m (i didnt use -m @ any of my players.)

    But i do also know your first Version of your squeezelite init script (the one that didnt have the lsb info) since your not using [at this time] $network as Required-Start that might start squeezelite without knewing a active Lan/Wlan Adapter and therefore squeezelite uses 00:00:00:00:00:00 as Mac.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •