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 1jdAQr-00025q-5k for barebox@lists.infradead.org; Mon, 25 May 2020 10:34:14 +0000 From: Sascha Hauer Date: Mon, 25 May 2020 12:33:48 +0200 Message-Id: <20200525103349.19449-20-s.hauer@pengutronix.de> In-Reply-To: <20200525103349.19449-1-s.hauer@pengutronix.de> References: <20200525103349.19449-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 19/20] 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 cnkgdG8gVVNCIHRoZSBob3N0IHdpbGwgbm90IG5vdGljZSB3aGVuIGEgVURQIHNlcnZl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