Пример #1
0
    def build_dhcpv6_pd_reply(self, s, server, client, T1=300, T2=300):
        p = DHCP6_Reply(trid=s.trid)/ \
                DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)/ \
                    DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))
        for ia in builder.pd_ias(s[DHCP6OptIA_PD], server.iface(0), T1, T2):
            p = p/ia

        return p
Пример #2
0
 def build_dhcpv6_pd_advertise(self, s, server, client, ias=True, T1=300, T2=300):
     p = DHCP6_Advertise(trid=s.trid)/ \
             DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)/ \
                 DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))
     if ias:
         for ia in builder.pd_ias(s[DHCP6OptIA_PD], server.iface(0), T1, T2):
             p = p/ia
         
     return p
Пример #3
0
    def build_dhcpv6_reply(self, q, server, client, ias=True, T1=300, T2=300):
        p = DHCP6_Reply(trid=q.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=q[DHCP6OptClientId].duid)
        if ias:
            for ia in builder.ias(q[DHCP6OptIA_NA], client, T1, T2):
                p = p / ia
        p = p / DHCP6OptPref()

        return p
Пример #4
0
    def build_dhcpv6_reply(self, q, server, client, ias=True, T1=300, T2=300):
        p = DHCP6_Reply(trid=q.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=q[DHCP6OptClientId].duid)
        if ias:
            for ia in builder.ias(q[DHCP6OptIA_NA], client, T1, T2):
                p = p/ia
        p = p/DHCP6OptPref()

        return p
Пример #5
0
 def build_dhcpv6_solicit(self,
                          client,
                          iaid=0x4321,
                          trid=0x1234,
                          T1=300,
                          T2=300):
     p = DHCP6_Solicit(trid=trid)/ \
             DHCP6OptClientId(duid=builder.duid(client.iface(0).ll_addr))/ \
                 DHCP6OptOptReq()/ \
                     DHCP6OptIA_NA(iaid=iaid, T1=T1, T2=T2)
     return p
Пример #6
0
    def build_dhcpv6_confirm(self,
                             server,
                             client,
                             ip,
                             iaid=0x87654322,
                             trid=0x1235,
                             T1=300,
                             T2=300):
        p = DHCP6_Confirm(trid=trid)/ \
                DHCP6OptClientId(duid=builder.duid(client.iface(0).ll_addr))/ \
                    DHCP6OptIA_NA(iaid=iaid, T1=T1, T2=T2, ianaopts=DHCP6OptIAAddress(addr=ip))

        return p
Пример #7
0
    def build_dhcpv6_advertisement(self, s, server, client, options=True, ias=True, T1=300, T2=300):
        a = DHCP6_Advertise(trid=s.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)
        if options:
            for option in builder.options(s[DHCP6OptOptReq].reqopts):
                a = a/option
        if ias:
            for ia in builder.ias(s[DHCP6OptIA_NA], client, T1, T2):
                a = a/ia
        a = a/DHCP6OptPref()

        return a
Пример #8
0
    def build_dhcpv6_advertisement(self,
                                   s,
                                   server,
                                   client,
                                   options=True,
                                   ias=True,
                                   T1=300,
                                   T2=300):
        a = DHCP6_Advertise(trid=s.trid)/ \
                DHCP6OptServerId(duid=builder.duid(server.iface(0).ll_addr))/ \
                    DHCP6OptClientId(duid=s[DHCP6OptClientId].duid)
        if options:
            for option in builder.options(s[DHCP6OptOptReq].reqopts):
                a = a / option
        if ias:
            for ia in builder.ias(s[DHCP6OptIA_NA], client, T1, T2):
                a = a / ia
        a = a / DHCP6OptPref()

        return a
Пример #9
0
 def build_dhcpv6_pd_solicit(self, client, iaid=0x4321, trid=0x1234, T1=300, T2=300):
     p = DHCP6_Solicit(trid=trid)/ \
             DHCP6OptClientId(duid=builder.duid(client.iface(0).ll_addr))/ \
                 DHCP6OptOptReq()/ \
                     DHCP6OptIA_PD(iaid=iaid, T1=T1, T2=T2)
     return p
Пример #10
0
    def build_dhcpv6_confirm(self, server, client, ip, iaid=0x87654322, trid=0x1235, T1=300, T2=300):
        p = DHCP6_Confirm(trid=trid)/ \
                DHCP6OptClientId(duid=builder.duid(client.iface(0).ll_addr))/ \
                    DHCP6OptIA_NA(iaid=iaid, T1=T1, T2=T2, ianaopts=DHCP6OptIAAddress(addr=ip))

        return p