Bug 250722 - net/mpd5: port redirection with NAT fails after FreeBSD system upgrade to 12.2
Summary: net/mpd5: port redirection with NAT fails after FreeBSD system upgrade to 12.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Eugene Grosbein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-29 14:45 UTC by Niels Bakker
Modified: 2020-11-17 13:36 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (eugen)


Attachments
restore ABI for ng_nat (519 bytes, patch)
2020-10-31 21:58 UTC, Eugene Grosbein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Bakker 2020-10-29 14:45:24 UTC
Hi,

After upgrading from 12.1 to 12.2, the mpd5 binary compiled under 12.1 started giving this error message:

Oct 29 15:14:40 server mpd[25294]: [E] can't set NAT redirect-port: Invalid argument

The config line in question was:

	set nat red-port tcp 0.0.0.0 8080 192.168.1.2 8080

"show nat" in the CLI showed the line as "(inactive)".

After recompiling mpd5-5.9 and restarting the daemon, the error message did not reappear, "(inactive)" changed to "(active)" and the port forward started working again.

I suggest incrementing the port revision to force a recompile with the new system headers. I've not tested backwards compatibility.
Comment 1 Eugene Grosbein freebsd_committer 2020-10-29 16:59:19 UTC
Adding some more eyes.

Dear colleagues, do we have ABI breakage here for stable/12?
Comment 2 Andrey V. Elsukov freebsd_committer 2020-10-30 10:10:58 UTC
I don't remember and don't see from a quick look any changes in ipfw/nat that could be related to such breakage. I suspect mpd5 uses ng_nat, thus probably the breakage is netgraph related. I think it is your r359697, that added NGM_NAT_{SET/GET}_DLT in the middle of enum.
Comment 3 Niels Bakker 2020-10-30 11:39:16 UTC
That sounds plausible. I don't use pf or ipfw+natd in this setup, mpd5 indeed uses cg_nat:

# ngctl list | grep nat
  Name: mpd33913-E-nat  Type: nat             ID: 0000006b   Num hooks: 2
Comment 4 Eugene Grosbein freebsd_committer 2020-10-31 21:58:51 UTC
Created attachment 219265 [details]
restore ABI for ng_nat
Comment 5 Eugene Grosbein freebsd_committer 2020-10-31 21:59:05 UTC
I've reproduced the problem installing 12.1-RELEASE/amd64 into new virtual maching, installing mpd5-5.9 package from quarterly branch for 12.1, upgrading to 12.2-RELEASE with freebsd-update and running old binary with corresponding configuration (pptp client/server) with nat redirect.

Andrey's analisys is right as attached patch for ng_nat kernel module restores ABI compatibility.

Should I commit the patch to stable/12 directly to restore ABI?
Comment 6 Andrey V. Elsukov freebsd_committer 2020-11-01 13:13:05 UTC
I think it is too late, with this commit you will break it again for those who already did update.
Comment 7 Kyle Evans freebsd_committer 2020-11-01 13:52:22 UTC
(In reply to Andrey V. Elsukov from comment #6)

I suspect the number of people who updated and run their own packages is probably quite small compared to the number of people this might affect (people running 12.2 with our packages for the next 3 months)
Comment 8 commit-hook freebsd_committer 2020-11-10 02:27:22 UTC
A commit references this bug:

Author: eugen
Date: Tue Nov 10 02:26:45 UTC 2020
New revision: 367545
URL: https://svnweb.freebsd.org/changeset/base/367545

Log:
  ng_nat: unbreak ABI

  The revision r342168 broke ABI of ng_nat needlessly and
  the change was merged to stable branches breaking ABI there, too.
  Unbreak it.

  PR:		250722
  MFC after:	1 week

Changes:
  head/sys/netgraph/ng_nat.h
Comment 9 commit-hook freebsd_committer 2020-11-17 05:00:55 UTC
A commit references this bug:

Author: eugen
Date: Tue Nov 17 05:00:24 UTC 2020
New revision: 367747
URL: https://svnweb.freebsd.org/changeset/base/367747

Log:
  MFC r367545: ng_nat: unbreak ABI

  The revision r342168 broke ABI of ng_nat needlessly and
  the change was merged to stable branches breaking ABI there, too.
  Unbreak it.

  PR:		250722

Changes:
_U  stable/12/
  stable/12/sys/netgraph/ng_nat.h
Comment 10 commit-hook freebsd_committer 2020-11-17 05:01:57 UTC
A commit references this bug:

Author: eugen
Date: Tue Nov 17 05:01:55 UTC 2020
New revision: 367748
URL: https://svnweb.freebsd.org/changeset/base/367748

Log:
  MFC r367545: ng_nat: unbreak ABI

  The revision r342168 broke ABI of ng_nat needlessly and
  the change was merged to stable branches breaking ABI there, too.
  Unbreak it.

  PR:		250722

Changes:
_U  stable/11/
  stable/11/sys/netgraph/ng_nat.h
Comment 11 Eugene Grosbein freebsd_committer 2020-11-17 05:08:48 UTC
Thank you very much for the report. The ABI was fixed. Unfortunately, this means you will need to rebuild your mpd5 binary again when you upgrade base system next time.
Comment 12 Niels Bakker 2020-11-17 13:36:15 UTC
Thanks, everyone!