mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-28 11:57:28 +00:00
Improve copy-and-pasted versions of SIOCGIFADDR.
The original implementation used a reference to ifr_data and a cast to do the equivalent of accessing ifr_addr. This was copied multiple times since 1996. Approved by: kib MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14873
This commit is contained in:
parent
f8f65519d2
commit
38d958a647
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331648
@ -681,12 +681,7 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
break;
|
||||
|
||||
case SIOCGIFADDR:
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) &ifr->ifr_data;
|
||||
*(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp);
|
||||
}
|
||||
ifr->ifr_addr.sa_data[0] = ARC_LLADDR(ifp);
|
||||
break;
|
||||
|
||||
case SIOCADDMULTI:
|
||||
|
@ -1108,13 +1108,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
break;
|
||||
|
||||
case SIOCGIFADDR:
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) & ifr->ifr_data;
|
||||
bcopy(IF_LLADDR(ifp),
|
||||
(caddr_t) sa->sa_data, ETHER_ADDR_LEN);
|
||||
}
|
||||
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
|
||||
ETHER_ADDR_LEN);
|
||||
break;
|
||||
|
||||
case SIOCSIFMTU:
|
||||
|
@ -558,14 +558,9 @@ fddi_ioctl (ifp, command, data)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SIOCGIFADDR: {
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) & ifr->ifr_data;
|
||||
bcopy(IF_LLADDR(ifp),
|
||||
(caddr_t) sa->sa_data, FDDI_ADDR_LEN);
|
||||
|
||||
}
|
||||
case SIOCGIFADDR:
|
||||
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
|
||||
FDDI_ADDR_LEN);
|
||||
break;
|
||||
case SIOCSIFMTU:
|
||||
/*
|
||||
|
@ -662,13 +662,8 @@ firewire_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
break;
|
||||
|
||||
case SIOCGIFADDR:
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) & ifr->ifr_data;
|
||||
bcopy(&IFP2FWC(ifp)->fc_hwaddr,
|
||||
(caddr_t) sa->sa_data, sizeof(struct fw_hwaddr));
|
||||
}
|
||||
bcopy(&IFP2FWC(ifp)->fc_hwaddr, &ifr->ifr_addr.sa_data[0],
|
||||
sizeof(struct fw_hwaddr));
|
||||
break;
|
||||
|
||||
case SIOCSIFMTU:
|
||||
|
@ -173,13 +173,9 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFADDR: {
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) & ifr->ifr_data;
|
||||
bcopy(IF_LLADDR(ifp),
|
||||
(caddr_t) sa->sa_data, ISO88025_ADDR_LEN);
|
||||
}
|
||||
case SIOCGIFADDR:
|
||||
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
|
||||
ISO88025_ADDR_LEN);
|
||||
break;
|
||||
|
||||
case SIOCSIFMTU:
|
||||
|
@ -1790,12 +1790,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
#endif
|
||||
break;
|
||||
case SIOCGIFADDR:
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *)&ifr->ifr_data;
|
||||
bcopy(IF_LLADDR(ifp), sa->sa_data, ifp->if_addrlen);
|
||||
}
|
||||
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
|
||||
ifp->if_addrlen);
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
VLAN_SLOCK();
|
||||
|
@ -320,13 +320,8 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
break;
|
||||
|
||||
case SIOCGIFADDR:
|
||||
{
|
||||
struct sockaddr *sa;
|
||||
|
||||
sa = (struct sockaddr *) & ifr->ifr_data;
|
||||
bcopy(IF_LLADDR(ifp),
|
||||
(caddr_t) sa->sa_data, INFINIBAND_ALEN);
|
||||
}
|
||||
bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
|
||||
INFINIBAND_ALEN);
|
||||
break;
|
||||
|
||||
case SIOCSIFMTU:
|
||||
|
Loading…
Reference in New Issue
Block a user