Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnrc_netif/lorawan: drop netif header on send #16584

Merged

Conversation

jia200x
Copy link
Member

@jia200x jia200x commented Jun 24, 2021

Contribution description

This PR fixes a memory leak introduced by #16080. The netif hdr was not being released on send.

Testing procedure

On current master:

ifconfig 3 up
2021-06-24 15:24:51,325 # ifconfig 3 up
> ifconfig
2021-06-24 15:25:06,809 # ifconfig
2021-06-24 15:25:06,820 # Iface  3  HWaddr: 26:01:44:AF  Frequency: 869524963Hz  RSSI: 99  BW: 125kHz  SF: 12  CR: 4/5  Link: up 
2021-06-24 15:25:06,827 #            TX-Power: 14dBm  State: SLEEP  Demod margin.: 0  Num gateways.: 0 
2021-06-24 15:25:06,829 #           IQ_INVERT  
2021-06-24 15:25:06,833 #           RX_SINGLE  OTAA  L2-PDU:767  
2021-06-24 15:25:06,834 #           
txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:26:25,320 # txtsnd 3 01 "THIS IS RIOT!"
> txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:26:29,540 # txtsnd 3 01 "THIS IS RIOT!"
> pktbuf
2021-06-24 15:26:32,857 # pktbuf
2021-06-24 15:26:32,864 # packet buffer: first byte: 0x2000119c, last byte: 0x2000139c (size: 512)
2021-06-24 15:26:32,866 #   position of last byte used: 120
2021-06-24 15:26:32,872 # =========== chunk   0 (0x2000119c size:  120) ===========
2021-06-24 15:26:32,879 # 00000000  00  00  00  00  B4  11  00  20  0D  00  00  00  01  00  00  00
2021-06-24 15:26:32,885 # 00000010  00  00  00  00  00  00  00  00  70  7C  9F  54  84  06  8F  42
2021-06-24 15:26:32,892 # 00000020  BD  69  C1  24  3B  18  4F  84  9C  11  00  20  DC  11  00  20
2021-06-24 15:26:32,899 # 00000030  09  00  00  00  01  00  00  00  FF  00  00  00  00  00  00  00
2021-06-24 15:26:32,905 # 00000040  00  01  00  00  00  00  00  80  01  00  00  00  00  00  00  00
2021-06-24 15:26:32,912 # 00000050  9C  11  00  20  04  12  00  20  09  00  00  00  01  00  00  00
2021-06-24 15:26:32,919 # 00000060  FF  00  00  00  00  00  00  00  00  01  00  00  00  00  00  80
2021-06-24 15:26:32,922 # 00000070  01  00  00  00  00  00  00  00
2021-06-24 15:26:32,927 # ~ unused: 0x20001214 (next: (nil), size:  392) ~

With this PR:

2021-06-24 15:22:42,977 # ifconfig 3 up
> ifconfig
2021-06-24 15:22:53,247 # ifconfig
2021-06-24 15:22:53,258 # Iface  3  HWaddr: 26:01:4F:A0  Frequency: 869524963Hz  RSSI: 99  BW: 125kHz  SF: 12  CR: 4/5  Link: up 
2021-06-24 15:22:53,265 #            TX-Power: 14dBm  State: SLEEP  Demod margin.: 0  Num gateways.: 0 
2021-06-24 15:22:53,267 #           IQ_INVERT  
2021-06-24 15:22:53,271 #           RX_SINGLE  OTAA  L2-PDU:767  
2021-06-24 15:22:53,272 #           
txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:22:58,717 # txtsnd 3 01 "THIS IS RIOT!"
ifconfig 3 set dr 5
2021-06-24 15:23:14,571 # ifconfig 3 set dr 5
2021-06-24 15:23:14,576 # success: set datarate on interface 3 to 5
txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:23:16,002 # txtsnd 3 01 "THIS IS RIOT!"
> txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:23:23,133 # txtsnd 3 01 "THIS IS RIOT!"
> txtsnd 3 01 "THIS IS RIOT!"
2021-06-24 15:23:36,768 # txtsnd 3 01 "THIS IS RIOT!"
> 2021-06-24 15:23:37,889 # PKTDUMP: data received:
2021-06-24 15:23:37,894 # ~~ SNIP  0 - size:   4 byte, type: NETTYPE_UNDEF (0)
2021-06-24 15:23:37,897 # 00000000  DE  AD  BE  EF
2021-06-24 15:23:37,901 # ~~ SNIP  1 - size:   9 byte, type: NETTYPE_NETIF (-1)
2021-06-24 15:23:37,905 # if_pid: 3  rssi: -32768  lqi: 0
2021-06-24 15:23:37,905 # flags: 0x0
2021-06-24 15:23:37,907 # src_l2addr: (nil)
2021-06-24 15:23:37,908 # dst_l2addr: 01
2021-06-24 15:23:37,912 # ~~ PKT    -  2 snips, total size:  13 byte
pktbuf
2021-06-24 15:23:44,918 # pktbuf
2021-06-24 15:23:44,924 # packet buffer: first byte: 0x2000119c, last byte: 0x2000139c (size: 512)
2021-06-24 15:23:44,928 #   position of last byte used: 128
2021-06-24 15:23:44,933 # ~ unused: 0x2000119c (next: (nil), size:  512) ~

Issues/PRs references

#16080

@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Jun 24, 2021
@MrKevinWeiss MrKevinWeiss added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jun 24, 2021
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jun 24, 2021
Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems sound, test output is provided, and a test will be added to the release test.

ACK!

@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 25, 2021
@MrKevinWeiss MrKevinWeiss merged commit 05b61e8 into RIOT-OS:master Jun 25, 2021
@MrKevinWeiss MrKevinWeiss modified the milestone: Release 2021.07 Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants