
Dear Matthias Weisser,
In message 1323021425-7854-1-git-send-email-weisserm@arcor.de you wrote:
This patch adds support for networking to sandbox architecture using tap. A tap device "tap0" has to be created e.g. using openvpn
$ openvpn --mktun --dev tap0
u-boot should then be able to detect the network device on startup. To test the network related commands the following commands can be used to create an ethernet bridge to local network connection.
$ brctl addbr br0 $ ifconfig eth0 0.0.0.0 promisc $ ifconfig tap0 0.0.0.0 $ brctl addif br0 eth0 $ brctl addif br0 tap0 $ ifconfig br0 up $ pump -i br0
Signed-off-by: Matthias Weisser weisserm@arcor.de
...
+int os_tap_set_hw_addr(int fd, unsigned char *hwaddr) +{
- /*
* The following code should be able to change the MAC of a TAP
* interface but doesn't work on my box. So leave it disabled
* here as a reference if someone is going to pick that up in
* the future.
*/
+#if 0
- struct ifreq ifr;
- memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, "tap0", IFNAMSIZ);
- /* Get the interface flags */
- if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
perror("Could not get interface flags");
return -1;
- }
- /* Shut down the interface */
- ifr.ifr_flags &= ~(IFF_UP);
- if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
perror("Could not down the interface");
return -1;
- }
- /* Set the new hw address */
- ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
- memcpy(&ifr.ifr_hwaddr.sa_data, hwaddr, ETH_ALEN);
- if (ioctl(fd, SIOCSIFHWADDR, &ifr) < 0) {
perror("ioctl(SIOCSIFHWADDR)");
return -1;
- }
- /* Get the interface flags */
- if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
perror("Could not get interface flags");
return -1;
- }
- /* Shut down the interface */
- ifr.ifr_flags |= IFF_UP;
- if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
perror("Could not up the interface");
return -1;
- }
- return 0;
+#endif
Please do not add dead code.
Best regards,
Wolfgang Denk