git: 3671e9d23962 - main - net/mpd5: minor improvements

From: Eugene Grosbein <eugen_at_FreeBSD.org>
Date: Fri, 27 Oct 2023 09:32:16 UTC
The branch main has been updated by eugen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3671e9d239628d5f25b282255e4d864cf7536614

commit 3671e9d239628d5f25b282255e4d864cf7536614
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2023-10-27 09:18:09 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2023-10-27 09:32:10 +0000

    net/mpd5: minor improvements
    
    (1) Import r2512 and r2529 from upstream:
    
    * optimize CCP logging a bit: no string copying for known CCP names;
    * use right name for HP-PPC.
    
    Bump PORTREVISION.
    
    (2) Also, this commit fixes upgrade problem for package users
    introduced with previous commit that removed USES=ssl
    not bumping PORTREVISION and following rename of openssl package
    to openssl111. For details, refer to:
    
    https://github.com/opnsense/core/issues/6959
    
    PR:             274748 (2)
    Reported by:    Franco Fichtner (2)
    Fixes:          87e2681289fc1eb5fda22e4072aca1e7943af25e
---
 net/mpd5/Makefile        |   2 +-
 net/mpd5/files/patch-ccp | 107 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/net/mpd5/Makefile b/net/mpd5/Makefile
index 58b5e00506f9..0c63072d8abc 100644
--- a/net/mpd5/Makefile
+++ b/net/mpd5/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	mpd
 DISTVERSION=	5.9
-PORTREVISION=	16
+PORTREVISION=	17
 CATEGORIES=	net
 MASTER_SITES=	SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION}
 PKGNAMESUFFIX=	5
diff --git a/net/mpd5/files/patch-ccp b/net/mpd5/files/patch-ccp
new file mode 100644
index 000000000000..3055d4f84643
--- /dev/null
+++ b/net/mpd5/files/patch-ccp
@@ -0,0 +1,107 @@
+Index: ccp.h
+===================================================================
+--- src/ccp.h	(revision 2511)
++++ src/ccp.h	(working copy)
+@@ -39,7 +39,7 @@
+   #define CCP_TY_PRED1		1	/* Predictor type 1 */
+   #define CCP_TY_PRED2		2	/* Predictor type 2 */
+   #define CCP_TY_PUDDLE		3	/* Puddle Jumper */
+-  #define CCP_TY_HWPPC		16	/* Hewlett-Packard PPC */
++  #define CCP_TY_HPPPC		16	/* Hewlett-Packard PPC */
+   #define CCP_TY_STAC		17	/* Stac Electronics LZS */
+   #define CCP_TY_MPPC		18	/* Microsoft PPC */
+   #define CCP_TY_GAND		19	/* Gandalf FZA */
+@@ -50,6 +50,7 @@
+   #define CCP_TY_DCE		25	/* Data Compression in Data Circuit-Terminating Equipment */
+   #define CCP_TY_DEFLATE	26	/* Gzip "deflate" compression */
+   #define CCP_TY_V44		27	/* V.44/LZJH Compression Protocol */
++  #define CCP_TY_LASTKNOWN	CCP_TY_V44
+ 
+   #define CCP_OVERHEAD		2
+ 
+--- src/ccp.c.orig	2023-10-27 15:59:28.379182000 +0700
++++ src/ccp.c	2023-10-27 16:00:57.038431000 +0700
+@@ -60,7 +60,7 @@
+   static int		CcpCheckEncryption(Bund b);
+   static int		CcpSetCommand(Context ctx, int ac, const char *const av[], const void *arg);
+   static CompType	CcpFindComp(int type, int *indexp);
+-  static const char	*CcpTypeName(int type, char *buf, size_t len);
++  static const char	*CcpTypeName(u_char type, char *buf, size_t len);
+ 
+   static void		CcpNgCtrlEvent(int type, void *cookie);
+   static void		CcpNgDataEvent(int type, void *cookie);
+@@ -132,28 +132,6 @@
+     NULL, NULL, NULL, NULL
+   };
+ 
+-  /* Names for different types of compression */
+-  static const struct ccpname {
+-    u_char	type;
+-    const char	*name;
+-  } gCcpTypeNames[] = {
+-    { CCP_TY_OUI,		"OUI" },
+-    { CCP_TY_PRED1,		"PRED1" },
+-    { CCP_TY_PRED2,		"PRED2" },
+-    { CCP_TY_PUDDLE,		"PUDDLE" },
+-    { CCP_TY_HWPPC,		"HWPPC" },
+-    { CCP_TY_STAC,		"STAC" },
+-    { CCP_TY_MPPC,		"MPPC" },
+-    { CCP_TY_GAND,		"GAND" },
+-    { CCP_TY_V42BIS,		"V42BIS" },
+-    { CCP_TY_BSD,		"BSD" },
+-    { CCP_TY_LZS_DCP,		"LZS-DCP" },
+-    { CCP_TY_MVRCA,		"MVRCA" },
+-    { CCP_TY_DCE,		"DCE" },
+-    { CCP_TY_DEFLATE,		"DEFLATE" },
+-    { CCP_TY_V44,		"V.44/LZJH" },
+-    { 0,			NULL },
+-  };
+ 
+ int		gCcpCsock = -1;		/* Socket node control socket */
+ int		gCcpDsock = -1;		/* Socket node data socket */
+@@ -1107,17 +1085,35 @@ CcpFindComp(int type, int *indexp)
+  */
+ 
+ static const char *
+-CcpTypeName(int type, char *buf, size_t len)
+-{
+-  const struct ccpname	*p;
++CcpTypeName(u_char type, char *buf, size_t len)
++ {
++  /* Names for different types of compression */
++  static const char * const ccpnames[] = {
++      "OUI",
++      "PRED1",
++      "PRED2",
++      "PUDDLE",
++      "HPPPC",
++      "STAC",
++      "MPPC",
++      "GAND",
++      "V42BIS",
++      "BSD",
++      "UNKNOWN[22]",
++      "LZS_DCP",
++      "MVRCA",
++      "DCE",
++      "DEFLATE",
++      "V.44/LZJH"
++  };
++  if (type <= CCP_TY_PUDDLE)
++    return(ccpnames[type]);
+ 
+-  for (p = gCcpTypeNames; p->name; p++) {
+-    if (p->type == type) {
+-	strlcpy(buf, p->name, len);
+-        return (buf);
+-    }
+-  }
+-  snprintf(buf, sizeof(buf), "UNKNOWN[%d]", type);
++  if (type >= CCP_TY_HPPPC && type <= CCP_TY_LASTKNOWN)
++    /* type - (CCP_TY_HPPPC-CCP_TY_PUDDLE-1) */
++    return(ccpnames[type - 12]);
++
++  snprintf(buf, len, "UNKNOWN[%u]", (unsigned)type);
+   return(buf);
+ }
+