Index: head/print/hplip/Makefile =================================================================== --- head/print/hplip/Makefile (revision 542779) +++ head/print/hplip/Makefile (revision 542780) @@ -1,147 +1,147 @@ # Created by: amistry@am-productions.biz # $FreeBSD$ PORTNAME= hplip PORTVERSION= 3.20.3 -PORTREVISION= 0 +PORTREVISION= 1 CATEGORIES= print MASTER_SITES= SF MAINTAINER= woodsb02@FreeBSD.org COMMENT= Drivers and utilities for HP printers and All-in-One devices LICENSE= GPLv2+ MIT BSD3CLAUSE LICENSE_COMB= multi LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libcupsimage.so:print/cups \ libdbus-1.so:devel/dbus RUN_DEPENDS= cups-filters>=0:print/cups-filters \ ${PYTHON_PKGNAMEPREFIX}dbus>=0:devel/py-dbus@${PY_FLAVOR} CONFLICTS_INSTALL= hpijs-[0-9]* INSTALL_TARGET= install-strip USES= dos2unix gnome jpeg libtool pkgconfig python shebangfix USE_GNOME= pygobject3 USE_LDCONFIG= yes SHEBANG_GLOB= *.py hpps pstotiff DOS2UNIX_FILES= scan/sane/orblite.c GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-cupsbackenddir=${PREFIX}/libexec/cups/backend \ --with-cupsfilterdir=${PREFIX}/libexec/cups/filter \ --with-icondir=${DESKTOPDIR} \ --with-systraydir=${PREFIX}/etc/xdg/autostart \ --with-mimedir=${PREFIX}/share/cups/mime \ --with-docdir=${DOCSDIR} \ --with-htmldir=${DOCSDIR} \ --with-drvdir=${PREFIX}/share/cups/drv \ --disable-qt4 CONFIGURE_ENV+= PYTHONINCLUDEDIR=${PYTHON_INCLUDEDIR} CPPFLAGS+= -I${LOCALBASE}/include -I${PYTHON_INCLUDEDIR} LIBS+= -L${LOCALBASE}/lib OPTIONS_DEFINE= DOCS FAX SCAN SNMP X11 XSANE QT5 OPTIONS_DEFAULT= QT5 SCAN SNMP X11 OPTIONS_SUB= yes DOCS_CONFIGURE_ENABLE= doc-build FAX_DESC= PC Send Fax support FAX_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}reportlab>=0:print/py-reportlab@${PY_FLAVOR} FAX_CONFIGURE_ENABLE= fax-build SCAN_DESC= Scanning support SCAN_RUN_DEPENDS= ${PY_PILLOW} SCAN_LIB_DEPENDS= libsane.so:graphics/sane-backends SCAN_CONFIGURE_ENABLE= scan-build SNMP_DESC= Network/JetDirect support SNMP_USES= ssl SNMP_LIB_DEPENDS= libnetsnmp.so:net-mgmt/net-snmp SNMP_CONFIGURE_ENABLE= network-build X11_DESC= Graphical User Interface (Qt) X11_CONFIGURE_ENABLE= gui-build XSANE_DESC= Install XSane for scanning (implies SCAN) XSANE_IMPLIES= SCAN XSANE_RUN_DEPENDS= xsane:graphics/xsane .include .if ${PORT_OPTIONS:MQT5} && ${PORT_OPTIONS:MX11} USES+= pyqt:5 USE_PYQT= core_run dbussupport_run gui_run sip widgets_run CONFIGURE_ARGS+= --enable-qt5 .else CONFIGURE_ARGS+= --disable-qt5 .endif .if ${PORT_OPTIONS:MX11} && ! ${PORT_OPTIONS:MQT5} BROKEN= The X11 option requires the QT5 option .endif post-patch: @${REINPLACE_CMD} -e 's|-ldld||g;' \ -e 's|-ldl||g' \ -e 's,-lusb-1.0,-lusb,g' \ -e 's,libusb-1.0/libusb.h,libusb.h,g' \ ${WRKSRC}/configure \ ${WRKSRC}/Makefile.in @${REINPLACE_CMD} -e '/[[:space:]]install-dist_rulesDATA/ s,install-dist_rulesDATA,,' \ -e '/[[:space:]]install-dist_rulessystemDATA/ s,install-dist_rulessystemDATA,,' \ ${WRKSRC}/Makefile.in @${REINPLACE_CMD} -e 's,/etc/hp,${PREFIX}&,g' \ -e 's,/etc/cups,${LOCALBASE}&,g' \ -e 's,/etc/init.d,${LOCALBASE}/etc/rc.d,g' \ -e 's,/etc/sane.d,${LOCALBASE}&,g' \ -e 's,/usr/share,${LOCALBASE}/share,g' \ -e 's,/usr/include,${LOCALBASE}/include,g' \ ${WRKSRC}/Makefile.in \ ${WRKSRC}/base/codes.py \ ${WRKSRC}/base/g.py \ ${WRKSRC}/base/password.py \ ${WRKSRC}/base/pkit.py \ ${WRKSRC}/base/queues.py \ ${WRKSRC}/base/services.py \ ${WRKSRC}/base/utils.py \ ${WRKSRC}/check.py \ ${WRKSRC}/fax/backend/hpfax.py \ ${WRKSRC}/fax/coverpages.py \ ${WRKSRC}/fax/filters/pstotiff \ ${WRKSRC}/hplip.list.in \ ${WRKSRC}/installer/core_install.py \ ${WRKSRC}/installer/dcheck.py \ ${WRKSRC}/installer/pluginhandler.py \ ${WRKSRC}/logcapture.py \ ${WRKSRC}/prnt/cups.py \ ${WRKSRC}/prnt/filters/hpps \ ${WRKSRC}/prnt/hpcups/HPCupsFilter.cpp \ ${WRKSRC}/prnt/hpijs/globals.cpp \ ${WRKSRC}/prnt/hpijs/hpcupsfax.cpp \ ${WRKSRC}/prnt/hpijs/hpijs.cpp \ ${WRKSRC}/ui/devmgr4.py \ ${WRKSRC}/ui4/devmgr5.py \ ${WRKSRC}/ui5/devmgr5.py @${REINPLACE_CMD} -e 's/umask(0)/umask(0o022)/' \ -e 's/umask(0o111)/umask(0o133)/' \ ${WRKSRC}/base/os_utils.py \ ${WRKSRC}/base/validation.py \ ${WRKSRC}/fax/backend/hpfax.py \ ${WRKSRC}/hpdio.py \ ${WRKSRC}/installer/pluginhandler.py post-install: ${MV} ${STAGEDIR}${PREFIX}/etc/hp/hplip.conf \ ${STAGEDIR}${PREFIX}/etc/hp/hplip.conf.sample ${MKDIR} ${STAGEDIR}${DATADIR}/ui4/plugins ${MKDIR} ${STAGEDIR}/var/lib/hp post-install-SCAN-on: ${MKDIR} ${STAGEDIR}${PREFIX}/etc/sane.d/dll.d ${MV} ${STAGEDIR}${PREFIX}/etc/sane.d/dll.conf \ ${STAGEDIR}${PREFIX}/etc/sane.d/dll.d/hpaio .include Index: head/print/hplip/files/patch-protocol_discovery_mdns.c =================================================================== --- head/print/hplip/files/patch-protocol_discovery_mdns.c (revision 542779) +++ head/print/hplip/files/patch-protocol_discovery_mdns.c (revision 542780) @@ -1,27 +1,86 @@ ---- protocol/discovery/mdns.c.orig 2019-10-22 06:18:12 UTC +Use a dynamically allocated port instead of binding port 5353. The bind(2) +call fails when Avahi has already claimed port 5353. On top of that, HPLIP +only performs one-shot queries and those shouldn't be using port 5353 according +to RFC 6762. + +Don't disable loop-back. It's harmless. + +Use default TTL of 1. RFC 6762 requires 255 for responses, not for queries. + +There's no need to join the multicast group for one-shot queries. Responses +are sent to the unicast address. + +--- protocol/discovery/mdns.c.orig 2020-07-01 14:48:56 UTC +++ protocol/discovery/mdns.c @@ -24,7 +24,11 @@ Author: Sanjay Kumar \*****************************************************************************/ -//#include +#include +#include +#include +#include +#include #include #include #include -@@ -85,6 +89,11 @@ static int mdns_open_socket(int *psocket) +@@ -70,57 +74,13 @@ static int mdns_convert_name_to_dns(const char *name, + static int mdns_open_socket(int *psocket) + { + int stat = MDNS_STATUS_ERROR; +- int udp_socket = -1, yes = 1; +- char loop = 0, ttl = 255; +- struct sockaddr_in recv_addr , addr; +- struct ip_mreq mreq; ++ int udp_socket; - /* Get rid of "address already in use" error message. */ - if (setsockopt(udp_socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) -+ { -+ BUG("unable to setsockopt: %m\n"); -+ goto bugout; -+ } -+ if (setsockopt(udp_socket, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) == -1) + DBG("mdns_open_socket entry.\n"); + + if ((udp_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { - BUG("unable to setsockopt: %m\n"); + BUG("unable to create udp socket: %m\n"); +- goto bugout; +- } +- +- /* Get rid of "address already in use" error message. */ +- if (setsockopt(udp_socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) +- { +- BUG("unable to setsockopt: %m\n"); +- goto bugout; +- } +- +- /* Bind the socket to port and IP equal to INADDR_ANY. */ +- bzero(&recv_addr, sizeof(recv_addr)); +- recv_addr.sin_family = AF_INET; +- recv_addr.sin_addr.s_addr = htonl(INADDR_ANY); +- recv_addr.sin_port = htons(5353); +- if (bind(udp_socket, (struct sockaddr *) &recv_addr, sizeof(recv_addr)) == -1) +- { +- BUG("unable to bind udp socket: %m\n"); +- goto bugout; +- } +- +- /* Set multicast loopback off. */ +- if (setsockopt(udp_socket, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) == -1) +- { +- BUG("unable to setsockopt: %m\n"); +- goto bugout; +- } +- +- /* Set ttl to 255. Required by mdns. */ +- if (setsockopt(udp_socket, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl))== -1) +- { +- BUG("unable to setsockopt: %m\n"); +- goto bugout; +- } +- +- /* Join the .local multicast group */ +- mreq.imr_multiaddr.s_addr = inet_addr("224.0.0.251"); +- mreq.imr_interface.s_addr = htonl(INADDR_ANY); +- if (setsockopt(udp_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(struct ip_mreq)) == -1) { +- BUG("unable to add to multicast group: %m\n"); +- close(udp_socket); goto bugout; + } +