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 bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlTAZ-0000hY-N1 for barebox@lists.infradead.org; Wed, 17 Jun 2020 08:11:45 +0000 From: Sascha Hauer Date: Wed, 17 Jun 2020 10:11:22 +0200 Message-Id: <20200617081126.5683-16-s.hauer@pengutronix.de> In-Reply-To: <20200617081126.5683-1-s.hauer@pengutronix.de> References: <20200617081126.5683-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 15/19] 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 cnkgdG8gVVNCIHRoZSBob3N0IHdpbGwgbm90IG5vdGljZSB3aGVuIGEgVURQI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