Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 1010091 Details for
Bug 1189840
[atomic] Negative DNS caching of the dockerd breaks docker pull
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh92 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
go reproducer
ping-after-iface-restart.go (text/plain), 2.74 KB, created by
Michal Minar
on 2015-04-02 09:46:42 UTC
(
hide
)
Description:
go reproducer
Filename:
MIME Type:
Creator:
Michal Minar
Created:
2015-04-02 09:46:42 UTC
Size:
2.74 KB
patch
obsolete
>package main > >import ( > "crypto/tls" > "flag" > "fmt" > "net" > "net/http" > "os" > "os/exec" > "strings" > "time" > > "github.com/docker/docker/pkg/timeoutconn" >) > >const IndexURL = "https://index.docker.io/v1" > >func die(msg string, args ...interface{}) { > fmt.Printf(msg+"\n", args...) > os.Exit(1) >} > >func trustedLocation(req *http.Request) bool { > var ( > trusteds = []string{"docker.com", "docker.io"} > hostname = strings.SplitN(req.Host, ":", 2)[0] > ) > if req.URL.Scheme != "https" { > return false > } > > for _, trusted := range trusteds { > if hostname == trusted || strings.HasSuffix(hostname, "."+trusted) { > return true > } > } > return false >} > >func AddRequiredHeadersToRedirectedRequests(req *http.Request, via []*http.Request) error { > if via != nil && via[0] != nil { > if trustedLocation(req) && trustedLocation(via[0]) { > req.Header = via[0].Header > return nil > } > for k, v := range via[0].Header { > if k != "Authorization" { > for _, vv := range v { > req.Header.Add(k, vv) > } > } > } > } > return nil >} > >func makeClient() *http.Client { > tlsConfig := tls.Config{ > // Avoid fallback to SSL protocols < TLS1.0 > MinVersion: tls.VersionTLS10, > InsecureSkipVerify: true, > } > > httpTransport := &http.Transport{ > DisableKeepAlives: true, > Proxy: http.ProxyFromEnvironment, > TLSClientConfig: &tlsConfig, > } > > httpTransport.Dial = func(proto string, addr string) (net.Conn, error) { > d := net.Dialer{DualStack: true} > > conn, err := d.Dial(proto, addr) > if err != nil { > return nil, err > } > conn = timeoutconn.New(conn, 1*time.Minute) > return conn, nil > } > > return &http.Client{ > Transport: httpTransport, > CheckRedirect: AddRequiredHeadersToRedirectedRequests, > //Jar: jar, > } >} > >func ping() { > fmt.Printf("Pinging index %s\n", IndexURL) > req, err := http.NewRequest("GET", IndexURL+"/_ping", nil) > if err != nil { > die("Failed to create request.") > } > client := makeClient() > resp, err := client.Do(req) > if err != nil { > fmt.Printf("Failed to ping %s: %v\n", IndexURL, err) > } > version := resp.Header.Get("X-Docker-Registry-Version") > if version == "" { > version = "unknown" > } > fmt.Printf("Ping successful. StatusCode=%d, Registry Version: %s\n", resp.StatusCode, version) >} > >func main() { > var iface = flag.String("iface", "eth0", "The name of interface to restart.") > flag.Parse() > > ping() > fmt.Printf("Shutting down interface %q.\n", *iface) > cmd := exec.Command("nmcli", "d", "disconnect", *iface) > if _, err := cmd.Output(); err != nil { > die("Failed to shut down interface %q: %v", *iface, err) > } > ping() > fmt.Printf("Bringing interface %q back up.\n", *iface) > cmd = exec.Command("nmcli", "d", "connect", *iface) > if _, err := cmd.Output(); err != nil { > die("Failed to bring interface %q up: %v", *iface, err) > } > ping() >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1189840
:
1010091
|
1010094
|
1010593