From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.emlix.com ([188.40.240.192]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZIUw-0005Gt-Bj for barebox@lists.infradead.org; Thu, 14 May 2020 18:22:27 +0000 Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 23F635FEC9 for ; Thu, 14 May 2020 20:22:14 +0200 (CEST) From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Date: Thu, 14 May 2020 20:21:57 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: 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 v2 09/10] fastboot net: implement fastboot over UDP To: barebox@lists.infradead.org Cc: Edmund Henniges , =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= RnJvbTogRWRtdW5kIEhlbm5pZ2VzIDxlaEBlbWxpeC5jb20+CgpUaGlzIGltcGxlbWVudHMgdGhl IFVEUCB2YXJpYW50IG9mIHRoZSBmYXN0Ym9vdCBwcm90b2NvbC4gVGhlIG9ubHkgd2F5IHRvCnN0 YXJ0IHRoZSBzZXJ2aWNlIGZvciBub3cgaXMgdG8gY29tcGlsZSB3aXRoIENPTkZJR19GQVNUQk9P VF9ORVRfT05fQk9PVC4KVGhlIHNlcnZpY2Ugd2lsbCBiaW5kIHRvIHRoZSBuZXR3b3JrIGludGVy ZmFjZSB0aGF0IHByb3ZpZGVzIHRoZSBJUHY0CmdhdGV3YXkuCgpTZW5kaW5nIGFuIE9LQVkgcGFj a2V0IGJlZm9yZSBwZXJmb3JtaW5nIGEgcmVzd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