:: Re: [DNG] new freedesktop "standard…
Página Principal
Delete this message
Reply to this message
Autor: Alessandro Selli
Data:  
Para: dng
Assunto: Re: [DNG] new freedesktop "standard": /etc/machine-id
On 09/03/19 at 12:46, marc wrote:
>>> So you are correct that gethostid has been around for a while,
>>> but this call returns a 32bit number, typically the IP.
>> ?? No, it returns a value that's unique to the local machine even if it
>> was not configured on any network.?? Plus, the IP can change, but the
>> hostid is supposed to be static.?? The Unix hostid was developed in order
>> to uniquely identify a machine regardless of where in the Internet it
>> is.?? What you described is the gethostbyname syscall.
> Maybe your system is different to mine, but try compiling the below
> and find out for yourself:
>
> #include <stdio.h>
> #include <unistd.h>
>
> int main()
> {
> int id;
>
> id = gethostid();
>
> printf("my id is 0x%08x\n", id);
>
> return 0;
> }


my id is 0x007f0101


[root@wkstn05 ~]# ifdown eth0
Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:2e:d5:f6:62:4b
Sending on   LPF/eth0/00:2e:d5:f6:62:4b
Sending on   Socket/fallback
DHCPRELEASE of 192.168.0.6 on eth0 to 192.168.0.200 port 67
invoke-rc.d: policy-rc.d denied execution of reload.
[root@wkstn05 ~]#

my id is 0x007f0101

[root@wkstn05 ~]# ifup wlan1
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan1/1a:66:81d9:fc:30
Sending on   LPF/wlan1/1a:66:81d9:fc:30
Sending on   Socket/fallback
Created duid "\000\001\000\001$\036kp\021\322\366\231\345M".
DHCPDISCOVER on wlan1 to 255.255.255.255 port 67 interval 4
DHCPOFFER of 192.168.48.101 from 192.168.48.158
DHCPREQUEST for 192.168.48.101 on wlan1 to 255.255.255.255 port 67
DHCPACK of 192.168.48.101 from 192.168.48.158
invoke-rc.d: policy-rc.d denied execution of reload.
bound to 192.168.48.101 -- renewal in 1626 seconds.
invoke-rc.d: policy-rc.d denied execution of alarm.
[root@wkstn05 ~]#


my id is 0x007f0101


  So what?  Can't you read man gethostid(3)?


--
Alessandro Selli <alessandroselli@???>
VOIP SIP: dhatarattha@???
Chiave firma e cifratura PGP/GPG signing and encoding key:
BA651E4050DDFC31E17384BABCE7BD1A1B0DF2AE