diff options
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan.c | 21 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.h | 23 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 515da4334..4b4d5426e 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -139,11 +139,20 @@ | |||
139 | 139 | ||
140 | /** | 140 | /** |
141 | * Packet format type for the messages we receive from | 141 | * Packet format type for the messages we receive from |
142 | * the kernel. This is for Ethernet 10Mbps format (no | ||
143 | * performance information included). | ||
144 | */ | ||
145 | #define ARPHRD_ETHER 1 | ||
146 | |||
147 | |||
148 | /** | ||
149 | * Packet format type for the messages we receive from | ||
142 | * the kernel. This is for plain messages (with no | 150 | * the kernel. This is for plain messages (with no |
143 | * performance information included). | 151 | * performance information included). |
144 | */ | 152 | */ |
145 | #define ARPHRD_IEEE80211 801 | 153 | #define ARPHRD_IEEE80211 801 |
146 | 154 | ||
155 | |||
147 | /** | 156 | /** |
148 | * Packet format type for the messages we receive from | 157 | * Packet format type for the messages we receive from |
149 | * the kernel. This is for the PRISM format. | 158 | * the kernel. This is for the PRISM format. |
@@ -1588,6 +1597,17 @@ linux_read (struct HardwareInfos *dev, | |||
1588 | case ARPHRD_IEEE80211: | 1597 | case ARPHRD_IEEE80211: |
1589 | n = 0; /* no header */ | 1598 | n = 0; /* no header */ |
1590 | break; | 1599 | break; |
1600 | case ARPHRD_ETHER: | ||
1601 | { | ||
1602 | ; | ||
1603 | |||
1604 | if (sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen) | ||
1605 | return 0; /* invalid */ | ||
1606 | memcpy (&buf[sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)], | ||
1607 | tmpbuf + sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame), | ||
1608 | caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4 /* 4 byte FCS */); | ||
1609 | return caplen - sizeof (struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4; | ||
1610 | } | ||
1591 | default: | 1611 | default: |
1592 | errno = ENOTSUP; /* unsupported format */ | 1612 | errno = ENOTSUP; /* unsupported format */ |
1593 | return -1; | 1613 | return -1; |
@@ -1652,6 +1672,7 @@ open_device_raw (struct HardwareInfos *dev) | |||
1652 | return 1; | 1672 | return 1; |
1653 | } | 1673 | } |
1654 | if (((ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) && | 1674 | if (((ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) && |
1675 | (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) && | ||
1655 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) && | 1676 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) && |
1656 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL)) ) | 1677 | (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL)) ) |
1657 | { | 1678 | { |
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h index 2b70fc0f5..b7f22de71 100644 --- a/src/transport/plugin_transport_wlan.h +++ b/src/transport/plugin_transport_wlan.h | |||
@@ -80,6 +80,29 @@ struct GNUNET_TRANSPORT_WLAN_HelperControlMessage | |||
80 | struct GNUNET_TRANSPORT_WLAN_MacAddress mac; | 80 | struct GNUNET_TRANSPORT_WLAN_MacAddress mac; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | /** | ||
84 | * generic definitions for IEEE 802.3 frames | ||
85 | */ | ||
86 | struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame | ||
87 | { | ||
88 | |||
89 | /** | ||
90 | * Address 1: destination address in ad-hoc mode or AP, BSSID if station, | ||
91 | */ | ||
92 | struct GNUNET_TRANSPORT_WLAN_MacAddress dst; | ||
93 | |||
94 | /** | ||
95 | * Address 2: source address if in ad-hoc-mode or station, BSSID if AP | ||
96 | */ | ||
97 | struct GNUNET_TRANSPORT_WLAN_MacAddress src; | ||
98 | |||
99 | /** | ||
100 | * Packet type ID. | ||
101 | */ | ||
102 | uint16_t type; | ||
103 | |||
104 | }; | ||
105 | |||
83 | 106 | ||
84 | /** | 107 | /** |
85 | * generic definitions for IEEE 802.11 frames | 108 | * generic definitions for IEEE 802.11 frames |