net/if: Drop ifmediareq and just use the regular ifreq for SIOCGIFMEDIA.

This was introduced into the main API in 2010 (d72ede75fb),
but was actually only fully used for the past month (c2a9a890f3)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.

Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.

If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.

This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.

The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.
This commit is contained in:
Augustin Cavalier
2022-06-13 22:31:33 -04:00
parent ecf18ba4c8
commit 44fa45df3a
8 changed files with 26 additions and 70 deletions
-3
View File
@@ -99,9 +99,6 @@ public:
uint32 Flags() const;
bool HasLink() const;
int32 CountMedia() const;
int32 GetMediaAt(int32 index) const;
int32 Media() const;
status_t SetMedia(int32 media);
-11
View File
@@ -64,17 +64,6 @@ struct ifaliasreq {
uint32_t ifra_flags;
};
/* used with SIOCGIFMEDIA */
struct ifmediareq {
char ifm_name[IF_NAMESIZE];
int ifm_current;
int ifm_mask;
int ifm_status;
int ifm_active;
int ifm_count;
int* ifm_ulist;
};
/* interface flags */
#define IFF_UP 0x0001