mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #11912 from miri64/gnrc_netif_hdr/enh/netif_setter2
gnrc_netif_hdr: add setter for netif (minimal approach)
This commit is contained in:
commit
716cbe3f34
@ -294,6 +294,19 @@ static inline gnrc_netif_t *gnrc_netif_hdr_get_netif(const gnrc_netif_hdr_t *hdr
|
||||
return gnrc_netif_get_by_pid(hdr->if_pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convenience function to set the interface of an interface header,
|
||||
* given the network interface
|
||||
*
|
||||
* @param[out] hdr Header to set the interface for.
|
||||
* @param[in] netif Network interface to set for @p hdr.
|
||||
*/
|
||||
static inline void gnrc_netif_hdr_set_netif(gnrc_netif_hdr_t *hdr,
|
||||
const gnrc_netif_t *netif)
|
||||
{
|
||||
hdr->if_pid = (netif != NULL) ? netif->pid : KERNEL_PID_UNDEF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Outputs a generic interface header to stdout.
|
||||
*
|
||||
|
@ -230,7 +230,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netif_t *netif)
|
||||
gnrc_netif_hdr_init(netif_hdr->data, ETHERNET_ADDR_LEN, ETHERNET_ADDR_LEN);
|
||||
gnrc_netif_hdr_set_src_addr(netif_hdr->data, hdr->src, ETHERNET_ADDR_LEN);
|
||||
gnrc_netif_hdr_set_dst_addr(netif_hdr->data, hdr->dst, ETHERNET_ADDR_LEN);
|
||||
((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = netif->pid;
|
||||
gnrc_netif_hdr_set_netif(netif_hdr->data, netif);
|
||||
|
||||
DEBUG("gnrc_netif_ethernet: received packet from %02x:%02x:%02x:%02x:%02x:%02x "
|
||||
"of length %d\n",
|
||||
|
@ -81,7 +81,8 @@ def testfunc(child):
|
||||
child.expect("PKTDUMP: data received:")
|
||||
child.expect(r"~~ SNIP 0 - size: 0 byte, type: NETTYPE_UNDEF \(0\)")
|
||||
child.expect(r"00000000~~ SNIP 1 - size: \d+ byte, type: NETTYPE_NETIF \(-1\)")
|
||||
child.expect(r"if_pid: \d+ rssi: -?\d+ lqi: \d+")
|
||||
child.expect(r"if_pid: (\d+) rssi: -?\d+ lqi: \d+")
|
||||
assert 0 < int(child.match.group(1))
|
||||
child.expect("flags: 0x0")
|
||||
child.expect("src_l2addr: 3E:E6:B5:22:FD:0B")
|
||||
child.expect("dst_l2addr: 3E:E6:B5:22:FD:0A")
|
||||
@ -91,7 +92,8 @@ def testfunc(child):
|
||||
child.expect("PKTDUMP: data received:")
|
||||
child.expect(r"~~ SNIP 0 - size: 0 byte, type: NETTYPE_UNDEF \(0\)")
|
||||
child.expect(r"00000000~~ SNIP 1 - size: \d+ byte, type: NETTYPE_NETIF \(-1\)")
|
||||
child.expect(r"if_pid: \d+ rssi: -?\d+ lqi: \d+")
|
||||
child.expect(r"if_pid: (\d+) rssi: -?\d+ lqi: \d+")
|
||||
assert 0 < int(child.match.group(1))
|
||||
child.expect("flags: 0x0")
|
||||
child.expect("src_l2addr: 3E:E6:B5:0F:19:22:FD:0B")
|
||||
child.expect("dst_l2addr: 3E:E6:B5:0F:19:22:FD:0A")
|
||||
@ -102,7 +104,8 @@ def testfunc(child):
|
||||
child.expect(r"~~ SNIP 0 - size: 4 byte, type: NETTYPE_UNDEF \(0\)")
|
||||
child.expect("00000000 12 34 45 56")
|
||||
child.expect(r"~~ SNIP 1 - size: \d+ byte, type: NETTYPE_NETIF \(-1\)")
|
||||
child.expect(r"if_pid: \d+ rssi: -?\d+ lqi: \d+")
|
||||
child.expect(r"if_pid: (\d+) rssi: -?\d+ lqi: \d+")
|
||||
assert 0 < int(child.match.group(1))
|
||||
child.expect("flags: 0x0")
|
||||
child.expect("src_l2addr: 3E:E6:B5:22:FD:0B")
|
||||
child.expect("dst_l2addr: 3E:E6:B5:22:FD:0A")
|
||||
@ -113,7 +116,8 @@ def testfunc(child):
|
||||
child.expect(r"~~ SNIP 0 - size: 4 byte, type: NETTYPE_UNDEF \(0\)")
|
||||
child.expect("00000000 12 34 45 56")
|
||||
child.expect(r"~~ SNIP 1 - size: \d+ byte, type: NETTYPE_NETIF \(-1\)")
|
||||
child.expect(r"if_pid: \d+ rssi: -?\d+ lqi: \d+")
|
||||
child.expect(r"if_pid: (\d+) rssi: -?\d+ lqi: \d+")
|
||||
assert 0 < int(child.match.group(1))
|
||||
child.expect("flags: 0x0")
|
||||
child.expect("src_l2addr: 3E:E6:B5:0F:19:22:FD:0B")
|
||||
child.expect("dst_l2addr: 3E:E6:B5:0F:19:22:FD:0A")
|
||||
@ -130,7 +134,8 @@ def testfunc(child):
|
||||
child.expect("source address: fe80::3fe6:b5ff:fe22:fd0a")
|
||||
child.expect("destination address: fe80::3fe6:b5ff:fe22:fd0b")
|
||||
child.expect(r"~~ SNIP 1 - size: \d+ byte, type: NETTYPE_NETIF \(-1\)")
|
||||
child.expect(r"if_pid: \d+ rssi: -?\d+ lqi: \d+")
|
||||
child.expect(r"if_pid: (\d+) rssi: -?\d+ lqi: \d+")
|
||||
assert 0 < int(child.match.group(1))
|
||||
child.expect("flags: 0x0")
|
||||
child.expect("src_l2addr: 3E:E6:B5:22:FD:0B")
|
||||
child.expect("dst_l2addr: 3E:E6:B5:22:FD:0A")
|
||||
|
Loading…
Reference in New Issue
Block a user