GBA style trimming worked by starting at the end of the ROM and going back until they found something that was not a FF or 00 and chopped from that point on. The earliest DS trimmers continued doing this.
It was however noted that DS included a file size/end of file section in them (if you are especially bored then
http://problemkaputt.de/gbatek.htm#dscartridgeheader ). The next round of DS trimmers went in for this and it solved a few problems (even on the GBA it was acceptable to have 00 or FF in your file, in some cases it might even be more probable than some other hex values).
For reasons I never bothered to investigate, and I don't think anybody else did either, it was noted that some wifi games would not work when trimmed to said header value and instead would only work with wifi when a few extra bytes were left after that. I don't know if it was a quirk of coding or some weak anti piracy (a later method of anti piracy involved reading outside "normal" parameters as well, and "detect unexpected behaviours" is step one of anti piracy creation) but it is what it is and easily solved at that by allowing a few more bytes* to remain.
*2 gig SD cards were not that bad at this point and it is not like this was back in the GBA when 32 megs was a fairly standard size.