Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2008 14:19:33 -0500
From:      Ryan Tomayko <rtomayko@gmail.com>
To:        "Sergey A. Osokin" <osa@FreeBSD.org>
Cc:        ports@freebsd.org
Subject:   nginx upstream_fair module patch
Message-ID:  <47C46645.80700@gmail.com>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060305020001060608010404
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hello Sergey,

There is an experimental module for nginx that adds fair upstream/proxy
balancing (note that this is a "third party" patch, not an optional
nginx module):

    http://wiki.codemongers.com/NginxHttpUpstreamFairModule

We've modified the nginx port to include the patch and added a knob for
enabling it. I wasn't sure if this was something that's acceptable to
include in the official nginx port but I've attached a patch in case
you're interested.

The patch should apply cleanly with:

    cd /usr/ports/www/nginx
    patch -p1 < nginx-port-upstream-fair.diff

I also have a git repo that tracks the nginx port tree with a branch for
the upstream_fair patch:

    http://github.com/rtomayko/nginx-port-upstream-fair/tree/master

If this is something that's acceptable for EXTRA_PATCHES, I'd be happy
to sign up for testing/maintaining the patch through new versions of nginx.

I apologize if I'm not correctly following any of the precepts for
submitting port change requests; I've seen different instructions. Some
say to submit a pr with a shar file and others say that most small
tweaks should be directed to the mailing list. Any direction here is
appreciated.

Thanks
--
Ryan Tomayko <rtomayko@gmail.com>

http://tomayko.com
http://lesscode.org


--------------060305020001060608010404
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
	name="nginx-port-upstream-fair.diff"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="nginx-port-upstream-fair.diff"

ZGlmZiAtLWdpdCBhL01ha2VmaWxlIGIvTWFrZWZpbGUKaW5kZXggOTg4ZTE4Yi4uZDYxZjk4
NSAxMDA2NDQKLS0tIGEvTWFrZWZpbGUKKysrIGIvTWFrZWZpbGUKQEAgLTIwLDYgKzIwLDcg
QEAgT1BUSU9OUz0JREVCVUcgIkVuYWJsZSBuZ2lueCBkZWJ1Z2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LjAwMDAwMDAwMCAtMDUwMAorQEAgLTAsMCArMSw4ODAgQEAKKysvKgor
KyAqIENvcHlyaWdodCAoQykgMjAwNyBHcnplZ29yeiBOb3NlaworKyAqIFdvcmsgc3BvbnNv
cmVkIGJ5IEV6cmEgWnlnbXVudG93aWN6ICYgRW5naW5lWWFyZC5jb20KKysgKgorKyAqIEJh
c2VkIG9uIG5naW54IHNvdXJjZSAoQykgSWdvciBTeXNvZXYKKysgKi8KKysKKysjaW5jbHVk
ZSA8bmd4X2NvbmZpZy5oPgorKyNpbmNsdWRlIDxuZ3hfY29yZS5oPgorKyNpbmNsdWRlIDxu
Z3hfaHR0cC5oPgorKworK3R5cGVkZWYgc3RydWN0IHsKKysgICAgbmd4X2F0b21pY190ICAg
ICAgICAgICAgICAgICAgICAgICAgbnJlcTsKKysgICAgbmd4X2F0b21pY190ICAgICAgICAg
ICAgICAgICAgICAgICAgbGFzdF9hY3RpdmU7CisrfSBuZ3hfaHR0cF91cHN0cmVhbV9mYWly
X3NoYXJlZF90OworKworKworK3R5cGVkZWYgc3RydWN0IHsKKysgICAgbmd4X3JidHJlZV9u
b2RlX3QgICAgICAgICAgICAgICAgICAgbm9kZTsKKysgICAgbmd4X2N5Y2xlX3QgICAgICAg
ICAgICAgICAgICAgICAgICAqY3ljbGU7CisrICAgIHZvaWQgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgKnBlZXJzOyAgICAgIC8qIGZvcm1zIGEgdW5pcXVlIGNvb2tpZSB0b2dl
dGhlciB3aXRoIGN5Y2xlICovCisrICAgIG5neF9pbnRfdCAgICAgICAgICAgICAgICAgICAg
ICAgICAgIHJlZmNvdW50OyAgIC8qIGFjY2Vzc2VkIG9ubHkgdW5kZXIgc2htdHhfbG9jayAq
LworKyAgICBuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3NoYXJlZF90ICAgICBzdGF0c1sxXTsK
Kyt9IG5neF9odHRwX3Vwc3RyZWFtX2ZhaXJfc2htX2Jsb2NrX3Q7CisrCisrCisrdHlwZWRl
ZiBzdHJ1Y3QgeworKyAgICBuZ3hfY3ljbGVfdCAgICAgICAgICAgICAgICAgICAgICAgICpj
eWNsZTsKKysgICAgbmd4X2h0dHBfdXBzdHJlYW1fZmFpcl9zaG1fYmxvY2tfdCAqc2hhcmVk
OworKyAgICBuZ3hfaHR0cF91cHN0cmVhbV9ycl9wZWVyc190ICAgICAgICpycnA7CisrICAg
IG5neF91aW50X3QgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnQ7CisrICAgIG5n
eF91aW50X3QgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfZXJyOjE7CisrfSBuZ3hf
aHR0cF91cHN0cmVhbV9mYWlyX3BlZXJzX3Q7CisrCisrCisrI2RlZmluZSBOR1hfUEVFUl9J
TlZBTElEICh+MFVMKQorKworKworK3R5cGVkZWYgc3RydWN0IHsKKysgICAgbmd4X2h0dHBf
dXBzdHJlYW1fZmFpcl9zaGFyZWRfdCAgICAqc2hhcmVkOworKyAgICBuZ3hfaHR0cF91cHN0
cmVhbV9ycl9wZWVyc190ICAgICAgICpycnA7CisrICAgIG5neF9odHRwX3Vwc3RyZWFtX2Zh
aXJfcGVlcnNfdCAgICAgKnBlZXJzOworKyAgICBuZ3hfdWludF90ICAgICAgICAgICAgICAg
ICAgICAgICAgICBjdXJyZW50OworKyAgICB1aW50cHRyX3QgICAgICAgICAgICAgICAgICAg
ICAgICAgICp0cmllZDsKKysgICAgdWludHB0cl90ICAgICAgICAgICAgICAgICAgICAgICAg
ICAgZGF0YTsKKyt9IG5neF9odHRwX3Vwc3RyZWFtX2ZhaXJfcGVlcl9kYXRhX3Q7CisrCisr
Cisrc3RhdGljIG5neF9pbnRfdCBuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX2luaXRfbW9kdWxl
KG5neF9jeWNsZV90ICpjeWNsZSk7Cisrc3RhdGljIG5neF9pbnRfdCBuZ3hfaHR0cF91cHN0
cmVhbV9pbml0X2ZhaXIobmd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KyNlbmRpZgorKworK3N0YXRpYyBuZ3hfY29tbWFuZF90ICBuZ3hfaHR0cF91cHN0
cmVhbV9mYWlyX2NvbW1hbmRzW10gPSB7CisrCisrICAgIHsgbmd4X3N0cmluZygiZmFpciIp
LAorKyAgICAgIE5HWF9IVFRQX1VQU19DT05GfE5HWF9DT05GX05PQVJHUywKKysgICAgICBu
Z3hfaHR0cF91cHN0cmVhbV9mYWlyLAorKyAgICAgIDAsCisrICAgICAgMCwKKysgICAgICBO
VUxMIH0sCisrCisrICAgIHsgbmd4X3N0cmluZygidXBzdHJlYW1fZmFpcl9zaG1fc2l6ZSIp
LAorKyAgICAgIE5HWF9IVFRQX01BSU5fQ09ORnxOR1hfQ09ORl9UQUtFMSwKKysgICAgICBu
Z3hfaHR0cF91cHN0cmVhbV9mYWlyX3NldF9zaG1fc2l6ZSwKKysgICAgICAwLAorKyAgICAg
IDAsCisrICAgICAgTlVMTCB9LAorKworKyAgICAgIG5neF9udWxsX2NvbW1hbmQKKyt9Owor
KworKworK3N0YXRpYyBuZ3hfaHR0cF9tb2R1bGVfdCAgbmd4X2h0dHBfdXBzdHJlYW1fZmFp
cl9tb2R1bGVfY3R4ID0geworKyAgICBOVUxMLCAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAvKiBwcmVjb25maWd1cmF0aW9uICovCisrICAgIE5VTEwsICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIC8qIHBvc3Rjb25maWd1cmF0aW9uICovCisrCisrICAg
IE5VTEwsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGNyZWF0ZSBtYWlu
IGNvbmZpZ3VyYXRpb24gKi8KKysgICAgTlVMTCwgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgLyogaW5pdCBtYWluIGNvbmZpZ3VyYXRpb24gKi8KKysKKysgICAgTlVMTCwg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyogY3JlYXRlIHNlcnZlciBjb25m
aWd1cmF0aW9uICovCisrICAgIE5VTEwsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIC8qIG1lcmdlIHNlcnZlciBjb25maWd1cmF0aW9uICovCisrCisrICAgIE5VTEwsICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGNyZWF0ZSBsb2NhdGlvbiBjb25m
aWd1cmF0aW9uICovCisrICAgIE5VTEwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIC8qIG1lcmdlIGxvY2F0aW9uIGNvbmZpZ3VyYXRpb24gKi8KKyt9OworKworKworK25n
eF9tb2R1bGVfdCAgbmd4X2h0dHBfdXBzdHJlYW1fZmFpcl9tb2R1bGUgPSB7CisrICAgIE5H
WF9NT0RVTEVfVjEsCisrICAgICZuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX21vZHVsZV9jdHgs
IC8qIG1vZHVsZSBjb250ZXh0ICovCisrICAgIG5neF9odHRwX3Vwc3RyZWFtX2ZhaXJfY29t
bWFuZHMsICAgIC8qIG1vZHVsZSBkaXJlY3RpdmVzICovCisrICAgIE5HWF9IVFRQX01PRFVM
RSwgICAgICAgICAgICAgICAgICAgICAgIC8qIG1vZHVsZSB0eXBlICovCisrICAgIE5VTEws
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGluaXQgbWFzdGVyICovCisr
ICAgIE5VTEwsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIGluaXQgbW9k
dWxlICovCisrICAgIE5VTEwsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8q
IGluaXQgcHJvY2VzcyAqLworKyAgICBOVUxMLCAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAvKiBpbml0IHRocmVhZCAqLworKyAgICBOVUxMLCAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAvKiBleGl0IHRocmVhZCAqLworKyAgICBOVUxMLCAgICAgICAg
ICAgICAgICAgICAg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AgIGlmIChsZWZ0LT5wZWVycyA8IHJpZ2h0LT5wZWVycykgeworKyAgICAg
ICAgICAgIHJldHVybiAtMTsKKysgICAgICAgIH0gZWxzZSBpZiAobGVmdC0+cGVlcnMgPiBy
aWdodC0+cGVlcnMpIHsKKysgICAgICAgICAgICByZXR1cm4gMTsKKysgICAgICAgIH0gZWxz
ZSB7CisrICAgICAgICAgICAgcmV0dXJuIDA7CisrICAgICAgICB9CisrICAgIH0KKyt9Cisr
CisrLyoKKysgKiBnZW5lcmljIGZ1bmN0aW9ucyBzdGFydCBoZXJlCisrICovCisrc3RhdGlj
IHZvaWQKKytuZ3hfcmJ0cmVlX2dlbmVyaWNfaW5zZXJ0KG5neF9yYnRyZWVfbm9kZV90ICp0
ZW1wLAorKyAgICBuZ3hfcmJ0cmVlX25vZGVfdCAqbm9kZSwgbmd4X3JidHJlZV9ub2RlX3Qg
KnNlbnRpbmVsLAorKyAgICBpbnQgKCpjb21wYXJlKShjb25zdCBuZ3hfcmJ0cmVlX25vZGVf
dCAqbGVmdCwgY29uc3Qgbmd4X3JidHJlZV9ub2RlX3QgKnJpZ2h0KSkKKyt7CisrICAgIGZv
ciAoIDs7ICkgeworKyAgICAgICAgaWYgKG5vZGUtPmtleSA8IHRlbXAtPmtleSkgeworKwor
KyAgICAgICAgICAgIGlmICh0ZW1wLT5sZWZ0ID09IHNlbnRpbmVsKSB7CisrICAgICAgICAg
ICAgICAgIHRlbXAtPmxlZnQgPSBub2RlOworKyAgICAgICAgICAgICAgICBicmVhazsKKysg
ICAgICAgICAgICB9CisrCisrICAgICAgICAgICAgdGVtcCA9IHRlbXAtPmxlZnQ7CisrCisr
ICAgICAgICB9IGVsc2UgaWYgKG5vZGUtPmtleSA+IHRlbXAtPmtleSkgeworKworKyAgICAg
ICAgICAgIGlmICh0ZW1wLT5yaWdodCA9PSBzZW50aW5lbCkgeworKyAgICAgICAgICAgICAg
ICB0ZW1wLT5yaWdodCA9IG5vZGU7CisrICAgICAgICAgICAgICAgIGJyZWFrOworKyAgICAg
ICAgICAgIH0KKysKKysgICAgICAgICAgICB0ZW1wID0gdGVtcC0+cmlnaHQ7CisrCisrICAg
ICAgICB9IGVsc2UgeyAvKiBub2RlLT5rZXkgPT0gdGVtcC0+a2V5ICovCisrICAgICAgICAg
ICAgaWYgKGNvbXBhcmUobm9kZSwgdGVtcCkgPCAwKSB7CisrCisrICAgICAgICAgICAgICAg
IGlmICh0ZW1wLT5sZWZ0ID09IHNlbnRpbmVsKSB7CisrICAgICAgICAgICAgICAgICAgICB0
ZW1wLT5sZWZ0ID0gbm9kZTsKKysgICAgICAgICAgICAgICAgICAgIGJyZWFrOworKyAgICAg
ICAgICAgICAgICB9CisrCisrICAgICAgICAgICAgICAgIHRlbXAgPSB0ZW1wLT5sZWZ0Owor
KworKyAgICAgICAgICAgIH0gZWxzZSB7CisrCisrICAgICAgICAgICAgICAgIGlmICh0ZW1w
LT5yaWdodCA9PSBzZW50aW5lbCkgeworKyAgICAgICAgICAgICAgICAgICAgdGVtcC0+cmln
aHQgPSBub2RlOworKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisrICAgICAgICAgICAg
ICAgIH0KKysKKysgICAgICAgICAgICAgICAgdGVtcCA9IHRlbXAtPnJpZ2h0OworKyAgICAg
ICAgICAgIH0KKysgICAgICAgIH0KKysgICAgfQorKworKyAgICBub2RlLT5wYXJlbnQgPSB0
ZW1wOworKyAgICBub2RlLT5sZWZ0ID0gc2VudGluZWw7CisrICAgIG5vZGUtPnJpZ2h0ID0g
c2VudGluZWw7CisrICAgIG5neF9yYnRfcmVkKG5vZGUpOworK30KKysKKysjZGVmaW5lIE5H
WF9CSVRWRUNUT1JfRUxUX1NJWkUgKHNpemVvZih1aW50cHRyX3QpICogOCkKKysKKytzdGF0
aWMgdWludHB0cl90ICoKKytuZ3hfYml0dmVjdG9yX2FsbG9jKG5neF9wb29sX3QgKnBvb2ws
IG5neF91aW50X3Qgc2l6ZSwgdWludHB0cl90ICpzbWFsbCkKKyt7CisrICAgIG5neF91aW50
X3QgbmVsdHMgPSAoc2l6ZSArIE5HWF9CSVRWRUNUT1JfRUxUX1NJWkUgLSAxKSAvIE5HWF9C
SVRWRUNUT1JfRUxUX1NJWkU7CisrCisrICAgIGlmIChzbWFsbCAmJiBuZWx0cyA9PSAxKSB7
CisrICAgICAgICAqc21hbGwgPSAwOworKyAgICAgICAgcmV0dXJuIHNtYWxsOworKyAgICB9
CisrCisrICAgIHJldHVybiBuZ3hfcGNhbGxvYyhwb29sLCBuZWx0cyAqIE5HWF9CSVRWRUNU
T1JfRUxUX1NJWkUpOworK30KKysKKytzdGF0aWMgbmd4X2ludF90Cisrbmd4X2JpdHZlY3Rv
cl90ZXN0KHVpbnRwdHJfdCAqYnYsIG5neF91aW50X3QgYml0KQorK3sKKysgICAgbmd4X3Vp
bnRfdCAgICAgICAgICAgICAgICAgICAgICBuLCBtOworKworKyAgICBuID0gYml0IC8gTkdY
X0JJVFZFQ1RPUl9FTFRfU0laRTsKKysgICAgbSA9IDEgPDwgKGJpdCAlIE5HWF9CSVRWRUNU
T1JfRUxUX1NJWkUpOworKworKyAgICByZXR1cm4gYnZbbl0gJiBtOworK30KKysKKytzdGF0
aWMgdm9pZAorK25neF9iaXR2ZWN0b3Jfc2V0KHVpbnRwdHJfdCAqYnYsIG5neF91aW50X3Qg
Yml0KQorK3sKKysgICAgbmd4X3VpbnRfdCAgICAgICAgICAgICAgICAgICAgICBuLCBtOwor
KworKyAgICBuID0gYml0IC8gTkdYX0JJVFZFQ1RPUl9FTFRfU0laRTsKKysgICAgbSA9IDEg
PDwgKGJpdCAlIE5HWF9CSVRWRUNUT1JfRUxUX1NJWkUpOworKworKyAgICBidltuXSB8PSBt
OworK30KKysKKysvKgorKyAqIGdlbmVyaWMgZnVuY3Rpb25zIGVuZCBoZXJlCisrICovCisr
Cisrc3RhdGljIHZvaWQKKytuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3JidHJlZV9pbnNlcnQo
bmd4X3JidHJlZV9ub2RlX3QgKnRlbXAsCisrICAgIG5neF9yYnRyZWVfbm9kZV90ICpub2Rl
LCBuZ3hfcmJ0cmVlX25vZGVfdCAqc2VudGluZWwpIHsKKysKKysgICAgbmd4X3JidHJlZV9n
ZW5lcmljX2luc2VydCh0ZW1wLCBub2RlLCBzZW50aW5lbCwKKysgICAgICAgIG5neF9odHRw
X3Vwc3RyZWFtX2ZhaXJfY29tcGFyZV9yYnRyZWVfbm9kZSk7CisrfQorKworKworK3N0YXRp
YyBuZ3hfaW50X3QKKytuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX2luaXRfc2htX3pvbmUobmd4
X3NobV96b25lX3QgKnNobV96b25lLCB2b2lkICpkYXRhKQorK3sKKysgICAgbmd4X3NsYWJf
cG9vbF90ICAgICAgICAgICAgICAgICpzaHBvb2w7CisrICAgIG5neF9yYnRyZWVfdCAgICAg
ICAgICAgICAgICAgICAqdHJlZTsKKysgICAgbmd4X3JidHJlZV9ub2RlX3QgICAgICAgICAg
ICAgICpzZW50aW5lbDsKKysKKysgICAgaWYgKGRhdGEpIHsKKysgICAgICAgIHNobV96b25l
LT5kYXRhID0gZGF0YTsKKysgICAgICAgIHJldHVybiBOR1hfT0s7CisrICAgIH0KKysKKysg
ICAgc2hwb29sID0gKG5neF9zbGFiX3Bvb2xfdCAqKSBzaG1fem9uZS0+c2htLmFkZHI7Cisr
ICAgIHRyZWUgPSBuZ3hfc2xhYl9hbGxvYyhzaHBvb2wsIHNpemVvZiAqdHJlZSk7CisrICAg
IGlmICh0cmVlID09IE5VTEwpIHsKKysgICAgICAgIHJldHVybiBOR1hfRVJST1I7CisrICAg
IH0KKysKKysgICAgc2VudGluZWwgPSBuZ3hfc2xhYl9hbGxvYyhzaHBvb2wsIHNpemVvZiAq
c2VudGluZWwpOworKyAgICBpZiAoc2VudGluZWwgPT0gTlVMTCkgeworKyAgICAgICAgcmV0
dXJuIE5HWF9FUlJPUjsKKysgICAgfQorKworKyAgICBuZ3hfcmJ0c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ysKKysgICAgdXNjZiA9IG5neF9odHRwX2NvbmZfZ2V0X21vZHVsZV9zcnZf
Y29uZihjZiwgbmd4X2h0dHBfdXBzdHJlYW1fbW9kdWxlKTsKKysKKysgICAgdXNjZi0+cGVl
ci5pbml0X3Vwc3RyZWFtID0gbmd4X2h0dHBfdXBzdHJlYW1faW5pdF9mYWlyOworKworKyAg
ICB1c2NmLT5mbGFncyA9IE5HWF9IVFRQX1VQU1RSRUFNX0NSRUFURQorKyAgICAgICAgICAg
ICAgICAgIHxOR1hfSFRUUF9VUFNUUkVBTV9XRUlHSFQKKysgICAgICAgICAgICAgICAgICB8
TkdYX0hUVFBfVVBTVFJFQU1fTUFYX0ZBSUxTCisrICAgICAgICAgICAgICAgICAgfE5HWF9I
VFRQX1VQU1RSRUFNX0ZBSUxfVElNRU9VVAorKyAgICAgICAgICAgICAgICAgIHxOR1hfSFRU
UF9VUFNUUkVBTV9ET1dOOworKworKyAgICByZXR1cm4gTkdYX0NPTkZfT0s7CisrfQorKwor
KworK3N0YXRpYyBuZ3hfaW50X3QKKytuZ3hfaHR0cF91cHN0cmVhbV9pbml0X2ZhaXIobmd4
X2NvbmZfdCAqY2YsIG5neF9odHRwX3Vwc3RyZWFtX3Nydl9jb25mX3QgKnVzKQorK3sKKysg
ICAgbmd4X2h0dHBfdXBzdHJlYW1fZmFpcl9wZWVyc190ICAgICAqcGVlcnM7CisrICAgIG5n
eF91aW50X3QgICAgICAgICAgICAgICAgICAgICAgICAgIG47CisrICAgIG5neF9zdHJfdCAg
ICAgICAgICAgICAgICAgICAgICAgICAgKnNobV9uYW1lOworKworKyAgICAvKiBkbyB0aGUg
ZGlydHkgd29yayB1c2luZyByciBtb2R1bGUgKi8KKysgICAgaWYgKG5neF9odHRwX3Vwc3Ry
ZWFtX2luaXRfcm91bmRfcm9iaW4oY2YsIHVzKSAhPSBOR1hfT0spIHsKKysgICAgICAgIHJl
dHVybiBOR1hfRVJST1I7CisrICAgIH0KKysKKysgICAgLyogc2V0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ZCkpCisrICAgICAgICByZXR1cm4gTkdYX0JVU1k7
CisrCisrICAgIHBlZXIgPSAmZnAtPnJycC0+cGVlcltwZWVyX2lkXTsKKysKKysgICAgaWYg
KCFwZWVyLT5kb3duKSB7CisrICAgICAgICBpZiAocGVlci0+bWF4X2ZhaWxzID09IDAgfHwg
cGVlci0+ZmFpbHMgPCBwZWVyLT5tYXhfZmFpbHMpIHsKKysgICAgICAgICAgICByZXR1cm4g
TkdYX09LOworKyAgICAgICAgfQorKworKyAgICAgICAgaWYgKG5vdyAtIHBlZXItPmFjY2Vz
c2VkID4gcGVlci0+ZmFpbF90aW1lb3V0KSB7CisrICAgICAgICAgICAgcGVlci0+ZmFpbHMg
PSAwOworKyAgICAgICAgICAgIHJldHVybiBOR1hfT0s7CisrICAgICAgICB9CisrICAgIH0K
KysKKysgICAgbmd4X2JpdHZlY3Rvcl9zZXQoZnAtPnRyaWVkLCBwZWVyX2lkKTsKKysKKysg
ICAgaWYgKHBjKQorKyAgICAgICAgcGMtPnRyaWVzLS07CisrICAgIHJldHVybiBOR1hfQlVT
WTsKKyt9CisrCisrc3RhdGljIG5neF9pbnRfdAorK25neF9odHRwX3Vwc3RyZWFtX2Nob29z
ZV9mYWlyX3BlZXIobmd4X3BlZXJfY29ubmVjdGlvbl90ICpwYywKKysgICAgbmd4X2h0dHBf
dXBzdHJlYW1fZmFpcl9wZWVyX2RhdGFfdCAqZnAsIG5neF91aW50X3QgKnBlZXJfaWQpCisr
eworKyAgICBuZ3hfdWludF90ICAgICAgICAgICAgICAgICAgICAgICAgICBpLCBuOworKyAg
ICBuZ3hfdWludF90ICAgICAgICAgICAgICAgICAgICAgICAgICBucGVlcnM7CisrICAgIG5n
eF9odHRwX3Vwc3RyZWFtX2ZhaXJfc2hhcmVkX3QgICAgIGZzYzsKKysgICAgdGltZV90ICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgbm93OworKyAgICBuZ3hfdWludF90ICAgICAg
ICAgICAgICAgICAgICAgICAgICBiZXN0X3NjaGVkX3Njb3JlID0gVUlOVF9NQVgsIHNjaGVk
X3Njb3JlOworKworKyAgICBucGVlcnMgPSBmcC0+cnJwLT5udW1iZXI7CisrCisrICAgIC8q
IGp1c3QgYSBzaW5nbGUgYmFja2VuZCAqLworKyAgICBpZiAobnBlZXJzID09IDEpIHsKKysg
ICAgICAgICpwZWVyX2lkID0gMDsKKysgICAgICAgIHJldHVybiBOR1hfT0s7CisrICAgIH0K
KysKKysgICAgbm93ID0gbmd4X3RpbWUoKTsKKysKKysgICAgLyogYW55IGlkbGUgYmFja2Vu
ZHM/ICovCisrICAgIGZvciAoaSA9IDAsIG4gPSBmcC0+Y3VycmVudDsgaSA8IG5wZWVyczsg
aSsrLCBuID0gKG4gKyAxKSAlIG5wZWVycykgeworKyAgICAgICAgaWYgKG5neF9hdG9taWNf
ZmV0Y2hfYWRkKCZmcC0+c2hhcmVkW25dLm5yZXEsIDApID09IDAgJiYKKysgICAgICAgICAg
ICBuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3RyeV9wZWVyKHBjLCBmcCwgbiwgbm93KSA9PSBO
R1hfT0spIHsKKysKKysgICAgICAgICAgICBuZ3hfbG9nX2RlYnVnMShOR1hfTE9HX0RFQlVH
X0hUVFAsIHBjLT5sb2csIDAsICJbdXBzdHJlYW1fZmFpcl0gcGVlciAlaSBpcyBpZGxlIiwg
bik7CisrICAgICAgICAgICAgKnBlZXJfaWQgPSBuOworKyAgICAgICAgICAgIHJldHVybiBO
R1hfT0s7CisrICAgICAgICB9CisrICAgIH0KKysKKysgICAgLyoKKysgICAgICogY2FsY3Vs
YXRlIHNjaGVkIHNjb3JlcyBmb3IgYWxsIHRoZSBwZWVycywgY2hvb3NpbmcgdGhlIGxvd2Vz
dCBvbmUKKysgICAgICovCisrICAgIGZvciAoaSA9IDA7IGkgPCBucGVlcnM7IGkrKywgbiA9
IChuICsgMSkgJSBucGVlcnMpIHsKKysgICAgICAgIG5neF9odHRwX3Vwc3RyZWFtX3J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mZnNjLCBwZWVyLCBuKTsKKysKKysgICAgICAgIC8qCisrICAg
ICAgICAgKiB0YWtlIHBlZXIgd2VpZ2h0IGludG8gYWNjb3VudAorKyAgICAgICAgICovCisr
ICAgICAgICBpZiAocGVlci0+Y3VycmVudF93ZWlnaHQgPiAwKSB7CisrICAgICAgICAgICAg
c2NoZWRfc2NvcmUgLz0gcGVlci0+Y3VycmVudF93ZWlnaHQ7CisrICAgICAgICB9CisrCisr
ICAgICAgICBuZ3hfbG9nX2RlYnVnMyhOR1hfTE9HX0RFQlVHX0hUVFAsIHBjLT5sb2csIDAs
ICJbdXBzdHJlYW1fZmFpcl0gYnNzID0gJWksIHNzID0gJWkgKG4gPSAlZCkiLCBiZXN0X3Nj
aGVkX3Njb3JlLCBzY2hlZF9zY29yZSwgbik7CisrCisrICAgICAgICBpZiAoc2NoZWRfc2Nv
cmUgPD0gYmVzdF9zY2hlZF9zY29yZSkgeworKyAgICAgICAgICAgICpwZWVyX2lkID0gbjsK
KysgICAgICAgICAgICBiZXN0X3NjaGVkX3Njb3JlID0gc2NoZWRfc2NvcmU7CisrICAgICAg
ICB9CisrICAgIH0KKysKKysgICAgcmV0dXJuIE5HWF9PSzsKKyt9CisrCisrbmd4X2ludF90
Cisrbmd4X2h0dHBfdXBzdHJlYW1fZ2V0X2ZhaXJfcGVlcihuZ3hfcGVlcl9jb25uZWN0aW9u
X3QgKnBjLCB2b2lkICpkYXRhKQorK3sKKysgICAgbmd4X2ludF90ICAgICAgICAgICAgICAg
ICAgICAgICAgICAgcmV0OworKyAgICBuZ3hfdWludF90ICAgICAgICAgICAgICAgICAgICAg
ICAgICBwZWVyX2lkLCBpOworKyAgICBuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3BlZXJfZGF0
YV90ICpmcCA9IGRhdGE7CisrICAgIG5neF9odHRwX3Vwc3RyZWFtX3JyX3BlZXJfdCAgICAg
ICAgKnBlZXI7CisrCisrICAgIHBlZXJfaWQgPSBmcC0+Y3VycmVudDsK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ZS0+
cmlnaHQsCisrICAgICAgICAgICAgc2VudGluZWwsIGN5Y2xlLCBwZWVycyk7CisrICAgICAg
ICBpZiAodG1wX25vZGUpIHsKKysgICAgICAgICAgICBmb3VuZF9ub2RlID0gdG1wX25vZGU7
CisrICAgICAgICB9CisrICAgIH0KKysKKysgICAgLyogdmlzaXQgY3VycmVudCBub2RlICov
CisrICAgIHVmX25vZGUgPSAobmd4X2h0dHBfdXBzdHJlYW1fZmFpcl9zaG1fYmxvY2tfdCAq
KSBub2RlOworKyAgICBpZiAodWZfbm9kZS0+Y3ljbGUgIT0gY3ljbGUpIHsKKysgICAgICAg
IGlmICgtLXVmX25vZGUtPnJlZmNvdW50ID09IDApIHsKKysgICAgICAgICAgICBuZ3hfcmJ0
cmVlX2RlbGV0ZShuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3JidHJlZSwgbm9kZSk7CisrICAg
ICAgICAgICAgbmd4X3NsYWJfZnJlZV9sb2NrZWQoc2hwb29sLCBub2RlKTsKKysgICAgICAg
IH0KKysgICAgfSBlbHNlIGlmICh1Zl9ub2RlLT5wZWVycyA9PSBwZWVycykgeworKyAgICAg
ICAgZm91bmRfbm9kZSA9IHVmX25vZGU7CisrICAgIH0KKysKKysgICAgcmV0dXJuIGZvdW5k
X25vZGU7CisrfQorKworK3N0YXRpYyBuZ3hfaW50X3QKKytuZ3hfaHR0cF91cHN0cmVhbV9m
YWlyX3NobV9hbGxvYyhuZ3hfaHR0cF91cHN0cmVhbV9mYWlyX3BlZXJzX3QgKnVzZnAsIG5n
eF9sb2dfdCAqbG9nKQorK3sKKysgICAgbmd4X3NsYWJfcG9vbF90ICAgICAgICAgICAgICAg
ICAgICAgICAgKnNocG9vbDsKKysgICAgbmd4X3VpbnRfdCAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgIGk7CisrCisrICAgIGlmICh1c2ZwLT5zaGFyZWQpIHsKKysgICAgICAgIHJl
dHVybiBOR1hfT0s7CisrICAgIH0KKysKKysgICAgc2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
KiBUT0RPOiBtYXkgYmxvY2sgKi8KKysKKysgICAgICAgIG5neF9zc2xfZnJlZV9zZXNzaW9u
KG9sZF9zc2xfc2Vzc2lvbik7CisrICAgIH0KKyt9CisrCisrI2VuZGlmCg==
--------------060305020001060608010404--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C46645.80700>