From owner-svn-ports-head@freebsd.org Mon Feb 26 09:16:12 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B0BBF371A1; Mon, 26 Feb 2018 09:16:12 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A6ED6B8DB; Mon, 26 Feb 2018 09:16:12 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EBF4197B4; Mon, 26 Feb 2018 09:16:12 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1Q9GBNj003118; Mon, 26 Feb 2018 09:16:11 GMT (envelope-from ale@FreeBSD.org) Received: (from ale@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1Q9GBHI003116; Mon, 26 Feb 2018 09:16:11 GMT (envelope-from ale@FreeBSD.org) Message-Id: <201802260916.w1Q9GBHI003116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ale set sender to ale@FreeBSD.org using -f From: Alex Dupre Date: Mon, 26 Feb 2018 09:16:11 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r463007 - in head/net/mpd5: . files X-SVN-Group: ports-head X-SVN-Commit-Author: ale X-SVN-Commit-Paths: in head/net/mpd5: . files X-SVN-Commit-Revision: 463007 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Feb 2018 09:16:12 -0000 Author: ale Date: Mon Feb 26 09:16:11 2018 New Revision: 463007 URL: https://svnweb.freebsd.org/changeset/ports/463007 Log: Fix support of PPPoE over VLAN and add basic parsing of PADM messages. Submitted by: ale Reviewed by: mav julian Differential Revision: https://reviews.freebsd.org/D9848 Added: head/net/mpd5/files/patch-src_pppoe.c (contents, props changed) Modified: head/net/mpd5/Makefile Modified: head/net/mpd5/Makefile ============================================================================== --- head/net/mpd5/Makefile Mon Feb 26 09:14:10 2018 (r463006) +++ head/net/mpd5/Makefile Mon Feb 26 09:16:11 2018 (r463007) @@ -3,7 +3,7 @@ PORTNAME= mpd DISTVERSION= 5.8 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net MASTER_SITES= SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION} PKGNAMESUFFIX= 5 Added: head/net/mpd5/files/patch-src_pppoe.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/mpd5/files/patch-src_pppoe.c Mon Feb 26 09:16:11 2018 (r463007) @@ -0,0 +1,126 @@ +--- src/pppoe.c.orig 2016-01-06 15:42:06 UTC ++++ src/pppoe.c +@@ -71,6 +71,7 @@ + + /* Per link private info */ + struct pppoeinfo { ++ char iface[IFNAMSIZ]; /* PPPoE interface name */ + char path[MAX_PATH]; /* PPPoE node path */ + char hook[NG_HOOKSIZ]; /* hook on that node */ + char session[MAX_SESSION]; /* session name */ +@@ -165,7 +166,7 @@ static int PppoeListen(Link l); + static int PppoeUnListen(Link l); + static void PppoeNodeUpdate(Link l); + static void PppoeListenEvent(int type, void *arg); +-static int CreatePppoeNode(struct PppoeIf *PIf, const char *path, const char *hook); ++static int CreatePppoeNode(struct PppoeIf *PIf, const char *iface, const char *path, const char *hook); + + static void PppoeDoClose(Link l); + +@@ -282,6 +283,7 @@ PppoeInit(Link l) + pe = (PppoeInfo)(l->info = Malloc(MB_PHYS, sizeof(*pe))); + pe->incoming = 0; + pe->opened = 0; ++ snprintf(pe->iface, sizeof(pe->iface), "undefined"); + snprintf(pe->path, sizeof(pe->path), "undefined:"); + snprintf(pe->hook, sizeof(pe->hook), "undefined"); + snprintf(pe->session, sizeof(pe->session), "*"); +@@ -660,6 +662,16 @@ PppoeCtrlReadEvent(int type, void *arg) + break; + } + #endif ++#ifdef NGM_PPPOE_PADM_COOKIE ++ case NGM_PPPOE_HURL: ++ Log(LG_PHYS, ("PPPoE: rec'd HURL \"%s\"", ++ ((struct ngpppoe_padm *)u.resp.data)->msg)); ++ break; ++ case NGM_PPPOE_MOTM: ++ Log(LG_PHYS, ("PPPoE: rec'd MOTM \"%s\"", ++ ((struct ngpppoe_padm *)u.resp.data)->msg)); ++ break; ++#endif + default: + Log(LG_PHYS, ("PPPoE: rec'd command %lu from \"%s\"", + (u_long)u.resp.header.cmd, path)); +@@ -695,6 +707,7 @@ PppoeStat(Context ctx) + } + + Printf("PPPoE configuration:\r\n"); ++ Printf("\tIface Name : %s\r\n", pe->iface); + Printf("\tIface Node : %s\r\n", pe->path); + Printf("\tIface Hook : %s\r\n", pe->hook); + Printf("\tSession : %s\r\n", pe->session); +@@ -748,12 +761,8 @@ static int + PppoePeerIface(Link l, void *buf, size_t buf_len) + { + PppoeInfo const pppoe = (PppoeInfo)l->info; +- char iface[IFNAMSIZ]; + +- strlcpy(iface, pppoe->path, sizeof(iface)); +- if (iface[strlen(iface) - 1] == ':') +- iface[strlen(iface) - 1] = '\0'; +- strlcpy(buf, iface, buf_len); ++ strlcpy(buf, pppoe->iface, buf_len); + return (0); + } + +@@ -880,7 +889,7 @@ PppoeGetMru(Link l, int conf) + } + + static int +-CreatePppoeNode(struct PppoeIf *PIf, const char *path, const char *hook) ++CreatePppoeNode(struct PppoeIf *PIf, const char *iface, const char *path, const char *hook) + { + union { + u_char buf[sizeof(struct ng_mesg) + 2048]; +@@ -892,11 +901,6 @@ CreatePppoeNode(struct PppoeIf *PIf, con + uint32_t f; + + /* Make sure interface is up. */ +- char iface[IFNAMSIZ]; +- +- strlcpy(iface, path, sizeof(iface)); +- if (iface[strlen(iface) - 1] == ':') +- iface[strlen(iface) - 1] = '\0'; + if (ExecCmdNosh(LG_PHYS2, iface, "%s %s up", _PATH_IFCONFIG, iface) != 0) { + Log(LG_ERR, ("PPPoE: can't bring up interface %s", + iface)); +@@ -1501,7 +1505,7 @@ PppoeGetNode(Link l) + l->name)); + return; + } +- if (CreatePppoeNode(&PppoeIfs[free], pi->path, pi->hook)) { ++ if (CreatePppoeNode(&PppoeIfs[free], pi->iface, pi->path, pi->hook)) { + strlcpy(PppoeIfs[free].ifnodepath, + pi->path, + sizeof(PppoeIfs[free].ifnodepath)); +@@ -1673,7 +1677,7 @@ PppoeSetCommand(Context ctx, int ac, cha + { + const PppoeInfo pi = (PppoeInfo) ctx->lnk->info; + const char *hookname = ETHER_DEFAULT_HOOK; +- const char *colon; ++ int i; + #ifdef NGM_PPPOE_SETMAXP_COOKIE + int ap; + #endif +@@ -1684,9 +1688,17 @@ PppoeSetCommand(Context ctx, int ac, cha + hookname = av[1]; + /* fall through */ + case 1: +- colon = (av[0][strlen(av[0]) - 1] == ':') ? "" : ":"; +- snprintf(pi->path, sizeof(pi->path), +- "%s%s", av[0], colon); ++ strlcpy(pi->iface, av[0], sizeof(pi->iface)); ++ strlcpy(pi->path, pi->iface, sizeof(pi->path) - 1); ++ for (i = 0; i < sizeof(pi->path) - 1; i++) { ++ if (pi->path[i] == '.' || pi->path[i] == ':') ++ pi->path[i] = '_'; ++ else if (pi->path[i] == '\0') { ++ pi->path[i] = ':'; ++ pi->path[i + 1] = '\0'; ++ break; ++ } ++ } + strlcpy(pi->hook, hookname, sizeof(pi->hook)); + break; + default: