From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jmBhS-00059s-9w for barebox@lists.infradead.org; Fri, 19 Jun 2020 07:44:38 +0000 From: Sascha Hauer Date: Fri, 19 Jun 2020 09:44:23 +0200 Message-Id: <20200619074427.17289-18-s.hauer@pengutronix.de> In-Reply-To: <20200619074427.17289-1-s.hauer@pengutronix.de> References: <20200619074427.17289-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 17/21] fastboot net: implement fastboot over UDP To: Barebox List Cc: Edmund Henniges , =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= RnJvbTogRWRtdW5kIEhlbm5pZ2VzIDxlaEBlbWxpeC5jb20+CgpUaGlzIGltcGxlbWVudHMgdGhl IFVEUCB2YXJpYW50IG9mIHRoZSBmYXN0Ym9vdCBwcm90b2NvbC4gVGhlIG9ubHkgd2F5IHRvCnN0 YXJ0IHRoZSBzZXJ2aWNlIGZvciBub3cgaXMgdG8gY29tcGlsZSB3aXRoIENPTkZJR19GQVNUQk9P VF9ORVRfT05fQk9PVC4KVGhlIHNlcnZpY2Ugd2lsbCBiaW5kIHRvIHRoZSBuZXR3b3JrIGludGVy ZmFjZSB0aGF0IHByb3ZpZGVzIHRoZSBJUHY0CmdhdGV3YXkuCgpTZW5kaW5nIGFuIE9LQVkgcGFj a2V0IGJlZm9yZSBwZXJmb3JtaW5nIGEgcmVzdGFydCBpcyBuZWNlc3Nhcnkgc2luY2UKY29udHJh cnkgdG8gVVNCIHRoZSBob3N0IHdpbGwgbm90IG5vdGljZSB3aGVuIGEgVURQIHNlcn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