patches/howl-02-ifreq.diff
author jurikm
Sun, 12 Feb 2012 14:04:10 +0000
changeset 8245 383896da4129
parent 2963 3684b0c23637
permissions -rw-r--r--
SFEsauerbraten.spec: add IPS package name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2963
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     1
--- old/howl-1.0.0/src/lib/howl/Posix/posix_interface.c	2010-10-14 17:43:29.366790584 -0400
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     2
+++ howl-1.0.0/src/lib/howl/Posix/posix_interface.c	2010-10-14 17:45:57.048458250 -0400
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     3
@@ -367,17 +367,10 @@
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     4
 	sw_debug(SW_LOG_VERBOSE, "got ip address: %s\n", tmpname);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     5
 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     6
 	/* mac address */
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     7
-#if defined(SIOCGIFHWADDR)
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     8
-	res = ioctl(sock, SIOCGIFHWADDR, &ifr);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
     9
-	err = sw_translate_error(res == 0, errno);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    10
-	sw_check_okay_log(err, exit);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    11
-	sw_memcpy(nif->m_super.m_mac_address.m_id, (sw_uint8*)(ifr.ifr_hwaddr.sa_data), sizeof(sw_mac_address)); 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    12
-#elif defined(SIOCGENADDR)
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    13
 	res = ioctl(sock, SIOCGENADDR, &ifr);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    14
 	err = sw_translate_error(res == 0, errno);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    15
 	sw_check_okay_log(err, exit);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    16
 	sw_memcpy(nif->m_super.m_mac_address.m_id, (sw_uint8*)(ifr.ifr_ifru.ifru_enaddr), sizeof(sw_mac_address)); 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    17
-#endif
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    18
 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    19
 	/* index */
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    20
 	nif->m_super.m_index = if_nametoindex(ifr.ifr_name);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    21
@@ -436,18 +429,10 @@
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    22
 	sw_ipv4_address_init_from_saddr(&(nif->m_super.m_netmask), ((struct sockaddr_in*) &ifr->ifr_addr )->sin_addr.s_addr );
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    23
 #endif
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    24
 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    25
-#if defined(SIOCGIFHWADDR)
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    26
-	/* mac address */
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    27
-	res = ioctl(sock, SIOCGIFHWADDR, ifr);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    28
-	err = sw_translate_error(res != -1, errno);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    29
-	sw_check_okay_log(err, exit);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    30
-	sw_memcpy(nif->m_super.m_mac_address.m_id, (sw_uint8*)(ifr->ifr_hwaddr.sa_data), sizeof(sw_mac_address)); 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    31
-#elif defined(SIOCGENADDR)
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    32
 	res = ioctl(sock, SIOCGENADDR, ifr);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    33
 	err = sw_translate_error(res != -1, errno);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    34
 	sw_check_okay_log(err, exit);
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    35
 	sw_memcpy(nif->m_super.m_mac_address.m_id, (sw_uint8*)(ifr->ifr_ifru.ifru_enaddr), sizeof(sw_mac_address)); 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    36
-#endif
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    37
 
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    38
 	/* initialize link status field */
3684b0c23637 2010-10-17 James Choi <[email protected]>
jchoi42
parents:
diff changeset
    39
 	sw_network_interface_link_status(&nif->m_super, &(nif->m_super.m_linked));