Commit addf02c
authored
Clamp HEP capture payload to the buffer instead of dropping chunks (#321)
The capture builders broke out of the copy loop at the first iov
fragment that would exceed the buffer cap, before copying any of it,
so an oversize message lost everything from that fragment on. A UDP
datagram arrives as a single fragment, so the whole message was
dropped and the HEP frame carried an empty payload; a TCP read arrives
as several fragments, so some were kept and the tail lost.
Clamp each fragment's copy length to the remaining buffer room instead
of dropping it, in both the HEPv2 and HEPv3 builders, filling up to the
cap.
This also fixes an over-declared HEPv3 length: the sizing and copy
passes counted different totals against the cap, so `header.length`
could exceed the bytes actually sent. The copy pass now emits exactly
the counted `payload_len`, keeping declared and sent length in sync.1 parent bd16af3 commit addf02c
1 file changed
Lines changed: 34 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
| 605 | + | |
606 | 606 | | |
| 607 | + | |
| 608 | + | |
607 | 609 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
616 | 618 | | |
617 | 619 | | |
618 | 620 | | |
| |||
638 | 640 | | |
639 | 641 | | |
640 | 642 | | |
641 | | - | |
642 | | - | |
| 643 | + | |
643 | 644 | | |
644 | 645 | | |
645 | 646 | | |
| |||
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
795 | 801 | | |
796 | | - | |
797 | | - | |
798 | 802 | | |
799 | 803 | | |
800 | 804 | | |
| |||
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
844 | | - | |
845 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
846 | 851 | | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
855 | 859 | | |
856 | 860 | | |
857 | 861 | | |
| |||
0 commit comments