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 1jbLGq-00085h-19 for barebox@lists.infradead.org; Wed, 20 May 2020 09:44:22 +0000 From: Sascha Hauer Date: Wed, 20 May 2020 11:44:02 +0200 Message-Id: <20200520094403.12651-19-s.hauer@pengutronix.de> In-Reply-To: <20200520094403.12651-1-s.hauer@pengutronix.de> References: <20200520094403.12651-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 18/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 cnkgdG8gVVNCIHRoZSBob3N0IHdpbGwgbm90IG5vdGljZSB3aGVuIGEgVURQIHNlcnZl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Jvb3Rfb25fYm9vdCh2b2lkKQoreworCXN0cnVjdCBmYXN0Ym9vdF9u ZXQgKmZibjsKKworCWlmdXBfYWxsKDApOworCWZibiA9IGZhc3Rib290X25ldF9pbml0KE5VTEwp OworCisJaWYgKElTX0VSUihmYm4pKQorCQlyZXR1cm4gUFRSX0VSUihmYm4pOworCisJZmFzdGJv b3RfbmV0X29iaiA9IGZibjsKKwlyZXR1cm4gMDsKK30KKworc3RhdGljIHZvaWQgZmFzdGJvb3Rf bmV0X2V4aXQodm9pZCkKK3sKKwlpZiAoZmFzdGJvb3RfbmV0X29iaikKKwkJZmFzdGJvb3RfbmV0 X2ZyZWUoZmFzdGJvb3RfbmV0X29iaik7Cit9CisKK3Bvc3RlbnZpcm9ubWVudF9pbml0Y2FsbChm YXN0Ym9vdF9vbl9ib290KTsKK3ByZWRldnNodXRkb3duX2V4aXRjYWxsKGZhc3Rib290X25ldF9l eGl0KTsKKyNlbmRpZgotLSAKMi4yNi4yCgoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX18KYmFyZWJveCBtYWlsaW5nIGxpc3QKYmFyZWJveEBsaXN0cy5pbmZy YWRlYWQub3JnCmh0dHA6Ly9saXN0cy5pbmZyYWRlYWQub3JnL21haWxtYW4vbGlzdGluZm8vYmFy ZWJveAo=