Date: Tue, 9 Feb 1999 15:18:26 -0500 (EST) From: Larry Lile <lile@stdio.com> To: Julian Elischer <julian@whistle.com> Cc: hackers@FreeBSD.ORG Subject: Re: Why did this panic? Message-ID: <Pine.BSF.4.05.9902091456290.14147-200000@heathers.stdio.com> In-Reply-To: <Pine.BSF.3.95.990209113256.5802E-100000@current1.whistle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-519715650-918591506=:14147 Content-Type: TEXT/PLAIN; charset=US-ASCII Oops, too much buffer size math, I should add the following between 1248 & 1249: mbuf_size -= 2; I guess that could explain the panic. I wonder why I don't see it with smaller mtu's? I guess I probably wrote off the end of one mbuf into the beggining of a mbuf cluster and ate the free list pointer. Yes, consider me suitably embarrased, I was in a hurry when I globbed that 3-way min together. Thanks for pointing out my math error! I am not very happy with all of that code to begin with, do you have any suggestions on how to make it more elegant? I do intend at some point to try just linking the raw receive buffers to m_ext and setting the free routine to a routine in the driver to avoid the unnecesary copies. Heres a new cut. Larry Lile lile@stdio.com On Tue, 9 Feb 1999, Julian Elischer wrote: > > > > > in line 1248, > subtract 2 from buf_size as well > > 1245 m0->m_pkthdr.rcvif = &sc->arpcom.ac_if; > 1246 m0->m_pkthdr.len = ByteCount; > 1247 m0->m_len = 0; > 1248 m0->m_data += 2; > 1249 th = mtod(m0, struct iso88025_header *); > > > in 1255 you overwrite what you just calculated the line before.. > have you already set up the variables used? > (looks like you have..) > ah it's a 3 way min() > > use a MIN macro please.. > #define MIN(A,B) (((A) < (B)) ? (A) : (B)) > length = MIN( frame_len, > MIN( (RX_BUFFER_LEN - frag_offset), > (mbuf_size - mbuf_offset)) > --0-519715650-918591506=:14147 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="if_oltr.c" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.BSF.4.05.9902091518260.14147@heathers.stdio.com> Content-Description: Content-Disposition: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uaW9iYXNlMCkgew0KICAgICAgICAgICAgICAgIGlmIChhc3NpZ25lZFtp XSkgew0KICAgICAgICAgICAgICAgICAgICBwcmludGYoIm9sdHIlZDogYWRh cHRlciAoMHglWCkgYWxyZWFkeSBhc3NpZ25lZC5cbiIsIGlzLT5pZF91bml0 LCBpcy0+aWRfaW9iYXNlKTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJu KDApOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBhc3Np Z25lZFtpXSA9IDE7DQogICAgICAgICAgICAgICAgc2MtPmNvbmZpZyA9ICZv bHRyX2NvbmZpZ1tpXTsNCiAgICAgICAgICAgICAgICBpZiAoaXMtPmlkX2ly cSA9PSAwKQ0KICAgICAgICAgICAgICAgICAgICBpcy0+aWRfaXJxID0gKDEg PDwgc2MtPmNvbmZpZy0+aW50ZXJydXB0bGV2ZWwpOyAgICAgICAgIC8qIENs YWltIG91ciBpbnRlcnJ1cHQgKi8NCiAgICAgICAgICAgICAgICBpcy0+aWRf aW50ciA9IChpbnRoYW5kMl90ICopb2x0cl9pbnRyOw0KICAgICAgICAgICAg ICAgIHJlZ2lzdGVyX2ludHIoZmZzKGlzLT5pZF9pcnEpIC0gMSwgaXMtPmlk X2lkLCBpcy0+aWRfcmlfZmxhZ3MsIGlzLT5pZF9pbnRyLCAmbmV0X2ltYXNr LCBpcy0+aWRfdW5pdCk7DQogICAgICAgICAgICAgICAgaWYgKChpcy0+aWRf ZHJxID09IDB4ZmZmZmZmZmYpICYmIChzYy0+Y29uZmlnLT5kbWFsZXZlbCAh PSBUUkxMRF9ETUFfUElPKSkNCiAgICAgICAgICAgICAgICAgICAgaXMtPmlk X2RycSA9IHNjLT5jb25maWctPmRtYWxldmVsOyAgICAgICAgICAgICAgICAg ICAgICAvKiBDbGFpbSBvdXIgZG1hIGNoYW5uZWwgKi8NCiAgICAgICAgICAg ICAgICBwcmludGYoIm9sdHIlZDogPCVzPiBbJTZEXVxuIiwgaXMt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ZmZmZikgPT0gMHgwMDA3KSB8fCANCiAgICAgICAgICAgKCgoZGV2aWNl X2lkID4+IDE2KSAmIDB4ZmZmZikgPT0gMHgwMDA4KSkpIHsNCg0KICAgICAg ICBmb3IgKGkgPSAwOyBpIDwgNjQ7IGkrKykNCiAgICAgICAgICAgIFBDSUNv bmZpZ3VyYXRpb25TcGFjZVtpXSA9IHBjaV9jZmdyZWFkKGNvbmZpZ19pZCwg aSwgLypieXRlcyovMSk7DQoNCiAgICAgICAgcmMgPSBUUmxsZFBDSUNvbmZp Zygmb2x0ckxsZERyaXZlciwgJm9sdHJfY29uZmlnW2pdLCBQQ0lDb25maWd1 cmF0aW9uU3BhY2UpOw0KDQogICAgICAgIGlmICgocmMgPT0gVFJMTERfUENJ Q09ORklHX09LKSB8fCAocmMgPT0gVFJMTERfUENJQ09ORklHX1NFVF9DT01N QU5EKSkgew0KICAgICAgICAgICAgaWYgKHJjID09IFRSTExEX1BDSUNPTkZJ R19TRVRfQ09NTUFORCkgew0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0 cjogc2V0dGluZyBidXMtbWFzdGVyIG1vZGVcbiIpOw0KICAgICAgICAgICAg ICAgIGNvbW1hbmQgPSBwY2lfY29uZl9yZWFkKGNvbmZpZ19pZCwgUENJUl9D T01NQU5EKTsNCiAgICAgICAgICAgICAgICBwY2lfY29uZl93cml0ZShjb25m aWdfaWQsIFBDSVJfQ09NTUFORCwgKGNvbW1hbmQgfCBQQ0lNX0NNRF9CVVNN QVNURVJFTikpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgcGNpX2Nh cmRzKys7DQogICAgICAgICAgICByZXR1cm4gKEFkYXB0ZXJOYW1lW29sdHJf Y29uZmlnW2pdLnR5cGVdKTsNCiAgICAgICAgfSBlbHNlIHsNCiAgICAgICAg ICAgIGlmIChyYyA9PSBUUkxMRF9QQ0lDT05GSUdfRkFJTCkNCiAgICAgICAg ICAgICAgICBwcmludGYoIm9sdHI6IFRSbGxkUENJQ29uZmlnIGZhaWxlZCFc biIpOw0KICAgICAgICAgICAgaWYgKHJjID09IFRSTExEX1BDSUNPTkZJR19W RVJTSU9OKQ0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0cjogd3Jvbmcg TExEIHZlcnNpb25cbiIpOw0KICAgICAgICB9DQogICAgfQ0KICAgIHJldHVy bihOVUxMKTsNCn0NCiNlbmRpZiAvKiBOUENJICovDQoNCnN0YXRpYyBpbnQN Cm9sdHJfYXR0YWNoKGlzKQ0KICAgIHN0cnVjdCBpc2FfZGV2aWNlICppczsN CnsNCiAgICBzdHJ1Y3Qgb2x0cl9zb2Z0YyAqc2MgPSAmb2x0cl9zb2Z0Y1tp cy0+aWRfdW5pdF07DQogICAgaW50IHJjOw0KDQogICAgc2MtPnVuaXQgPSBp cy0+aWRfdW5pdDsNCg0KICAgIGlmICghb2x0cl9hdHRhY2hfY29tbW9uKHNj KSkNCiAgICAgICAgcmV0dXJuKDApOw0KDQogICAgLyogSWYgdGhlIGtlcm5l bCBjb25maWcgZG9lcyBub3QgbWF0Y2ggdGhlIGN1cnJlbnQgY2FyZCBjb25m aWd1cmF0aW9uIHRoZW4NCiAgICAgKiBhZGp1c3QgdGhlIGNhcmQgc2V0dGlu Z3MgdG8gbWF0Y2ggdGhlIGtlcm5lbC4NCiAgICAgKi8NCiAgICBpZiAoKGZm cyhpcy0+aWRfaXJxKSAtIDEpICE9IHNjLT5jb25maWctPmludGVycnVwdGxl dmVsKSB7DQogICAgICAgIHJjID0gVFJsbGRTZXRJbnRlcnJ1cHQoc2MtPlRS bGxkQWRhcHRlciwgaXMtPmlkX2lycSk7IA0KICAgICAgICBpZiAocmMgIT0g VFJMTERfQ09ORklHX09LKSB7ICANCiAgICAgICAgICAgIHByaW50Zigib2x0 ciVkOiBVbmFibGUgdG8gY2hhbmdlIGFkYXB0ZXIgaW50ZXJydXB0IGxldmVs ICgleClcbiIsIHNjLT51bml0LCByYyk7DQogICAgICAgICAgICByZXR1cm4o MCk7DQogICAgICAgIH0NCiAgICB9ICAgDQogICAgICAgIA0KICAgIC8qIFNl dCBkbWEgbGV2ZWwsIGZhbGwgYmFjayB0byBwaW8gaWYgcG9zc2libGUuIChm b2xsb3dpbmcgU0NPIGRyaXZlciBleGFtcGxlKSAqLw0KICAgIGlmIChpcy0+ aWRfZHJxICE9IHNjLT5jb25maWctPmRtYWxldmVsKSB7DQogICAgICAgIHJj ID0gVFJsbGRTZXRETUEoc2MtPlRSbGxkQWRhcHRlciwgaXMtPmlkX2RycSwg JnNjLT5jb25maWctPm1vZGUpOw0KICAgICAgICBpZiAocmMgIT0gVFJMTERf Q09ORklHX09LKSB7DQogICAgICAgICAgICBpZiAoKHNjLT5jb25maWctPmRt YWxldmVsICE9IFRSTExEX0RNQV9QSU8pICYmDQogICAgICAgICAgICAgICAg KFRSbGxkU2V0RE1BKHNjLT5UUmxsZEFkYXB0ZXIsIFRSTExEX0RNQV9QSU8s ICZzYy0+Y29uZmlnLT5tb2RlKSAhPSBUUkxMRF9DT05GSUdfT0spKSB7DQog ICAgICAgICAgICAgICAgcHJpbnRmKCJvbHRyJWQ6IHVuYWJsZSB0byBjaGFu Z2UgZG1hIGxldmVsIGZyb20gJWQgdG8gJWQgKCV4KVxuIiwgc2MtPnVuaXQs DQogICAgICAgICAgICAgICAgICAgICAgICBzYy0+Y29uZmlnLT5kbWFsZXZl bCwgaXMtPmlkX2RycSwgcmMpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAg ICAgcHJpbnRmKCJvbHRyJWQ6IFVuYWJsZSB0byBjaGFuZ2UgYWRhcHRlciBk bWEgbGV2ZWwsIHVzaW5nIFBJTyBtb2RlICgleClcbiIsIHNjLT51bml0LCBy Yyk7DQogICAgICAgICAgICBzYy0+Y29uZmlnLT5kbWFsZXZlbCA9IFRSTExE X0RNQV9QSU87DQogICAgICAgICAgICByYyA9IFRSbGxkU2V0RE1BKHNjLT5U UmxsZEFkYXB0ZXIsIGlzLT5pZF9kcnEsICZzYy0+Y29uZmln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OiBB ZGFwdGVyIG5vdCBzdXBwb3J0ZWQgYnkgbG93IGxldmVsIGRyaXZlci5cbiIs IHNjLT51bml0KTsNCiAgICAgICAgICAgICAgICBzYy0+aHdfc3RhdGUgPSBI V19VTktOT1dOOw0KICAgICAgICAgICAgICAgIHJldHVybigwKTsNCiAgICAg ICAgICAgIGNhc2UgVFJMTERfSU5JVF9QSFlTMTY6DQogICAgICAgICAgICAg ICAgcHJpbnRmKCJvbHRyJWQ6IEFkYXB0ZXIgbWVtb3J5IGJsb2NrIGFib3Zl IDE2TSwgbXVzdCBiZSBiZWxvdyAxNk0uXG4iLCBzYy0+dW5pdCk7DQogICAg ICAgICAgICAgICAgcmV0dXJuKDApOw0KICAgICAgICAgICAgY2FzZSBUUkxM RF9JTklUX1ZFUlNJT046DQogICAgICAgICAgICAgICAgcHJpbnRmKCJvbHRy JWQ6IExvdyBsZXZlbCBkcml2ZXIgdmVyc2lvbiBtaXNtYXRjaC5cbiIsIHNj LT51bml0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4oMCk7DQogICAgICAg ICAgICBkZWZhdWx0Og0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0ciVk OiBVbmtub3duIGluaXRpbGl6YXRpb24gZXJyb3Igb2Njb3VyZWQgKCV4KS5c biIsIHNjLT51bml0LCByYyk7DQogICAgICAgICAgICAgICAgcmV0dXJuKDAp Ow0KICAgICAgICB9DQogICAgfQ0KDQogICAgLyogRG93bmxvYWQgQWRhcHRl ciBNaWNyb2NvZGUgKi8NCiAgICAvKnByaW50Zigib2x0ciVkOiBEb3dubG9h ZGluZyBhZGFwdGVyIG1pY3JvY29kZS4uLiIsIHNjLT51bml0KTsqLw0KICAg IHNjLT5od19zdGF0ZSA9IEhXX0xPQURJTkc7DQogICAgc3dpdGNoKHNjLT5j b25maWctPm1hY3R5cGUpIHsNCiAgICAgICAgY2FzZSBUUkxMRF9NQUNfVE1T OiAgICAgICAgICAgLyogVE1TIG1pY3JvY29kZSAqLw0KICAgICAgICAgICAg cmMgPSBUUmxsZERvd25sb2FkKHNjLT5UUmxsZEFkYXB0ZXIsIFRSbGxkTWFj Q29kZSk7DQogICAgICAgICAgICBicmVhazsNCiAgICAgICAgY2FzZSBUUkxM RF9NQUNfSEFXS0VZRTogICAgICAgIC8qIEhhd2tleWUgbWljcm9jb2RlICov DQogICAgICAgICAgICByYyA9IFRSbGxkRG93bmxvYWQoc2MtPlRSbGxkQWRh cHRlciwgVFJsbGRIYXdrZXllTWFjKTsNCiAgICAgICAgICAgIGJyZWFrOw0K ICAgICAgICBjYXNlIFRSTExEX01BQ19CVUxMU0VZRTogICAgICAvKiBCdWxs c2V5ZSBtaWNyb2NvZGUgKi8NCiAgICAgICAgICAgIHJjID0gVFJsbGREb3du bG9hZChzYy0+VFJsbGRBZGFwdGVyLCBUUmxsZEJ1bGxzZXllTWFjKTsNCiAg ICAgICAgICAgIGJyZWFrOw0KICAgICAgICBkZWZhdWx0Og0KICAgICAgICAg ICAgcHJpbnRmKCJvbHRyJWQ6IHVua25vd24gbWFjdHlwZSAlZFxuIiwgc2Mt PnVuaXQsIHNjLT5jb25maWctPm1hY3R5cGUpOw0KICAgICAgICAgICAgcmV0 dXJuKDApOw0KICAgIH0NCiAgICAvKmlmIChyYyA9PSBUUkxMRF9ET1dOTE9B RF9PSykgDQogICAgICAgIHByaW50ZigiZG9uZVxuIik7Ki8NCiAgICBpZiAo KHJjID09IFRSTExEX0RPV05MT0FEX0VSUk9SKSB8fCAocmMgPT0gVFJMTERf U1RBVEUpKSB7DQogICAgICAgIHByaW50Zigib2x0ciVkOiBBZGFwdGVyIG1p Y3JvY29kZSBkb3dubG9hZCBmYWlsZWQhIChyYyA9ICV4KVxuIiwgc2MtPnVu aXQsIHJjKTsNCiAgICAgICAgc2MtPmh3X3N0YXRlID0gSFdfQkFEOw0KICAg ICAgICByZXR1cm4oMCk7ICAgICANCiAgICB9DQoNCiAgICBUUmxsZFNldFNw ZWVkKHNjLT5UUmxsZEFkYXB0Z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f RkFJTEVEOw0KICAgIH0gZWxzZSB7DQogICAgICAgIC8qcHJpbnRmKCJvbHRy JWQ6IGFkYXB0ZXIgb3BlbmluZy4uLlxuIiwgc2MtPnVuaXQpOyovDQogICAg ICAgIC8qaWZwLT5pZl9mbGFncyB8PSAoSUZGX1VQIHwgSUZGX1JVTk5JTkcp OyovDQogICAgICAgIGlmcC0+aWZfZmxhZ3MgJj0gfklGRl9PQUNUSVZFOw0K ICAgIH0NCiAgICBzYy0+b2x0cl9jaCA9IHRpbWVvdXQob2x0cl90aW1lb3V0 LCAodm9pZCAqKXNjLT51bml0LCAzMCpoeik7DQogICAgdHNsZWVwKCh2b2lk ICopc2MtPnVuaXQsIDEsICJvbHRyb3AiLCAzMCpoeik7DQoNCiAgICAvKiBH aXZlIHRoZSB0cmFuc21pdCBidWZmZXJzIHRvIHRoZSBhZGFwdGVyICovDQog ICAgZm9yIChpID0gMDsgaSA8IFJYX0xJU1RfU0laRTsgaSsrKSB7IA0KICAg ICAgICByYyA9IFRSbGxkUmVjZWl2ZUZyYWdtZW50KHNjLT5UUmxsZEFkYXB0 ZXIsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQg KilzYy0+cnhfYnVmZmVyW3NjLT5yeF9uZXh0ICYgUlhfTElTVF9NQVNLXS5i dWYsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga3Z0b3Ao c2MtPnJ4X2J1ZmZlcltzYy0+cnhfbmV4dCAmIFJYX0xJU1RfTUFTS10uYnVm KSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSWF9CVUZG RVJfTEVOLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2 b2lkICopc2MtPnJ4X2J1ZmZlcltzYy0+cnhfbmV4dCAmIFJYX0xJU1RfTUFT S10uaW5kZXgpOw0KICAgICAgICBpZiAocmMgIT0gVFJMTERfUkVDRUlWRV9P Sykgew0KICAgICAgICAgICAgcHJpbnRmKC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bHRyX3NvZnRjW2lmcC0+aWZfdW5pdF07DQogICAgc3RydWN0 IGlmcmVxICppZnIgPSAoc3RydWN0IGlmcmVxICopZGF0YTsNCiAgICBpbnQg ZXJyb3IgPSAwLCBzOw0KDQogICAgLypwcmludGYoIm9sdHIlZDogb2x0cl9p b2N0bFxuIiwgaWZwLT5pZl91bml0KTsqLw0KDQogICAgcyA9IHNwbGltcCgp Ow0KDQogICAgc3dpdGNoIChjbWQpIHsNCiAgIA0KICAgICAgICBjYXNlIFNJ T0NTSUZBRERSOg0KICAgICAgICBjYXNlIFNJT0NHSUZBRERSOg0KICAgICAg ICBjYXNlIFNJT0NTSUZNVFU6DQogICAgICAgICAgICBlcnJvciA9IGlzbzg4 MDI1X2lvY3RsKGlmcCwgY21kLCBkYXRhKTsNCiAgICAgICAgICAgIGJyZWFr Ow0KDQogICAgICAgIGNhc2UgU0lPQ1NJRkZMQUdTOg0KICAgICAgICAgICAg LyoNCiAgICAgICAgICAgICAqIElmIHRoZSBpbnRlcmZhY2UgaXMgbWFya2Vk IHVwIGFuZCBzdG9wcGVkLCB0aGVuIHN0YXJ0IGl0Lg0KICAgICAgICAgICAg ICogSWYgaXQgaXMgbWFya2VkIGRvd24gYW5kIHJ1bm5pbmcsIHRoZW4gc3Rv cCBpdC4NCiAgICAgICAgICAgICAqLw0KICAgICAgICAgICAgaWYgKGlmcC0+ aWZfZmxhZ3MgJiBJRkZfVVApIHsNCiAgICAgICAgICAgICAgICAgICAgaWYg KChpZnAtPmlmX2ZsYWdzICYgSUZGX1JVTk5JTkcpID09IDApDQogICAgICAg ICAgICAgICAgICAgICAgICAgICAgb2x0cl9pbml0KHNjKTsNCiAgICAgICAg ICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgICAgIGlmIChpZnAtPmlm X2ZsYWdzICYgSUZGX1JVTk5JTkcpIHsNCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICBvbHRyX3N0b3Aoc2MpOw0KICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGlmcC0+aWZfZmxhZ3MgJj0gfklGRl9SVU5OSU5HOw0KICAgICAg ICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAg IGlmICgoaWZwLT5pZl9mbGFncyAmIElGRl9QUk9NSVNDKSAhPSBzYy0+UHJv bWlzY01vZGUpIHsNCiAgICAgICAgICAgICAgICBpZiAoaWZwLT5pZl9mbGFn cyAmIElGRl9QUk9NSVNDKQ0KICAgICAgICAgICAgICAgICAgICBUUmxsZFNl dFByb21pc2N1b3VzTW9kZShzYy0+VFJsbGRBZGFwdGVyLCBPTFRSX1BST01J U0NfTU9ERSk7DQogICAgICAgICAgICAgICAgZWxzZQ0KICAgICAgICAgICAg ICAgICAgICBUUmxsZFNldFByb21pc2N1b3VzTW9kZShzYy0+VFJsbGRBZGFw dGVyLCAwKTsNCiAgICAgICAgICAgICAgICBzYy0+UHJvbWlzY01vZGUgPSAo aWZwLT5pZl9mbGFncyAmIElGRl9QUk9NSVNDKTsNCiAgICAgICAgICAgIH0N CiAgICAgICAgICAgIA0KICAgICAgICAgICAgYnJlYWs7DQogICAgICAgIGNh c2UgU0lPQ0dJRk1FRElBOg0KICAgICAgICBjYXNlIFNJT0NTSUZNRURJQToN CiAgICAgICAgICAgIGVycm9yID0gaWZtZWRpYV9pb2N0bChpZnAsIGlmciwg JnNjLT5pZm1lZGlhLCBjbWQpOw0KICAgICAgICAgICAgYnJlYWs7DQogICAg ICAgIGRlZmF1bHQ6DQogICAgICAgICAgICBlcnJvciA9IEVJTlZBTDsNCiAg ICB9DQogICAgc3BseChzKTsNCiAgICByZXR1cm4oZXJyb3IpOw0KfQ0KDQov Kg0KICogUE1XIENhbGxiYWNrIGZ1bmN0aW9ucyAtLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQogKi8NCg0K c3RhdGljIHZvaWQNCkRyaXZlclN1c3BlbmQoTWljcm9TZWNvb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F9PSykgew0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0ciVk OiBhZGFwdGVyIHN0YXR1cyBnb29kLiAoY2xvc2UgY29tcGxldGVkL3NlbGYt dGVzdClcbiIsIHNjLT51bml0KTsNCiAgICAgICAgICAgICAgICBpZiAoKHNj LT5od19zdGF0ZSA9PSBIV19MT0FESU5HKSB8fCAoc2MtPmh3X3N0YXRlID09 IEhXX0NMT1NJTkcpIHx8IChzYy0+aHdfc3RhdGUgPT0gSFdfQ0xPU0lORzIp KSB7DQogICAgICAgICAgICAgICAgICAgIHNjLT5od19zdGF0ZSA9IEhXX0NM T1NFRDsNCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7DQogICAgICAgICAg ICAgICAgfQ0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAg ICBwcmludGYoIm9sdHIlZDogU2VsZiB0ZXN0IGZhaWxlZDogIiwgc2MtPnVu aXQpOw0KICAgICAgICAgICAgICAgIHN3aXRjaCAoU3RhdHVzLT5TcGVjaWZp Y2F0aW9uLlNlbGZ0ZXN0U3RhdHVzKSB7DQogICAgICAgICAgICAgICAgICAg IGNhc2UgVFJMTERfU1RfRVJST1IgKyAwOiBwcmludGYoIkluaXRpYWwgVGVz dCBFcnJvclxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICBjYXNl IFRSTExEX1NUX0VSUk9SICsgMTogcHJpbnRmKCJBZGFwdGVyIFNvZnR3YXJl IENoZWNrc3VtIEVycm9yXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAgICAg ICAgIGNhc2UgVFJMTERfU1RfRVJST1IgKyAyOiBwcmludGYoIkFkYXB0ZXIg UkFNIEVycm9yXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAgICAgICAgIGNh c2UgVFJMTERfU1RfRVJST1IgKyA0OiBwcmludGYoIkluc3RydWN0aW9uIFRl c3QgRXJyb3JcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgY2Fz ZSBUUkxMRF9TVF9FUlJPUiArIDU6IHByaW50ZigiUHJvdG9jb2wgSGFuZGxl ci9SSSBIdyBFcnJvclxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgICAg ICBjYXNlIFRSTExEX1NUX0VSUk9SICsgNjogcHJpbnRmKCJTeXN0ZW0gSW50 ZXJmYWNlIFJlZ2lzdGVyIEVycm9yXG4iKTsgYnJlYWs7DQogICAgICAgICAg ICAgICAgICAgIGNhc2UgVFJMTERfU1RfVElNRU9VVDogICBwcmludGYoIlNl bGZ0ZXN0IGRpZCBub3QgY29tcGxldGVcbiIpOyBicmVhazsNCiAgICAgICAg ICAgICAgICAgICAgZGVmYXVsdDogcHJpbnRmKCJVbmtub3duIGVycm9yICgl eClcbiIsIFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5TZWxmdGVzdFN0YXR1cyk7 DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KICAgICAgICAg ICAgYnJlYWs7DQogICAgICAgIGNhc2UgVFJMTERfU1RTX0lOSVRfU1RBVFVT Og0KICAgICAgICAgICAgcHJpbnRmKCJvbHRyJWQ6IEFkYXB0ZXIgaW5pdGlh bGl6YXRpb24gZmFpbGVkOiAiLCBzYy0+dW5pdCk7DQogICAgICAgICAgICBz d2l0Y2goU3RhdHVzLT5TcGVjaWZpY2F0aW9uLkluaXRTdGF0dXMpIHsNCiAg ICAgICAgICAgICAgICBjYXNlIFRSTExEX0lOSVRfRVJST1IgKyAweDAxOiBw cmludGYoIkludmFsaWQgaW5pdCBibG9jayAoTExEIGVycm9yKVxuIik7IGJy ZWFrOw0KICAgICAgICAgICAgICAgIGNhc2UgVFJMTERfSU5JVF9FUlJPUiAr IDB4MDI6IHByaW50ZigiSW52YWxpZCBvcHRpb25zIChMTEQgZXJyb3IpXG4i KTsgYnJlYWs7DQogICAgICAgICAgICAgICAgY2FzZSBUUkxMRF9JTklUX0VS Uk9SICsgMHgwMzogcHJpbnRmKCJJbnZhbGlkIHJjdiBidXJzdCAoTExEIGVy cm9yKVxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgIGNhc2UgVFJMTERf SU5JVF9FUlJPUiArIDB4MDQ6IHByaW50ZigiSW52YWxpZCB4bXQgYnVyc3Qg KExMRCBlcnJvcilcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICBjYXNl IFRSTExEX0lOSVRfRVJST1IgKyAweDA1OiBwcmludGYoIkludmFsaWQgRE1B IHRocmVzaG9sZCAoTExEIGVycm9yKVxuIik7IGJyZWFrOw0KICAgICAgICAg ICAgICAgIGNhc2UgVFJMTERfSU5JVF9FUlJPUiArIDB4MDY6IHByaW50Zigi SW52YWxpZCBzY2IgYWRkclxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAg IGNhc2UgVFJMTERfSU5JVF9FUlJPUiArIDB4MDc6IHByaW50ZigiSW52YWxp ZCBzc2IgYWRkclxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgIGNhc2Ug VFJMTERfSU5JVF9FUlJPUiArIDB4MDg6IHByaW50ZigiRElPIHBhcml0eSBl cnJvciAoSFcgZXJyb3IpXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAgICAg Y2FzZSBUUkxMRF9JTklUX0VSUk9SICsgMHgwOTogcHJpbnRmKCJETUEgdGlt ZW91dCAoTWF5IGJlIGludGVycnVwdCBmYWlsaW5nIGlmIFBJTyBtb2RlIG9y IFBDSTIpXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAgICAgY2FzZSBUUkxM RF9JTklUX0VSUk9SICsgMHgwQTogcHJpbnRmKCJETUEgcGFyaXR5IGVycm9y IChIVyBlcnJvcilcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICBjYXNl IFRSTExEX0lOSVRfRVJST1IgKyAweDBCOiBwcmludGYoIkRNQSBidXMgZXJy b3IgKEhXIGVycm9yKVxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgIGNh c2UgVFJMTERfSU5JVF9FUlJPUiArIDB4MEM6IHByaW50ZigiRE1BIGRhdGEg ZXJyb3JcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICBjYXNlIFRSTExE X0lOSVRfRVJST1IgKyAweDBEOiBwcmludGYoIkFkYXB0ZXIgQ2hlY2tcbiIp OyBicmVhazsNCiAgICAgICAgICAgICAgICBjYXNlIFRSTExEX0lOSVRfVElN RU9VVDogICAgICBwcmludGYoIkFkYXB0ZXIgaW5pdGlhbGl6YXRpb24gZGlk IG5vdCBjb21wbGV0ZVxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgIGNh c2UgVFJMTERfSU5JVF9ETUFfRVJST1I6ICAgIHByaW50ZigiQWRhcHRlciBj YW5ub3QgYWNjZXNzIHN5c3RlbSBtZW1vcnlcbiIpOyBicmVhazsNCiAgICAg ICAgICAgICAgICBjYXNlIFRSTExEX0lOSVRfSU5UUl9FUlJPUjogICBwcmlu dGYoIkFkYXB0ZXIgY2Fubm90IGludGVycnVwdFxuIik7IGJyZWFrOw0KICAg ICAgICAgICAgICAgIGNhc2UgVFJMTERfT1BFTl9USU1FT1VUOiAgICAgIHBy aW50ZigiQWRhcHRlciBkaWQgbm90IGNvbXBsZXRlIG9wZW4gd2l0aGluIDMw IHNlY29uZHNcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICBjYXNlIFRS TExEX09QRU5fRVJST1IgKyAweDAxOiBwcmludGYoIkludmFsaWQgb3BlbiBv cHRpb25zIChMTEQgZXJyb3IpXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAg ICAgY2FzZSBUUkxMRF9PUEVOX0VSUk9SICsgMHgwNDogcHJpbnRmKCJUeEJ1 ZmZlciBjb3VudCBlcnJvciAoTExEIGVycm9yKVxuIik7IGJyZWFrOw0KICAg ICAgICAgICAgICAgIGNhc2UgVFJMTERfT1BFTl9FUlJPUiArIDB4MTA6IHBy aW50ZigiQnVmZmVyIHNpemUgZXJyb3IgKExMRCBlcnJvcilcbiIpOyBicmVh azsNCiAgICAgICAgICAgICAgICBjYXNlIFRSTExEX09QRU5fRVJST1IgKyAw eDIwOiBwcmludGYoIkxpc3Qgc2l6ZSBlcnJvciAoTExEIGVycm9yKVxuIik7 IGJyZWFrOw0KICAgICAgICAgICAgICAgIGRlZmF1bHQ6IA0KICAgICAgICAg ICAgICAgICAgICBpZiAoU3RhdHVzLT5TcGVjaWZpY2F0aW9uLkluaXRTdGF0 dXMgJiAweDcwMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNo IChTdGF0dXMtPlNwZWNpZmljYXRpb24uSW5pdFN0YXR1cyAmIDB4NzBGKSB7 DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUUkxMRF9PUEVO X1JFUEVBVCArIDB4MDE6IHByaW50ZigiTG9iZSBtZWRpYSB0ZXN0IC0gIik7 IGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFJM TERfT1BFTl9SRVBFQVQgKyAweDAyOiBwcmludGYoIlBoeXNpY2FsIGluc2Vy dGlvbiAtICIpOyBicmVhazsNCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICBjYXNlIFRSTExEX09QRU5fUkVQRUFUICsgMHgwMzogcHJpbnRmKCJBZGRy ZXNzIHZlcmlmaWNhdGlvbiAtICIpOyBicmVhazsNCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICBjYXNlIFRSTExEX09QRU5fUkVQRUFUICsgMHgwNDog cHJpbnRmKCJQYXJ0aWNpcGF0aW9uIGluIHJpbmcgcG9sbCAtICIpOyBicmVh azsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFRSTExEX09Q RU5fUkVQRUFUICsgMHgwNTogcHJpbnRmKCJSZXF1ZXN0IGluaXRpYWxpemF0 aW9uIC0gIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAg IGNhc2UgVFJMTERfT1BFTl9SRVBFQVQgKyAweDA5OiBwcmludGYoIlJlcXVl c3QgcmVnaXN0cmF0aW9uIChUWEkpIC0gIik7IGJyZWFrOw0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGNhc2UgVFJMTERfT1BFTl9SRVBFQVQgKyAw eDBBOiBwcmludGYoIkxvYmUgbWVkaWEgdGVzdCAoVFhJKSAtICIpOyBicmVh azsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OiAgICAg ICAgICAgICAgICAgICAgICAgcHJpbnRmKCJVbmtub3duIHBoYXNlICgleCkg LSAiLCBTdGF0dXMtPlNwZWNpZmljYXRpb24uSW5pdFN0YXR1cyAmIDB4MDBG KTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAg ICAgICAgICAgIHN3aXRjaCAoU3RhdHVzLT5TcGVjaWZpY2F0aW9uLkluaXRT dGF0dXMgJiAweDdGMCkgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAg IGNhc2UgVFJMTERfT1BFTl9SRVBFQVQgKyAweDEwOiBwcmludGYoIkZ1bmN0 aW9uIGZhaWx1cmUgKE5vIGNhYmxlPylcbiIpOyBicmVhazsNCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICBjYXNlIFRSTExEX09QRU5fUkVQRUFUICsg MHgyMDogcHJpbnRmKCJTaWduYWwgbG9zc1xuIik7IGJyZWFrOw0KICAgICAg ICAgICAgICAgICAgICAgICAgICAgIGNhc2UgVFJMTERfT1BFTl9SRVBFQVQg KyAweDUwOiBwcmludGYoIlRpbWVvdXRcbiIpOyBicmVhazsNCiAgICAgICAg ICAgICAgICAgICAgICAgICAgICBjYXNlIFRSTExEX09QRU5fUkVQRUFUICsg MHg2MDogcHJpbnRmKCJSaW5nIGZhaWx1cmUgKFRLUCkgLyBQcm90b2NvbCBl cnJvciAoVFhJKVxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGNhc2UgVFJMTERfT1BFTl9SRVBFQVQgKyAweDcwOiBwcmludGYo IlJpbmcgYmVhY29uaW5nXG4iKTsgYnJlYWs7DQogICAgICAgICAgICAgICAg ICAgICAgICAgICAgY2FzZSBUUkxMRF9PUEVOX1JFUEVBVCArIDB4ODA6IHBy aW50ZigiRHVwbGljYXRlIG5vZGUgYWRkcmVzcyAoVEtQKSAvIEluc2VydCBk ZW5pZWQgKFRYSSlcbiIpOyBicmVhazsNCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICBjYXNlIFRSTExEX09QRU5fUkVQRUFUICsgMHg5MDogcHJpbnRm KCJSZXF1ZXN0IGluaXRpYWxpemF0aW9uIChUS1ApXG4iKTsgYnJlYWs7DQog ICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUUkxMRF9PUEVOX1JF UEVBVCArIDB4YTA6IHByaW50ZigiUmVtb3ZlIHJlY2VpdmVkXG4iKTsgYnJl YWs7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBUUkxMRF9P UEVOX1JFUEVBVCArIDB4YjA6IHByaW50ZigiQy1wb3J0IGFkZHJlc3MgY2hh bmdlZCAoVFhJKVxuIik7IGJyZWFrOw0KICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGRlZmF1bHQ6ICAgICAgICAgICAgICAgICAgICAgICBwcmludGYo IlVua25vd24gdHlwZSAoJXgpXG4iLCBTdGF0dXMtPlNwZWNpZmljYXRpb24u SW5pdFN0YXR1cyAmIDB4MEYwKTsNCiAgICAgICAgICAgICAgICAgICAgICAg IH0NCiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAg ICAgICAgICAgICAgIHByaW50ZigiVW5rbm93biBlcnJvciAoJXgpXG4iLCBT dGF0dXMtPlNwZWNpZmljYXRpb24uSW5pdFN0YXR1cyk7IA0KICAgICAgICAg ICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgICAgICBicmVh azsNCiAgICAgICAgY2FzZSBUUkxMRF9TVFNfUklOR19TVEFUVVM6DQogICAg ICAgICAgICBpZiAoU3RhdHVzLT5TcGVjaWZpY2F0aW9uLlJpbmdTdGF0dXMg IT0gMCkgew0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0ciVkOiBSaW5n IHN0YXR1cyBjaGFuZ2U6ICIsIHNjLT51bml0KTsNCiAgICAgICAgICAgICAg ICBpZiAoU3RhdHVzLT5TcGVjaWZpY2F0aW9uLlJpbmdTdGF0dXMgJiBUUkxM RF9SU19IQVJEX0VSUk9SKSAgICAgICAgIHByaW50ZigiW0hhcmQgZXJyb3Jd ICIpOw0KICAgICAgICAgICAgICAgIGlmIChTdGF0dXMtPlNwZWNpZmljYXRp b24uUmluZ1N0YXR1cyAmIFRSTExEX1JTX1NPRlRfRVJST1IpICAgICAgICAg cHJpbnRmKCJbU29mdCBlcnJvcl0gIik7DQogICAgICAgICAgICAgICAgaWYg KFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5SaW5nU3RhdHVzICYgVFJMTERfUlNf VFJBTlNNSVRfQkVBQ09OKSAgICBwcmludGYoIltUcmFuc21pdCBiZWFjb25d ICIpOw0KICAgICAgICAgICAgICAgIGlmIChTdGF0dXMtPlNwZWNpZmljYXRp b24uUmluZ1N0YXR1cyAmIFRSTExEX1JTX0xPQkVfV0lSRV9GQVVMVCkgICAg cHJpbnRmKCJbV2lyZSBmYXVsdF0gIik7DQogICAgICAgICAgICAgICAgaWYg KFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5SaW5nU3RhdHVzICYgVFJMTERfUlNf QVVUT19SRU1PVkFMX0VSUk9SKSBwcmludGYoIltBdXRvIHJlbW92YWxdICIp Ow0KICAgICAgICAgICAgICAgIGlmIChTdGF0dXMtPlNwZWNpZmljYXRpb24u UmluZ1N0YXR1cyAmIFRSTExEX1JTX1JFTU9WRV9SRUNFSVZFRCkgICAgcHJp bnRmKCJbUmVtb3ZlIHJlY2VpdmVkXSAiKTsNCiAgICAgICAgICAgICAgICBp ZiAoU3RhdHVzLT5TcGVjaWZpY2F0aW9uLlJpbmdTdGF0dXMgJiBUUkxMRF9S U19DT1VOVEVSX09WRVJGTE9XKSAgIHByaW50ZigiW0NvdW50ZXIgb3ZlcmZs b3ddICIpOw0KICAgICAgICAgICAgICAgIGlmIChTdGF0dXMtPlNwZWNpZmlj YXRpb24uUmluZ1N0YXR1cyAmIFRSTExEX1JTX1NJTkdMRV9TVEFUSU9OKSAg ICAgcHJpbnRmKCJbU2luZ2xlIHN0YXRpb25dICIpOw0KICAgICAgICAgICAg ICAgIGlmIChTdGF0dXMtPlNwZWNpZmljYXRpb24uUmluZ1N0YXR1cyAmIFRS TExEX1JTX1JJTkdfUkVDT1ZFUlkpICAgICAgcHJpbnRmKCJbUmluZyByZWNv dmVyeV0gIik7DQogICAgICAgICAgICAgICAgcHJpbnRmKCJcbiIpOw0KICAg ICAgICAgICAgfQ0KICAgICAgICAgICAgYnJlYWs7DQogICAgICAgIGNhc2Ug VFJMTERfU1RTX0FEQVBURVJfQ0hFQ0s6DQogICAgICAgICAgICBwcmludGYo Im9sdHIlZDogQWRhcHRlciBjaGVjayAoJXggJXggJXggJXgpXG4iLCBzYy0+ dW5pdCwgU3RhdHVzLT5TcGVjaWZpY2F0aW9uLkFkYXB0ZXJDaGVja1swXSwg DQogICAgICAgICAgICAgICAgICAgIFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5B ZGFwdGVyQ2hlY2tbMV0sIFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5BZGFwdGVy Q2hlY2tbMl0sIA0KICAgICAgICAgICAgICAgICAgICBTdGF0dXMtPlNwZWNp ZmljYXRpb24uQWRhcHRlckNoZWNrWzNdKTsgDQogICAgICAgICAgICBicmVh azsNCiAgICAgICAgY2FzZSBUUkxMRF9TVFNfUFJPTUlTQ1VPVVNfU1RPUFBF RDoNCiAgICAgICAgICAgIHByaW50Zigib2x0ciVkOiBQcm9taXNjdW91cyBt b2RlIHN0b3BwZWQ6ICIsIHNjLT51bml0KTsNCiAgICAgICAgICAgIHN3aXRj aChTdGF0dXMtPlNwZWNpZmljYXRpb24uUHJvbVJlbW92ZWRDYXVzZSkgew0K ICAgICAgICAgICAgICAgIGNhc2UgVFJMTERfUFJPTV9SRU1PVkVfUkVDRUlW RUQ6IHByaW50ZigiUmVtb3ZlIHJlY2VpdmVkXG4iKTsgYnJlYWs7DQogICAg ICAgICAgICAgICAgY2FzZSBUUkxMRF9QUk9NX1BPTExfRkFJTFVSRTogICAg cHJpbnRmKCJQb2xsIGZhaWx1cmVcbiIpOyBicmVhazsNCiAgICAgICAgICAg ICAgICBkZWZhdWx0OiAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYo IlVua25vd24gKCV4KVxuIiwgU3RhdHVzLT5TcGVjaWZpY2F0aW9uLlByb21S ZW1vdmVkQ2F1c2UpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgYnJl YWs7DQogICAgICAgIGNhc2UgVFJMTERfU1RTX0xMRF9FUlJPUjoNCiAgICAg ICAgICAgIHByaW50Zigib2x0ciVkOiBMTEQgZXJyb3IgKCV4ICV4ICV4ICV4 KSAiLCBzYy0+dW5pdCwgU3RhdHVzLT5TcGVjaWZpY2F0aW9uLkludGVybmFs RXJyb3JbMF0sIA0KICAgICAgICAgICAgICAgICAgICBTdGF0dXMtPlNwZWNp ZmljYXRpb24uSW50ZXJuYWxFcnJvclsxXSwgU3RhdHVzLT5TcGVjaWZpY2F0 aW9uLkludGVybmFsRXJyb3JbMl0sIA0KICAgICAgICAgICAgICAgICAgICBT dGF0dXMtPlNwZWNpZmljYXRpb24uSW50ZXJuYWxFcnJvclszXSk7DQogICAg ICAgICAgICBicmVhazsNCiAgICAgICAgY2FzZSBUUkxMRF9TVFNfQURBUFRF Ul9USU1FT1VUOg0KICAgICAgICAgICAgcHJpbnRmKCJvbHRyJWQ6IEFkYXB0 ZXIgb3BlcmF0aW9uIHRpbWVkIG91dDogIiwgc2MtPnVuaXQpOw0KICAgICAg ICAgICAgc3dpdGNoKFN0YXR1cy0+U3BlY2lmaWNhdGlvbi5BZGFwdGVyVGlt ZW91dCkgew0KICAgICAgICAgICAgICAgIGNhc2UgVFJMTERfQ09NTUFORF9U SU1FT1VUOiAgIHByaW50ZigiQ29tbWFuZFxuIik7DQogICAgICAgICAgICAg ICAgY2FzZSBUUkxMRF9UUkFOU01JVF9USU1FT1VUOiAgcHJpbnRmKCJUcmFu c21pdFxuIik7DQogICAgICAgICAgICAgICAgY2FzZSBUUkxMRF9JTlRFUlJV UFRfVElNRU9VVDogcHJpbnRmKCJJbnRlcnJ1cHRcbiIpOw0KICAgICAgICAg ICAgICAgIGRlZmF1bHQ6ICAgICAgICAgICAgICAgICAgICAgIHByaW50Zigi VW5rbm93biAoJXgpXG4iLCBTdGF0dXMtPlNwZWNpZmljYXRpb24uQWRhcHRl clRpbWVvdXQpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgYnJlYWs7 DQogICAgICAgIGRlZmF1bHQ6DQogICAgICAgICAgICBwcmludGYoIm9sdHIl ZDogVW5rbm93biBzdGF0dXMgdHlwZSAoJXgpXG4iLCBzYy0+dW5pdCwgU3Rh dHVzLT5UeXBlKTsNCg0KICAgIH0NCiAgICBpZiAoU3RhdHVzLT5DbG9zZWQp IHsNCiAgICAgICAgaWYgKHNjLT5od19zdGF0ZSA+IEhXX0JBRCkgew0KICAg ICAgICAgICAgc2MtPmh3X3N0YXRlID0gSFdfRkFJTEVEOw0KICAgICAgICAg ICAgcHJpbnRmKCJvbHRyJWQ6IGNsb3NpbmcgYWRhcHRlciBkdWUgdG8gZmFp bHVyZS5cbiIsIHNjLT51bml0KTsNCiAgICAgICAgICAgIG9sdHJfc3RvcChz Yyk7DQogICAgICAgIH0NCiAgICB9DQp9DQoNCnN0YXRpYyB2b2lkDQpEcml2 ZXJDbG9zZUNvbXBsZXRlZChEcml2ZXJIYW5kbGUpDQogICAgdm9pZCAqRHJp dmVySGFuZGxlOw0Kew0KICAgIHN0cnVjdCBvbHRyX3NvZnRjICpzYyA9ICZv bHRyX3NvZnRjWyhpbnQpRHJpdmVySGFuZGxlXTsNCg0KIC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NQVNLXS5idWYpIHsNCiAgICAgICAgICAgIHByaW50 Zigib2x0ciVkOiByaW5nIGJ1ZmZlciBwb2ludGVyIGJsb3duXG4iLCBzYy0+ dW5pdCk7DQogICAgICAgICAgICBvbHRyX3N0b3Aoc2MpOw0KICAgICAgICAg ICAgcmV0dXJuOw0KICAgICAgICB9DQogICAgICAgIGlmIChSZWNlaXZlU3Rh dHVzID09IFRSTExEX1JDVl9PSykgeyAgICAvKiBSZWNlaXZlIGdvb2QgZnJh bWUgKi8NCiAgICAgICAgICAgIE1HRVRIRFIobTAsIE1fRE9OVFdBSVQsIE1U X0RBVEEpOw0KICAgICAgICAgICAgbWJ1Zl9zaXplID0gTUhMRU47DQogICAg ICAgICAgICBpZiAobTAgPT0gTlVMTCkgew0KICAgICAgICAgICAgICAgIGlm cC0+aWZfaWVycm9ycysrOw0KICAgICAgICAgICAgICAgIGdvdG8gb3V0Ow0K ICAgICAgICAgICAgfQ0KICAgICAgICAgICAgaWYgKEJ5dGVDb3VudCArIDIg PiBNSExFTikgew0KICAgICAgICAgICAgICAgIE1DTEdFVChtMCwgTV9ET05U V0FJVCk7DQogICAgICAgICAgICAgICAgbWJ1Zl9zaXplID0gTUNMQllURVM7 DQogICAgICAgICAgICAgICAgaWYgKChtMC0+bV9mbGFncyAmIE1fRVhUKSA9 PSAwKSB7DQogICAgICAgICAgICAgICAgICAgIG1fZnJlZW0obTApOw0KICAg ICAgICAgICAgICAgICAgICBpZnAtPmlmX2llcnJvcnMrKzsNCiAgICAgICAg ICAgICAgICAgICAgZ290byBvdXQ7DQogICAgICAgICAgICAgICAgfQ0KICAg ICAgICAgICAgfQ0KDQogICAgICAgICAgICBtMC0+bV9wa3RoZHIucmN2aWYg PSAmc2MtPmFycGNvbS5hY19pZjsNCiAgICAgICAgICAgIG0wLT5tX3BrdGhk ci5sZW4gPSBCeXRlQ291bnQ7DQogICAgICAgICAgICBtMC0+bV9sZW4gPSAw Ow0KICAgICAgICAgICAgbTAtPm1fZGF0YSArPSAyOw0KICAgICAgICAgICAg bWJ1Zl9zaXplIC09MjsNCiAgICAgICAgICAgIHRoID0gbXRvZChtMCwgc3Ry dWN0IGlzbzg4MDI1X2hlYWRlciAqKTsNCg0KICAgICAgICAgICAgbSA9IG0w OyBtYnVmX29mZnNldCA9IDA7IGZyYWdfb2Zmc2V0ID0gMDsNCiAgICAgICAg ICAgIHdoaWxlIChmcmFtZV9sZW4gPiAwKSB7DQogICAgICAgICAgICAgICAg bGVuZ3RoID0gTUlOMyhmcmFtZV9sZW4sIChSWF9CVUZGRVJfTEVOIC0gZnJh Z19vZmZzZXQpLCAobWJ1Zl9zaXplIC0gbWJ1Zl9vZmZzZXQpKTsNCiAgICAg ICAgICAgICAgICBiY29weShmcmFnICsgZnJhZ19vZmZzZXQsIG10b2QobSwg Y2hhciAqKSArIG1idWZfb2Zmc2V0LCBsZW5ndGgpOw0KICAgICAgICAgICAg ICAgIG0tPm1fbGVuICs9IGxlbmd0aDsNCiAgICAgICAgICAgICAgICBtYnVm X29mZnNldCArPSBsZW5ndGg7DQogICAgICAgICAgICAgICAgZnJhZ19vZmZz ZXQgKz0gbGVuZ3RoOw0KICAgICAgICAgICAgICAgIGZyYW1lX2xlbiAtPSBs ZW5ndGg7DQogICAgICAgICAgICAgICAgaWYgKGZyYWdfb2Zmc2V0ID09IFJY X0JVRkZFUl9MRU4pIHsNCiAgICAgICAgICAgICAgICAgICAgZnJhZyA9IHNj LT5yeF9idWZmZXJbKytqXS5idWY7DQogICAgICAgICAgICAgICAgICAgIGZy YWdfb2Zmc2V0ID0gMDsNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAg ICAgICAgaWYgKChtYnVmX29mZnNldCA9PSBtYnVmX3NpemUpICYmIChmcmFt ZV9sZW4gPiAwKSkgew0KICAgICAgICAgICAgICAgICAgICBNR0VUKG0xLCBN X0RPTlRXQUlULCBNVF9EQVRBKTsNCiAgICAgICAgICAgICAgICAgICAgbWJ1 Zl9zaXplID0gTUhMRU47DQogICAgICAgICAgICAgICAgICAgIGlmIChtMSA9 PSBOVUxMKSB7DQogICAgICAgICAgICAgICAgICAgICAgICBpZnAtPmlmX2ll cnJvcnMrKzsNCiAgICAgICAgICAgICAgICAgICAgICAgIG1fZnJlZW0obTAp Ow0KICAgICAgICAgICAgICAgICAgICAgICAgZ290byBvdXQ7DQogICAgICAg ICAgICAgICAgICAgIH0gIA0KICAgICAgICAgICAgICAgICAgICBpZiAoZnJh bWVfbGVuID4gTUhMRU4pIHsNCiAgICAgICAgICAgICAgICAgICAgICAgIE1D TEdFVChtMSwgTV9ET05UV0FJVCk7DQogICAgICAgICAgICAgICAgICAgICAg ICBtYnVmX3NpemUgPSBNQ0xCWVRFUzsNCiAgICAgICAgICAgICAgICAgICAg ICAgIGlmICgobTEtPm1fZmxhZ3MgJiBNX0VYVCkgPT0gMCkgew0KICAgICAg ICAgICAgICAgICAgICAgICAgICAgIG1fZnJlZW0obTApOw0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgIG1fZnJlZW0obTEpOw0KICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGlmcC0+aWZfaWVycm9ycysrOw0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgIGdvdG8gb3V0Ow0KICAgICAgICAgICAgICAg ICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAg ICAgICAgICAgIG0tPm1fbmV4dCA9IG0xOw0KICAgICAgICAgICAgICAgICAg ICBtID0gbTE7DQogICAgICAgICAgICAgICAgICAgIG1idWZfb2Zmc2V0ID0g MDsNCiAgICAgICAgICAgICAgICAgICAgbS0+bV9sZW4gPSAwOw0KICAgICAg ICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCiAgICAgICAgICAgIGlmcC0+ aWZfaXBhY2tldHMrKzsNCiAgICAgICAgDQojaWYgTkJQRklMVEVSID4gMA0K ICAgICAgICAgICAgaWYgKGlmcC0+aWZfYnBmKQ0KICAgICAgICAgICAgICAg IGJwZl9tdGFwKGlmcCwgbTApOw0KI2VuZGlmDQoNCiAgICAgICAgICAgIGlm IChpZnAtPmlmX2ZsYWdzICYgSUZGX1BST01JU0MpDQogICAgICAgICAgICAg ICAgaWYgKGJjbXAodGgtPmlzbzg4MDI1X2Rob3N0LCBldGhlcmJyb2FkY2Fz dGFkZHIsIHNpemVvZih0aC0+aXNvODgwMjVfZGhvc3QpKSAhPSAwKSB7DQog ICAgICAgICAgICAgICAgICAgIGlmICgoKHRoLT5pc284ODAyNV9kaG9zdFsw XSAmIDB4N2YpICE9IHNjLT5hcnBjb20uYWNfZW5hZGRyWzBdKSB8fA0KICAg ICAgICAgICAgICAgICAgICAgICAgKGJjbXAodGgtPmlzbzg4MDI1X2Rob3N0 ICsgMSwgc2MtPmFycGNvbS5hY19lbmFkZHIgKyAxLCBJU084ODAyNV9BRERS X0xFTiAtIDEpKSkgew0KCSAgICAgICAgICAgICAgICBtX2ZyZWVtKG0wKTsN CiAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gb3V0Ow0KICAgICAgICAg ICAgICAgICAgICB9DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgIG1h Y19oZHJfbGVuID0gSVNPODgwMjVfSERSX0xFTjsNCiAgICAgICAgICAgIGlm ICh0aC0+aXNvODgwMjVfc2hvc3RbMF0gJiAweDgwKSAvKiBDaGVjayBmb3Ig c291cmNlIHJvdXRpbmcgaW5mbyAqLw0KICAgICAgICAgICAgICAgIG1hY19o ZHJfbGVuICs9ICAobnRvaHModGgtPnJjZikgJiAweDFmMDApID4+IDg7DQog ICAgICAgICAgICANCiAgICAgICAgICAgIG0wLT5tX3BrdGhkci5sZW4gLT0g bWFjX2hkcl9sZW47DQogICAgICAgICAgICBtMC0+bV9sZW4gLT0gbWFjX2hk cl9sZW47DQogICAgICAgICAgICBtMC0+bV9kYXRhICs9IG1hY19oZHJfbGVu Ow0KDQogICAgICAgICAgICBpc284ODAyNV9pbnB1dCgmc2MtPmFycGNvbS5h Y19pZiwgdGgsIG0wKTsNCg0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAg ICAgaWYgKFJlY2VpdmVTdGF0dXMgIT0gVFJMTERfUkNWX05PX0RBVEEpIHsN CiAgICAgICAgICAgICAgICBwcmludGYoIm9sdHIlZDogcmVjZWl2ZSBlcnJv ci4gKFJlY2VpdmVTdGF0dXM9JWQpXG4iLCBzYy0+dW5pdCwgUmVjZWl2ZVN0 YXR1cyk7DQogICAgICAgICAgICAgICAgaWZwLT5pZl9pZXJyb3JzKys7DQog ICAgICAgICAgICB9DQogICAgICAgIH0NCm91dDoNCiAgICAgICAgd2hpbGUg KEZyYWdtZW50Q291bnQgPiAwKSB7DQogICAgICAgICAgICByYyA9IFRSbGxk UmVjZWl2ZUZyYWdtZW50KHNjLT5UUmxsZEFkYXB0ZXIsIA0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopc2MtPnJ4X2J1 ZmZlcltzYy0+cnhfbmV4dCAmIFJYX0xJU1RfTUFTS10uYnVmLA0KICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGt2dG9wKHNjLT5yeF9i dWZmZXJbc2MtPnJ4X25leHQgJiBSWF9MSVNUX01BU0tdLmJ1ZiksDQogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUlhfQlVGRkVSX0xF TiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9p ZCAqKXNjLT5yeF9idWZmZXJbc2MtPnJ4X25leHQgJiBSWF9MSVNUX01BU0td LmluZGV4KTsNCiAgICAgICAgICAgIGlmIChyYyA9PSBUUkxMRF9SRUNFSVZF X09LKSB7DQogICAgICAgICAgICAgICAgc2MtPnJ4X25leHQrKzsNCiAgICAg ICAgICAgICAgICBGcmFnbWVudENvdW50LS07DQogICAgICAgICAgICB9IGVs c2Ugew0KICAgICAgICAgICAgICAgIHByaW50Zigib2x0ciVkOiBBZGFwdGVy IHJlZnVzZWQgZnJhZ21lbnQg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LCBEV29yZENvdW50KQ0KICAg IHVuc2lnbmVkIHNob3J0IElPQWRkcmVzczsNCiAgICB1bnNpZ25lZCBsb25n ICAqRGF0YVBvaW50ZXI7DQogICAgaW50IERXb3JkQ291bnQ7DQp7DQogICAg aW5zbChJT0FkZHJlc3MsICh2b2lkICopRGF0YVBvaW50ZXIsIERXb3JkQ291 bnQpOw0KfQ0KI2VuZGlmIC8qIFRSbGxkSW5saW5lSU8gKi8NCg0KI2VuZGlm IC8qIE5PTFRSICovDQo= --0-519715650-918591506=:14147-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9902091456290.14147-200000>