-
Denis
I wonder why illumos is the only OS (as far as I managed to test, anyway) that implements getifaddrs() and for Ethernet interfaces returns AF_LINK addresses with sdl_type set to 0 instead of IFT_ETHER
-
Denis
-
Denis
is there any explanation why this would be the intended behaviour?
-
rmustacc
Feels more likely just a bug?
-
Denis
from my point of view, yes, but I decided to ask first
-
rmustacc
I'm just looking at the source and there's nothing obvious there.
-
rmustacc
Support for AF_LINK was added relatively recently to getifaddrs().
-
Denis
I know how it feels
-
rmustacc
It wasn't immediately in the information we were grabbing to fill in that field.
-
rmustacc
It was set on the ifi_type for that case on the higher level ifaddr structure.
-
Denis
does the kernel have enough internal information about the interfaces to derive sdl_type from?
-
rmustacc
So I think it'd likely be a similar operation here.
-
rmustacc
Yeah, it should
-
rmustacc
We do when getting it from other ways, but getifaddrs() isn't a kernel thing.
-
rmustacc
It's just going through info from different sources.
-
Denis
I do not know if illumos implements SIOCGIFTYPE, but that in theory should feed from the same internal interface type
-
rmustacc
I mean, we have this info in the ifi_type, so it should just be another assignment, if I'm reading this correctly.
-
rmustacc
We don't have anything by that name (but neither does FreeBSD).
-
Denis
I suppose at least IFT_ETHER and IFT_LOOP from /usr/include/net/if_types.h should have a purpose
-
Denis
although for the loopback getifaddrs() does not return an AF_LINK address
-
rmustacc
That's correct because there is no layer 2 address for it.
-
Denis
alright, I am opening a bug report then?
-
rmustacc
Sure. If you do, let me know and I can add some more specifics. Or I can write something up.
-
Denis
would "lib" or "networking" be the correct category?
-
rmustacc
Either is fine. Don't sweat it.
-
rmustacc
I'm going to have to step afk, so leave me a note of the bug id and I can add more specifics about whta's required to be filled in.
-
rmustacc
Though I do wonder if it would be better to try libdlpi here, though that's probably more of a pain.
-
Denis
-
fenix
→
BUG 16383: getifaddrs() returns AF_LINK addresses with sockaddr_dl.sdl_type == 0 (New)
-
Denis
thank you for the comments
-
Denis
for packet capture DLPI used to be the interface of choice on older Solaris versions, then at some point Solaris grew BPF, which libpcap started to use instead
-
Denis
for interface enumeration it used to be SIOCGIFCONF for very old Unixes, probably including SunOS, then Solaris developed SIOCGLIFCONF, which served the purpose on Solaris 10 and probably before, then Solaris 11 developed getifaddrs()
-
Denis
so illumos inherited the BPF+getifaddrs() combination, which is one of the most popular
-
Denis
there is quite a bit of DLPI-specific code, but now it covers HP-UX only, and if there is a need to adapt it to another OS, there would be a risk of breaking HP-UX
-
rmustacc
Thanks for filing that. I've followed up with the note about what I think the fix is likely.
-
sommerfeld
the illumos getifaddrs is largely built on top of SIOCGLIFCONF
-
Denis
is there a meaningful advantage of one over another or it is just a BSD/SystemV difference?
-
sommerfeld
all of the SIOCG*IF* socket ioctls are complicated & fussy. SIOCGIFCONF wasn't a good match for what solaris had in its stack, especially with the addition of IPv6
-
sommerfeld
so getifaddrs() hides the mess so only the library maintainer has to muck with it.
-
Denis
in libpcap getifaddrs() is the first choice, then SIOCGLIFCONF, then SIOCGIFCONF:
github.com/the-tcpdump-group/libpcap/blob/master/configure.ac#L1162
-
Denis
it is difficult to tell immediately whether it would make more sense to prefer SIOCGLIFCONF, but at least one useful side effect is discovering a bug in getifaddrs()
-
Denis
-
Denis
anyway, thank you for the comments, it is becoming late in this corner of the Internet, I will be back tomorrow
-
sommerfeld
I think preferring getifaddrs() makes sense in almost all cases.
-
nikolam
I tried sharing physical drive over iSCSI from SmartOS host (p0) and linux machine doesn't see it and Windows iSCSI sees it and target but in disk management con't see partitions bt trats it as unformatted.
-
Denis
nikolam: does it look unformatted in SmartOS too?
-
nikolam
Denis, nope, look allright, in format/fdisk, like 1 Ntfs partition on drive.
-
Denis
well, then I don't know
-
Denis
is the size at least the same at both ends?
-
nikolam
Denis, what size. physical disk block size? I tried also today to set it on 512 was before 4096 exported and nothing changes, like, windows treats iscsi target as unformatted
-
denk
nikolam: show the output of stmfadm list-lu -v
-
Denis
I had the exact disk size in bytes in mind, just to make sure it is the right lot of bytes that is being fed into iSCSI
-
nikolam
-
denk
nikolam: you should recreate it and use metafile
-
denk
otherwise the metadata will be placed into the data file
-
nikolam
ah. metafile
-
denk
it uses for about 64k
-
Denis
/dev/rdsk/c1t1d0p0 means a partition on the disk, doesn't it?
-
nikolam
looking for a manual for metafile.. p0 should be the whole drive
-
Denis
the disk would be /dev/rdsk/c1t1d0, AFAIR, and the sizes would be different
-
Denis
but perhaps you know better
-
denk
nikolam: also disable writeback cache
-
nikolam
denk, thankt, still look how to make the metafiel and docs on it
-
nikolam
thanks
-
denk
stmfadm create-lu -pmeta=/path/to/meta.file -pblk=<physical sector size> -pserail=MySerial -pwcd=true /dev/rdsk/<device>
-
denk
meta.file should exist
-
denk
for example, touch /var/tmp/meta.file
-
nikolam
wow I see thanks
-
denk
probably you have corrupted the data on the device
-
denk
don't forget about 64k of the metadata
-
denk
anyway, you have been warned some time ago about second chance to fail :)
-
nikolam
second chance to fail? :P
-
denk
with zfs and snapshots
-
denk
you choosen direct device
-
nikolam
Ah ok :P data integrity. No sweat in this case
-
nikolam
now with /var/tmp/meta.file is sees the drive wight in iscsi on windows. Without -pserail=MySerial , Will see about disabling writeback cache
-
denk
wcd can be modified by modify-lu subcommand
-
denk
stmfadm modify-lu -pwcd=true <guid>
-
nikolam
wow I should be really reading more man pages. many thanks denk
-
nikolam
will reboot to see how it it going on in real windows , thank you
-
Denis
sommerfeld: rmustacc: found another bug in getifaddrs(), filed as #16384
-
Denis
rmustacc: re DLPI, libpcap uses it on Solaris 10 for packet capture, but it would be only compile-testable with the current resources
-
Denis
also, re AF_LINK on the loopback interface, the semantics in other OSes that do it is to set sdl_alen to 0, then the purpose of sockaddr_dl is to convey the interface type and index