Page MenuHomeFreeBSD

Convert ng_deflate to use new zlib.
ClosedPublic

Authored by delphij on Aug 8 2019, 8:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 17, 6:14 PM
Unknown Object (File)
Sat, Mar 9, 8:48 AM
Unknown Object (File)
Feb 19 2024, 7:58 AM
Unknown Object (File)
Feb 19 2024, 4:11 AM
Unknown Object (File)
Feb 16 2024, 1:32 AM
Unknown Object (File)
Feb 14 2024, 10:49 AM
Unknown Object (File)
Feb 7 2024, 9:07 AM
Unknown Object (File)
Jan 26 2024, 6:09 PM
Subscribers

Details

Summary

Convert ng_deflate to use new zlib.

Test Plan

Test against mpd5 PPTP server with deflate enabled, watch the numbers reported.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25912
Build 24478: arc lint + arc unit

Event Timeline

I haven't looked into FreeBSD extension of zlib yet to see if this change is safe.

sys/netgraph/ng_deflate.c
489

Z_PACKET_FLUSH is the FreeBSD only and specific implementation.

(Hopefully have fixed all issues I have found so far).

Remove bogus inflateInit().

delphij removed a reviewer: bz.

(I've looked over the change other than the just update dictionary section so far)

sys/netgraph/ng_deflate.c
377–379

unrelated whitespace change?

490

maybe a kassert that outlen > 4 && the last 4 bytes are the expected 00 00 ff ff?

Undo unrelated space change.

delphij marked an inline comment as done.

Assert that the empty block actually exists.

I will take a closer look.
I've never used nor looked into details of this API.
Please allow me a bit extra time for review.

sys/netgraph/ng_deflate.c
667

Does this fnflate() really do a work?
Its output buffer begins with priv->outbuf just like before although it passes the fake header to zlib.
Is this to pass the size of uncompressed stream to zip?

delphij added inline comments.
sys/netgraph/ng_deflate.c
667

Yes, this would pass the uncompressed data through inflate engine and update the dictionary, which will be used for later decompression (the first few packets are not compressible normally).

The change looks reasonable based on PPP protocol and comparison to existing zlib code.

I didn't know ng_deflate was for ppp.
I was curious how others implemented and found that NetBSD, OpenBSD, and Linux uses Z_PACKET_FLUSH as well, interestingly.
I never looked at ppp implementation and didn't know all others have same base code along with modified zlib.
I am no longer sure if Z_PACKET_FLUSH was FreeBSD original implementation.

It will be nice if we can get another person familiar with netgraph/ppp.

The change looks reasonable based on PPP protocol and comparison to existing zlib code.

I didn't know ng_deflate was for ppp.
I was curious how others implemented and found that NetBSD, OpenBSD, and Linux uses Z_PACKET_FLUSH as well, interestingly.
I never looked at ppp implementation and didn't know all others have same base code along with modified zlib.
I am no longer sure if Z_PACKET_FLUSH was FreeBSD original implementation.

No, it was not. Z_PACKET_FLUSH was from Paul Mackerras's PPP package, where the original PPP specific version of zlib was bundled. You can find additional history at Paul's git repository at https://github.com/paulusmack/ppp .

It will be nice if we can get another person familiar with netgraph/ppp.

Unfortunately, all reviewers didn't respond my private requests except Alexander who have gave me some hints on how to test the code.

I have so far only gently tested it against another FreeBSD -STABLE system with deflate enabled to make sure that two way communication with it still works.

Thank you for explanations.
I found and had looked at that git repo while reviewing this change.
However, I didn't have enough guts to look into each of repo history to figure out which one came from where.
That explains why all of ppp use Z_PACKET_FLUSH while really NONE uses Z_SYNC_FLUSH.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 23 2019, 7:24 AM
This revision was automatically updated to reflect the committed changes.